Skip to content

Commit

Permalink
add version and help commandline options
Browse files Browse the repository at this point in the history
  • Loading branch information
HanYoung-uwu committed May 19, 2021
1 parent e8b2e9f commit a225fa4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 1 addition & 4 deletions src/about.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
#include "ui_about.h"
#include "kiwixapp.h"

#define _STR(...) # __VA_ARGS__
#define STR(X) _STR(X)

About::About(QWidget *parent) :
QDialog(parent),
ui(new Ui::AboutDialog)
Expand All @@ -23,7 +20,7 @@ About::About(QWidget *parent) :
htmlText = htmlText.replace("{{LIBRARIES}}", gt("about-libraries-title"));

htmlText = htmlText.replace("{{GITHUB_URL}}", "https://github.com/kiwix/kiwix-desktop");
htmlText = htmlText.replace("{{VERSION}}", STR(VERSION));
htmlText = htmlText.replace("{{VERSION}}", version);
htmlText = htmlText.replace("{{TRACKER_URL}}", "https://github.com/kiwix/kiwix-desktop/issues");
ui->aboutText->setHtml(htmlText);
}
Expand Down
4 changes: 3 additions & 1 deletion src/kiwixapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,7 @@ public slots:
};

QString gt(const QString &key);

#define _STR(...) # __VA_ARGS__
#define STR(X) _STR(X)
static QString version = STR(VERSION);
#endif // KIWIXAPP_H
6 changes: 4 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
#include <QWebEngineUrlScheme>
#endif

int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
Expand All @@ -16,9 +15,12 @@ int main(int argc, char *argv[])
QWebEngineUrlScheme::registerScheme(scheme);
#endif
KiwixApp a(argc, argv);
a.setApplicationVersion(version);
QCommandLineParser parser;
QString zimfile;

parser.setApplicationDescription(QStringLiteral("The Kiwix Desktop is a viewer/manager of ZIM files for GNU/Linux and Microsoft Windows OSes."));
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument("zimfile", "The zim file");
parser.process(a);
auto positionalArguments = parser.positionalArguments();
Expand Down

0 comments on commit a225fa4

Please sign in to comment.