From 874735be55291290819f26df9c7951d9a44e105f Mon Sep 17 00:00:00 2001
From: "littletux89@gmail.com" <littletux89@gmail.com>
Date: Wed, 4 Dec 2019 21:57:12 +0300
Subject: [PATCH] [-] Commented code removed, errors in qml code fixed.

---
 .../DapCommandController.cpp                  |  6 +---
 CellFrameDashboardGUI/DapScreenDialog.cpp     |  2 --
 .../DapScreenDialogChangeWidget.cpp           |  2 --
 .../DapServiceController.cpp                  |  6 ----
 CellFrameDashboardGUI/main.cpp                |  2 --
 CellFrameDashboardGUI/qml.qrc                 |  2 +-
 .../screen/DapUiQmlScreenMainWindow.qml       |  6 ----
 .../DapUiQmlScreenExchangeForm.ui.qml         |  7 ----
 .../DapUiQmlWidgetNodeNetworkExplorer.qml     |  1 -
 .../screen/History/DapUiQmlScreenHistory.qml  |  6 ----
 .../DapUiQmlWidgetSignatureTypeComboBox.qml   |  6 ----
 .../StatusBar/DapUiQmlWidgetStatusBar.qml     |  9 +-----
 ... DapUiQmlWidgetStatusBarButtonForm.ui.qml} |  0
 .../screen/VPN/DapUiQmlScreenVpn.qml          |  1 +
 .../screen/VPN/DapUiQmlScreenVpnForm.ui.qml   | 25 ++++++++++-----
 .../DapChainWallet.cpp                        |  6 +---
 .../DapSettingsCipher.cpp                     | 25 ---------------
 .../DapSettingsCipher.h                       | 32 -------------------
 .../libCellFrameDashboardCommon.pri           |  2 --
 19 files changed, 22 insertions(+), 124 deletions(-)
 rename CellFrameDashboardGUI/screen/StatusBar/{DapUiQmlWidgetStatusBarButton.ui.qml => DapUiQmlWidgetStatusBarButtonForm.ui.qml} (100%)
 delete mode 100644 libCellFrameDashboardCommon/DapSettingsCipher.cpp
 delete mode 100644 libCellFrameDashboardCommon/DapSettingsCipher.h

diff --git a/CellFrameDashboardGUI/DapCommandController.cpp b/CellFrameDashboardGUI/DapCommandController.cpp
index 0fa87cd4a..e690e439f 100644
--- a/CellFrameDashboardGUI/DapCommandController.cpp
+++ b/CellFrameDashboardGUI/DapCommandController.cpp
@@ -93,9 +93,6 @@ void DapCommandController::requestWalletData()
 
 void DapCommandController::processChangedLog()
 {
-//    QStringList tempLogModel;
-//    for(int x{0}; x < aLogModel.count(); ++x)
-//        tempLogModel.append(aLogModel.at(x).toString());
     emit onChangeLogModel();
 }
 
@@ -294,8 +291,7 @@ void DapCommandController::getNetworkList()
 
 void DapCommandController::setNodeStatus(const bool aIsOnline)
 {
-    /*DapRpcServiceReply *reply =*/ m_DAPRpcSocket->invokeRemoteMethod("RPCServer.setNodeStatus", aIsOnline);
-//    connect(reply, SIGNAL(finished()), this, SLOT(processGetNodeStatus()));
+    m_DAPRpcSocket->invokeRemoteMethod("RPCServer.setNodeStatus", aIsOnline);
 }
 
 void DapCommandController::executeCommand(const QString &command)
diff --git a/CellFrameDashboardGUI/DapScreenDialog.cpp b/CellFrameDashboardGUI/DapScreenDialog.cpp
index 33155e7b1..0814c9e09 100644
--- a/CellFrameDashboardGUI/DapScreenDialog.cpp
+++ b/CellFrameDashboardGUI/DapScreenDialog.cpp
@@ -3,9 +3,7 @@
 DapScreenDialog::DapScreenDialog(QObject *parent) : QObject(parent)
 {
     m_proxyModel = new QSortFilterProxyModel;
-//    m_proxyModel->setSourceModel(&DapUiQmlWidgetModel::getInstance());
     m_proxyModel->setFilterRegExp(QRegExp("true"));
-//    m_proxyModel->setFilterRole(VisibleRole);
 }
 
 QSortFilterProxyModel *DapScreenDialog::proxyModel() const
diff --git a/CellFrameDashboardGUI/DapScreenDialogChangeWidget.cpp b/CellFrameDashboardGUI/DapScreenDialogChangeWidget.cpp
index eb80026d3..fa396332d 100644
--- a/CellFrameDashboardGUI/DapScreenDialogChangeWidget.cpp
+++ b/CellFrameDashboardGUI/DapScreenDialogChangeWidget.cpp
@@ -3,9 +3,7 @@
 DapScreenDialogChangeWidget::DapScreenDialogChangeWidget(QObject *parent) : QObject(parent)
 {
     m_proxyModel = new QSortFilterProxyModel(this);
-//    m_proxyModel->setSourceModel(&DapUiQmlWidgetModel::getInstance());
     m_proxyModel->setFilterRegExp(QRegExp("false"));
-//    m_proxyModel->setFilterRole(VisibleRole);
 }
 
 QSortFilterProxyModel *DapScreenDialogChangeWidget::proxyModel() const
diff --git a/CellFrameDashboardGUI/DapServiceController.cpp b/CellFrameDashboardGUI/DapServiceController.cpp
index 90bd849fd..aaa03277b 100644
--- a/CellFrameDashboardGUI/DapServiceController.cpp
+++ b/CellFrameDashboardGUI/DapServiceController.cpp
@@ -110,7 +110,6 @@ void DapServiceController::processGetNodeLogs(const QStringList &aNodeLogs)
     if(aNodeLogs.isEmpty())
         return;
 
-    int xx = DapLogModel::getInstance().rowCount();
     QRegularExpression re("(?<=])\\s");
     for (auto const & log : aNodeLogs)
     {
@@ -136,7 +135,6 @@ void DapServiceController::getNodeLogs() const
 void DapServiceController::clearLogModel()
 {
     DapLogModel::getInstance().clear();
-    int z = DapLogModel::getInstance().rowCount();
     emit logCompleted();
 }
 
@@ -218,10 +216,6 @@ void DapServiceController::processGetWalletInfo(const QString &asWalletName, con
     qInfo() << QString("processGetWalletInfo(%1, %2)").arg(asWalletName).arg(asWalletAddress);
     DapChainWallet wallet("", asWalletName, asWalletAddress, aBalance, aTokens);
     DapChainWalletsModel::getInstance().append(wallet);
-    
-    for (QString s : aBalance) {
-        qDebug() << s;
-    }
 }
 
 void DapServiceController::processExecuteCommandInfo(const QString &result)
diff --git a/CellFrameDashboardGUI/main.cpp b/CellFrameDashboardGUI/main.cpp
index 204ce4bac..942af0aef 100644
--- a/CellFrameDashboardGUI/main.cpp
+++ b/CellFrameDashboardGUI/main.cpp
@@ -12,7 +12,6 @@
 #include "DapScreenDialog.h"
 #include "DapScreenDialogChangeWidget.h"
 #include "DapSettings.h"
-#include "DapSettingsCipher.h"
 #include "DapServiceClient.h"
 #include "DapServiceController.h"
 #include "DapLogger.h"
@@ -99,7 +98,6 @@ int main(int argc, char *argv[])
     engine.rootContext()->setContextProperty("pt", 1.3);
     engine.load(QUrl("qrc:/screen/main.qml"));
 
-    qDebug() << engine.rootObjects().isEmpty();
     if (engine.rootObjects().isEmpty())
         return -1;
     
diff --git a/CellFrameDashboardGUI/qml.qrc b/CellFrameDashboardGUI/qml.qrc
index 74a2dcc5d..965f958ee 100755
--- a/CellFrameDashboardGUI/qml.qrc
+++ b/CellFrameDashboardGUI/qml.qrc
@@ -86,7 +86,7 @@
         <file>screen/Settings/DapUiQmlWidgetSettingsNetwork.qml</file>
         <file>screen/Settings/DapUiQmlWidgetSettingsNetworkForm.ui.qml</file>
         <file>screen/StatusBar/DapUiQmlWidgetStatusBar.qml</file>
-        <file>screen/StatusBar/DapUiQmlWidgetStatusBarButton.ui.qml</file>
+        <file>screen/StatusBar/DapUiQmlWidgetStatusBarButtonForm.ui.qml</file>
         <file>screen/StatusBar/DapUiQmlWidgetStatusBarComboBoxWallet.qml</file>
         <file>screen/StatusBar/DapUiQmlWidgetStatusBarComboBoxWalletForm.ui.qml</file>
         <file>screen/VPN/DapUiQmlScreenVpn.qml</file>
diff --git a/CellFrameDashboardGUI/screen/DapUiQmlScreenMainWindow.qml b/CellFrameDashboardGUI/screen/DapUiQmlScreenMainWindow.qml
index 33f62f756..a1ab023fc 100644
--- a/CellFrameDashboardGUI/screen/DapUiQmlScreenMainWindow.qml
+++ b/CellFrameDashboardGUI/screen/DapUiQmlScreenMainWindow.qml
@@ -84,9 +84,3 @@ DapUiQmlScreenMainWindowForm {
         }
     }
 }
-
-
-/*##^## Designer {
-    D{i:0;autoSize:true;height:480;width:640}
-}
- ##^##*/
diff --git a/CellFrameDashboardGUI/screen/Exchange/DapUiQmlScreenExchangeForm.ui.qml b/CellFrameDashboardGUI/screen/Exchange/DapUiQmlScreenExchangeForm.ui.qml
index 7e796a587..886f88e9b 100644
--- a/CellFrameDashboardGUI/screen/Exchange/DapUiQmlScreenExchangeForm.ui.qml
+++ b/CellFrameDashboardGUI/screen/Exchange/DapUiQmlScreenExchangeForm.ui.qml
@@ -22,10 +22,3 @@ Page {
         }
     }
 }
-
-
-
-/*##^## Designer {
-    D{i:0;autoSize:true;height:480;width:640}
-}
- ##^##*/
diff --git a/CellFrameDashboardGUI/screen/Explorer/DapUiQmlWidgetNodeNetworkExplorer.qml b/CellFrameDashboardGUI/screen/Explorer/DapUiQmlWidgetNodeNetworkExplorer.qml
index d0cd57297..a32806736 100644
--- a/CellFrameDashboardGUI/screen/Explorer/DapUiQmlWidgetNodeNetworkExplorer.qml
+++ b/CellFrameDashboardGUI/screen/Explorer/DapUiQmlWidgetNodeNetworkExplorer.qml
@@ -7,7 +7,6 @@ import NodeNetworkExplorer 1.0
 Page {
     Rectangle {
         anchors.fill: parent;
-//        color: "#3b3353";
     }
 
     RowLayout {
diff --git a/CellFrameDashboardGUI/screen/History/DapUiQmlScreenHistory.qml b/CellFrameDashboardGUI/screen/History/DapUiQmlScreenHistory.qml
index 0d5d53672..7882a45eb 100644
--- a/CellFrameDashboardGUI/screen/History/DapUiQmlScreenHistory.qml
+++ b/CellFrameDashboardGUI/screen/History/DapUiQmlScreenHistory.qml
@@ -101,7 +101,6 @@ DapUiQmlScreenHistoryForm {
 
                         Text {
                             id: dapNumberWallet
-//                            width: parent.width / 2
                             anchors.fill: parent
                             color: "#4F5357"
                             text: numberWallet
@@ -243,8 +242,3 @@ DapUiQmlScreenHistoryForm {
         visible: false
     }
 }
-
-/*##^## Designer {
-    D{i:0;autoSize:true;height:480;width:640}
-}
- ##^##*/
diff --git a/CellFrameDashboardGUI/screen/LastAction/DapUiQmlWidgetSignatureTypeComboBox.qml b/CellFrameDashboardGUI/screen/LastAction/DapUiQmlWidgetSignatureTypeComboBox.qml
index e7338ec0c..20daf4073 100644
--- a/CellFrameDashboardGUI/screen/LastAction/DapUiQmlWidgetSignatureTypeComboBox.qml
+++ b/CellFrameDashboardGUI/screen/LastAction/DapUiQmlWidgetSignatureTypeComboBox.qml
@@ -50,9 +50,3 @@ DapUiQmlWidgetStatusBarComboBox {
         highlighted: parent.highlightedIndex === index
     }
 }
-
-/*##^##
-Designer {
-    D{i:0;autoSize:true;height:480;width:640}
-}
-##^##*/
diff --git a/CellFrameDashboardGUI/screen/StatusBar/DapUiQmlWidgetStatusBar.qml b/CellFrameDashboardGUI/screen/StatusBar/DapUiQmlWidgetStatusBar.qml
index 8ed0069e5..f4877094f 100644
--- a/CellFrameDashboardGUI/screen/StatusBar/DapUiQmlWidgetStatusBar.qml
+++ b/CellFrameDashboardGUI/screen/StatusBar/DapUiQmlWidgetStatusBar.qml
@@ -5,7 +5,6 @@ import QtGraphicalEffects 1.0
 import QtQuick.Layouts 1.3
 
 Rectangle {
-//    property alias addWalletPressed: statusBarAddWalletButton.pressed
     Rectangle {
         anchors.fill: parent
         anchors.bottomMargin: 1
@@ -62,7 +61,7 @@ Rectangle {
             }
         }
 
-        DapUiQmlWidgetStatusBarButton {
+        DapUiQmlWidgetStatusBarButtonForm {
             id: statusBarAddWalletButton
             width: 130 * pt
             anchors.right: parent.right
@@ -79,9 +78,3 @@ Rectangle {
         }
     }
 }
-
-/*##^##
-Designer {
-    D{i:0;autoSize:true;height:480;width:640}
-}
-##^##*/
diff --git a/CellFrameDashboardGUI/screen/StatusBar/DapUiQmlWidgetStatusBarButton.ui.qml b/CellFrameDashboardGUI/screen/StatusBar/DapUiQmlWidgetStatusBarButtonForm.ui.qml
similarity index 100%
rename from CellFrameDashboardGUI/screen/StatusBar/DapUiQmlWidgetStatusBarButton.ui.qml
rename to CellFrameDashboardGUI/screen/StatusBar/DapUiQmlWidgetStatusBarButtonForm.ui.qml
diff --git a/CellFrameDashboardGUI/screen/VPN/DapUiQmlScreenVpn.qml b/CellFrameDashboardGUI/screen/VPN/DapUiQmlScreenVpn.qml
index d764fba09..4dcee1be4 100644
--- a/CellFrameDashboardGUI/screen/VPN/DapUiQmlScreenVpn.qml
+++ b/CellFrameDashboardGUI/screen/VPN/DapUiQmlScreenVpn.qml
@@ -1,4 +1,5 @@
 import QtQuick 2.4
 
 DapUiQmlScreenVpnForm {
+    imageServer.source: modelTest.get(modelTest.index(comboboxServer.currentIndex, 0)).icon
 }
diff --git a/CellFrameDashboardGUI/screen/VPN/DapUiQmlScreenVpnForm.ui.qml b/CellFrameDashboardGUI/screen/VPN/DapUiQmlScreenVpnForm.ui.qml
index d4d6286f5..2a848acb7 100644
--- a/CellFrameDashboardGUI/screen/VPN/DapUiQmlScreenVpnForm.ui.qml
+++ b/CellFrameDashboardGUI/screen/VPN/DapUiQmlScreenVpnForm.ui.qml
@@ -8,6 +8,10 @@ Item {
     width: 400
     height: 600
 
+    property ListModel modelTest: modelTest
+    property ComboBox comboboxServer: comboboxServer
+    property alias imageServer: imageServer
+
     Text {
         anchors.left: parent.left
         anchors.top: parent.top
@@ -44,7 +48,6 @@ Item {
         }
     }
 
-
     Switch {
         id: control
         anchors.verticalCenter: parent.verticalCenter
@@ -87,6 +90,18 @@ Item {
         }
     }
 
+    ListModel {
+                id: modelTest
+                ListElement {
+                    name: "first"
+                    icon: "qrc:/res/icons/defaul_icon.png"
+                }
+                ListElement {
+                    name: "second"
+                    icon: "qrc:/res/icons/defaul_icon.png"
+                }
+            }
+
     ComboBox {
         id: comboboxServer
         anchors.horizontalCenter: parent.horizontalCenter
@@ -96,11 +111,7 @@ Item {
         height: 48 * pt
         textRole: "name"
 
-        model: ListModel {
-            id: modelTest
-            ListElement {name: "first"; icon: "qrc:/res/icons/defaul_icon.png" }
-            ListElement {name: "second"; icon: "qrc:/res/icons/defaul_icon.png" }
-        }
+        model: modelTest
 
         background: Rectangle {
             anchors.fill: parent
@@ -130,7 +141,6 @@ Item {
                 anchors.left: parent.left
                 anchors.leftMargin: 22 * pt
                 anchors.verticalCenter: parent.verticalCenter
-                source: modelTest.get(modelTest.index(comboboxServer.currentIndex, 0)).icon
                 width: 24 * pt
                 height: 24 * pt
             }
@@ -144,6 +154,5 @@ Item {
                 font.pixelSize: 16 * pt
             }
         }
-
     }
 }
diff --git a/libCellFrameDashboardCommon/DapChainWallet.cpp b/libCellFrameDashboardCommon/DapChainWallet.cpp
index a49ecf96d..2fa9c8c97 100755
--- a/libCellFrameDashboardCommon/DapChainWallet.cpp
+++ b/libCellFrameDashboardCommon/DapChainWallet.cpp
@@ -8,11 +8,7 @@ DapChainWalletTokenItem::DapChainWalletTokenItem(const QString& aWalletAddress,
 }
 
 DapChainWalletTokenItem::DapChainWalletTokenItem(const QString& aWalletAddress, const DapChainWalletTokenData& aData, QObject* parent) :
-    QObject(parent)/*
-    m_wallet(aWalletAddress),
-    m_name(aData.Name),
-    m_balance(aData.Balance),
-    m_emission(aData.Emission)*/
+    QObject(parent)
 {
     m_wallet = aWalletAddress;
     m_name = aData.Name;
diff --git a/libCellFrameDashboardCommon/DapSettingsCipher.cpp b/libCellFrameDashboardCommon/DapSettingsCipher.cpp
deleted file mode 100644
index 60e894683..000000000
--- a/libCellFrameDashboardCommon/DapSettingsCipher.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "DapSettingsCipher.h"
-
-DapSettingsCipher::DapSettingsCipher(const DapSettings& settings) 
-    : DapSettings(), m_settings(settings)
-{
-    setFileName(settings.getFileName());
-}
-
-QByteArray DapSettingsCipher::encrypt(const QByteArray &byteArray) const
-{
-// TODO: implement encryption to next iteration.
-//    return m_settings.encrypt(byteArray);
-}
-
-QByteArray DapSettingsCipher::decrypt(const QByteArray &byteArray) const
-{
-// TODO: implement decryption to next iteration.
-//    return m_settings.decrypt(byteArray);
-}
-
-DapSettingsCipher &DapSettingsCipher::getInstance(const DapSettings& settings)
-{
-    static DapSettingsCipher instance(settings);
-    return instance;
-}
diff --git a/libCellFrameDashboardCommon/DapSettingsCipher.h b/libCellFrameDashboardCommon/DapSettingsCipher.h
deleted file mode 100644
index 1bc366692..000000000
--- a/libCellFrameDashboardCommon/DapSettingsCipher.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef DAPSETTINGSCIPHER_H
-#define DAPSETTINGSCIPHER_H
-
-#include <QObject>
-
-#include "DapSettings.h"
-
-class DapSettingsCipher : public DapSettings
-{
-    Q_OBJECT
-    
-protected:
-    
-    const DapSettings   &m_settings;
-    
-    DapSettingsCipher(const DapSettings& settings);
-     
-public:
-    virtual QByteArray encrypt(const QByteArray &byteArray) const;
-    
-    virtual QByteArray decrypt(const QByteArray &byteArray) const;
-    
-    /// Removed as part of the implementation of the pattern sington.
-    DapSettingsCipher(const DapSettingsCipher&) = delete;
-    DapSettingsCipher& operator= (const DapSettingsCipher &) = delete;
-    
-    /// Get an instance of a class.
-    /// @return Instance of a class.
-    Q_INVOKABLE static DapSettingsCipher &getInstance(const DapSettings& settings);
-};
-
-#endif // DAPSETTINGSCIPHER_H
diff --git a/libCellFrameDashboardCommon/libCellFrameDashboardCommon.pri b/libCellFrameDashboardCommon/libCellFrameDashboardCommon.pri
index 7bd94e563..cf5328792 100755
--- a/libCellFrameDashboardCommon/libCellFrameDashboardCommon.pri
+++ b/libCellFrameDashboardCommon/libCellFrameDashboardCommon.pri
@@ -17,7 +17,6 @@ SOURCES +=\
     $$PWD/DapHalper.cpp \
     $$PWD/DapHistoryType.cpp \
     $$PWD/DapSettings.cpp \
-    $$PWD/DapSettingsCipher.cpp \
     $$PWD/DapLogMessage.cpp \
     $$PWD/DapLogModel.cpp \
     $$PWD/DapChainWallet.cpp
@@ -27,7 +26,6 @@ HEADERS +=\
     $$PWD/DapHalper.h \
     $$PWD/DapHistoryType.h \
     $$PWD/DapSettings.h \
-    $$PWD/DapSettingsCipher.h \
     $$PWD/DapLogMessage.h \
     $$PWD/DapLogModel.h \
     $$PWD/DapChainWallet.h \
-- 
GitLab