Skip to content

Commit

Permalink
2023-08-04 Fred Gleason <[email protected]>
Browse files Browse the repository at this point in the history
	* Added copyright and license notices to the standard '--version'
	output.

Signed-off-by: Fred Gleason <[email protected]>
  • Loading branch information
ElvishArtisan committed Aug 4, 2023
1 parent fd3f9f5 commit 8f9061d
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -24332,3 +24332,6 @@
fail with the message "Voicetrack Found".
2023-08-04 Fred Gleason <[email protected]>
* Added a rivendell(7) man page.
2023-08-04 Fred Gleason <[email protected]>
* Added copyright and license notices to the standard '--version'
output.
7 changes: 7 additions & 0 deletions lib/rd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
7 changes: 6 additions & 1 deletion lib/rdcmd_switch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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") {
Expand Down Expand Up @@ -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") {
Expand Down
22 changes: 22 additions & 0 deletions lib/rdconf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
2 changes: 1 addition & 1 deletion lib/rdconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 8f9061d

Please sign in to comment.