Compare commits
17 commits
Author | SHA1 | Date | |
---|---|---|---|
9affcfdbcb | |||
5c0c55108e | |||
c01f714335 | |||
27f36b4aa8 | |||
980f60c003 | |||
d6b3606bd6 | |||
8abb60c5db | |||
d73afbf22e | |||
da038ca875 | |||
843d894dd2 | |||
cb461f52ab | |||
c3fd8eb2dd | |||
50c0f72c95 | |||
4a2a4f92b4 | |||
95eb6b54f2 | |||
30c34f4674 | |||
b30b44fa40 |
22 changed files with 56 additions and 173 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
|
||||
|
|
6
.gitmodules
vendored
6
.gitmodules
vendored
|
@ -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
|
|
@ -1,13 +1,14 @@
|
|||
cmake_minimum_required(VERSION 3.10)
|
||||
cmake_minimum_required(VERSION 3.30)
|
||||
|
||||
project(kima2 VERSION 1.9.0)
|
||||
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)
|
||||
|
@ -29,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)
|
||||
|
|
2
LICENSE
2
LICENSE
|
@ -1,4 +1,4 @@
|
|||
Copyright © 2018-2024 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,
|
||||
|
|
33
meson.build
33
meson.build
|
@ -1,33 +0,0 @@
|
|||
project('kima2', 'cpp', default_options : ['cpp_std=c++20'], version : '1.8.0')
|
||||
|
||||
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
|
||||
|
|
@ -3,11 +3,12 @@ set(Boost_USE_STATIC_LIBS ON)
|
|||
find_package(Boost 1.78 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
|
||||
entity.cpp
|
||||
entityint.cpp
|
||||
|
@ -21,9 +22,6 @@ 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)
|
||||
target_link_libraries(core PRIVATE bcrypt)
|
||||
|
|
|
@ -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)
|
|
@ -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)
|
||||
|
||||
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,6 +13,8 @@
|
|||
#include <singleapplication.h>
|
||||
#include <stdexcept>
|
||||
|
||||
using namespace Qt::Literals::StringLiterals;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SingleApplication kimaApp(argc, argv, false, SingleApplication::Mode::User | SingleApplication::ExcludeAppPath | SingleApplication::ExcludeAppVersion);
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ MainWindow::MainWindow()
|
|||
});
|
||||
connect(m_ui.licenseAction, &QAction::triggered, this, [this]() {
|
||||
QString licenseText(
|
||||
"Copyright © 2018-2024 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, "
|
||||
|
|
|
@ -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,6 +201,7 @@ void ReportDialog::onPrintSellerReceiptButtonClicked()
|
|||
return;
|
||||
|
||||
auto indexes = selModel->selectedRows();
|
||||
std::ranges::sort(indexes);
|
||||
|
||||
auto printerDevice =
|
||||
convertToPosPrinterDevice(posPrinterDevice.toStdString(), posPrinterEndpoint.toStdString());
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<item>
|
||||
<widget class="QTableView" name="reportView">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::MultiSelection</enum>
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
subdir('core')
|
||||
subdir('printer')
|
||||
subdir('gui')
|
|
@ -9,12 +9,12 @@ 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()
|
||||
|
|
|
@ -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()) {}
|
||||
|
||||
|
|
|
@ -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 9cca280a4d0ccf0c08f47a99aa71d1b0e52f8d03
|
|
@ -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 8c48163c4d3fbba603cfe8a5b94046c9dad71825
|
Loading…
Add table
Reference in a new issue