diff options
author | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-07-15 14:53:18 +0300 |
---|---|---|
committer | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-07-15 14:53:18 +0300 |
commit | 4059f17e156b44aff81b4467b914cb817661f9da (patch) | |
tree | f8227e7482cecf40059ae9a9d63c656f58788926 | |
parent | Update issue template (diff) | |
download | nheko-4059f17e156b44aff81b4467b914cb817661f9da.tar.xz |
Add the -v / --version option, which displays the version string of the application.
-rw-r--r-- | src/main.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main.cc b/src/main.cc index 3ba19b4a..67c98339 100644 --- a/src/main.cc +++ b/src/main.cc @@ -16,6 +16,7 @@ */ #include <QApplication> +#include <QCommandLineParser> #include <QDesktopWidget> #include <QDir> #include <QFile> @@ -135,12 +136,16 @@ main(int argc, char *argv[]) return a.exec(); } + QApplication app(argc, argv); QCoreApplication::setApplicationName("nheko"); QCoreApplication::setApplicationVersion(nheko::version); QCoreApplication::setOrganizationName("nheko"); QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); - QApplication app(argc, argv); + QCommandLineParser parser; + parser.addHelpOption(); + parser.addVersionOption(); + parser.process(app); QFontDatabase::addApplicationFont(":/fonts/fonts/OpenSans/OpenSans-Regular.ttf"); QFontDatabase::addApplicationFont(":/fonts/fonts/OpenSans/OpenSans-Italic.ttf"); |