From 6e307a04f7328167a14a30a7388f9aeb478d2d84 Mon Sep 17 00:00:00 2001 From: Fabien-B Date: Thu, 9 Sep 2021 19:17:47 +0200 Subject: [PATCH] Add version. --- CMakeLists.txt | 8 ++++++++ build_deb.sh | 2 +- src/main.cpp | 6 +++++- src/pprzmain.cpp | 12 +++++++----- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ff531c4f..4ff16f87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,14 @@ endif() message("DEFAULT_APP_DATA_PATH set to ${DEFAULT_APP_DATA_PATH}") add_definitions(-DDEFAULT_APP_DATA_PATH="${DEFAULT_APP_DATA_PATH}") +if(NOT PPRZGCS_VERSION) + if ("${PPRZGCS_VERSION}" STREQUAL "") + set(PPRZGCS_VERSION "devel") + endif() +endif() +message("PPRZGCS_VERSION set to ${PPRZGCS_VERSION}") +add_definitions(-DPPRZGCS_VERSION="${PPRZGCS_VERSION}") + find_package(Qt5 5.12 COMPONENTS Widgets Xml Network Svg TextToSpeech REQUIRED) find_package(IvyQt REQUIRED) find_package(pprzlinkQt REQUIRED) diff --git a/build_deb.sh b/build_deb.sh index 77df902f..dca7ccad 100755 --- a/build_deb.sh +++ b/build_deb.sh @@ -37,7 +37,7 @@ cmake -S $pprzlinkqt_src -B $pprzlinkqt_build -DCMAKE_BUILD_TYPE=Release -DCMAKE cmake --build $pprzlinkqt_build cmake --install $pprzlinkqt_build -cmake -S . -B $WD/build/pprzgcs -DCMAKE_INSTALL_PREFIX=$deb_install_prefix -DCMAKE_PREFIX_PATH=$install_prefix -DCMAKE_BUILD_TYPE=Release +cmake -S . -B $WD/build/pprzgcs -DCMAKE_INSTALL_PREFIX=$deb_install_prefix -DCMAKE_PREFIX_PATH=$install_prefix -DCMAKE_BUILD_TYPE=Release -DPPRZGCS_VERSION=$(git describe --tags) cmake --build $WD/build/pprzgcs cmake --install $WD/build/pprzgcs diff --git a/src/main.cpp b/src/main.cpp index a50f1947..de847ddb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,6 +19,10 @@ #error "you need to define DEFAULT_APP_DATA_PATH!" #endif +#ifndef PPRZGCS_VERSION +#error "you need to define PPRZGCS_VERSION!" +#endif + void launch_main_app() { auto settings = getAppSettings(); QFile file(settings.value("APP_STYLE_FILE").toString()); @@ -63,7 +67,7 @@ int main(int argc, char *argv[]) auto gconfig = GlobalConfig::get(); QCoreApplication::setApplicationName("pprzgcs"); - QCoreApplication::setApplicationVersion("0.1"); + QCoreApplication::setApplicationVersion(PPRZGCS_VERSION); auto settings_path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/settings.conf"; gconfig->setValue("SETTINGS_PATH", settings_path); diff --git a/src/pprzmain.cpp b/src/pprzmain.cpp index 9135cc41..97809475 100644 --- a/src/pprzmain.cpp +++ b/src/pprzmain.cpp @@ -135,9 +135,9 @@ void PprzMain::populate_menu() { auto help_menu = menuBar->addMenu("&Help"); auto about = help_menu->addAction("&About"); - connect(about, &QAction::triggered, [=]() { - QMessageBox::about(this,"About PprzGCS", + QString about_txt = QString( "

PprzGCS

" + "version %1" "

PprzGCS is a ground control software for paparrazi UAV drones.

" "

source code can be found here: " "https://github.com/Fabien-B/GcsAgain

" @@ -153,9 +153,11 @@ void PprzMain::populate_menu() { "" - ); + "
  • libzip
  • " + "").arg(QCoreApplication::applicationVersion()); + + connect(about, &QAction::triggered, [=]() { + QMessageBox::about(this,"About PprzGCS", about_txt); });