From 3ebbb00a4e9fb347e870fc473a46e1388241e427 Mon Sep 17 00:00:00 2001 From: vshevchyk Date: Mon, 8 Jul 2019 15:42:39 +0300 Subject: [PATCH] Code refactoring --- QScadaEntity/qscadaconnecteddeviceinfo.cpp | 66 ++-- QScadaEntity/qscadaconnecteddeviceinfo.h | 6 +- QSimpleScada.pro.user | 333 --------------------- qpm.json | 2 +- qscadaconfig.h | 2 +- 5 files changed, 37 insertions(+), 372 deletions(-) delete mode 100644 QSimpleScada.pro.user diff --git a/QScadaEntity/qscadaconnecteddeviceinfo.cpp b/QScadaEntity/qscadaconnecteddeviceinfo.cpp index 29ba99a..31c258e 100644 --- a/QScadaEntity/qscadaconnecteddeviceinfo.cpp +++ b/QScadaEntity/qscadaconnecteddeviceinfo.cpp @@ -9,39 +9,39 @@ #include #include -const QString VConnectedDeviceInfo::tag_devices = QString("devices"); -const QString VConnectedDeviceInfo::tag_device = QString("device"); -const QString VConnectedDeviceInfo::tag_device_name = QString("name"); -const QString VConnectedDeviceInfo::tag_device_ip = QString("ip"); -const QString VConnectedDeviceInfo::tag_device_ip_v6 = QString("ip_v6"); -const QString VConnectedDeviceInfo::tag_device_host = QString("host"); -const QString VConnectedDeviceInfo::tag_device_domain = QString("domain"); +const QString QConnectedDeviceInfo::tag_devices = QString("devices"); +const QString QConnectedDeviceInfo::tag_device = QString("device"); +const QString QConnectedDeviceInfo::tag_device_name = QString("name"); +const QString QConnectedDeviceInfo::tag_device_ip = QString("ip"); +const QString QConnectedDeviceInfo::tag_device_ip_v6 = QString("ip_v6"); +const QString QConnectedDeviceInfo::tag_device_host = QString("host"); +const QString QConnectedDeviceInfo::tag_device_domain = QString("domain"); -const QString VConnectedDeviceInfo::tag_boards = QString("boards"); -const QString VConnectedDeviceInfo::tag_board = QString("board"); -const QString VConnectedDeviceInfo::tag_object = QString("object"); -const QString VConnectedDeviceInfo::tag_title = QString("title"); -const QString VConnectedDeviceInfo::tag_show_background = QString("show_background");//new -const QString VConnectedDeviceInfo::tag_show_background_image = QString("show_background_image"); // -const QString VConnectedDeviceInfo::tag_show_marker = QString("show_marker");//new -const QString VConnectedDeviceInfo::tag_background_image = QString("background_image");//new -const QString VConnectedDeviceInfo::tag_id = QString("id"); -const QString VConnectedDeviceInfo::tag_is_dynamic = QString("is_dynamic"); -const QString VConnectedDeviceInfo::tag_geometry_x = QString("geometry_x"); -const QString VConnectedDeviceInfo::tag_geometry_y = QString("geometry_y"); -const QString VConnectedDeviceInfo::tag_geometry_width = QString("geometry_width"); -const QString VConnectedDeviceInfo::tag_geometry_height = QString("geometry_height"); -const QString VConnectedDeviceInfo::tag_axis_enabled = QString("axis_enabled"); -const QString VConnectedDeviceInfo::tag_axis_position = QString("axis_position");//new -const QString VConnectedDeviceInfo::tag_axis_x = QString("axis_x"); -const QString VConnectedDeviceInfo::tag_axis_y = QString("axis_y"); -const QString VConnectedDeviceInfo::tag_axis_z = QString("axis_z"); +const QString QConnectedDeviceInfo::tag_boards = QString("boards"); +const QString QConnectedDeviceInfo::tag_board = QString("board"); +const QString QConnectedDeviceInfo::tag_object = QString("object"); +const QString QConnectedDeviceInfo::tag_title = QString("title"); +const QString QConnectedDeviceInfo::tag_show_background = QString("show_background");//new +const QString QConnectedDeviceInfo::tag_show_background_image = QString("show_background_image"); // +const QString QConnectedDeviceInfo::tag_show_marker = QString("show_marker");//new +const QString QConnectedDeviceInfo::tag_background_image = QString("background_image");//new +const QString QConnectedDeviceInfo::tag_id = QString("id"); +const QString QConnectedDeviceInfo::tag_is_dynamic = QString("is_dynamic"); +const QString QConnectedDeviceInfo::tag_geometry_x = QString("geometry_x"); +const QString QConnectedDeviceInfo::tag_geometry_y = QString("geometry_y"); +const QString QConnectedDeviceInfo::tag_geometry_width = QString("geometry_width"); +const QString QConnectedDeviceInfo::tag_geometry_height = QString("geometry_height"); +const QString QConnectedDeviceInfo::tag_axis_enabled = QString("axis_enabled"); +const QString QConnectedDeviceInfo::tag_axis_position = QString("axis_position");//new +const QString QConnectedDeviceInfo::tag_axis_x = QString("axis_x"); +const QString QConnectedDeviceInfo::tag_axis_y = QString("axis_y"); +const QString QConnectedDeviceInfo::tag_axis_z = QString("axis_z"); -VConnectedDeviceInfo::VConnectedDeviceInfo(QObject *parent): +QConnectedDeviceInfo::QConnectedDeviceInfo(QObject *parent): QScadaBasePrefEntity(parent) { } -QString VConnectedDeviceInfo::formTag(QString tag, bool isClosing, bool newLine, int numOfTabs) +QString QConnectedDeviceInfo::formTag(QString tag, bool isClosing, bool newLine, int numOfTabs) { QString lReturn; @@ -65,7 +65,7 @@ QString VConnectedDeviceInfo::formTag(QString tag, bool isClosing, bool newLine, return lReturn; } -QString VConnectedDeviceInfo::formTagValue(QString tag, QString value, bool newLine, int numOfTabs) +QString QConnectedDeviceInfo::formTagValue(QString tag, QString value, bool newLine, int numOfTabs) { QString lReturn; @@ -75,7 +75,7 @@ QString VConnectedDeviceInfo::formTagValue(QString tag, QString value, bool newL return lReturn; } -void VConnectedDeviceInfo::initFromXml(const QByteArray &xmlData) { +void QConnectedDeviceInfo::initFromXml(const QByteArray &xmlData) { QXmlStreamReader lXmlStreamReader(QString::fromStdString(xmlData.toStdString())); QScadaDeviceConfig *lDeviceConfig = nullptr; @@ -180,7 +180,7 @@ void VConnectedDeviceInfo::initFromXml(const QByteArray &xmlData) { } } -void VConnectedDeviceInfo::saveXmlToFile(const QString &filePath) +void QConnectedDeviceInfo::saveXmlToFile(const QString &filePath) { qDebug() << __FUNCTION__; QFile lFile(filePath); @@ -210,10 +210,10 @@ void VConnectedDeviceInfo::saveXmlToFile(const QString &filePath) } } -QString VConnectedDeviceInfo::XMLFromDeviceInfo(QList deviceList, QScadaBoardController *boardController) +QString QConnectedDeviceInfo::XMLFromDeviceInfo(QList deviceList, QScadaBoardController *boardController) { //create xml for devices - VConnectedDeviceInfo i; + QConnectedDeviceInfo i; QString rDevices = i.formTag(tag_devices, false, true, 0);//"\n"; for (QScadaDeviceInfo info: deviceList) { rDevices += i.formTag(tag_device, false, true, 1);//"\t\n"; diff --git a/QScadaEntity/qscadaconnecteddeviceinfo.h b/QScadaEntity/qscadaconnecteddeviceinfo.h index 18d9354..cf4986d 100644 --- a/QScadaEntity/qscadaconnecteddeviceinfo.h +++ b/QScadaEntity/qscadaconnecteddeviceinfo.h @@ -10,8 +10,6 @@ #include #include -class VConnectedDeviceInfo; - struct QScadaDeviceConfig { QString name; QString domain; @@ -21,7 +19,7 @@ struct QScadaDeviceConfig { QList boardList; }; -class VConnectedDeviceInfo : public QScadaBasePrefEntity +class QConnectedDeviceInfo : public QScadaBasePrefEntity { public: static const QString tag_devices; @@ -53,7 +51,7 @@ public: static const QString tag_axis_z; public: - VConnectedDeviceInfo(QObject *parent = 0); + QConnectedDeviceInfo(QObject *parent = 0); static QString formTag(QString tag, bool isClosing, bool newLine, int numOfTabs); //so if formTag("device", false, true, 1) the result will be "\t" static QString formTagValue(QString tag, QString value, bool newLine, int numOfTabs); diff --git a/QSimpleScada.pro.user b/QSimpleScada.pro.user deleted file mode 100644 index b0795de..0000000 --- a/QSimpleScada.pro.user +++ /dev/null @@ -1,333 +0,0 @@ - - - - - - EnvironmentId - {cbcb1914-db53-4fb3-aea6-273c979067a3} - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.10.1 clang 64bit - Desktop Qt 5.10.1 clang 64bit - qt.qt5.5101.clang_64_kit - 0 - 0 - 0 - - /Users/vshevchyk/projects/build-QSimpleScada-Desktop_Qt_5_10_1_clang_64bit-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - /Users/vshevchyk/projects/build-QSimpleScada-Desktop_Qt_5_10_1_clang_64bit-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - - /Users/vshevchyk/projects/build-QSimpleScada-Desktop_Qt_5_10_1_clang_64bit-Profile - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - true - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 3 - - - 0 - Deploy - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deploy Configuration - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - - - - - - ProjectExplorer.CustomExecutableRunConfiguration - 3768 - false - true - false - false - true - - 1 - - - - ProjectExplorer.Project.TargetCount - 1 - - - ProjectExplorer.Project.Updater.FileVersion - 18 - - - Version - 18 - - diff --git a/qpm.json b/qpm.json index 698c5b7..11535fc 100644 --- a/qpm.json +++ b/qpm.json @@ -10,7 +10,7 @@ "url": "https://github.com/IndeemaSoftware/QSimpleScada.git" }, "version": { - "label": "0.5.0", + "label": "0.5.1", "revision": "", "fingerprint": "" }, diff --git a/qscadaconfig.h b/qscadaconfig.h index 1804164..da0b1c9 100644 --- a/qscadaconfig.h +++ b/qscadaconfig.h @@ -24,7 +24,7 @@ typedef enum { QScadaMachineryClass4 } QScadaMachineryClass; -enum VUpdateMode { +enum QUpdateMode { VUpdateModeFromTo, VUpdateMode24Hours, VUpdateModeDaysCount