Skip to content

Commit

Permalink
Add version.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabien-B committed Sep 9, 2021
1 parent 0c8850d commit 6e307a0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion build_deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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);
Expand Down
12 changes: 7 additions & 5 deletions src/pprzmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
"<h1>PprzGCS</h1>"
"version %1"
"<p>PprzGCS is a ground control software for <a href=\"https://paparazziuav.org\">paparrazi UAV</a> drones.</p>"
"<p>source code can be found here: "
"<a href=\"https://github.com/Fabien-B/GcsAgain\">https://github.com/Fabien-B/GcsAgain</a></p>"
Expand All @@ -153,9 +153,11 @@ void PprzMain::populate_menu() {
"<ul>"
"<li><a href=\"https://www.qt.io/\">Qt 5.12.5</a></li>"
"<li><a href=\"https://proj.org/\">Proj</a></li>"
"<li><a href=\"https://libzip.org/\">libzip</a></li>"
"</ul>"
);
"<li><a %1 href=\"https://libzip.org/\">libzip</a></li>"
"</ul>").arg(QCoreApplication::applicationVersion());

connect(about, &QAction::triggered, [=]() {
QMessageBox::about(this,"About PprzGCS", about_txt);

});

Expand Down

0 comments on commit 6e307a0

Please sign in to comment.