diff --git a/application/CMakeLists.txt b/application/CMakeLists.txt index 0e7cca0..e2be31b 100644 --- a/application/CMakeLists.txt +++ b/application/CMakeLists.txt @@ -28,7 +28,9 @@ add_executable(prodejna logindialog.ui mainwindow.cpp mainwindow.h - mainwindow.ui) + mainwindow.ui + shop.rc + ) target_link_libraries(prodejna Qt::Core @@ -37,4 +39,9 @@ target_link_libraries(prodejna Qt::Sql Qt::Qml core - ) \ No newline at end of file + ) + + +if(CMAKE_BUILD_TYPE STREQUAL "Release") + set_property(TARGET prodejna PROPERTY WIN32_EXECUTABLE true) +endif() diff --git a/application/mainwindow.cpp b/application/mainwindow.cpp index 2abb963..2444cc8 100644 --- a/application/mainwindow.cpp +++ b/application/mainwindow.cpp @@ -256,5 +256,5 @@ void MainWindow::on_actionAbout_Qt_triggered() void MainWindow::on_actionAbout_triggered() { - QMessageBox::about(this, tr("About prodejna"), tr("Modular cash register software under GPL license.\n(C) 2015 - 2017 Josef Rokos, Zdenek Jonák")); + QMessageBox::about(this, tr("About prodejna"), tr("Modular cash register software under GPL license.\n(C) 2015 - 2023 Josef Rokos, Zdenek Jonák")); } diff --git a/application/mainwindow.ui b/application/mainwindow.ui index 1ed7db4..cfddf1a 100644 --- a/application/mainwindow.ui +++ b/application/mainwindow.ui @@ -117,9 +117,9 @@ - + - Prodejna 2.0 + Prodejna 3.0 Qt::AlignCenter @@ -137,7 +137,7 @@ 0 0 1000 - 42 + 21 diff --git a/camp/campservice.cpp b/camp/campservice.cpp index 39ebb08..ae72912 100644 --- a/camp/campservice.cpp +++ b/camp/campservice.cpp @@ -6,10 +6,6 @@ #include "campseller.h" #include -#ifdef _WIN32 -double round(double value) { return value < 0 ? -std::floor(0.5 - value) : std::floor(0.5 + value); } -#endif - CampService::CampService() { m_pluginId = "CAMP"; diff --git a/commodity/data/commoditydata.h b/commodity/data/commoditydata.h index 9d370cc..be5b5c7 100644 --- a/commodity/data/commoditydata.h +++ b/commodity/data/commoditydata.h @@ -11,7 +11,6 @@ #include "../commodity_global.h" -#pragma db object class CommodityData : public IShopItem { Q_OBJECT diff --git a/core/define.h b/core/define.h index efe6432..d44ab98 100644 --- a/core/define.h +++ b/core/define.h @@ -15,7 +15,11 @@ #ifndef PLUGIN_ROOT #ifdef _WIN32 - #define PLUGIN_ROOT "/../../plugins" + #ifdef QT_NO_DEBUG + #define PLUGIN_ROOT "/plugins" + #else + #define PLUGIN_ROOT "/../../plugins" + #endif #else #define PLUGIN_ROOT "/../plugins" #endif @@ -23,7 +27,11 @@ #ifndef REPORT_ROOT #ifdef _WIN32 - #define REPORT_ROOT "/../../reports" + #ifdef QT_NO_DEBUG + #define REPORT_ROOT "/reports" + #else + #define REPORT_ROOT "/../../reports" + #endif #else #define REPORT_ROOT "/../reports" #endif diff --git a/core/exprevaluator.cpp b/core/exprevaluator.cpp index a2c122e..36a61dc 100644 --- a/core/exprevaluator.cpp +++ b/core/exprevaluator.cpp @@ -1,21 +1,5 @@ #include "exprevaluator.h" -#ifdef _MSC_VER -ExprEvaluator::ExprEvaluator() -{ - m_operations["=="] = [](QVariant left, QVariant right) { return left == right; }; - m_operations["!="] = [](QVariant left, QVariant right) { return left != right; }; - m_operations["<"] = [](QVariant left, QVariant right) { return left < right; }; - m_operations["<="] = [](QVariant left, QVariant right) { return left <= right; }; - m_operations[">"] = [](QVariant left, QVariant right) { return left > right; }; - m_operations[">="] = [](QVariant left, QVariant right) { return left >= right; }; - m_operations["%"] = [](QVariant left, QVariant right) { return left.toString().contains(right.toString()); }; - - m_operations["||"] = [](QVariant left, QVariant right) { return left.toBool() || right.toBool(); }; - m_operations["&&"] = [](QVariant left, QVariant right) { return left.toBool() && right.toBool(); }; - m_caseSensitive = false; -} -#else const QMap > ExprEvaluator::m_operations = { { "==", [](QVariant left, QVariant right) { return left == right; }}, { "!=", [](QVariant left, QVariant right) { return left != right; }}, @@ -35,13 +19,6 @@ const QMap > ExprEvaluator::m_o { "&&", [](QVariant left, QVariant right) { return left.toBool() && right.toBool(); }} }; -ExprEvaluator::ExprEvaluator() -{ - m_caseSensitive = false; -} -#endif - - bool ExprEvaluator::evaluate(QObject *object, const QString &exp) { if (exp.contains("&&") && exp.contains("||")) diff --git a/core/exprevaluator.h b/core/exprevaluator.h index 36e3b21..37548ba 100644 --- a/core/exprevaluator.h +++ b/core/exprevaluator.h @@ -11,19 +11,15 @@ class CORESHARED_EXPORT ExprEvaluator { public: - ExprEvaluator(); + ExprEvaluator() = default; bool evaluate(QObject *object, const QString &exp); void setCaseSensitive(bool caseSensitive); private: -#ifdef _MSC_VER - QMap > m_operations; -#else static const QMap > m_operations; -#endif - bool m_caseSensitive; + bool m_caseSensitive{false}; bool subEval(const QString &oper, const QString &expresion, QObject *object); void parseExpr(const QString &exp, QVariant &value, QString &oper, QVariant &condition, QObject *object); diff --git a/core/iservice.cpp b/core/iservice.cpp index 7e95dda..6d4a188 100644 --- a/core/iservice.cpp +++ b/core/iservice.cpp @@ -1,5 +1,14 @@ #include "iservice.h" +#ifdef _MSC_VER +QX_REGISTER_CPP_CORE(IService) + +namespace qx { + template<> void register_class(QxClass&) { + } +} +#endif + IService::IService(QObject *parent) : QObject(parent) { } diff --git a/core/iservice.h b/core/iservice.h index 21a1697..4bc06d5 100644 --- a/core/iservice.h +++ b/core/iservice.h @@ -33,4 +33,8 @@ protected: QString m_pluginId; }; +#ifdef _MSC_VER +QX_REGISTER_HPP_CORE(IService, QObject, 0) +#endif + #endif // ISERVICE_H diff --git a/core/reporting/reportdialog.h b/core/reporting/reportdialog.h index 52f9a11..659a367 100644 --- a/core/reporting/reportdialog.h +++ b/core/reporting/reportdialog.h @@ -3,12 +3,13 @@ #include #include "report.h" +#include "../core_global.h" namespace Ui { class ReportDialog; } -class ReportDialog : public QDialog +class CORESHARED_EXPORT ReportDialog : public QDialog { Q_OBJECT diff --git a/shop/receiptgenerator.cpp b/shop/receiptgenerator.cpp index 4710292..e67cee3 100644 --- a/shop/receiptgenerator.cpp +++ b/shop/receiptgenerator.cpp @@ -59,11 +59,11 @@ void ReceiptGenerator::print() DWORD dwBytes; BOOL bStatus = FALSE; - if (OpenPrinter((LPWSTR)printer.toStdWString().c_str(), &hPrinter, NULL)) + if (OpenPrinter((LPWSTR)printer.toStdWString().c_str(), &hPrinter, nullptr)) { - docInfo.pDocName = L"Uctenka"; - docInfo.pOutputFile = NULL; - docInfo.pDatatype = L"RAW"; + docInfo.pDocName = (LPWSTR)"Uctenka"; + docInfo.pOutputFile = nullptr; + docInfo.pDatatype = (LPWSTR)"RAW"; dwJob = StartDocPrinter(hPrinter, 1, (LPBYTE)&docInfo); if (dwJob > 0)