Add --version command line argument and WFVIEW_VERSION #define

monitor
Phil Taylor 2021-11-19 17:52:18 +00:00
rodzic 62771f6b59
commit 39f07414ee
3 zmienionych plików z 14 dodań i 3 usunięć

Wyświetl plik

@ -12,7 +12,7 @@ aboutbox::aboutbox(QWidget *parent) :
ui->logoBtn->setIcon(QIcon(":resources/wfview.png")); ui->logoBtn->setIcon(QIcon(":resources/wfview.png"));
ui->logoBtn->setStyleSheet("Text-align:left"); ui->logoBtn->setStyleSheet("Text-align:left");
ui->topText->setText("wfview version 1.2d"); ui->topText->setText("wfview version " + QString(WFVIEW_VERSION));
QString head = QString("<html><head></head><body>"); QString head = QString("<html><head></head><body>");
QString copyright = QString("Copyright 2017-2021 Elliott H. Liggett, W6EL. All rights reserved. wfview source code is <a href=\"https://gitlab.com/eliggett/wfview/-/blob/master/LICENSE\">licensed</a> under the GNU GPLv3."); QString copyright = QString("Copyright 2017-2021 Elliott H. Liggett, W6EL. All rights reserved. wfview source code is <a href=\"https://gitlab.com/eliggett/wfview/-/blob/master/LICENSE\">licensed</a> under the GNU GPLv3.");

Wyświetl plik

@ -37,7 +37,7 @@ int main(int argc, char *argv[])
QString currentArg; QString currentArg;
const QString helpText = QString("\nUsage: -p --port /dev/port, -h --host remotehostname, -c --civ 0xAddr, -l --logfile filename.log, -s --settings filename.ini, -d --debug\n"); // TODO... const QString helpText = QString("\nUsage: -p --port /dev/port, -h --host remotehostname, -c --civ 0xAddr, -l --logfile filename.log, -s --settings filename.ini, -d --debug, -v --version\n"); // TODO...
for(int c=1; c<argc; c++) for(int c=1; c<argc; c++)
{ {
@ -88,12 +88,21 @@ int main(int argc, char *argv[])
c += 1; c += 1;
} }
} }
else if ((currentArg == "--help")) else if ((currentArg == "-?") || (currentArg == "--help"))
{ {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
QMessageBox::information(0, "wfview help", helpText); QMessageBox::information(0, "wfview help", helpText);
#else #else
std::cout << helpText.toStdString(); std::cout << helpText.toStdString();
#endif
return 0;
}
else if ((currentArg == "-v") || (currentArg == "--version"))
{
#ifdef Q_OS_WIN
QMessageBox::information(0, "wfview version", QString(WFVIEW_VERSION));
#else
std::cout << "wfview version: " << QString(WFVIEW_VERSION).toStdString();
#endif #endif
return 0; return 0;
} else { } else {

Wyświetl plik

@ -11,6 +11,8 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
TARGET = wfview TARGET = wfview
TEMPLATE = app TEMPLATE = app
DEFINES += WFVIEW_VERSION=\"1.2d\"
CONFIG(debug, release|debug) { CONFIG(debug, release|debug) {
# For Debug builds only: # For Debug builds only:
QMAKE_CXXFLAGS += -faligned-new QMAKE_CXXFLAGS += -faligned-new