diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,11 @@ cmake_minimum_required(VERSION 2.8.11) project(serialplot) +set(MAJOR_VERSION 0) +set(MINOR_VERSION 1) +set(PATCH_VERSION 0) +set(VERSION_STRING "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}") + # Find includes in corresponding build directories set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -70,6 +75,9 @@ else() message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") endif() +# configure version file +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/version.h") + # add make run target add_custom_target(run COMMAND serialplot @@ -114,9 +122,9 @@ include(InstallRequiredSystemLibraries) set(CPACK_PACKAGE_NAME "serialplot") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Small and simple software for plotting data from serial port") set(CPACK_PACKAGE_CONTACT "Hasan Yavuz Özderya ") -set(CPACK_PACKAGE_VERSION_MAJOR "0") -set(CPACK_PACKAGE_VERSION_MINOR "1") -set(CPACK_PACKAGE_VERSION_PATCH "0") +set(CPACK_PACKAGE_VERSION_MAJOR ${MAJOR_VERSION}) +set(CPACK_PACKAGE_VERSION_MINOR ${MINOR_VERSION}) +set(CPACK_PACKAGE_VERSION_PATCH ${PATCH_VERSION}) set(CPACK_STRIP_FILES TRUE) set(CPACK_PACKAGE_EXECUTABLES "serialplot") set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5widgets5 (>= 5.2.1), libqt5serialport5 (>= 5.2.1), libc6 (>= 2.19)") diff --git a/about_dialog.ui b/about_dialog.ui --- a/about_dialog.ui +++ b/about_dialog.ui @@ -15,9 +15,9 @@ - + - <html><head/><body><p align="center"><span style=" font-size:14pt;">SerialPlot</span></p><p align="center"><span style=" font-size:10pt;">v0.1</span></p><p align="center">Developed by Hasan Yavuz Özderya</p><p align="center">Using Qt and Qwt (<a href="http://qwt.sf.net"><span style=" text-decoration: underline; color:#0000ff;">http://qwt.sf.net</span></a>)</p><p align="center"><br/></p><p align="center">This software is GPL licensed. You can obtain source code from <a href="https://bitbucket.org/hyOzd/serialplot"><span style=" text-decoration: underline; color:#0000ff;">https://bitbucket.org/hyOzd/serialplot</span></a>.<br/></p></body></html> + <html><head/><body><p align="center"><span style=" font-size:14pt;">SerialPlot</span></p><p align="center"><span style=" font-size:10pt;">$VERSION_STRING$</span></p><p align="center">Developed by Hasan Yavuz Özderya</p><p align="center">Using Qt and Qwt (<a href="http://qwt.sf.net"><span style=" text-decoration: underline; color:#0000ff;">http://qwt.sf.net</span></a>)</p><p align="center"><br/></p><p align="center">This software is GPL licensed. You can obtain source code from <a href="https://bitbucket.org/hyOzd/serialplot"><span style=" text-decoration: underline; color:#0000ff;">https://bitbucket.org/hyOzd/serialplot</span></a>.<br/></p></body></html> true diff --git a/mainwindow.cpp b/mainwindow.cpp --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -26,6 +26,7 @@ #include #include #include "utils.h" +#include "version.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), @@ -212,6 +213,10 @@ void MainWindow::setupAboutDialog() QObject::connect(uiAboutDialog.pbAboutQt, &QPushButton::clicked, [](){ QApplication::aboutQt();}); + + QString aboutText = uiAboutDialog.lbAbout->text(); + aboutText.replace("$VERSION_STRING$", VERSION_STRING); + uiAboutDialog.lbAbout->setText(aboutText); } void MainWindow::loadPortList() diff --git a/version.h.in b/version.h.in new file mode 100644 --- /dev/null +++ b/version.h.in @@ -0,0 +1,23 @@ +/* + Copyright © 2015 Hasan Yavuz Özderya + + This file is part of serialplot. + + serialplot is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + serialplot is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with serialplot. If not, see . +*/ + +#define MAJOR_VERSION @MAJOR_VERSION@ +#define MINOR_VERSION @MINOR_VERSION@ +#define PATCH_VERSION @PATCH_VERSION@ +#define VERSION_STRING "@VERSION_STRING@"