Changeset - 7c96568d440b
[Not reviewed]
Merge default
0 6 7
Hasan Yavuz ÖZDERYA - 8 years ago 2017-08-20 12:26:02
hy@ozderya.net
Merge with update-checker
13 files changed with 721 insertions and 8 deletions:
0 comments (0 inline, 0 general)
CMakeLists.txt
Show inline comments
 
#
 
# Copyright © 2017 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 <http://www.gnu.org/licenses/>.
 
#
 

	
 
cmake_minimum_required(VERSION 3.2.2)
 

	
 
project(serialplot)
 

	
 
set(PROGRAM_NAME ${CMAKE_PROJECT_NAME} CACHE STRING "Output program name")
 
set(PROGRAM_DISPLAY_NAME "SerialPlot" CACHE STRING "Display name (menus etc) of the program")
 

	
 
# Find includes in corresponding build directories
 
set(CMAKE_INCLUDE_CURRENT_DIR ON)
 

	
 
# Instruct CMake to run moc automatically when needed.
 
set(CMAKE_AUTOMOC ON)
 

	
 
# add local path for cmake modules
 
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
 

	
 
# Find the QtWidgets library
 
find_package(Qt5Widgets)
 

	
 
# If set, cmake will download Qwt over SVN, build and use it as a static library.
 
set(BUILD_QWT true CACHE BOOL "Download and build Qwt automatically.")
 
if (BUILD_QWT)
 
  include(BuildQwt)
 
else (BUILD_QWT)
 
    find_package(Qwt 6.1 REQUIRED)
 
endif (BUILD_QWT)
 

	
 
# If set, cmake will download QtColorWidgets over git, build and use it as a static library.
 
set(BUILD_QTCOLORWIDGETS true CACHE BOOL "Download and build QtColorWidgets library automatically.")
 
if (BUILD_QTCOLORWIDGETS)
 
  include(BuildQColorWidgets)
 
else ()
 
  find_package(QtColorWidgets REQUIRED)
 
endif ()
 

	
 
# includes
 
include_directories("./src"
 
  ${QWT_INCLUDE_DIR}
 
  ${QTCOLORWIDGETS_INCLUDE_DIRS}
 
  )
 

	
 
# flags
 
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${QTCOLORWIDGETS_FLAGS}")
 

	
 
# wrap UI and resource files
 
qt5_wrap_ui(UI_FILES
 
  src/mainwindow.ui
 
  src/portcontrol.ui
 
  src/about_dialog.ui
 
  src/snapshotview.ui
 
  src/commandpanel.ui
 
  src/commandwidget.ui
 
  src/dataformatpanel.ui
 
  src/plotcontrolpanel.ui
 
  src/recordpanel.ui
 
  src/numberformatbox.ui
 
  src/endiannessbox.ui
 
  src/binarystreamreadersettings.ui
 
  src/asciireadersettings.ui
 
  src/framedreadersettings.ui
 
  src/updatecheckdialog.ui
 
  )
 

	
 
if (WIN32)
 
  qt5_add_resources(RES_FILES misc/icons.qrc misc/winicons.qrc)
 
else (WIN32)
 
  qt5_add_resources(RES_FILES misc/icons.qrc)
 
endif (WIN32)
 

	
 
add_executable(${PROGRAM_NAME} WIN32
 
  src/main.cpp
 
  src/mainwindow.cpp
 
  src/portcontrol.cpp
 
  src/plot.cpp
 
  src/zoomer.cpp
 
  src/scrollzoomer.cpp
 
  src/scrollbar.cpp
 
  src/hidabletabwidget.cpp
 
  src/framebuffer.cpp
 
  src/scalepicker.cpp
 
  src/scalezoomer.cpp
 
  src/portlist.cpp
 
  src/snapshot.cpp
 
  src/snapshotview.cpp
 
  src/snapshotmanager.cpp
 
  src/plotsnapshotoverlay.cpp
 
  src/commandpanel.cpp
 
  src/commandwidget.cpp
 
  src/commandedit.cpp
 
  src/dataformatpanel.cpp
 
  src/plotcontrolpanel.cpp
 
  src/recordpanel.cpp
 
  src/datarecorder.cpp
 
  src/tooltipfilter.cpp
 
  src/sneakylineedit.cpp
 
  src/channelmanager.cpp
 
  src/channelinfomodel.cpp
 
  src/framebufferseries.cpp
 
  src/numberformatbox.cpp
 
  src/endiannessbox.cpp
 
  src/abstractreader.cpp
 
  src/binarystreamreader.cpp
 
  src/binarystreamreadersettings.cpp
 
  src/asciireader.cpp
 
  src/asciireadersettings.cpp
 
  src/demoreader.cpp
 
  src/framedreader.cpp
 
  src/framedreadersettings.cpp
 
  src/plotmanager.cpp
 
  src/numberformat.cpp
 
  src/updatechecker.cpp
 
  src/versionnumber.cpp
 
  src/updatecheckdialog.cpp
 
  misc/windows_icon.rc
 
  ${UI_FILES}
 
  ${RES_FILES}
 
  )
 

	
 
# Use the Widgets module from Qt 5.
 
target_link_libraries(${PROGRAM_NAME}
 
  ${QWT_LIBRARY}
 
  ${QTCOLORWIDGETS_LIBRARIES}
 
  )
 
qt5_use_modules(${PROGRAM_NAME} Widgets SerialPort)
 
qt5_use_modules(${PROGRAM_NAME} Widgets SerialPort Network)
 

	
 
if (BUILD_QWT)
 
  add_dependencies(${PROGRAM_NAME} QWT)
 
endif ()
 

	
 
if (BUILD_QTCOLORWIDGETS)
 
  add_dependencies(${PROGRAM_NAME} QCW)
 
endif ()
 

	
 
# set compiler flags
 
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
 

	
 
# Enable C++11 support, fail if not supported
 
include(CheckCXXCompilerFlag)
 
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
 
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
 
if(COMPILER_SUPPORTS_CXX11)
 
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
 
elseif(COMPILER_SUPPORTS_CXX0X)
 
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
 
else()
 
  message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
 
endif()
 

	
 
# default version
 
set(VERSION_STRING "0.9.1")
 
set(VERSION_REVISION "0")
 

	
 
# get revision number from mercurial and parse version string
 
include(GetVersion)
 

	
 
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVERSION_STRING=\\\"${VERSION_STRING}\\\" ")
 
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVERSION_MAJOR=${VERSION_MAJOR} ")
 
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVERSION_MINOR=${VERSION_MINOR} ")
 
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVERSION_PATCH=${VERSION_PATCH} ")
 
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVERSION_REVISION=\\\"${VERSION_REVISION}\\\" ")
 

	
 
# add make run target
 
add_custom_target(run
 
    COMMAND ${PROGRAM_NAME}
 
    DEPENDS ${PROGRAM_NAME}
 
    WORKING_DIRECTORY ${CMAKE_PROJECT_DIR}
 
)
 

	
 
# installing
 
install(TARGETS ${PROGRAM_NAME} DESTINATION bin)
 

	
 
# for windows put libraries to install directory
 
if (WIN32)
 
  file(GLOB WINDOWS_INSTALL_LIBRARIES
 
    "${CMAKE_BINARY_DIR}/windows_install_libraries/*.*")
 
  install(FILES ${WINDOWS_INSTALL_LIBRARIES} DESTINATION bin)
 
endif (WIN32)
 

	
 
# prepare menu item and icon
 
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/misc/program_name.desktop.in"
 
  "${CMAKE_BINARY_DIR}/${PROGRAM_NAME}.desktop")
 
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/misc/program_name.png"
 
  "${CMAKE_BINARY_DIR}/${PROGRAM_NAME}.png" COPYONLY)
 

	
 
set(DESKTOP_FILE ${CMAKE_BINARY_DIR}/${PROGRAM_NAME}.desktop)
 
set(ICON_FILE ${CMAKE_BINARY_DIR}/${PROGRAM_NAME}.png)
 

	
 
# install menu item and icon
 
if (UNIX)
 
  install(FILES ${DESKTOP_FILE} DESTINATION share/applications/)
 
  install(FILES ${ICON_FILE} DESTINATION share/icons/hicolor/256x256/apps/)
 
endif (UNIX)
 

	
 
# uninstalling
 
configure_file(
 
  "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
 
  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
 
  @ONLY)
 

	
 
if (UNIX)
 
  add_custom_target(uninstall
 
    COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
 
endif (UNIX)
 

	
 
# packaging
 
include(BuildLinuxAppImage)
 

	
 
if (UNIX)
 
  set(CPACK_GENERATOR "DEB")
 
elseif (WIN32)
 
  set(CPACK_GENERATOR "NSIS")
 
endif (UNIX)
 

	
 
include(InstallRequiredSystemLibraries)
 

	
 
set(CPACK_PACKAGE_NAME "${PROGRAM_NAME}")
 
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Small and simple software for plotting data from serial port")
 
set(CPACK_PACKAGE_CONTACT "Hasan Yavuz Özderya <hy@ozderya.net>")
 
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
 
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
 
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
 
set(CPACK_STRIP_FILES TRUE)
 
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5widgets5 (>= 5.2.1), libqt5svg5 (>= 5.2.1), libqt5serialport5 (>= 5.2.1), libc6 (>= 2.19)")
 
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Small and simple software for plotting data from serial port
 
 Supports binary data formats ([u]int8, [u]int16, [u]int32, float)
 
 and ASCII (as CSV). Captured waveforms can be exported in CSV format.
 
 Can also send simple user defined commands to serial port device.")
 

	
 
if (NOT QWT_USE_STATIC)
 
  set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libqwt6-qt5 (>= 6.1.1)")
 
endif (NOT QWT_USE_STATIC)
 

	
 
if (UNIX)
 
  set(CPACK_PACKAGE_EXECUTABLES "${PROGRAM_NAME}")
 
elseif (WIN32)
 
  set(CPACK_PACKAGE_EXECUTABLES "${PROGRAM_NAME};${PROGRAM_DISPLAY_NAME}")
 
  set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROGRAM_NAME}")
 
  set(CPACK_CREATE_DESKTOP_LINKS "${PROGRAM_NAME}")
 
  set(CPACK_NSIS_MODIFY_PATH "ON")
 
  set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/misc/serialplot.bmp")
 
  string(REPLACE "/" "\\\\" CPACK_PACKAGE_ICON ${CPACK_PACKAGE_ICON})
 
  set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
 
  set(CPACK_NSIS_MENU_LINKS
 
    "https://bitbucket.org/hyOzd/serialplot" "SerialPlot source code on bitbucket.org")
 
  set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL true)
 
endif (UNIX)
 

	
 
if (UNIX)
 
  # set debian package name
 
  string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_PACKAGE_NAME_LOWERCASE)
 
  find_program(DPKG_PROGRAM dpkg DOC "dpkg program of Debian-based systems")
 
  if(DPKG_PROGRAM)
 
    execute_process(
 
      COMMAND ${DPKG_PROGRAM} --print-architecture
 
      OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
serialplot.pro
Show inline comments
 
#
 
# 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 <http://www.gnu.org/licenses/>.
 
#
 

	
 
#-------------------------------------------------
 
#
 
# Project created by QtCreator 2015-03-04T08:20:06
 
#
 
#-------------------------------------------------
 

	
 
QT       += core gui serialport
 

	
 
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
 

	
 
TARGET = serialplot
 
TEMPLATE = app
 

	
 
CONFIG += qwt
 

	
 
SOURCES += \
 
    src/main.cpp\
 
    src/mainwindow.cpp \
 
    src/portcontrol.cpp \
 
    src/plot.cpp \
 
    src/zoomer.cpp \
 
    src/hidabletabwidget.cpp \
 
    src/framebuffer.cpp \
 
    src/scalepicker.cpp \
 
    src/scalezoomer.cpp \
 
    src/portlist.cpp \
 
    src/snapshotview.cpp \
 
    src/snapshotmanager.cpp \
 
    src/snapshot.cpp \
 
    src/plotsnapshotoverlay.cpp \
 
    src/commandpanel.cpp \
 
    src/commandwidget.cpp \
 
    src/commandedit.cpp \
 
    src/dataformatpanel.cpp \
 
    src/tooltipfilter.cpp \
 
    src/sneakylineedit.cpp \
 
    src/channelmanager.cpp \
 
    src/framebufferseries.cpp \
 
    src/plotcontrolpanel.cpp \
 
    src/numberformatbox.cpp \
 
    src/endiannessbox.cpp \
 
    src/framedreadersettings.cpp \
 
    src/abstractreader.cpp \
 
    src/binarystreamreader.cpp \
 
    src/binarystreamreadersettings.cpp \
 
    src/asciireadersettings.cpp \
 
    src/asciireader.cpp \
 
    src/demoreader.cpp \
 
    src/framedreader.cpp \
 
    src/plotmanager.cpp \
 
    src/numberformat.cpp \
 
    src/recordpanel.cpp
 
    src/recordpanel.cpp \
 
    src/updatechecker.cpp \
 
    src/updatecheckdialog.cpp
 

	
 
HEADERS += \
 
    src/mainwindow.h \
 
    src/utils.h \
 
    src/portcontrol.h \
 
    src/floatswap.h \
 
    src/plot.h \
 
    src/zoomer.h \
 
    src/hidabletabwidget.h \
 
    src/framebuffer.h \
 
    src/scalepicker.h \
 
    src/scalezoomer.h \
 
    src/portlist.h \
 
    src/snapshotview.h \
 
    src/snapshotmanager.h \
 
    src/snapshot.h \
 
    src/plotsnapshotoverlay.h \
 
    src/commandpanel.h \
 
    src/commandwidget.h \
 
    src/commandedit.h \
 
    src/dataformatpanel.h \
 
    src/tooltipfilter.h \
 
    src/sneakylineedit.h \
 
    src/channelmanager.h \
 
    src/framebufferseries.h \
 
    src/plotcontrolpanel.h \
 
    src/numberformatbox.h \
 
    src/endiannessbox.h \
 
    src/framedreadersettings.h \
 
    src/abstractreader.h \
 
    src/binarystreamreader.h \
 
    src/binarystreamreadersettings.h \
 
    src/asciireadersettings.h \
 
    src/asciireader.h \
 
    src/demoreader.h \
 
    src/framedreader.h \
 
    src/plotmanager.h \
 
    src/setting_defines.h \
 
    src/numberformat.h \
 
    src/recordpanel.h
 
    src/recordpanel.h \
 
    src/updatechecker.h \
 
    src/updatecheckdialog.h
 

	
 
FORMS += \
 
    src/mainwindow.ui \
 
    src/about_dialog.ui \
 
    src/portcontrol.ui \
 
    src/snapshotview.ui \
 
    src/commandpanel.ui \
 
    src/commandwidget.ui \
 
    src/dataformatpanel.ui \
 
    src/plotcontrolpanel.ui \
 
    src/numberformatbox.ui \
 
    src/endiannessbox.ui \
 
    src/framedreadersettings.ui \
 
    src/binarystreamreadersettings.ui \
 
    src/asciireadersettings.ui \
 
    src/recordpanel.ui
 
    src/recordpanel.ui \
 
    src/updatecheckdialog.ui
 

	
 
INCLUDEPATH += qmake/ src/
 

	
 
CONFIG += c++11
 

	
 
RESOURCES += misc/icons.qrc
 

	
 
win32 {
 
    RESOURCES += misc/winicons.qrc
 
}
src/mainwindow.cpp
Show inline comments
 
/*
 
  Copyright © 2017 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 <http://www.gnu.org/licenses/>.
 
*/
 

	
 
#include "mainwindow.h"
 
#include "ui_mainwindow.h"
 
#include <QByteArray>
 
#include <QApplication>
 
#include <QFileDialog>
 
#include <QMessageBox>
 
#include <QFile>
 
#include <QTextStream>
 
#include <QMenu>
 
#include <QDesktopServices>
 
#include <QMap>
 
#include <QtDebug>
 
#include <qwt_plot.h>
 
#include <limits.h>
 
#include <cmath>
 
#include <iostream>
 

	
 
#include <plot.h>
 

	
 
#include "framebufferseries.h"
 
#include "utils.h"
 
#include "defines.h"
 
#include "version.h"
 
#include "setting_defines.h"
 

	
 
#if defined(Q_OS_WIN) && defined(QT_STATIC)
 
#include <QtPlugin>
 
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
 
#endif
 

	
 
const QMap<int, QString> panelSettingMap({
 
        {0, "Port"},
 
        {1, "DataFormat"},
 
        {2, "Plot"},
 
        {3, "Commands"}
 
    });
 

	
 
MainWindow::MainWindow(QWidget *parent) :
 
    QMainWindow(parent),
 
    ui(new Ui::MainWindow),
 
    aboutDialog(this),
 
    portControl(&serialPort),
 
    channelMan(1, 1, this),
 
    snapshotMan(this, &channelMan),
 
    commandPanel(&serialPort),
 
    dataFormatPanel(&serialPort, &channelMan, &recorder),
 
    recordPanel(&recorder, &channelMan)
 
    recordPanel(&recorder, &channelMan),
 
    updateCheckDialog(this)
 
{
 
    ui->setupUi(this);
 

	
 
    plotMan = new PlotManager(ui->plotArea, channelMan.infoModel());
 

	
 
    ui->tabWidget->insertTab(0, &portControl, "Port");
 
    ui->tabWidget->insertTab(1, &dataFormatPanel, "Data Format");
 
    ui->tabWidget->insertTab(2, &plotControlPanel, "Plot");
 
    ui->tabWidget->insertTab(3, &commandPanel, "Commands");
 
    ui->tabWidget->insertTab(4, &recordPanel, "Record");
 
    ui->tabWidget->setCurrentIndex(0);
 
    auto tbPortControl = portControl.toolBar();
 
    addToolBar(tbPortControl);
 
    addToolBar(recordPanel.toolbar());
 

	
 
    ui->plotToolBar->addAction(snapshotMan.takeSnapshotAction());
 
    ui->menuBar->insertMenu(ui->menuHelp->menuAction(), snapshotMan.menu());
 
    ui->menuBar->insertMenu(ui->menuHelp->menuAction(), commandPanel.menu());
 

	
 
    connect(&commandPanel, &CommandPanel::focusRequested, [this]()
 
            {
 
                this->ui->tabWidget->setCurrentWidget(&commandPanel);
 
                this->ui->tabWidget->showTabs();
 
            });
 

	
 
    tbPortControl->setObjectName("tbPortControl");
 
    ui->plotToolBar->setObjectName("tbPlot");
 

	
 
    setupAboutDialog();
 

	
 
    // init view menu
 
    for (auto a : plotMan->menuActions())
 
    {
 
        ui->menuView->addAction(a);
 
    }
 

	
 
    ui->menuView->addSeparator();
 

	
 
    QMenu* tbMenu = ui->menuView->addMenu("Toolbars");
 
    tbMenu->addAction(ui->plotToolBar->toggleViewAction());
 
    tbMenu->addAction(portControl.toolBar()->toggleViewAction());
 

	
 
    // init UI signals
 

	
 
    // Help menu signals
 
    QObject::connect(ui->actionHelpAbout, &QAction::triggered,
 
              &aboutDialog, &QWidget::show);
 

	
 
    QObject::connect(ui->actionCheckUpdate, &QAction::triggered,
 
              &updateCheckDialog, &QWidget::show);
 

	
 
    QObject::connect(ui->actionReportBug, &QAction::triggered,
 
                     [](){QDesktopServices::openUrl(QUrl(BUG_REPORT_URL));});
 

	
 
    // File menu signals
 
    QObject::connect(ui->actionExportCsv, &QAction::triggered,
 
                     this, &MainWindow::onExportCsv);
 

	
 
    QObject::connect(ui->actionSaveSettings, &QAction::triggered,
 
                     this, &MainWindow::onSaveSettings);
 

	
 
    QObject::connect(ui->actionLoadSettings, &QAction::triggered,
 
                     this, &MainWindow::onLoadSettings);
 

	
 
    ui->actionQuit->setShortcutContext(Qt::ApplicationShortcut);
 

	
 
    QObject::connect(ui->actionQuit, &QAction::triggered,
 
                     this, &MainWindow::close);
 

	
 
    // port control signals
 
    QObject::connect(&portControl, &PortControl::portToggled,
 
                     this, &MainWindow::onPortToggled);
 

	
 
    // plot control signals
 
    connect(&plotControlPanel, &PlotControlPanel::numOfSamplesChanged,
 
            this, &MainWindow::onNumOfSamplesChanged);
 

	
 
    connect(&plotControlPanel, &PlotControlPanel::numOfSamplesChanged,
 
            plotMan, &PlotManager::setNumOfSamples);
 

	
 
    connect(&plotControlPanel, &PlotControlPanel::yScaleChanged,
 
            plotMan, &PlotManager::setYAxis);
 

	
 
    connect(&plotControlPanel, &PlotControlPanel::xScaleChanged,
 
            plotMan, &PlotManager::setXAxis);
 

	
 
    QObject::connect(ui->actionClear, SIGNAL(triggered(bool)),
 
                     this, SLOT(clearPlot()));
 

	
 
    QObject::connect(snapshotMan.takeSnapshotAction(), &QAction::triggered,
 
                     plotMan, &PlotManager::flashSnapshotOverlay);
 

	
 
    // init port signals
 
    QObject::connect(&(this->serialPort), SIGNAL(error(QSerialPort::SerialPortError)),
 
                     this, SLOT(onPortError(QSerialPort::SerialPortError)));
 

	
 
    // init data format and reader
 
    QObject::connect(&channelMan, &ChannelManager::dataAdded,
 
                     plotMan, &PlotManager::replot);
 

	
 
    QObject::connect(ui->actionPause, &QAction::triggered,
 
                     &channelMan, &ChannelManager::pause);
 

	
 
    QObject::connect(&recordPanel, &RecordPanel::recordStarted,
 
                     &dataFormatPanel, &DataFormatPanel::startRecording);
 

	
 
    QObject::connect(&recordPanel, &RecordPanel::recordStopped,
 
                     &dataFormatPanel, &DataFormatPanel::stopRecording);
 

	
 
    QObject::connect(ui->actionPause, &QAction::triggered,
 
                     [this](bool enabled)
 
                     {
 
                         if (enabled && !recordPanel.recordPaused())
 
                         {
 
                             dataFormatPanel.pause(true);
 
                         }
 
                         else
 
                         {
 
                             dataFormatPanel.pause(false);
 
                         }
 
                     });
 

	
 
    QObject::connect(&recordPanel, &RecordPanel::recordPausedChanged,
 
                     [this](bool enabled)
 
                     {
 
                         if (ui->actionPause->isChecked() && enabled)
 
                         {
 
                             dataFormatPanel.pause(false);
 
                         }
 
                     });
 

	
 
    connect(&serialPort, &QIODevice::aboutToClose,
 
            &recordPanel, &RecordPanel::onPortClose);
 

	
 
    // init data arrays and plot
 
    numOfSamples = plotControlPanel.numOfSamples();
 
    unsigned numOfChannels = dataFormatPanel.numOfChannels();
 

	
 
    channelMan.setNumOfSamples(numOfSamples);
 
    channelMan.setNumOfChannels(dataFormatPanel.numOfChannels());
 

	
 
    connect(&dataFormatPanel, &DataFormatPanel::numOfChannelsChanged,
 
            &channelMan, &ChannelManager::setNumOfChannels);
 

	
 
    connect(&channelMan, &ChannelManager::numOfChannelsChanged,
 
            this, &MainWindow::onNumOfChannelsChanged);
 

	
 
@@ -453,184 +457,186 @@ bool MainWindow::isDemoRunning()
 

	
 
void MainWindow::enableDemo(bool enabled)
 
{
 
    if (enabled)
 
    {
 
        if (!serialPort.isOpen())
 
        {
 
            dataFormatPanel.enableDemo(true);
 
        }
 
        else
 
        {
 
            ui->actionDemoMode->setChecked(false);
 
        }
 
    }
 
    else
 
    {
 
        dataFormatPanel.enableDemo(false);
 
        ui->actionDemoMode->setChecked(false);
 
    }
 
}
 

	
 
void MainWindow::onExportCsv()
 
{
 
    bool wasPaused = ui->actionPause->isChecked();
 
    ui->actionPause->setChecked(true); // pause plotting
 

	
 
    QString fileName = QFileDialog::getSaveFileName(this, tr("Export CSV File"));
 

	
 
    if (fileName.isNull())  // user canceled export
 
    {
 
        ui->actionPause->setChecked(wasPaused);
 
    }
 
    else
 
    {
 
        Snapshot* snapshot = snapshotMan.makeSnapshot();
 
        snapshot->save(fileName);
 
        delete snapshot;
 
    }
 
}
 

	
 
PlotViewSettings MainWindow::viewSettings() const
 
{
 
    return plotMan->viewSettings();
 
}
 

	
 
void MainWindow::messageHandler(QtMsgType type,
 
                                const QMessageLogContext &context,
 
                                const QString &msg)
 
{
 
    QString logString;
 

	
 
    switch (type)
 
    {
 
#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
 
        case QtInfoMsg:
 
            logString = "[Info] " + msg;
 
            break;
 
#endif
 
        case QtDebugMsg:
 
            logString = "[Debug] " + msg;
 
            break;
 
        case QtWarningMsg:
 
            logString = "[Warning] " + msg;
 
            break;
 
        case QtCriticalMsg:
 
            logString = "[Error] " + msg;
 
            break;
 
        case QtFatalMsg:
 
            logString = "[Fatal] " + msg;
 
            break;
 
    }
 

	
 
    if (ui != NULL) ui->ptLog->appendPlainText(logString);
 
    std::cerr << logString.toStdString() << std::endl;
 

	
 
    if (type != QtDebugMsg && ui != NULL)
 
    {
 
        ui->statusBar->showMessage(msg, 5000);
 
    }
 

	
 
    if (type == QtFatalMsg)
 
    {
 
        __builtin_trap();
 
    }
 
}
 

	
 
void MainWindow::saveAllSettings(QSettings* settings)
 
{
 
    saveMWSettings(settings);
 
    portControl.saveSettings(settings);
 
    dataFormatPanel.saveSettings(settings);
 
    channelMan.saveSettings(settings);
 
    plotControlPanel.saveSettings(settings);
 
    plotMan->saveSettings(settings);
 
    commandPanel.saveSettings(settings);
 
    recordPanel.saveSettings(settings);
 
    updateCheckDialog.saveSettings(settings);
 
}
 

	
 
void MainWindow::loadAllSettings(QSettings* settings)
 
{
 
    loadMWSettings(settings);
 
    portControl.loadSettings(settings);
 
    dataFormatPanel.loadSettings(settings);
 
    channelMan.loadSettings(settings);
 
    plotControlPanel.loadSettings(settings);
 
    plotMan->loadSettings(settings);
 
    commandPanel.loadSettings(settings);
 
    recordPanel.loadSettings(settings);
 
    updateCheckDialog.loadSettings(settings);
 
}
 

	
 
void MainWindow::saveMWSettings(QSettings* settings)
 
{
 
    // save window geometry
 
    settings->beginGroup(SettingGroup_MainWindow);
 
    settings->setValue(SG_MainWindow_Size, size());
 
    settings->setValue(SG_MainWindow_Pos, pos());
 
    // save active panel
 
    settings->setValue(SG_MainWindow_ActivePanel,
 
                       panelSettingMap.value(ui->tabWidget->currentIndex()));
 
    // save panel minimization
 
    settings->setValue(SG_MainWindow_HidePanels,
 
                       ui->tabWidget->hideAction.isChecked());
 
    // save window maximized state
 
    settings->setValue(SG_MainWindow_Maximized,
 
                       bool(windowState() & Qt::WindowMaximized));
 
    // save toolbar/dockwidgets state
 
    settings->setValue(SG_MainWindow_State, saveState());
 
    settings->endGroup();
 
}
 

	
 
void MainWindow::loadMWSettings(QSettings* settings)
 
{
 
    settings->beginGroup(SettingGroup_MainWindow);
 
    // load window geometry
 
    resize(settings->value(SG_MainWindow_Size, size()).toSize());
 
    move(settings->value(SG_MainWindow_Pos, pos()).toPoint());
 

	
 
    // set active panel
 
    QString tabSetting =
 
        settings->value(SG_MainWindow_ActivePanel, QString()).toString();
 
    ui->tabWidget->setCurrentIndex(
 
        panelSettingMap.key(tabSetting, ui->tabWidget->currentIndex()));
 

	
 
    // hide panels
 
    ui->tabWidget->hideAction.setChecked(
 
        settings->value(SG_MainWindow_HidePanels,
 
                        ui->tabWidget->hideAction.isChecked()).toBool());
 

	
 
    // maximize window
 
    if (settings->value(SG_MainWindow_Maximized).toBool())
 
    {
 
        showMaximized();
 
    }
 

	
 
    // load toolbar/dockwidgets state
 
    restoreState(settings->value(SG_MainWindow_State).toByteArray());
 
    settings->setValue(SG_MainWindow_State, saveState());
 

	
 
    settings->endGroup();
 
}
 

	
 
void MainWindow::onSaveSettings()
 
{
 
    QString fileName = QFileDialog::getSaveFileName(
 
        this, tr("Save Settings"), QString(), "INI (*.ini)");
 

	
 
    if (!fileName.isNull()) // user canceled
 
    {
 
        QSettings settings(fileName, QSettings::IniFormat);
 
        saveAllSettings(&settings);
 
    }
 
}
 

	
 
void MainWindow::onLoadSettings()
 
{
 
    QString fileName = QFileDialog::getOpenFileName(
 
        this, tr("Load Settings"), QString(), "INI (*.ini)");
 

	
 
    if (!fileName.isNull()) // user canceled
 
    {
 
        QSettings settings(fileName, QSettings::IniFormat);
 
        loadAllSettings(&settings);
 
    }
 
}
src/mainwindow.h
Show inline comments
 
/*
 
  Copyright © 2017 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 <http://www.gnu.org/licenses/>.
 
*/
 

	
 
#ifndef MAINWINDOW_H
 
#define MAINWINDOW_H
 

	
 
#include <QMainWindow>
 
#include <QButtonGroup>
 
#include <QLabel>
 
#include <QString>
 
#include <QVector>
 
#include <QList>
 
#include <QSerialPort>
 
#include <QSignalMapper>
 
#include <QTimer>
 
#include <QColor>
 
#include <QtGlobal>
 
#include <QSettings>
 
#include <qwt_plot_curve.h>
 

	
 
#include "portcontrol.h"
 
#include "commandpanel.h"
 
#include "dataformatpanel.h"
 
#include "plotcontrolpanel.h"
 
#include "recordpanel.h"
 
#include "ui_about_dialog.h"
 
#include "framebuffer.h"
 
#include "channelmanager.h"
 
#include "snapshotmanager.h"
 
#include "plotmanager.h"
 
#include "datarecorder.h"
 
#include "updatecheckdialog.h"
 

	
 
namespace Ui {
 
class MainWindow;
 
}
 

	
 
class MainWindow : public QMainWindow
 
{
 
    Q_OBJECT
 

	
 
public:
 
    explicit MainWindow(QWidget *parent = 0);
 
    ~MainWindow();
 

	
 
    PlotViewSettings viewSettings() const;
 

	
 
    void messageHandler(QtMsgType type, const QMessageLogContext &context,
 
                        const QString &msg);
 

	
 
private:
 
    Ui::MainWindow *ui;
 

	
 
    QDialog aboutDialog;
 
    void setupAboutDialog();
 

	
 
    QSerialPort serialPort;
 
    PortControl portControl;
 

	
 
    unsigned int numOfSamples;
 

	
 
    QList<QwtPlotCurve*> curves;
 
    ChannelManager channelMan;
 
    PlotManager* plotMan;
 
    SnapshotManager snapshotMan;
 
    DataRecorder recorder;       // operated by `recordPanel`
 

	
 
    QLabel spsLabel;
 
    CommandPanel commandPanel;
 
    DataFormatPanel dataFormatPanel;
 
    RecordPanel recordPanel;
 
    PlotControlPanel plotControlPanel;
 
    UpdateCheckDialog updateCheckDialog;
 

	
 
    bool isDemoRunning();
 
    /// Stores settings for all modules
 
    void saveAllSettings(QSettings* settings);
 
    /// Load settings for all modules
 
    void loadAllSettings(QSettings* settings);
 
    /// Stores main window settings into a `QSettings`
 
    void saveMWSettings(QSettings* settings);
 
    /// Loads main window settings from a `QSettings`
 
    void loadMWSettings(QSettings* settings);
 

	
 
    /// `QWidget::closeEvent` handler
 
    void closeEvent(QCloseEvent * event);
 

	
 
private slots:
 
    void onPortToggled(bool open);
 
    void onPortError(QSerialPort::SerialPortError error);
 

	
 
    void onNumOfSamplesChanged(int value);
 
    void onNumOfChannelsChanged(unsigned value);
 

	
 
    void clearPlot();
 
    void onSpsChanged(unsigned sps);
 
    void enableDemo(bool enabled);
 
    void onExportCsv();
 
    void onSaveSettings();
 
    void onLoadSettings();
 
};
 

	
 
#endif // MAINWINDOW_H
src/mainwindow.ui
Show inline comments
 
<?xml version="1.0" encoding="UTF-8"?>
 
<ui version="4.0">
 
 <class>MainWindow</class>
 
 <widget class="QMainWindow" name="MainWindow">
 
  <property name="geometry">
 
   <rect>
 
    <x>0</x>
 
    <y>0</y>
 
    <width>653</width>
 
    <height>650</height>
 
   </rect>
 
  </property>
 
  <property name="windowTitle">
 
   <string>SerialPlot</string>
 
  </property>
 
  <widget class="QWidget" name="centralWidget">
 
   <layout class="QVBoxLayout" name="verticalLayout_2">
 
    <item>
 
     <widget class="QWidget" name="plotArea" native="true">
 
      <property name="sizePolicy">
 
       <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
 
        <horstretch>0</horstretch>
 
        <verstretch>0</verstretch>
 
       </sizepolicy>
 
      </property>
 
     </widget>
 
    </item>
 
    <item>
 
     <widget class="HidableTabWidget" name="tabWidget">
 
      <property name="sizePolicy">
 
       <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
 
        <horstretch>0</horstretch>
 
        <verstretch>0</verstretch>
 
       </sizepolicy>
 
      </property>
 
      <property name="minimumSize">
 
       <size>
 
        <width>0</width>
 
        <height>0</height>
 
       </size>
 
      </property>
 
      <property name="maximumSize">
 
       <size>
 
        <width>16777215</width>
 
        <height>16777215</height>
 
       </size>
 
      </property>
 
      <property name="currentIndex">
 
       <number>0</number>
 
      </property>
 
      <property name="movable">
 
       <bool>false</bool>
 
      </property>
 
      <widget class="QWidget" name="tabLog">
 
       <attribute name="title">
 
        <string>Log</string>
 
       </attribute>
 
       <attribute name="toolTip">
 
        <string>Error and Warning Messages</string>
 
       </attribute>
 
       <layout class="QHBoxLayout" name="horizontalLayout">
 
        <property name="leftMargin">
 
         <number>4</number>
 
        </property>
 
        <property name="topMargin">
 
         <number>4</number>
 
        </property>
 
        <property name="rightMargin">
 
         <number>4</number>
 
        </property>
 
        <property name="bottomMargin">
 
         <number>4</number>
 
        </property>
 
        <item>
 
         <widget class="QPlainTextEdit" name="ptLog">
 
          <property name="readOnly">
 
           <bool>true</bool>
 
          </property>
 
         </widget>
 
        </item>
 
       </layout>
 
      </widget>
 
     </widget>
 
    </item>
 
   </layout>
 
  </widget>
 
  <widget class="QMenuBar" name="menuBar">
 
   <property name="geometry">
 
    <rect>
 
     <x>0</x>
 
     <y>0</y>
 
     <width>653</width>
 
     <height>27</height>
 
     <height>25</height>
 
    </rect>
 
   </property>
 
   <widget class="QMenu" name="menuHelp">
 
    <property name="title">
 
     <string>&amp;Help</string>
 
    </property>
 
    <addaction name="actionDemoMode"/>
 
    <addaction name="actionReportBug"/>
 
    <addaction name="actionCheckUpdate"/>
 
    <addaction name="actionHelpAbout"/>
 
   </widget>
 
   <widget class="QMenu" name="menuFile">
 
    <property name="title">
 
     <string>&amp;File</string>
 
    </property>
 
    <addaction name="actionSaveSettings"/>
 
    <addaction name="actionLoadSettings"/>
 
    <addaction name="actionExportCsv"/>
 
    <addaction name="separator"/>
 
    <addaction name="actionQuit"/>
 
   </widget>
 
   <widget class="QMenu" name="menuView">
 
    <property name="title">
 
     <string>&amp;View</string>
 
    </property>
 
   </widget>
 
   <addaction name="menuFile"/>
 
   <addaction name="menuView"/>
 
   <addaction name="menuHelp"/>
 
  </widget>
 
  <widget class="QToolBar" name="plotToolBar">
 
   <property name="windowTitle">
 
    <string>Plot Toolbar</string>
 
   </property>
 
   <attribute name="toolBarArea">
 
    <enum>TopToolBarArea</enum>
 
   </attribute>
 
   <attribute name="toolBarBreak">
 
    <bool>false</bool>
 
   </attribute>
 
   <addaction name="actionPause"/>
 
   <addaction name="actionClear"/>
 
  </widget>
 
  <widget class="QStatusBar" name="statusBar"/>
 
  <action name="actionPause">
 
   <property name="checkable">
 
    <bool>true</bool>
 
   </property>
 
   <property name="checked">
 
    <bool>false</bool>
 
   </property>
 
   <property name="icon">
 
    <iconset theme="player_pause"/>
 
    <iconset theme="player_pause">
 
     <normaloff/>
 
    </iconset>
 
   </property>
 
   <property name="text">
 
    <string>Pause</string>
 
   </property>
 
   <property name="toolTip">
 
    <string>Pause Plotting</string>
 
   </property>
 
   <property name="shortcut">
 
    <string>P</string>
 
   </property>
 
  </action>
 
  <action name="actionClear">
 
   <property name="icon">
 
    <iconset theme="editclear"/>
 
    <iconset theme="editclear">
 
     <normaloff/>
 
    </iconset>
 
   </property>
 
   <property name="text">
 
    <string>Clear</string>
 
   </property>
 
   <property name="shortcut">
 
    <string>Ctrl+K</string>
 
   </property>
 
  </action>
 
  <action name="actionHelpAbout">
 
   <property name="text">
 
    <string>&amp;About</string>
 
   </property>
 
  </action>
 
  <action name="actionDemoMode">
 
   <property name="checkable">
 
    <bool>true</bool>
 
   </property>
 
   <property name="text">
 
    <string>&amp;Demo Mode</string>
 
   </property>
 
   <property name="toolTip">
 
    <string>Toggle Demo Mode</string>
 
   </property>
 
  </action>
 
  <action name="actionExportCsv">
 
   <property name="text">
 
    <string>&amp;Export CSV</string>
 
   </property>
 
   <property name="toolTip">
 
    <string>Export plot data to CSV</string>
 
   </property>
 
  </action>
 
  <action name="actionQuit">
 
   <property name="text">
 
    <string>&amp;Quit</string>
 
   </property>
 
   <property name="shortcut">
 
    <string>Ctrl+Q</string>
 
   </property>
 
  </action>
 
  <action name="actionReportBug">
 
   <property name="text">
 
    <string>&amp;Report a Bug</string>
 
   </property>
 
   <property name="toolTip">
 
    <string>Report a Bug on SerialPlot Website</string>
 
   </property>
 
  </action>
 
  <action name="actionSaveSettings">
 
   <property name="text">
 
    <string>&amp;Save Settings</string>
 
   </property>
 
   <property name="toolTip">
 
    <string>Save Settings to a File</string>
 
   </property>
 
  </action>
 
  <action name="actionLoadSettings">
 
   <property name="text">
 
    <string>&amp;Load Settings</string>
 
   </property>
 
   <property name="toolTip">
 
    <string>Load Settings from a File</string>
 
   </property>
 
  </action>
 
  <action name="actionCheckUpdate">
 
   <property name="text">
 
    <string>&amp;Check Update</string>
 
   </property>
 
  </action>
 
 </widget>
 
 <layoutdefault spacing="6" margin="11"/>
 
 <customwidgets>
 
  <customwidget>
 
   <class>HidableTabWidget</class>
 
   <extends>QTabWidget</extends>
 
   <header>hidabletabwidget.h</header>
 
   <container>1</container>
 
  </customwidget>
 
 </customwidgets>
 
 <resources/>
 
 <connections/>
 
</ui>
src/setting_defines.h
Show inline comments
 
/*
 
  Copyright © 2017 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 <http://www.gnu.org/licenses/>.
 
*/
 

	
 
#ifndef SETTING_DEFINES_H
 
#define SETTING_DEFINES_H
 

	
 
const char SettingGroup_MainWindow[] = "MainWindow";
 
const char SettingGroup_Port[] = "Port";
 
const char SettingGroup_DataFormat[] = "DataFormat";
 
const char SettingGroup_Binary[] = "DataFormat_Binary";
 
const char SettingGroup_ASCII[] = "DataFormat_ASCII";
 
const char SettingGroup_CustomFrame[] = "DataFormat_CustomFrame";
 
const char SettingGroup_Channels[] = "Channels";
 
const char SettingGroup_Plot[] = "Plot";
 
const char SettingGroup_Commands[] = "Commands";
 
const char SettingGroup_Record[] = "Record";
 
const char SettingGroup_UpdateCheck[] = "UpdateCheck";
 

	
 
// mainwindow setting keys
 
const char SG_MainWindow_Size[] = "size";
 
const char SG_MainWindow_Pos[] = "pos";
 
const char SG_MainWindow_ActivePanel[] = "activePanel";
 
const char SG_MainWindow_HidePanels[] = "hidePanels";
 
const char SG_MainWindow_Maximized[] = "maximized";
 
const char SG_MainWindow_State[] = "state";
 

	
 
// port setting keys
 
const char SG_Port_SelectedPort[] = "selectedPort";
 
const char SG_Port_BaudRate[] = "baudRate";
 
const char SG_Port_Parity[] = "parity";
 
const char SG_Port_DataBits[] = "dataBits";
 
const char SG_Port_StopBits[] = "stopBits";
 
const char SG_Port_FlowControl[] = "flowControl";
 

	
 
// data format panel keys
 
const char SG_DataFormat_Format[] = "format";
 

	
 
// binary stream reader keys
 
const char SG_Binary_NumOfChannels[] = "numOfChannels";
 
const char SG_Binary_NumberFormat[] = "numberFormat";
 
const char SG_Binary_Endianness[] = "endianness";
 

	
 
// ascii reader keys
 
const char SG_ASCII_NumOfChannels[] = "numOfChannels";
 

	
 
// framed reader keys
 
const char SG_CustomFrame_NumOfChannels[] = "numOfChannels";
 
const char SG_CustomFrame_FrameStart[] = "frameStart";
 
const char SG_CustomFrame_FixedSize[] = "fixedSize";
 
const char SG_CustomFrame_FrameSize[] = "frameSize";
 
const char SG_CustomFrame_NumberFormat[] = "numberFormat";
 
const char SG_CustomFrame_Endianness[] = "endianness";
 
const char SG_CustomFrame_Checksum[] = "checksum";
 
const char SG_CustomFrame_DebugMode[] = "debugMode";
 

	
 
// channel manager keys
 
const char SG_Channels_Channel[] = "channel";
 
const char SG_Channels_Name[] = "name";
 
const char SG_Channels_Color[] = "color";
 
const char SG_Channels_Visible[] = "visible";
 

	
 
// plot settings keys
 
const char SG_Plot_NumOfSamples[] = "numOfSamples";
 
const char SG_Plot_IndexAsX[] = "indexAsX";
 
const char SG_Plot_XMax[] = "xMax";
 
const char SG_Plot_XMin[] = "xMin";
 
const char SG_Plot_AutoScale[] = "autoScale";
 
const char SG_Plot_YMax[] = "yMax";
 
const char SG_Plot_YMin[] = "yMin";
 
const char SG_Plot_DarkBackground[] = "darkBackground";
 
const char SG_Plot_Grid[] = "grid";
 
const char SG_Plot_MinorGrid[] = "minorGrid";
 
const char SG_Plot_Legend[] = "legend";
 
const char SG_Plot_MultiPlot[] = "multiPlot";
 
const char SG_Plot_Symbols[] = "symbols";
 

	
 
// command setting keys
 
const char SG_Commands_Command[] = "command";
 
const char SG_Commands_Name[] = "name";
 
const char SG_Commands_Type[] = "type";
 
const char SG_Commands_Data[] = "data";
 

	
 
// record panel settings keys
 
const char SG_Record_AutoIncrement[]    = "autoIncrement";
 
const char SG_Record_RecordPaused[]     = "recordPaused";
 
const char SG_Record_StopOnClose[]      = "stopOnClose";
 
const char SG_Record_Header[]           = "header";
 
const char SG_Record_Separator[]        = "separator";
 
const char SG_Record_DisableBuffering[] = "disableBuffering";
 

	
 
// update check settings keys
 
const char SG_UpdateCheck_Periodic[]  = "periodicCheck";
 
const char SG_UpdateCheck_LastCheck[] = "lastCheck";
 

	
 
#endif // SETTING_DEFINES_H
src/updatecheckdialog.cpp
Show inline comments
 
new file 100644
 
/*
 
  Copyright © 2017 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 <http://www.gnu.org/licenses/>.
 
*/
 

	
 
#include "setting_defines.h"
 
#include "updatecheckdialog.h"
 
#include "ui_updatecheckdialog.h"
 

	
 
UpdateCheckDialog::UpdateCheckDialog(QWidget *parent) :
 
    QDialog(parent),
 
    ui(new Ui::UpdateCheckDialog)
 
{
 
    ui->setupUi(this);
 

	
 
    // by default start from yesterday, so that we check at first run
 
    lastCheck = QDate::currentDate().addDays(-1);
 

	
 
    connect(&updateChecker, &UpdateChecker::checkFailed,
 
            [this](QString errorMessage)
 
            {
 
                lastCheck = QDate::currentDate();
 
                ui->label->setText(QString("Update check failed.\n") + errorMessage);
 
            });
 

	
 
    connect(&updateChecker, &UpdateChecker::checkFinished,
 
            [this](bool found, QString newVersion, QString downloadUrl)
 
            {
 
                QString text;
 
                if (!found)
 
                {
 
                    text = "There is no update yet.";
 
                }
 
                else
 
                {
 
                    show();
 
#ifdef UPDATE_TYPE_PKGMAN
 
                    text = QString("There is a new version: %1. "
 
                                   "Use your package manager to update"
 
                                   " or click to <a href=\"%2\">download</a>.")\
 
                        .arg(newVersion).arg(downloadUrl);
 
#else
 
                    text = QString("Found update to version %1. Click to <a href=\"%2\">download</a>.")\
 
                        .arg(newVersion).arg(downloadUrl);
 
#endif
 
                }
 

	
 
                lastCheck = QDate::currentDate();
 
                ui->label->setText(text);
 
            });
 
}
 

	
 
UpdateCheckDialog::~UpdateCheckDialog()
 
{
 
    delete ui;
 
}
 

	
 
void UpdateCheckDialog::showEvent(QShowEvent *event)
 
{
 
    updateChecker.checkUpdate();
 
    ui->label->setText("Checking update...");
 
}
 

	
 
void UpdateCheckDialog::closeEvent(QShowEvent *event)
 
{
 
    if (updateChecker.isChecking()) updateChecker.cancelCheck();
 
}
 

	
 
void UpdateCheckDialog::saveSettings(QSettings* settings)
 
{
 
    settings->beginGroup(SettingGroup_UpdateCheck);
 
    settings->setValue(SG_UpdateCheck_Periodic, ui->cbPeriodic->isChecked());
 
    settings->setValue(SG_UpdateCheck_LastCheck, lastCheck.toString(Qt::ISODate));
 
    settings->endGroup();
 
}
 

	
 
void UpdateCheckDialog::loadSettings(QSettings* settings)
 
{
 
    settings->beginGroup(SettingGroup_UpdateCheck);
 
    ui->cbPeriodic->setChecked(settings->value(SG_UpdateCheck_Periodic,
 
                                               ui->cbPeriodic->isChecked()).toBool());
 
    auto lastCheckS = settings->value(SG_UpdateCheck_LastCheck, lastCheck.toString(Qt::ISODate)).toString();
 
    lastCheck = QDate::fromString(lastCheckS, Qt::ISODate);
 
    settings->endGroup();
 

	
 
    // start the periodic update if required
 
    if (ui->cbPeriodic->isChecked() && lastCheck < QDate::currentDate())
 
    {
 
        updateChecker.checkUpdate();
 
    }
 
}
src/updatecheckdialog.h
Show inline comments
 
new file 100644
 
/*
 
  Copyright © 2017 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 <http://www.gnu.org/licenses/>.
 
*/
 

	
 
#ifndef UPDATECHECKDIALOG_H
 
#define UPDATECHECKDIALOG_H
 

	
 
#include <QDialog>
 
#include <QDate>
 
#include <QSettings>
 
#include "updatechecker.h"
 

	
 
namespace Ui {
 
class UpdateCheckDialog;
 
}
 

	
 
class UpdateCheckDialog : public QDialog
 
{
 
    Q_OBJECT
 

	
 
public:
 
    explicit UpdateCheckDialog(QWidget *parent = 0);
 
    ~UpdateCheckDialog();
 

	
 
    /// Stores update settings into a `QSettings`.
 
    void saveSettings(QSettings* settings);
 
    /// Loads update settings from a `QSettings`.
 
    void loadSettings(QSettings* settings);
 

	
 
private:
 
    Ui::UpdateCheckDialog *ui;
 
    UpdateChecker updateChecker;
 
    QDate lastCheck;
 

	
 
    void showEvent(QShowEvent *event);
 
    void closeEvent(QShowEvent *event);
 
};
 

	
 
#endif // UPDATECHECKDIALOG_H
src/updatecheckdialog.ui
Show inline comments
 
new file 100644
 
<?xml version="1.0" encoding="UTF-8"?>
 
<ui version="4.0">
 
 <class>UpdateCheckDialog</class>
 
 <widget class="QDialog" name="UpdateCheckDialog">
 
  <property name="geometry">
 
   <rect>
 
    <x>0</x>
 
    <y>0</y>
 
    <width>400</width>
 
    <height>148</height>
 
   </rect>
 
  </property>
 
  <property name="windowTitle">
 
   <string>Check Update</string>
 
  </property>
 
  <layout class="QVBoxLayout" name="verticalLayout">
 
   <item>
 
    <widget class="QLabel" name="label">
 
     <property name="text">
 
      <string>Checking update...</string>
 
     </property>
 
     <property name="openExternalLinks">
 
      <bool>true</bool>
 
     </property>
 
    </widget>
 
   </item>
 
   <item>
 
    <widget class="QCheckBox" name="cbPeriodic">
 
     <property name="toolTip">
 
      <string>Updates will be checked only once a day at first start of the application</string>
 
     </property>
 
     <property name="text">
 
      <string>Check updates periodically</string>
 
     </property>
 
     <property name="checked">
 
      <bool>true</bool>
 
     </property>
 
    </widget>
 
   </item>
 
   <item>
 
    <widget class="QDialogButtonBox" name="buttonBox">
 
     <property name="orientation">
 
      <enum>Qt::Horizontal</enum>
 
     </property>
 
     <property name="standardButtons">
 
      <set>QDialogButtonBox::Close</set>
 
     </property>
 
    </widget>
 
   </item>
 
  </layout>
 
 </widget>
 
 <resources/>
 
 <connections>
 
  <connection>
 
   <sender>buttonBox</sender>
 
   <signal>clicked(QAbstractButton*)</signal>
 
   <receiver>UpdateCheckDialog</receiver>
 
   <slot>close()</slot>
 
   <hints>
 
    <hint type="sourcelabel">
 
     <x>199</x>
 
     <y>125</y>
 
    </hint>
 
    <hint type="destinationlabel">
 
     <x>199</x>
 
     <y>73</y>
 
    </hint>
 
   </hints>
 
  </connection>
 
 </connections>
 
</ui>
src/updatechecker.cpp
Show inline comments
 
new file 100644
 
/*
 
  Copyright © 2017 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 <http://www.gnu.org/licenses/>.
 
*/
 

	
 
#include <QJsonDocument>
 
#include <QJsonObject>
 
#include <QJsonArray>
 
#include <QJsonValue>
 
#include <QRegularExpression>
 
#include <algorithm>
 
#include <functional>
 

	
 
#include "updatechecker.h"
 

	
 
// This link returns the list of downloads in JSON format. Note that we only use
 
// the first page because results are sorted new to old.
 
const char BB_DOWNLOADS_URL[] = "https://api.bitbucket.org/2.0/repositories/hyozd/serialplot/downloads?fields=values.name,values.links.self.href";
 

	
 
UpdateChecker::UpdateChecker(QObject *parent) :
 
    QObject(parent), nam(this)
 
{
 
    activeReply = NULL;
 

	
 
    connect(&nam, &QNetworkAccessManager::finished,
 
            this, &UpdateChecker::onReqFinished);
 
}
 

	
 
bool UpdateChecker::isChecking() const
 
{
 
    return activeReply != NULL && !activeReply->isFinished();
 
}
 

	
 
void UpdateChecker::checkUpdate()
 
{
 
    if (isChecking()) return;
 

	
 
    auto req = QNetworkRequest(QUrl(BB_DOWNLOADS_URL));
 
    activeReply = nam.get(req);
 
}
 

	
 
void UpdateChecker::cancelCheck()
 
{
 
    if (activeReply != NULL) activeReply->abort();
 
}
 

	
 
void UpdateChecker::onReqFinished(QNetworkReply* reply)
 
{
 
    if (reply->error() != QNetworkReply::NoError)
 
    {
 
        emit checkFailed(QString("Network error: ") + reply->errorString());
 
    }
 
    else
 
    {
 
        QJsonParseError error;
 
        auto data = QJsonDocument::fromJson(reply->readAll(), &error);
 
        if (error.error != QJsonParseError::NoError)
 
        {
 
            emit checkFailed(QString("JSon parsing error: ") + error.errorString());
 
        }
 
        else
 
        {
 
            QList<FileInfo> files;
 
            if (!parseData(data, files))
 
            {
 
                // TODO: emit detailed data contents for logging
 
                emit checkFailed("Data parsing error.");
 
            }
 
            else
 
            {
 
                FileInfo updateFile;
 
                if (findUpdate(files, updateFile))
 
                {
 
                    emit checkFinished(
 
                        true, updateFile.version.toString(), updateFile.link);
 
                }
 
                else
 
                {
 
                    emit checkFinished(false, "", "");
 
                }
 
            }
 
        }
 
    }
 
    reply->deleteLater();
 
    activeReply = NULL;
 
}
 

	
 
bool UpdateChecker::parseData(const QJsonDocument& data, QList<FileInfo>& files) const
 
{
 
    /* Data is expected to be in this form:
 

	
 
    {
 
       "values": [
 
       {
 
         "name": "serialplot-0.9.1-x86_64.AppImage",
 
         "links": {
 
           "self": {
 
             "href": "https://api.bitbucket.org/2.0/repositories/hyOzd/serialplot/downloads/serialplot-0.9.1-x86_64.AppImage"
 
            }
 
          }
 
       }, ... ]
 
    }
 
    */
 

	
 
    if (!data.isObject()) return false;
 

	
 
    auto values = data.object()["values"];
 
    if (values == QJsonValue::Undefined || !values.isArray()) return false;
 

	
 
    for (auto value : values.toArray())
 
    {
 
        if (!value.isObject()) return false;
 

	
 
        auto name = value.toObject().value("name");
 
        if (name.isUndefined() || !name.isString())
 
             return false;
 

	
 
        auto links = value.toObject().value("links");
 
        if (links.isUndefined() || !links.isObject())
 
            return false;
 

	
 
        auto self = links.toObject().value("self");
 
        if (self.isUndefined() || !self.isObject())
 
            return false;
 

	
 
        auto href = self.toObject().value("href");
 
        if (href.isUndefined() || !href.isString())
 
            return false;
 

	
 
        FileInfo finfo;
 
        finfo.name = name.toString();
 
        finfo.link = href.toString();
 
        finfo.hasVersion = VersionNumber::extract(name.toString(), finfo.version);
 

	
 
        if (finfo.name.contains("amd64") ||
 
            finfo.name.contains("x86_64") ||
 
            finfo.name.contains("win64"))
 
        {
 
            finfo.arch = FileArch::amd64;
 
        }
 
        else if (finfo.name.contains("win32") ||
 
                 finfo.name.contains("i386"))
 
        {
 
            finfo.arch = FileArch::i386;
 
        }
 
        else
 
        {
 
            finfo.arch = FileArch::unknown;
 
        }
 

	
 
        files += finfo;
 
    }
 

	
 
    return true;
 
}
 

	
 
bool UpdateChecker::findUpdate(const QList<FileInfo>& files, FileInfo& foundFile) const
 
{
 
    QList<FileInfo> fflist;
 

	
 
    // filter the file list according to extension and version number
 
    for (int i = 0; i < files.length(); i++)
 
    {
 
        // file type to look
 
#if defined(Q_OS_WIN)
 
        const char ext[] = ".exe";
 
#else  // of course linux
 
        const char ext[] = ".appimage";
 
#endif
 

	
 
        // file architecture to look
 
#if defined(Q_PROCESSOR_X86_64)
 
        const FileArch arch = FileArch::amd64;
 
#elif defined(Q_PROCESSOR_X86_32)
 
        const FileArch arch = FileArch::i386;
 
#elif defined(Q_PROCESSOR_ARM)
 
        const FileArch arch = FileArch::arm;
 
#else
 
        #error Unknown architecture for update file detection.
 
#endif
 

	
 
        // filter the file list
 
        auto file = files[i];
 
        if (file.name.contains(ext, Qt::CaseInsensitive) &&
 
            file.arch == arch &&
 
            file.hasVersion && file.version > CurrentVersion)
 
        {
 
            fflist += file;
 
        }
 
    }
 

	
 
    // sort and find most up to date file
 
    if (!fflist.empty())
 
    {
 
        std::sort(fflist.begin(), fflist.end(),
 
                  [](const FileInfo& a, const FileInfo& b)
 
                  {
 
                      return a.version > b.version;
 
                  });
 

	
 
        foundFile = fflist[0];
 
        return true;
 
    }
 
    else
 
    {
 
        return false;
 
    }
 
}
src/updatechecker.h
Show inline comments
 
new file 100644
 
/*
 
  Copyright © 2017 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 <http://www.gnu.org/licenses/>.
 
*/
 

	
 
#ifndef UPDATECHECKER_H
 
#define UPDATECHECKER_H
 

	
 
#include <QObject>
 
#include <QNetworkAccessManager>
 
#include <QNetworkReply>
 
#include <QList>
 

	
 
#include "versionnumber.h"
 

	
 
class UpdateChecker : public QObject
 
{
 
    Q_OBJECT
 
public:
 
    explicit UpdateChecker(QObject *parent = 0);
 

	
 
    bool isChecking() const;
 

	
 
signals:
 
    void checkFinished(bool found, QString newVersion, QString downloadUrl);
 
    void checkFailed(QString errorMessage);
 

	
 
public slots:
 
    void checkUpdate();
 
    void cancelCheck();
 

	
 
private:
 
    enum class FileArch
 
    {
 
        unknown,
 
        i386,
 
        amd64,
 
        arm
 
    };
 

	
 
    struct FileInfo
 
    {
 
        QString name;
 
        QString link;
 
        bool hasVersion;
 
        VersionNumber version;
 
        FileArch arch;
 
    };
 

	
 
    QNetworkAccessManager nam;
 
    QNetworkReply* activeReply;
 

	
 
    /// Parses json and creates a list of files
 
    bool parseData(const QJsonDocument& data, QList<FileInfo>& files) const;
 
    /// Finds the update file in the file list. Returns `-1` if no new version
 
    /// is found.
 
    bool findUpdate(const QList<FileInfo>& files, FileInfo& foundFile) const;
 

	
 
private slots:
 
    void onReqFinished(QNetworkReply* reply);
 
};
 

	
 
#endif // UPDATECHECKER_H
src/versionnumber.cpp
Show inline comments
 
new file 100644
 
/*
 
  Copyright © 2017 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 <http://www.gnu.org/licenses/>.
 
*/
 

	
 
#include <QRegularExpression>
 

	
 
#include "versionnumber.h"
 

	
 
VersionNumber::VersionNumber(unsigned mj, unsigned mn, unsigned pt)
 
{
 
    major = mj;
 
    minor = mn;
 
    patch = pt;
 
}
 

	
 
QString VersionNumber::toString() const
 
{
 
    return QString("%1.%2.%3").arg(major).arg(minor).arg(patch);
 
}
 

	
 
bool VersionNumber::extract(const QString& str, VersionNumber& number)
 
{
 
    QRegularExpression regexp("(?:[-_vV \\t]|^)(?<major>\\d+)"
 
                              "(?:\\.(?<minor>\\d+))(?:\\.(?<patch>\\d+))?[-_ \\t]?");
 
    auto match = regexp.match(str, 0, QRegularExpression::PartialPreferCompleteMatch);
 

	
 
    if (!(match.hasMatch() || match.hasPartialMatch())) return false;
 

	
 
    number.major = match.captured("major").toUInt();
 

	
 
    auto zeroIfNull = [](QString str) -> unsigned
 
        {
 
            if (str.isNull()) return 0;
 
            return str.toUInt();
 
        };
 

	
 
    number.minor = zeroIfNull(match.captured("minor"));
 
    number.patch = zeroIfNull(match.captured("patch"));
 

	
 
    return true;
 
}
 

	
 
bool operator==(const VersionNumber& lhs, const VersionNumber& rhs)
 
{
 
    return lhs.major == rhs.major &&
 
           lhs.minor == rhs.minor &&
 
           lhs.patch == rhs.patch;
 
}
 

	
 
bool operator<(const VersionNumber& lhs, const VersionNumber& rhs)
 
{
 
    if (lhs.major < rhs.major)
 
    {
 
        return true;
 
    }
 
    else if (lhs.major == rhs.major)
 
    {
 
        if (lhs.minor < rhs.minor)
 
        {
 
             return true;
 
        }
 
        else if (lhs.minor == rhs.minor)
 
        {
 
            if (lhs.patch < rhs.patch) return true;
 
        }
 
    }
 
    return false;
 
}
 

	
 
bool operator>(const VersionNumber& lhs, const VersionNumber& rhs)
 
{
 
    if (lhs.major > rhs.major)
 
    {
 
        return true;
 
    }
 
    else if (lhs.major == rhs.major)
 
    {
 
        if (lhs.minor > rhs.minor)
 
        {
 
             return true;
 
        }
 
        else if (lhs.minor == rhs.minor)
 
        {
 
            if (lhs.patch > rhs.patch) return true;
 
        }
 
    }
 
    return false;
 
}
src/versionnumber.h
Show inline comments
 
new file 100644
 
/*
 
  Copyright © 2017 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 <http://www.gnu.org/licenses/>.
 
*/
 

	
 
#ifndef VERSIONNUMBER_H
 
#define VERSIONNUMBER_H
 

	
 
#include <QString>
 

	
 
struct VersionNumber
 
{
 
    unsigned major = 0;
 
    unsigned minor = 0;
 
    unsigned patch = 0;
 

	
 
    VersionNumber(unsigned mj=0, unsigned mn=0, unsigned pt=0);
 

	
 
    /// Convert version number to string.
 
    QString toString() const;
 

	
 
    /// Extracts the version number from given string.
 
    static bool extract(const QString& str, VersionNumber& number);
 
};
 

	
 
bool operator==(const VersionNumber& lhs, const VersionNumber& rhs);
 
bool operator<(const VersionNumber& lhs, const VersionNumber& rhs);
 
bool operator>(const VersionNumber& lhs, const VersionNumber& rhs);
 

	
 
const VersionNumber CurrentVersion(VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH);
 

	
 
#endif // VERSIONNUMBER_H
0 comments (0 inline, 0 general)