Compare commits
56 commits
Author | SHA1 | Date | |
---|---|---|---|
9affcfdbcb | |||
5c0c55108e | |||
c01f714335 | |||
27f36b4aa8 | |||
980f60c003 | |||
d6b3606bd6 | |||
8abb60c5db | |||
d73afbf22e | |||
da038ca875 | |||
843d894dd2 | |||
cb461f52ab | |||
c3fd8eb2dd | |||
50c0f72c95 | |||
4a2a4f92b4 | |||
95eb6b54f2 | |||
30c34f4674 | |||
b30b44fa40 | |||
02b4017b91 | |||
63712c8166 | |||
ebe80f6bbe | |||
98a9fe0069 | |||
8a5038e462 | |||
068a50e289 | |||
da89a0d2c7 | |||
429d66dd4d | |||
37c8446ea4 | |||
a896e0d40e | |||
3668e2484f | |||
52dc7f1974 | |||
ab7b14f12e | |||
0c7f071b9d | |||
d0c50c9b9a | |||
a17cb22e05 | |||
205dac5326 | |||
b0d2d6b284 | |||
7f11ba4e5d | |||
32d0ec7749 | |||
54e5c70447 | |||
379fd4a73c | |||
8a94b53379 | |||
d9b13d0e1a | |||
6f885dd64e | |||
1a698a6cd2 | |||
ac9ae8b34e | |||
4385624988 | |||
4cfd8d5572 | |||
528ae1ff31 | |||
649c26db4b | |||
13a1d26d96 | |||
f898844c7c | |||
e6b71a7e4d | |||
f4b4ccbbea | |||
e79a81797c | |||
8efdf7b6fe | |||
a46e8d89c9 | |||
3e293ba447 |
35 changed files with 203 additions and 250 deletions
|
@ -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
9
.gitmodules
vendored
|
@ -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
32
.vscode/settings.json
vendored
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
2
LICENSE
2
LICENSE
|
@ -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,
|
||||
|
|
12
README.md
12
README.md
|
@ -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:
|
||||
```
|
||||
|
|
27
de.rustysoft.kima2.metainfo.xml.in
Normal file
27
de.rustysoft.kima2.metainfo.xml.in
Normal 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 children’s 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.
33
meson.build
33
meson.build
|
@ -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
|
||||
|
|
@ -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')
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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}/..)
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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";
|
||||
|
||||
|
|
|
@ -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"]);
|
||||
|
|
|
@ -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)
|
|
@ -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 <rim(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();
|
||||
}
|
|
@ -10,5 +10,6 @@ std::string <rim(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
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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)
|
|
@ -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,
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
subdir('core')
|
||||
subdir('printer')
|
||||
subdir('gui')
|
|
@ -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})
|
||||
|
|
|
@ -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)
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue