From 1d3125fbdc98a9847c3a4ad4e1e9c52a8a026b85 Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Mon, 30 Jul 2018 16:39:33 +0200 Subject: [PATCH] initial about added --- CMakeLists.txt | 4 +++- config.h.in | 6 ++++++ src/gui/CMakeLists.txt | 1 + src/gui/mainwindow.cpp | 15 ++++++++++++++- src/gui/mainwindow.h | 1 + 5 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 config.h.in diff --git a/CMakeLists.txt b/CMakeLists.txt index d169771..1ee20ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.8) -project(KIMA2) +project(KIMA2 VERSION 0.1.0) set(CMAKE_MODULE_PATH "${CMAKE_HOME_DIRECTORY}/cmake" ${CMAKE_MODULE_PATH}) @@ -13,6 +13,8 @@ else() add_compile_options(-Wall -Wextra -pedantic -Woverloaded-virtual -Wredundant-decls -Wshadow) endif() +configure_file(config.h.in ${PROJECT_BINARY_DIR}/config.h) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..b3f9bae --- /dev/null +++ b/config.h.in @@ -0,0 +1,6 @@ +#ifndef CONFIG_H +#define CONFIG_H + +#cmakedefine PROJECT_VERSION "@PROJECT_VERSION@" + +#endif \ No newline at end of file diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index afcf239..a76e44b 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -27,4 +27,5 @@ set(GUI_SOURCES ) add_executable(kima2 ${GUI_SOURCES}) +target_include_directories(kima2 PRIVATE ${PROJECT_BINARY_DIR}) target_link_libraries(kima2 core Qt5::Widgets stdc++fs) diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 8e51602..625cf11 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -1,6 +1,7 @@ #include "mainwindow.h" #include "basketmodel.h" +#include "config.h" #include "pricedialog.h" #include "reportdialog.h" #include "salemodel.h" @@ -52,6 +53,7 @@ MainWindow::MainWindow() connect(static_cast(ui_.basketView->model()), &BasketModel::basketDataChanged, static_cast(ui_.salesView->model()), &SaleModel::onBasketDataChanged); connect(ui_.aboutQtAction, &QAction::triggered, this, &MainWindow::onAboutQt); + connect(ui_.aboutAction, &QAction::triggered, this, &MainWindow::onAbout); connect(ui_.reportAction, &QAction::triggered, this, [=]() { ReportDialog(this).exec(); }); connect(ui_.configAction, &QAction::triggered, this, [=]() { SettingsDialog(this).exec(); @@ -218,4 +220,15 @@ void MainWindow::onCancelAllArticlesButtonClicked([[maybe_unused]] bool checked) dynamic_cast(ui_.basketView->model())->cancelSale(); } -void MainWindow::onAboutQt() { QMessageBox::aboutQt(this); } \ No newline at end of file +void MainWindow::onAboutQt() { QMessageBox::aboutQt(this); } + +void MainWindow::onAbout() +{ + QMessageBox::about( + this, "Über", + QString("

KIMA2 Version ") + PROJECT_VERSION + + "

" + "

KIMA2 ist ein kleines Kassenprogramm für Kindersachenmärkte.

" + "

Copyright © Martin Brodbeck <info@rustysoft.de>

"); +} \ No newline at end of file diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index e6f7555..14ae9c0 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -26,6 +26,7 @@ class MainWindow : public QMainWindow void onCancelSaleButtonClicked(bool checked); void onCancelAllArticlesButtonClicked(bool checked); void onAboutQt(); + void onAbout(); private: void onActionEditSellerTriggered();