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". fail with the message "Voicetrack Found".
2023-08-04 Fred Gleason <fredg@paravelsystems.com> 2023-08-04 Fred Gleason <fredg@paravelsystems.com>
* Added a rivendell(7) man page. * 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 #ifndef RD_H
#define RD_H #define RD_H
#include <QObject>
/* /*
* Copyright Notice * Copyright Notice
*/ */
#define RD_COPYRIGHT_NOTICE "© 2002-2023 Fred Gleason" #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 * Default Configuration File
*/ */

View File

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

View File

@ -1179,3 +1179,25 @@ QString RDMimeType(const QByteArray &data,bool *ok)
return ret; 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); int RDCheckReturnCode(const QString &msg,int code,int ok_value);
QString RDMimeType(const QString &filename,bool *ok); QString RDMimeType(const QString &filename,bool *ok);
QString RDMimeType(const QByteArray &data,bool *ok); QString RDMimeType(const QByteArray &data,bool *ok);
QString RDWrapText(const QString &str,int width);
#endif // RDCONF_H #endif // RDCONF_H