2023-08-04 Fred Gleason <fredg@paravelsystems.com>

* Added copyright and license notices to the standard '--version'
	output.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2023-08-04 16:43:29 -04:00
parent fd3f9f5947
commit 8f9061d2d5
5 changed files with 39 additions and 2 deletions

View File

@ -24332,3 +24332,6 @@
fail with the message "Voicetrack Found".
2023-08-04 Fred Gleason <fredg@paravelsystems.com>
* Added a rivendell(7) man page.
2023-08-04 Fred Gleason <fredg@paravelsystems.com>
* Added copyright and license notices to the standard '--version'
output.

View File

@ -21,11 +21,18 @@
#ifndef RD_H
#define RD_H
#include <QObject>
/*
* Copyright Notice
*/
#define RD_COPYRIGHT_NOTICE "© 2002-2023 Fred Gleason"
/*
* License Notice
*/
#define RD_LICENSE_NOTICE QObject::tr("This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.")
/*
* Default Configuration File
*/

View File

@ -26,7 +26,9 @@
#include <QMessageBox>
#include <QStyleFactory>
#include <rdcmd_switch.h>
#include "rd.h"
#include "rdcmd_switch.h"
#include "rdconf.h"
RDCmdSwitch::RDCmdSwitch(const QString &modname,const QString &usage)
{
@ -38,6 +40,8 @@ RDCmdSwitch::RDCmdSwitch(const QString &modname,const QString &usage)
QString value=args.at(i);
if(value=="--version") {
printf("Rivendell v%s [%s]\n",VERSION,modname.toUtf8().constData());
printf("%s\n",RD_COPYRIGHT_NOTICE);
printf("%s\n",RDWrapText(RD_LICENSE_NOTICE,78).toUtf8().constData());
exit(0);
}
if(value=="--help") {
@ -93,6 +97,7 @@ RDCmdSwitch::RDCmdSwitch(int argc,char *argv[],const QString &modname,
QString value=QString::fromUtf8(argv[i]);
if(value=="--version") {
printf("Rivendell v%s [%s]\n",VERSION,modname.toUtf8().constData());
printf("%s\n",RD_COPYRIGHT_NOTICE);
exit(0);
}
if(value=="--help") {

View File

@ -1179,3 +1179,25 @@ QString RDMimeType(const QByteArray &data,bool *ok)
return ret;
}
QString RDWrapText(const QString &str,int width)
{
QString line;
QString ret;
QStringList f0=str.split(" ",QString::KeepEmptyParts);
int fn=0;
while(fn<f0.size()) {
if((line.length()+1+f0.at(fn).length())<width) {
line+=" "+f0.at(fn++);
}
else {
ret+=line.trimmed()+"\n";
line="";
}
}
ret+=line.trimmed()+"\n";
return ret.trimmed();
}

View File

@ -113,6 +113,6 @@ int RDCheckExitCode(RDConfig *config,const QString &msg,int exit_code);
int RDCheckReturnCode(const QString &msg,int code,int ok_value);
QString RDMimeType(const QString &filename,bool *ok);
QString RDMimeType(const QByteArray &data,bool *ok);
QString RDWrapText(const QString &str,int width);
#endif // RDCONF_H