Compare commits

...

41 commits

Author SHA1 Message Date
9affcfdbcb remove meson 2025-03-24 16:21:46 +01:00
5c0c55108e add cut commands 2025-03-20 14:29:20 +01:00
c01f714335 v1.9.2 2025-03-20 13:22:00 +01:00
27f36b4aa8 cmake stuff 2025-03-18 12:32:10 +01:00
980f60c003 cmake stuff 2025-03-18 10:06:18 +01:00
d6b3606bd6 Simplyfy nlohmann_json integration 2025-03-17 14:34:54 +01:00
8abb60c5db Remove unnecessary file 2025-03-17 14:24:36 +01:00
d73afbf22e Simplify singleapplication integration 2025-03-17 14:23:46 +01:00
da038ca875 license text updated 2025-03-17 13:56:40 +01:00
843d894dd2 require cmake 3.30 2025-03-17 13:47:06 +01:00
cb461f52ab Add QT_DEFAULT_MAJOR_VERSION for singleapplication 2025-03-17 13:41:07 +01:00
c3fd8eb2dd New qtsingleapplication version 2025-03-15 19:32:40 +01:00
50c0f72c95 new version 2025-03-15 17:22:00 +01:00
4a2a4f92b4 Use extended selection mode
Fixes #28
2025-03-15 17:15:32 +01:00
95eb6b54f2 Sort selected sellers 2025-03-15 17:12:29 +01:00
30c34f4674 clang-format fixed 2025-03-15 16:57:08 +01:00
b30b44fa40 use Qt string literals 2025-03-15 15:51:01 +01:00
02b4017b91 manual updated 2025-03-14 13:56:24 +01:00
63712c8166 adapt for Windows build 2025-03-14 13:51:05 +01:00
ebe80f6bbe bump version 2025-03-14 13:40:45 +01:00
98a9fe0069 Allow to print multiple seller recipes. 2025-03-14 12:17:24 +01:00
8a5038e462 README 2024-10-01 14:39:54 +02:00
068a50e289 Push to new version 2024-10-01 14:08:34 +02:00
da89a0d2c7 Fix translations and style for Windows 2024-10-01 14:00:36 +02:00
429d66dd4d user manual updated 2024-09-30 15:03:17 +02:00
37c8446ea4 user manual updated 2024-09-30 14:39:50 +02:00
a896e0d40e Push to new version 2024-09-30 14:17:17 +02:00
3668e2484f try to make singleapplication flatpak-compatible (2) 2024-09-30 10:47:03 +02:00
52dc7f1974 try to make singleapplication flatpak-compatible 2024-09-30 10:26:14 +02:00
ab7b14f12e get rid of fmt 2024-05-22 13:09:44 +02:00
0c7f071b9d include dir for boost added. 2024-03-05 14:38:02 +01:00
d0c50c9b9a qsingleapplication version bumped 2024-01-23 11:25:07 +01:00
a17cb22e05 2023 → 2024 2024-01-23 11:22:51 +01:00
205dac5326 nlohmann updateted to 3.11.3 2024-01-23 11:20:39 +01:00
b0d2d6b284 update to version 1.8 2024-01-23 10:46:49 +01:00
7f11ba4e5d new version 1.8.0 2024-01-23 10:42:04 +01:00
32d0ec7749 Allow import of multiple sales at once. 2024-01-23 10:39:43 +01:00
54e5c70447 Changed minimum versions 2024-01-23 10:06:01 +01:00
379fd4a73c Lib references for Windows updated 2023-09-21 15:00:18 +02:00
8a94b53379 Push boost version. 2023-05-02 11:07:15 +02:00
d9b13d0e1a README updated. 2023-05-02 11:03:22 +02:00
29 changed files with 108 additions and 223 deletions

View file

@ -31,11 +31,11 @@ BinPackArguments: true
BinPackParameters: true BinPackParameters: true
BraceWrapping: BraceWrapping:
AfterCaseLabel: false AfterCaseLabel: false
AfterClass: false AfterClass: true
AfterControlStatement: Never AfterControlStatement: Never
AfterEnum: false AfterEnum: false
AfterFunction: false AfterFunction: true
AfterNamespace: false AfterNamespace: true
AfterObjCDeclaration: false AfterObjCDeclaration: false
AfterStruct: false AfterStruct: false
AfterUnion: false AfterUnion: false
@ -51,10 +51,6 @@ BraceWrapping:
BreakBeforeBinaryOperators: None BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: true BreakBeforeConceptDeclarations: true
BreakBeforeBraces: Custom BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: true
AfterFunction: true
AfterNamespace: true
BreakBeforeInheritanceComma: false BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true BreakBeforeTernaryOperators: true

6
.gitmodules vendored
View file

@ -1,6 +0,0 @@
[submodule "subprojects/nlohmann_json"]
path = subprojects/nlohmann_json
url = https://github.com/nlohmann/json.git
[submodule "subprojects/singleapplication"]
path = subprojects/singleapplication/singleapplication.git
url = https://github.com/itay-grudev/SingleApplication.git

View file

@ -1,13 +1,14 @@
cmake_minimum_required(VERSION 3.8) cmake_minimum_required(VERSION 3.30)
project(kima2 VERSION 1.7.2) project(kima2 VERSION 1.9.2)
set(CMAKE_MODULE_PATH "${CMAKE_HOME_DIRECTORY}/cmake") set(CMAKE_MODULE_PATH "${CMAKE_HOME_DIRECTORY}/cmake")
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
#include(InstallRequiredSystemLibraries) # For SingleApplication and nlohmann_json
include(FetchContent)
if(MSVC) if(MSVC)
add_compile_options(/W4 /WX) add_compile_options(/W4 /WX)
@ -29,7 +30,6 @@ if(KIMA2_USE_EXTERNAL_JSON)
find_package(nlohmann_json REQUIRED) find_package(nlohmann_json REQUIRED)
endif() endif()
add_subdirectory(subprojects)
add_subdirectory(src) add_subdirectory(src)
#if(NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE MATCHES Debug) #if(NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE MATCHES Debug)
@ -98,9 +98,9 @@ if( MINGW )
${MINGW_PATH}/libwinpthread-1.dll ${MINGW_PATH}/libwinpthread-1.dll
${MINGW_PATH}/libsqlite3-0.dll ${MINGW_PATH}/libsqlite3-0.dll
${MINGW_PATH}/libusb-1.0.dll ${MINGW_PATH}/libusb-1.0.dll
${MINGW_PATH}/libicuuc72.dll ${MINGW_PATH}/libicuuc76.dll
${MINGW_PATH}/libicuin72.dll ${MINGW_PATH}/libicuin76.dll
${MINGW_PATH}/libicudt72.dll ${MINGW_PATH}/libicudt76.dll
${MINGW_PATH}/libpcre2-16-0.dll ${MINGW_PATH}/libpcre2-16-0.dll
${MINGW_PATH}/libpcre2-8-0.dll ${MINGW_PATH}/libpcre2-8-0.dll
${MINGW_PATH}/zlib1.dll ${MINGW_PATH}/zlib1.dll
@ -111,13 +111,12 @@ if( MINGW )
${MINGW_PATH}/libgraphite2.dll ${MINGW_PATH}/libgraphite2.dll
${MINGW_PATH}/libbz2-1.dll ${MINGW_PATH}/libbz2-1.dll
${MINGW_PATH}/libintl-8.dll ${MINGW_PATH}/libintl-8.dll
${MINGW_PATH}/libpcre-1.dll
${MINGW_PATH}/libdouble-conversion.dll ${MINGW_PATH}/libdouble-conversion.dll
${MINGW_PATH}/libzstd.dll ${MINGW_PATH}/libzstd.dll
${MINGW_PATH}/libmd4c.dll ${MINGW_PATH}/libmd4c.dll
${MINGW_PATH}/libbrotlicommon.dll ${MINGW_PATH}/libbrotlicommon.dll
${MINGW_PATH}/libbrotlidec.dll ${MINGW_PATH}/libbrotlidec.dll
${MINGW_PATH}/libfmt.dll #${MINGW_PATH}/libfmt.dll
${MINGW_PATH}/libb2-1.dll ${MINGW_PATH}/libb2-1.dll
${MINGW_PATH}/libiconv-2.dll) ${MINGW_PATH}/libiconv-2.dll)
install(FILES ${MINGW_PATH}/../share/qt6/plugins/platforms/qwindows.dll install(FILES ${MINGW_PATH}/../share/qt6/plugins/platforms/qwindows.dll
@ -129,10 +128,9 @@ if( MINGW )
${MINGW_PATH}/../share/qt6/translations/qt_de.qm ${MINGW_PATH}/../share/qt6/translations/qt_de.qm
${MINGW_PATH}/../share/qt6/translations/qt_help_de.qm ${MINGW_PATH}/../share/qt6/translations/qt_help_de.qm
${MINGW_PATH}/../share/qt6/translations/qtmultimedia_de.qm ${MINGW_PATH}/../share/qt6/translations/qtmultimedia_de.qm
#${MINGW_PATH}/../share/qt6/translations/qtquickcontrols_de.qm DESTINATION bin/share/qt6/translations)
#${MINGW_PATH}/../share/qt6/translations/qtscript_de.qm install(FILES ${MINGW_PATH}/../share/qt6/plugins/styles/qmodernwindowsstyle.dll
#${MINGW_PATH}/../share/qt6/translations/qtxmlpatterns_de.qm DESTINATION bin/styles)
DESTINATION bin/translations)
endif( MINGW ) endif( MINGW )
include(InstallRequiredSystemLibraries) include(InstallRequiredSystemLibraries)

View file

@ -1,4 +1,4 @@
Copyright © 2018-2023 Martin Brodbeck Copyright © 2018-2025 Martin Brodbeck
Hiermit wird unentgeltlich jeder Person, die eine Kopie der Software und der Hiermit wird unentgeltlich jeder Person, die eine Kopie der Software und der
zugehörigen Dokumentationen (die "Software") erhält, die Erlaubnis erteilt, zugehörigen Dokumentationen (die "Software") erhält, die Erlaubnis erteilt,

View file

@ -13,20 +13,16 @@ Verkaufsdaten nach dem Verkaufsende auszutauschen.
Ebenso können über einen ESC/POS-Drucker Quittungen ausgestellt werden. Ebenso können über einen ESC/POS-Drucker Quittungen ausgestellt werden.
## Installation ## Installation
Auf [rustysoft.de](https://www.rustysoft.de/software/kima2/) werden verschiedene Installationspakete (Arch Linux, Auf [rustysoft.de](https://www.rustysoft.de/software/kima2/) werden die Installationsmöglichkeiten (Flatpak, Windows-Installer) erläutert. Bitte die Hinweise dort beachten.
Ubuntu, Windows) angeboten. Bitte die Hinweise dort beachten.
### Selbst compilieren ## Selbst compilieren
KIMA2 benötigt folgende Libraries: KIMA2 benötigt folgende Libraries:
* Qt 6 * Qt 6
* boost >= 1.62 * boost >= 1.80
* libusb-1.0 * libusb-1.0
* xlnt >= 1.5.0
* nlohmann-json (als 3rdparty submodule vorhanden) * nlohmann-json (als 3rdparty submodule vorhanden)
* csv-parser (als 3rdparty submodule vorhanden)
Da Features aus C++20 verwendet werden sowie std::filesystem, sollte als Compiler mindestens Da Features aus C++20 sowie von neueren Compilern verwendet werden, sollte als Compiler mindestens GCC 14 verwendet werden.
GCC 12 verwendet werden.
Die Installationsschritte unter Linux sind wie folgt: Die Installationsschritte unter Linux sind wie folgt:
``` ```

View file

@ -9,12 +9,12 @@
<project_license>GPL-3.0-or-later</project_license> <project_license>GPL-3.0-or-later</project_license>
<releases> <releases>
<release version="@PROJECT_VERSION@" type="stable" date="2023-04-25" /> <release version="@PROJECT_VERSION@" type="stable" date="2024-01-23" />
</releases> </releases>
<description> <description>
<p> <p>
A small cash point program for childrens stuff markets. German language only. A small cash point program for children's stuff markets. German language only.
</p> </p>
</description> </description>

Binary file not shown.

Binary file not shown.

View file

@ -1,33 +0,0 @@
project('kima2', 'cpp', default_options : ['cpp_std=c++20'], version : '1.6.1')
conf_data = configuration_data()
conf_data.set('PROJECT_VERSION', '"' + meson.project_version() + '"')
configure_file(output : 'config.h',
configuration : conf_data)
configuration_inc = include_directories('.')
#csv = cmake.subproject('csv-parser')
#csv_lib = csv.dependency('csv')
nlohmann_lib = dependency('nlohmann_json', version : '>=3.5.0', required : false)
if not nlohmann_lib.found()
nlohmann_inc = include_directories('subprojects/nlohmann_json/single_include')
nlohmann_lib = declare_dependency(include_directories : nlohmann_inc)
endif
csv_inc = include_directories('subprojects/csv-parser/single_include')
csv_dep = declare_dependency(include_directories : csv_inc)
singleapp_proj = subproject('singleapplication')
singleapp_lib = singleapp_proj.get_variable('singleapp_lib')
singleapp_dep = singleapp_proj.get_variable('singleapp_dep')
subdir('src')
if build_machine.system() == 'linux'
install_data('misc/kima2.svg', install_dir : get_option('datadir') / 'icons/hicolor/scalable/apps')
install_data('misc/kima2.desktop', install_dir : get_option('datadir') / 'applications')
install_data('manual/Benutzerhandbuch.pdf', install_dir : get_option('datadir') / 'kima2')
endif

View file

@ -1,13 +1,14 @@
set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.62 REQUIRED) find_package(Boost 1.78 REQUIRED)
find_package(SQLite3 REQUIRED) find_package(SQLite3 REQUIRED)
# Because csv-parser needs threads: FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz)
FetchContent_MakeAvailable(json)
find_package(fmt) add_library(core STATIC)
set(CORE_SOURCES target_sources(core PRIVATE
database.cpp database.cpp
entity.cpp entity.cpp
entityint.cpp entityint.cpp
@ -21,14 +22,11 @@ set(CORE_SOURCES
utils.cpp utils.cpp
) )
add_library(core STATIC ${CORE_SOURCES})
#target_include_directories(core PRIVATE ${PROJECT_SOURCE_DIR}/subprojects/csv-parser/single_include)
if (WIN32) if (WIN32)
target_link_libraries(core PRIVATE sqlite3 nlohmann_json::nlohmann_json fmt::fmt) target_link_libraries(core PRIVATE sqlite3 nlohmann_json::nlohmann_json)
target_link_libraries(core PRIVATE bcrypt) target_link_libraries(core PRIVATE bcrypt)
else() else()
target_link_libraries(core PRIVATE sqlite3 nlohmann_json::nlohmann_json fmt::fmt) target_link_libraries(core PRIVATE sqlite3 nlohmann_json::nlohmann_json)
endif() endif()
target_include_directories(core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..) target_include_directories(core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..)

View file

@ -2,7 +2,7 @@
#include <chrono> #include <chrono>
#include <filesystem> #include <filesystem>
#include <fmt/chrono.h> #include <format>
#include <iostream> #include <iostream>
#include <stdexcept> #include <stdexcept>
#include <vector> #include <vector>
@ -47,7 +47,7 @@ void Database::newDb()
fs::path destPath = sourcePath.parent_path() / sourcePath.stem(); fs::path destPath = sourcePath.parent_path() / sourcePath.stem();
auto chronoTime = std::chrono::system_clock::now(); auto chronoTime = std::chrono::system_clock::now();
std::string timeString = fmt::format("{0:%FT%H-%M-%S}", chronoTime); std::string timeString = std::format("{0:%FT%H-%M-%S}", chronoTime);
destPath += std::string("_") += timeString += ".db"; destPath += std::string("_") += timeString += ".db";

View file

@ -102,8 +102,10 @@ void JsonUtil::importSales(const std::filesystem::path &filePath, Marketplace *m
int source_no = jsonValues["source_no"]; int source_no = jsonValues["source_no"];
if (source_no == cashPointNo) { if (source_no == cashPointNo) {
throw std::runtime_error("Die Kassen-Nr. der zu imporierenden Daten wird von dieser Kasse " std::string ret = "Die Kassen-Nr. ";
"hier bereits verwendet."); ret += std::to_string(source_no);
ret += " der zu imporierenden Daten wird von dieser Kasse hier bereits verwendet.";
throw std::runtime_error(ret);
} }
market->setSalesToDelete(jsonValues["source_no"]); market->setSalesToDelete(jsonValues["source_no"]);

View file

@ -1,13 +0,0 @@
boost = dependency('boost', modules: ['date_time'], static: true)
xlnt = dependency('xlnt')
sqlite = dependency('sqlite3')
src = ['database.cpp', 'entity.cpp', 'entityint.cpp', 'entityuuid.cpp',
'seller.cpp', 'article.cpp', 'sale.cpp', 'marketplace.cpp',
'excelreader.cpp', 'csvreader.cpp', 'jsonutil.cpp', 'utils.cpp']
core_inc = include_directories('..')
core_lib = static_library('core', src, dependencies: [boost, xlnt, sqlite, nlohmann_lib, csv_dep])
core_dep = declare_dependency(link_with: core_lib, include_directories : core_inc)

View file

@ -2,13 +2,13 @@
#include <algorithm> #include <algorithm>
#include <clocale> #include <clocale>
#include <fmt/format.h> #include <format>
#include <iomanip> #include <iomanip>
#include <numeric> #include <numeric>
#include <iostream> #include <iostream>
using namespace fmt; //using namespace fmt;
std::string formatCentAsEuroString(const int cent, int width) std::string formatCentAsEuroString(const int cent, int width)
{ {
@ -32,7 +32,7 @@ std::string formatCentAsEuroString(const int cent, int width)
#else #else
std::locale myLocale{"de_DE.utf8"}; std::locale myLocale{"de_DE.utf8"};
#endif #endif
return fmt::format(myLocale, "{:{}.2Lf} €", cent / 100.0L, width); return std::format(myLocale, "{:{}.2Lf} €", cent / 100.0L, width);
} }
std::string &ltrim(std::string &str, const std::string &chars) std::string &ltrim(std::string &str, const std::string &chars)

View file

@ -9,15 +9,21 @@ set(CMAKE_AUTORCC ON)
# Find the QtWidgets library # Find the QtWidgets library
find_package(Qt6 COMPONENTS Widgets Network PrintSupport CONFIG REQUIRED) find_package(Qt6 COMPONENTS Widgets Network PrintSupport CONFIG REQUIRED)
#find_package(Qt5Widgets CONFIG REQUIRED)
#find_package(Qt5PrintSupport CONFIG REQUIRED)
# For SingleApplication: # For SingleApplication:
#find_package(Qt5Network CONFIG REQUIRED) set(QT_DEFAULT_MAJOR_VERSION 6 CACHE STRING "Qt version to use, defaults to 6")
set(QAPPLICATION_CLASS QApplication) set(QAPPLICATION_CLASS QApplication CACHE STRING "Inheritance class for SingleApplication")
FetchContent_Declare(
SingleApplication
GIT_REPOSITORY https://github.com/itay-grudev/SingleApplication
GIT_TAG v3.5.2
)
FetchContent_MakeAvailable(SingleApplication)
add_compile_definitions(QAPPLICATION_CLASS=${QAPPLICATION_CLASS}) add_compile_definitions(QAPPLICATION_CLASS=${QAPPLICATION_CLASS})
set(GUI_SOURCES add_executable(kima2)
target_sources(kima2 PRIVATE
kima2.cpp kima2.cpp
mainwindow.cpp mainwindow.cpp
mainwindow.ui mainwindow.ui
@ -34,15 +40,12 @@ set(GUI_SOURCES
settingsdialog.cpp settingsdialog.cpp
settingsdialog.ui settingsdialog.ui
../../kima2.qrc ../../kima2.qrc
${PROJECT_SOURCE_DIR}/subprojects/singleapplication/singleapplication.git/singleapplication.cpp kima2.rc
${PROJECT_SOURCE_DIR}/subprojects/singleapplication/singleapplication.git/singleapplication_p.cpp
) )
add_executable(kima2 ${GUI_SOURCES} kima2.rc)
target_include_directories(kima2 PRIVATE ${PROJECT_BINARY_DIR}) target_include_directories(kima2 PRIVATE ${PROJECT_BINARY_DIR})
target_include_directories(kima2 PRIVATE ${PROJECT_SOURCE_DIR}/subprojects/singleapplication/singleapplication.git)
# target_link_libraries(kima2 core printer Qt5::Widgets Qt5::PrintSupport Qt5::Network stdc++fs) target_link_libraries(kima2 core printer Qt::Core Qt::PrintSupport Qt::Network SingleApplication::SingleApplication)
target_link_libraries(kima2 core printer Qt::Core Qt::PrintSupport Qt::Network)
if(WIN32) if(WIN32)
set_target_properties(kima2 PROPERTIES LINK_FLAGS "-mwindows") set_target_properties(kima2 PROPERTIES LINK_FLAGS "-mwindows")

View file

@ -13,9 +13,11 @@
#include <singleapplication.h> #include <singleapplication.h>
#include <stdexcept> #include <stdexcept>
using namespace Qt::Literals::StringLiterals;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
SingleApplication kimaApp(argc, argv); SingleApplication kimaApp(argc, argv, false, SingleApplication::Mode::User | SingleApplication::ExcludeAppPath | SingleApplication::ExcludeAppVersion);
// QCoreApplication::setOrganizationName("RustySoft"); // QCoreApplication::setOrganizationName("RustySoft");
QCoreApplication::setOrganizationDomain("rustysoft.de"); QCoreApplication::setOrganizationDomain("rustysoft.de");
@ -23,7 +25,7 @@ int main(int argc, char *argv[])
QTranslator qtTranslator; QTranslator qtTranslator;
if (qtTranslator.load(QLocale::system(), u"qtbase"_qs, u"_"_qs, if (qtTranslator.load(QLocale::system(), u"qtbase"_s, u"_"_s,
QLibraryInfo::path(QLibraryInfo::TranslationsPath))) { QLibraryInfo::path(QLibraryInfo::TranslationsPath))) {
kimaApp.installTranslator(&qtTranslator); kimaApp.installTranslator(&qtTranslator);
} }

View file

@ -105,7 +105,7 @@ MainWindow::MainWindow()
}); });
connect(m_ui.licenseAction, &QAction::triggered, this, [this]() { connect(m_ui.licenseAction, &QAction::triggered, this, [this]() {
QString licenseText( QString licenseText(
"Copyright © 2018-2023 Martin Brodbeck\n\n" "Copyright © 2018-2025 Martin Brodbeck\n\n"
"Hiermit wird unentgeltlich jeder Person, die eine Kopie der Software und der " "Hiermit wird unentgeltlich jeder Person, die eine Kopie der Software und der "
"zugehörigen Dokumentationen (die \"Software\") erhält, die Erlaubnis erteilt, " "zugehörigen Dokumentationen (die \"Software\") erhält, die Erlaubnis erteilt, "
"sie uneingeschränkt zu nutzen, inklusive und ohne Ausnahme mit dem Recht, " "sie uneingeschränkt zu nutzen, inklusive und ohne Ausnahme mit dem Recht, "
@ -504,12 +504,13 @@ void MainWindow::onImportSalesJsonActionTriggered()
{ {
QSettings settings; QSettings settings;
auto filename = QFileDialog::getOpenFileName(this, "Umsätze/Transaktionen importieren", auto filenames = QFileDialog::getOpenFileNames(this, "Umsätze/Transaktionen importieren",
QString(), "JSON Dateien (*.json)"); QString(), "JSON Dateien (*.json)");
if (filename.isEmpty()) if (filenames.isEmpty())
return; return;
for(auto filename: filenames) {
#if defined(_WIN64) || defined(_WIN32) #if defined(_WIN64) || defined(_WIN32)
fs::path filePath(filename.toStdWString()); fs::path filePath(filename.toStdWString());
#else #else
@ -525,6 +526,8 @@ void MainWindow::onImportSalesJsonActionTriggered()
this) this)
.exec(); .exec();
} }
}
setSaleModel(); setSaleModel();
updateStatLabel(); updateStatLabel();
} }

View file

@ -1,23 +0,0 @@
qt5 = import('qt5')
qt5_dep = dependency('qt5', modules: ['Core', 'Gui', 'PrintSupport', 'Network'])
thread_dep = dependency('threads')
src = ['kima2.cpp', 'mainwindow.cpp', 'sellerdialog.cpp', 'sellermodel.cpp',
'pricedialog.cpp', 'basketmodel.cpp', 'salemodel.cpp', 'reportdialog.cpp',
'reportmodel.cpp', 'settingsdialog.cpp']
ui = ['mainwindow.ui', 'sellerdialog.ui', 'pricedialog.ui', 'reportdialog.ui', 'settingsdialog.ui']
processed = qt5.preprocess(moc_headers : ['basketmodel.h', 'mainwindow.h', 'pricedialog.h',
'reportdialog.h', 'sellerdialog.h', 'settingsdialog.h',
'sellermodel.h', 'salemodel.h'],
ui_files : ui,
qresources : '../../kima2.qrc',
dependencies: qt5_dep)
kima2 = executable('kima2', sources : [src, processed],
dependencies : [qt5_dep, singleapp_dep, core_dep, printer_dep, thread_dep],
include_directories : [configuration_inc],
install : true)

View file

@ -201,7 +201,7 @@ void ReportDialog::onPrintSellerReceiptButtonClicked()
return; return;
auto indexes = selModel->selectedRows(); auto indexes = selModel->selectedRows();
auto &seller = m_market->getSellers().at(indexes[0].row()); std::ranges::sort(indexes);
auto printerDevice = auto printerDevice =
convertToPosPrinterDevice(posPrinterDevice.toStdString(), posPrinterEndpoint.toStdString()); convertToPosPrinterDevice(posPrinterDevice.toStdString(), posPrinterEndpoint.toStdString());
@ -214,10 +214,14 @@ void ReportDialog::onPrintSellerReceiptButtonClicked()
printer = std::make_unique<PosPrinter>(); printer = std::make_unique<PosPrinter>();
} }
if (printer->isValid()) if (printer->isValid()) {
for (const auto &index : indexes) {
auto &seller = m_market->getSellers().at(index.row());
printer->printSellerReceipt( printer->printSellerReceipt(
seller.get(), feeInPercent, maxFeeInEuro * 100, seller.get(), feeInPercent, maxFeeInEuro * 100,
settings.value("global/commune", "Dettingen").toString().toStdString()); settings.value("global/commune", "Dettingen").toString().toStdString());
}
}
} }
void ReportDialog::onReportViewSelectionChanged(const QItemSelection &selected, void ReportDialog::onReportViewSelectionChanged(const QItemSelection &selected,

View file

@ -19,7 +19,7 @@
<item> <item>
<widget class="QTableView" name="reportView"> <widget class="QTableView" name="reportView">
<property name="selectionMode"> <property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum> <enum>QAbstractItemView::ExtendedSelection</enum>
</property> </property>
<property name="selectionBehavior"> <property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum> <enum>QAbstractItemView::SelectRows</enum>

View file

@ -1,3 +0,0 @@
subdir('core')
subdir('printer')
subdir('gui')

View file

@ -1,6 +1,6 @@
set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.62 REQUIRED) find_package(Boost 1.78 REQUIRED)
if(WIN32) if(WIN32)
find_package(LIBUSB REQUIRED) find_package(LIBUSB REQUIRED)
@ -9,15 +9,15 @@ else()
pkg_check_modules(LibUSB REQUIRED libusb-1.0) pkg_check_modules(LibUSB REQUIRED libusb-1.0)
endif() endif()
set(PRINTER_SOURCES add_library(printer STATIC)
target_sources(printer PRIVATE
posprinter.cpp posprinter.cpp
utils.cpp utils.cpp
) )
add_library(printer STATIC ${PRINTER_SOURCES})
if(WIN32) if(WIN32)
target_link_libraries(printer core ${LIBUSB_1_LIBRARIES}) target_link_libraries(printer core ${LIBUSB_1_LIBRARIES})
else() else()
target_link_libraries(printer core ${LibUSB_LIBRARIES}) target_link_libraries(printer core ${LibUSB_LIBRARIES})
endif() endif()
target_include_directories(printer PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..) target_include_directories(printer PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/.. ${Boost_INCLUDE_DIRS})

View file

@ -1,9 +0,0 @@
libusb = dependency('libusb-1.0')
src = ['posprinter.cpp', 'utils.cpp']
printer_inc = include_directories('..')
printer_lib = static_library('printer', src, dependencies: [libusb, core_dep])
printer_dep = declare_dependency(link_with : printer_lib, include_directories : printer_inc)

View file

@ -19,6 +19,8 @@ const std::string PosPrinter::Command::RIGHT_ALIGN = {0x1b, 0x61, 0x02};
const std::string PosPrinter::Command::FONT_SIZE_BIG = {0x1b, 0x21, 0x10}; const std::string PosPrinter::Command::FONT_SIZE_BIG = {0x1b, 0x21, 0x10};
const std::string PosPrinter::Command::FONT_SIZE_NORMAL = {0x1b, 0x21, 0x00}; const std::string PosPrinter::Command::FONT_SIZE_NORMAL = {0x1b, 0x21, 0x00};
const std::string PosPrinter::Command::FEED = {0x1b, 0x64, 0x03}; const std::string PosPrinter::Command::FEED = {0x1b, 0x64, 0x03};
const std::string PosPrinter::Command::PARTIAL_CUT = {0x1b, 0x69};
const std::string PosPrinter::Command::FULL_CUT = {0x1b, 0x6d};
PosPrinter::PosPrinter() : PosPrinter(PrinterDevice()) {} PosPrinter::PosPrinter() : PosPrinter(PrinterDevice()) {}
@ -202,7 +204,7 @@ void PosPrinter::printSellerReceipt(Seller* seller, const int percent, const int
<< marketFeeAsString(seller->sumInCents(), percent, maxFeeInCent) << "\n"; << marketFeeAsString(seller->sumInCents(), percent, maxFeeInCent) << "\n";
commandStream << "\nAuszahlung............. " commandStream << "\nAuszahlung............. "
<< paymentAsString(seller->sumInCents(), percent, maxFeeInCent) << "\n"; << paymentAsString(seller->sumInCents(), percent, maxFeeInCent) << "\n";
commandStream << Command::FEED; commandStream << Command::FEED << Command::FEED;
write(commandStream.str()); write(commandStream.str());
} }

View file

@ -49,6 +49,8 @@ class PosPrinter
static const std::string FONT_SIZE_BIG; static const std::string FONT_SIZE_BIG;
static const std::string FONT_SIZE_NORMAL; static const std::string FONT_SIZE_NORMAL;
static const std::string FEED; static const std::string FEED;
static const std::string PARTIAL_CUT;
static const std::string FULL_CUT;
}; };
private: private:

View file

@ -1,5 +0,0 @@
if(NOT KIMA2_USE_EXTERNAL_JSON)
set(JSON_BuildTests OFF CACHE INTERNAL "")
add_subdirectory(nlohmann_json EXCLUDE_FROM_ALL)
endif()
#add_subdirectory(csv-parser)

@ -1 +0,0 @@
Subproject commit bc889afb4c5bf1c0d8ee29ef35eaaf4c8bef8a5d

View file

@ -1,27 +0,0 @@
project('singleapplication')
qt5 = import('qt5')
dep_qt5 = dependency('qt5', modules: ['Core', 'Widgets', 'Network'])
singleapp_inc = include_directories('singleapplication.git')
singleapp_moc = qt5.preprocess(
moc_headers: ['singleapplication.git/singleapplication.h', 'singleapplication.git/singleapplication_p.h'],
moc_extra_arguments: ['-DQAPPLICATION_CLASS=QApplication'],
dependencies: dep_qt5
)
singleapp_lib = static_library('SingleApplication',
['singleapplication.git/singleapplication.cpp', 'singleapplication.git/singleapplication_p.cpp', singleapp_moc],
include_directories: singleapp_inc,
cpp_args : '-DQAPPLICATION_CLASS=QApplication',
dependencies: dep_qt5
)
singleapp_dep = declare_dependency(
include_directories: singleapp_inc,
link_with: singleapp_lib
)
# On windows, SingleApplication needs to be linked against advapi32. This is
# done by adding 'advapi32' to cpp_winlibs, where it should be by default.

@ -1 +0,0 @@
Subproject commit a3ed916f591c300e97b873fde36863fa37b49fa9