Compare commits

...

56 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
6f885dd64e more on metainfo 2023-04-28 10:29:39 +02:00
1a698a6cd2 metainfo added 2023-04-28 10:12:10 +02:00
ac9ae8b34e Add metainfo 2023-04-28 10:08:02 +02:00
4385624988 Merge branch 'master' of ssh://git.rustysoft.de/martin/kima2 2023-04-26 12:47:45 +02:00
4cfd8d5572 2022 → 2023 2023-04-26 12:47:41 +02:00
528ae1ff31 use QUrl::fromLocalFile 2023-04-26 12:46:35 +02:00
649c26db4b Updated for Windows installation 2023-04-26 08:53:13 +02:00
13a1d26d96 description updated 2023-04-26 08:36:03 +02:00
f898844c7c remove obsolete lstdc++fs flag 2023-04-25 16:19:27 +02:00
e6b71a7e4d Get rid of csv-parser 2023-04-25 16:11:34 +02:00
f4b4ccbbea Revert "Remove fmt dependency"
This reverts commit 8efdf7b6fe.
2023-04-25 15:22:06 +02:00
e79a81797c Increase version number 2023-04-21 21:35:46 +02:00
8efdf7b6fe Remove fmt dependency 2023-04-21 21:33:59 +02:00
a46e8d89c9 remove xlnt stuff 2023-01-18 19:41:53 +01:00
3e293ba447 updated 2023-01-18 17:08:09 +01:00
35 changed files with 203 additions and 250 deletions

View file

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

9
.gitmodules vendored
View file

@ -1,9 +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
[submodule "subprojects/csv-parser"]
path = subprojects/csv-parser
url = https://github.com/vincentlaucsb/csv-parser.git

32
.vscode/settings.json vendored
View file

@ -65,7 +65,37 @@
"condition_variable": "cpp",
"mutex": "cpp",
"hash_map": "cpp",
"future": "cpp"
"future": "cpp",
"bit": "cpp",
"compare": "cpp",
"concepts": "cpp",
"forward_list": "cpp",
"map": "cpp",
"set": "cpp",
"string": "cpp",
"unordered_set": "cpp",
"iterator": "cpp",
"memory_resource": "cpp",
"random": "cpp",
"semaphore": "cpp",
"stop_token": "cpp",
"__bit_reference": "cpp",
"__bits": "cpp",
"__config": "cpp",
"__debug": "cpp",
"__errc": "cpp",
"__hash_table": "cpp",
"__locale": "cpp",
"__mutex_base": "cpp",
"__node_handle": "cpp",
"__split_buffer": "cpp",
"__threading_support": "cpp",
"__tree": "cpp",
"__tuple": "cpp",
"__verbose_abort": "cpp",
"format": "cpp",
"ios": "cpp",
"locale": "cpp"
},
"C_Cpp.clang_format_path": "/usr/bin/clang-format",
"cmake.configureOnOpen": true,

View file

@ -1,13 +1,14 @@
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.30)
project(kima2 VERSION 1.7.1)
project(kima2 VERSION 1.9.2)
set(CMAKE_MODULE_PATH "${CMAKE_HOME_DIRECTORY}/cmake")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#include(InstallRequiredSystemLibraries)
# For SingleApplication and nlohmann_json
include(FetchContent)
if(MSVC)
add_compile_options(/W4 /WX)
@ -17,6 +18,7 @@ else()
endif()
configure_file(config.h.in ${PROJECT_BINARY_DIR}/config.h)
configure_file(de.rustysoft.kima2.metainfo.xml.in ${PROJECT_BINARY_DIR}/de.rustysoft.kima2.metainfo.xml)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
@ -28,7 +30,6 @@ if(KIMA2_USE_EXTERNAL_JSON)
find_package(nlohmann_json REQUIRED)
endif()
add_subdirectory(subprojects)
add_subdirectory(src)
#if(NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE MATCHES Debug)
@ -79,6 +80,8 @@ else(WIN32 AND NOT UNIX)
DESTINATION share/${PROJECT_NAME})
install(FILES "${CMAKE_SOURCE_DIR}/misc/kima2.svg"
DESTINATION share/icons/hicolor/scalable/apps)
install(FILES de.rustysoft.kima2.metainfo.xml
DESTINATION share/metainfo)
endif (WIN32 AND NOT UNIX)
if( MINGW )
@ -95,9 +98,9 @@ if( MINGW )
${MINGW_PATH}/libwinpthread-1.dll
${MINGW_PATH}/libsqlite3-0.dll
${MINGW_PATH}/libusb-1.0.dll
${MINGW_PATH}/libicuuc71.dll
${MINGW_PATH}/libicuin71.dll
${MINGW_PATH}/libicudt71.dll
${MINGW_PATH}/libicuuc76.dll
${MINGW_PATH}/libicuin76.dll
${MINGW_PATH}/libicudt76.dll
${MINGW_PATH}/libpcre2-16-0.dll
${MINGW_PATH}/libpcre2-8-0.dll
${MINGW_PATH}/zlib1.dll
@ -108,13 +111,12 @@ if( MINGW )
${MINGW_PATH}/libgraphite2.dll
${MINGW_PATH}/libbz2-1.dll
${MINGW_PATH}/libintl-8.dll
${MINGW_PATH}/libpcre-1.dll
${MINGW_PATH}/libdouble-conversion.dll
${MINGW_PATH}/libzstd.dll
${MINGW_PATH}/libmd4c.dll
${MINGW_PATH}/libbrotlicommon.dll
${MINGW_PATH}/libbrotlidec.dll
${MINGW_PATH}/libfmt.dll
#${MINGW_PATH}/libfmt.dll
${MINGW_PATH}/libb2-1.dll
${MINGW_PATH}/libiconv-2.dll)
install(FILES ${MINGW_PATH}/../share/qt6/plugins/platforms/qwindows.dll
@ -122,14 +124,13 @@ if( MINGW )
DESTINATION bin/platforms)
#install(FILES ${MINGW_PATH}/../share/qt6/plugins/printsupport/windowsprintersupport.dll
# DESTINATION bin/printsupport)
install(FILES ${MINGW_PATH}/../share/qt5/translations/qtbase_de.qm
install(FILES ${MINGW_PATH}/../share/qt6/translations/qtbase_de.qm
${MINGW_PATH}/../share/qt6/translations/qt_de.qm
${MINGW_PATH}/../share/qt6/translations/qt_help_de.qm
${MINGW_PATH}/../share/qt6/translations/qtmultimedia_de.qm
#${MINGW_PATH}/../share/qt6/translations/qtquickcontrols_de.qm
#${MINGW_PATH}/../share/qt6/translations/qtscript_de.qm
#${MINGW_PATH}/../share/qt6/translations/qtxmlpatterns_de.qm
DESTINATION bin/translations)
DESTINATION bin/share/qt6/translations)
install(FILES ${MINGW_PATH}/../share/qt6/plugins/styles/qmodernwindowsstyle.dll
DESTINATION bin/styles)
endif( MINGW )
include(InstallRequiredSystemLibraries)

View file

@ -1,4 +1,4 @@
Copyright © 2018-2022 Martin Brodbeck
Copyright © 2018-2025 Martin Brodbeck
Hiermit wird unentgeltlich jeder Person, die eine Kopie der Software und der
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.
## Installation
Auf [rustysoft.de](https://www.rustysoft.de/software/kima2/) werden verschiedene Installationspakete (Arch Linux,
Ubuntu, Windows) angeboten. Bitte die Hinweise dort beachten.
Auf [rustysoft.de](https://www.rustysoft.de/software/kima2/) werden die Installationsmöglichkeiten (Flatpak, Windows-Installer) erläutert. Bitte die Hinweise dort beachten.
### Selbst compilieren
## Selbst compilieren
KIMA2 benötigt folgende Libraries:
* Qt 6
* boost >= 1.62
* boost >= 1.80
* libusb-1.0
* xlnt >= 1.5.0
* 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
GCC 12 verwendet werden.
Da Features aus C++20 sowie von neueren Compilern verwendet werden, sollte als Compiler mindestens GCC 14 verwendet werden.
Die Installationsschritte unter Linux sind wie folgt:
```

View file

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>de.rustysoft.kima2</id>
<name>KIMA2</name>
<summary>A small cash point program for childrens stuff markets</summary>
<metadata_license>MIT</metadata_license>
<project_license>GPL-3.0-or-later</project_license>
<releases>
<release version="@PROJECT_VERSION@" type="stable" date="2024-01-23" />
</releases>
<description>
<p>
A small cash point program for children's stuff markets. German language only.
</p>
</description>
<launchable type="desktop-id">de.rustysoft.kima2.desktop</launchable>
<screenshots>
<screenshot type="default">
<image>https://rustysoft.de/images/software/kima2/screenshot.png</image>
</screenshot>
</screenshots>
</component>

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,6 +1,6 @@
# Maintainer: Martin Brodbeck <martin at brodbeck-online dot de>
pkgname=kima2
pkgver=1.7.0
pkgver=1.7.1
pkgrel=1
pkgdesc="A small cash point program for children's things markets (German only)"
arch=('i686' 'x86_64')

View file

@ -3,8 +3,8 @@ Type=Application
Name=KIMA2
GenericName=Cash Point Program
GenericName[de]=Kassenprogramm
Comment=A small cash point program
Comment[de]=Ein kleines Kassenprogramm
Comment=A small cash point program for children's stuff markets
Comment[de]=Ein kleines Kassenprogramm für Kindersachenmärkte
Exec=kima2
Icon=kima2
Categories=Office;

View file

@ -1,15 +1,14 @@
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.62 REQUIRED)
find_package(Boost 1.78 REQUIRED)
find_package(SQLite3 REQUIRED)
# Because csv-parser needs threads:
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
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
entity.cpp
entityint.cpp
@ -23,14 +22,11 @@ set(CORE_SOURCES
utils.cpp
)
add_library(core STATIC ${CORE_SOURCES})
target_include_directories(core PRIVATE ${PROJECT_SOURCE_DIR}/subprojects/csv-parser/single_include)
if (WIN32)
target_link_libraries(core PRIVATE sqlite3 nlohmann_json::nlohmann_json ${XLNT_LIBRARY} Threads::Threads fmt::fmt)
target_link_libraries(core PRIVATE sqlite3 nlohmann_json::nlohmann_json)
target_link_libraries(core PRIVATE bcrypt)
else()
target_link_libraries(core PRIVATE sqlite3 nlohmann_json::nlohmann_json ${XLNT_LIBRARIES} Threads::Threads fmt::fmt)
target_link_libraries(core PRIVATE sqlite3 nlohmann_json::nlohmann_json)
endif()
target_include_directories(core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..)

View file

@ -3,7 +3,8 @@
#include <fstream>
#include <csv.hpp>
// #include <csv.hpp>
#include <boost/algorithm/string.hpp>
#ifdef DELETE
#undef DELETE
@ -13,17 +14,16 @@ namespace fs = std::filesystem;
std::size_t CsvReader::readSellersFromFile(const fs::path &filePath, Marketplace *market)
{
csv::CSVFormat format;
format.delimiter(';');
#if defined(_WIN64) || defined(_WIN32)
// Windows: Somhow this is necessary in order to open file names with umlauts
auto wide = filePath.wstring();
std::string fileName(wide.begin(), wide.end());
csv::CSVReader csvReader(fileName, format);
std::ifstream infile(fileName);
#else
csv::CSVReader csvReader(filePath.string(), format);
// csv::CSVReader csvReader(filePath.string(), format);
std::ifstream infile(filePath.string());
#endif
for (auto &seller : market->getSellers()) {
@ -32,28 +32,35 @@ std::size_t CsvReader::readSellersFromFile(const fs::path &filePath, Marketplace
market->storeToDb(true);
for (csv::CSVRow &row : csvReader) {
if (!row[0].is_int()) {
std::string line;
while (getline(infile, line)) {
std::vector<std::string> strs;
boost::split(strs, line, boost::is_any_of(";"));
auto seller = std::make_unique<Seller>();
try {
int sellerNo = std::stoi(strs[0]);
seller->setSellerNo(sellerNo);
} catch (std::invalid_argument const &ex) {
continue;
}
auto seller = std::make_unique<Seller>();
seller->setSellerNo(row[0].get<int>());
if (row[1].is_int()) {
seller->setNumArticlesOffered(row[1].get<int>());
} else {
if (isNumber(strs[1]))
seller->setNumArticlesOffered(std::stoi(strs[1]));
else
seller->setNumArticlesOffered(0);
}
// If both, first name and last name, are empty, use N. N.
// Else, use the real values.
if (row[2].get<std::string>().empty() && row[3].get<std::string>().empty()) {
if (strs[2].empty() && strs[2].empty()) {
seller->setFirstName("N.");
seller->setLastName("N.");
} else {
std::string firstName = row[2].get<std::string>();
std::string firstName = strs[2];
seller->setFirstName(trim(firstName));
std::string lastName = row[3].get<std::string>();
std::string lastName = strs[3];
seller->setLastName(trim(lastName));
}

View file

@ -2,7 +2,7 @@
#include <chrono>
#include <filesystem>
#include <fmt/chrono.h>
#include <format>
#include <iostream>
#include <stdexcept>
#include <vector>
@ -47,7 +47,7 @@ void Database::newDb()
fs::path destPath = sourcePath.parent_path() / sourcePath.stem();
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";

View file

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

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 <clocale>
#include <fmt/format.h>
#include <format>
#include <iomanip>
#include <numeric>
#include <iostream>
using namespace fmt;
//using namespace fmt;
std::string formatCentAsEuroString(const int cent, int width)
{
@ -32,7 +32,7 @@ std::string formatCentAsEuroString(const int cent, int width)
#else
std::locale myLocale{"de_DE.utf8"};
#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)
@ -61,3 +61,10 @@ bool case_insensitive_match(std::string s1, std::string s2)
return true; // The strings are same
return false; // not matched
}
bool isNumber(const std::string &str)
{
return !str.empty() && std::find_if(str.begin(), str.end(), [](unsigned char c) {
return !std::isdigit(c);
}) == str.end();
}

View file

@ -10,5 +10,6 @@ std::string &ltrim(std::string &str, const std::string &chars = "\t\n\v\f\r ");
std::string &rtrim(std::string &str, const std::string &chars = "\t\n\v\f\r ");
std::string &trim(std::string &str, const std::string &chars = "\t\n\v\f\r ");
bool case_insensitive_match(std::string s1, std::string s2);
bool isNumber(const std::string &str);
#endif

View file

@ -9,40 +9,43 @@ set(CMAKE_AUTORCC ON)
# Find the QtWidgets library
find_package(Qt6 COMPONENTS Widgets Network PrintSupport CONFIG REQUIRED)
#find_package(Qt5Widgets CONFIG REQUIRED)
#find_package(Qt5PrintSupport CONFIG REQUIRED)
# For SingleApplication:
#find_package(Qt5Network CONFIG REQUIRED)
set(QAPPLICATION_CLASS QApplication)
set(QT_DEFAULT_MAJOR_VERSION 6 CACHE STRING "Qt version to use, defaults to 6")
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})
set(GUI_SOURCES
kima2.cpp
mainwindow.cpp
mainwindow.ui
sellerdialog.cpp
sellerdialog.ui
sellermodel.cpp
pricedialog.cpp
pricedialog.ui
basketmodel.cpp
salemodel.cpp
reportdialog.cpp
reportdialog.ui
reportmodel.cpp
settingsdialog.cpp
settingsdialog.ui
../../kima2.qrc
${PROJECT_SOURCE_DIR}/subprojects/singleapplication/singleapplication.git/singleapplication.cpp
${PROJECT_SOURCE_DIR}/subprojects/singleapplication/singleapplication.git/singleapplication_p.cpp
add_executable(kima2)
target_sources(kima2 PRIVATE
kima2.cpp
mainwindow.cpp
mainwindow.ui
sellerdialog.cpp
sellerdialog.ui
sellermodel.cpp
pricedialog.cpp
pricedialog.ui
basketmodel.cpp
salemodel.cpp
reportdialog.cpp
reportdialog.ui
reportmodel.cpp
settingsdialog.cpp
settingsdialog.ui
../../kima2.qrc
kima2.rc
)
add_executable(kima2 ${GUI_SOURCES} kima2.rc)
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 stdc++fs)
target_link_libraries(kima2 core printer Qt::Core Qt::PrintSupport Qt::Network SingleApplication::SingleApplication)
if(WIN32)
set_target_properties(kima2 PROPERTIES LINK_FLAGS "-mwindows")

View file

@ -13,9 +13,11 @@
#include <singleapplication.h>
#include <stdexcept>
using namespace Qt::Literals::StringLiterals;
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::setOrganizationDomain("rustysoft.de");
@ -23,7 +25,7 @@ int main(int argc, char *argv[])
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))) {
kimaApp.installTranslator(&qtTranslator);
}

View file

@ -99,14 +99,13 @@ MainWindow::MainWindow()
for (auto location : locations) {
if (QFile::exists(location + QString("/Benutzerhandbuch.pdf"))) {
QDesktopServices::openUrl(
QUrl(QString("file:///") + location + QString("/Benutzerhandbuch.pdf"),
QUrl::TolerantMode));
QUrl::fromLocalFile(location + QString("/Benutzerhandbuch.pdf")));
}
}
});
connect(m_ui.licenseAction, &QAction::triggered, this, [this]() {
QString licenseText(
"Copyright © 2018-2022 Martin Brodbeck\n\n"
"Copyright © 2018-2025 Martin Brodbeck\n\n"
"Hiermit wird unentgeltlich jeder Person, die eine Kopie der Software und der "
"zugehörigen Dokumentationen (die \"Software\") erhält, die Erlaubnis erteilt, "
"sie uneingeschränkt zu nutzen, inklusive und ohne Ausnahme mit dem Recht, "
@ -505,27 +504,30 @@ void MainWindow::onImportSalesJsonActionTriggered()
{
QSettings settings;
auto filename = QFileDialog::getOpenFileName(this, "Umsätze/Transaktionen importieren",
auto filenames = QFileDialog::getOpenFileNames(this, "Umsätze/Transaktionen importieren",
QString(), "JSON Dateien (*.json)");
if (filename.isEmpty())
if (filenames.isEmpty())
return;
for(auto filename: filenames) {
#if defined(_WIN64) || defined(_WIN32)
fs::path filePath(filename.toStdWString());
fs::path filePath(filename.toStdWString());
#else
fs::path filePath(filename.toStdString());
fs::path filePath(filename.toStdString());
#endif
delete m_ui.salesView->model();
try {
JsonUtil::importSales(filePath, m_marketplace.get(),
settings.value("global/cashPointNo").toInt());
} catch (std::runtime_error &err) {
QMessageBox(QMessageBox::Icon::Warning, "Import nicht möglich", err.what(), QMessageBox::Ok,
this)
.exec();
delete m_ui.salesView->model();
try {
JsonUtil::importSales(filePath, m_marketplace.get(),
settings.value("global/cashPointNo").toInt());
} catch (std::runtime_error &err) {
QMessageBox(QMessageBox::Icon::Warning, "Import nicht möglich", err.what(), QMessageBox::Ok,
this)
.exec();
}
}
setSaleModel();
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;
auto indexes = selModel->selectedRows();
auto &seller = m_market->getSellers().at(indexes[0].row());
std::ranges::sort(indexes);
auto printerDevice =
convertToPosPrinterDevice(posPrinterDevice.toStdString(), posPrinterEndpoint.toStdString());
@ -214,10 +214,14 @@ void ReportDialog::onPrintSellerReceiptButtonClicked()
printer = std::make_unique<PosPrinter>();
}
if (printer->isValid())
printer->printSellerReceipt(
seller.get(), feeInPercent, maxFeeInEuro * 100,
settings.value("global/commune", "Dettingen").toString().toStdString());
if (printer->isValid()) {
for (const auto &index : indexes) {
auto &seller = m_market->getSellers().at(index.row());
printer->printSellerReceipt(
seller.get(), feeInPercent, maxFeeInEuro * 100,
settings.value("global/commune", "Dettingen").toString().toStdString());
}
}
}
void ReportDialog::onReportViewSelectionChanged(const QItemSelection &selected,

View file

@ -19,7 +19,7 @@
<item>
<widget class="QTableView" name="reportView">
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="selectionBehavior">
<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)
find_package(Boost 1.62 REQUIRED)
find_package(Boost 1.78 REQUIRED)
if(WIN32)
find_package(LIBUSB REQUIRED)
@ -9,15 +9,15 @@ else()
pkg_check_modules(LibUSB REQUIRED libusb-1.0)
endif()
set(PRINTER_SOURCES
posprinter.cpp
utils.cpp
add_library(printer STATIC)
target_sources(printer PRIVATE
posprinter.cpp
utils.cpp
)
add_library(printer STATIC ${PRINTER_SOURCES})
if(WIN32)
target_link_libraries(printer core ${LIBUSB_1_LIBRARIES})
else()
target_link_libraries(printer core ${LibUSB_LIBRARIES})
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_NORMAL = {0x1b, 0x21, 0x00};
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()) {}
@ -202,7 +204,7 @@ void PosPrinter::printSellerReceipt(Seller* seller, const int percent, const int
<< marketFeeAsString(seller->sumInCents(), percent, maxFeeInCent) << "\n";
commandStream << "\nAuszahlung............. "
<< paymentAsString(seller->sumInCents(), percent, maxFeeInCent) << "\n";
commandStream << Command::FEED;
commandStream << Command::FEED << Command::FEED;
write(commandStream.str());
}

View file

@ -49,6 +49,8 @@ class PosPrinter
static const std::string FONT_SIZE_BIG;
static const std::string FONT_SIZE_NORMAL;
static const std::string FEED;
static const std::string PARTIAL_CUT;
static const std::string FULL_CUT;
};
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 ea547fdb16c7baf99bd9ced5febba52cc5da3ca3

@ -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