From 98be94f33b87470a7dbeac81a34ff14dedce6ae2 Mon Sep 17 00:00:00 2001 From: Siegfried Siegert Date: Tue, 24 Nov 2026 15:14:38 +0100 Subject: [PATCH] test add compact format --- library/library.pro | 10 ++++++++++ library/src/calculate_price.cpp | 35 ++++++++++++++++++++++----------- main/aes128.cpp | 0 main/aes128.h | 0 main/cc_iuc_asynchpos.cpp | 0 5 files changed, 33 insertions(+), 12 deletions(-) mode change 100755 => 100644 main/aes128.cpp mode change 100755 => 100644 main/aes128.h mode change 100755 => 100644 main/cc_iuc_asynchpos.cpp diff --git a/library/library.pro b/library/library.pro index 2f7001c..6bbb182 100644 --- a/library/library.pro +++ b/library/library.pro @@ -28,6 +28,13 @@ CONFIG(debug, debug|release) { } } +contains(CONFIG, DesktopLinux) { + DEFINES += DESKTOP_LINUX + + CONFIG -= c++11 c++14 + CONFIG += c++17 +} + SOURCES += \ src/calculator_functions.cpp \ src/utilities.cpp \ @@ -104,3 +111,6 @@ OTHER_FILES += src/main.cpp \ qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target + +SOURCES += src/compact_api.cpp +HEADERS += include/mobilisis/compact_api.h include/mobilisis/compact_engine.h include/mobilisis/compact_tariff.h include/mobilisis/compact_calendar.h diff --git a/library/src/calculate_price.cpp b/library/src/calculate_price.cpp index cdb5a98..27b5345 100644 --- a/library/src/calculate_price.cpp +++ b/library/src/calculate_price.cpp @@ -7,6 +7,7 @@ #include "period_year.h" #include "tariff_permit_type.h" +#include #include #include #include @@ -446,19 +447,29 @@ int CALCULATE_LIBRARY_API get_maximal_parkingprice(Configuration *cfg, int CALCULATE_LIBRARY_API get_zone_nr(int zone) { - if(zone > -1) return zone; - else - { - QFile zone("/mnt/system_data/zone_nr"); - if (zone.exists()) { - QFileInfo finfo(zone); - if (zone.open(QIODevice::ReadOnly | QIODevice::Text)) { - QTextStream in(&zone); - return in.readLine(100).toInt(); - } - } - return -1; + if (zone > -1) + return zone; + +#ifdef DESKTOP_LINUX + QString zonePath = QDir::homePath() + "/atbapp/zone_nr"; +#else + QString zonePath = "/mnt/system_data/zone_nr"; +#endif + + QFile zoneFile(zonePath); + + if (zoneFile.open(QIODevice::ReadOnly | QIODevice::Text)) { + QTextStream in(&zoneFile); + + bool ok = false; + int zoneNr = in.readLine(100).trimmed().toInt(&ok); + + if (ok) + return zoneNr; } + + qWarning() << "Failed to read zone number from:" << zonePath; + return -1; } CalcState CALCULATE_LIBRARY_API init_tariff(parking_tariff_t **tariff, char const *config_file) { diff --git a/main/aes128.cpp b/main/aes128.cpp old mode 100755 new mode 100644 diff --git a/main/aes128.h b/main/aes128.h old mode 100755 new mode 100644 diff --git a/main/cc_iuc_asynchpos.cpp b/main/cc_iuc_asynchpos.cpp old mode 100755 new mode 100644