From 89a8f133ed547ce3538046b1a5fd38dcd4eff5c7 Mon Sep 17 00:00:00 2001
From: jonymt <johanmt@yandex.ru>
Date: Mon, 23 Sep 2019 18:35:21 +0200
Subject: [PATCH] [*] added comments

---
 CellFrameDashboardGUI/DapServiceController.h  |  2 +-
 .../DapSettingsNetworkModel.cpp               |  2 +-
 .../DapSettingsNetworkModel.h                 | 17 +++++++++++++--
 .../DapUiQmlScreenSettings.qml                | 20 +-----------------
 .../DapUiQmlScreenSettingsSection.qml         | 21 +++++++++++++++++++
 .../DapUiQmlWidgetSettingsNetwork.qml         |  1 -
 CellFrameDashboardGUI/qml.qrc                 |  1 +
 .../DapChainDashboardService.h                |  6 ++++--
 .../DapChainNetworkHandler.h                  |  2 ++
 9 files changed, 46 insertions(+), 26 deletions(-)
 create mode 100644 CellFrameDashboardGUI/DapUiQmlScreenSettingsSection.qml

diff --git a/CellFrameDashboardGUI/DapServiceController.h b/CellFrameDashboardGUI/DapServiceController.h
index 9e40b90..4943d9c 100755
--- a/CellFrameDashboardGUI/DapServiceController.h
+++ b/CellFrameDashboardGUI/DapServiceController.h
@@ -80,7 +80,7 @@ public:
     Q_INVOKABLE void executeCommand(const QString& command);
 
     void getWalletInfo(const QString& asWalletName);
-
+    /// Request about new netowrk list
     void getNetworkList();
 
 signals:
diff --git a/CellFrameDashboardGUI/DapSettingsNetworkModel.cpp b/CellFrameDashboardGUI/DapSettingsNetworkModel.cpp
index e3aa141..e6567a0 100644
--- a/CellFrameDashboardGUI/DapSettingsNetworkModel.cpp
+++ b/CellFrameDashboardGUI/DapSettingsNetworkModel.cpp
@@ -3,7 +3,7 @@
 DapSettingsNetworkModel::DapSettingsNetworkModel(QObject *parent) : QAbstractListModel(parent),
     m_CurrentIndex(-1)
 {
-    m_NetworkList  = QStringList() << "First" << "Second" << "Third" << "Forth";
+
 }
 
 DapSettingsNetworkModel& DapSettingsNetworkModel::getInstance()
diff --git a/CellFrameDashboardGUI/DapSettingsNetworkModel.h b/CellFrameDashboardGUI/DapSettingsNetworkModel.h
index 05ce86c..216d012 100644
--- a/CellFrameDashboardGUI/DapSettingsNetworkModel.h
+++ b/CellFrameDashboardGUI/DapSettingsNetworkModel.h
@@ -9,9 +9,8 @@ class DapSettingsNetworkModel : public QAbstractListModel
 {
     Q_OBJECT
 
-//    Q_PROPERTY(QString CurrentNetwork READ getCurrentNetwork WRITE setCurrentNetwork NOTIFY currentNetworkChanged)
-
 public:
+    /// Enumeration display role
     enum DisplayRole {
       DisplayName = Qt::UserRole
     };
@@ -23,20 +22,34 @@ private:
 
 public:
     explicit DapSettingsNetworkModel(QObject *parent = nullptr);
+    /// Get instance of this object
+    /// @return instance
     static DapSettingsNetworkModel &getInstance();
 
+    /// Overload methods
     int rowCount(const QModelIndex& parent) const;
     QVariant data(const QModelIndex& index, int role) const;
     QHash<int, QByteArray> roleNames() const;
 
+    /// Get current network which was selected
+    /// @return name of current network
     Q_INVOKABLE QString getCurrentNetwork() const;
+    /// Get current index which was selected
+    /// @return index of current network
     Q_INVOKABLE int getCurrentIndex() const;
 
 public slots:
+    /// Set new network list
+    /// @param List of network
     void setNetworkList(const QStringList& aNetworkList);
+    /// Set current network which was selected in combobox
+    /// @param name of network
+    /// @param index of network
     void setCurrentNetwork(QString CurrentNetwork, int CurrentIndex);
 
 signals:
+    /// Signal about changing current network
+    /// @param name of network which was selected
     void currentNetworkChanged(QString currentNetwork);
 };
 
diff --git a/CellFrameDashboardGUI/DapUiQmlScreenSettings.qml b/CellFrameDashboardGUI/DapUiQmlScreenSettings.qml
index d1f6abc..f7897fe 100644
--- a/CellFrameDashboardGUI/DapUiQmlScreenSettings.qml
+++ b/CellFrameDashboardGUI/DapUiQmlScreenSettings.qml
@@ -31,24 +31,6 @@ DapUiQmlScreenSettingsForm {
 
         section.property: "name"
         section.criteria: ViewSection.FullString
-        section.delegate: Component {
-
-            Rectangle {
-                width: parent.width
-                height: 30 * pt
-                color: "#DFE1E6"
-
-                Text {
-                    anchors.fill: parent
-                    anchors.leftMargin: 18 * pt
-                    verticalAlignment: Qt.AlignVCenter
-                    text: section
-                    font.family: "Roboto"
-                    font.pixelSize: 12 * pt
-                    color: "#5F5F63"
-                }
-            }
-
-        }
+        section.delegate: DapUiQmlScreenSettingsSection {}
     }
 }
diff --git a/CellFrameDashboardGUI/DapUiQmlScreenSettingsSection.qml b/CellFrameDashboardGUI/DapUiQmlScreenSettingsSection.qml
new file mode 100644
index 0000000..51d10f3
--- /dev/null
+++ b/CellFrameDashboardGUI/DapUiQmlScreenSettingsSection.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Component {
+
+    Rectangle {
+        width: parent.width
+        height: 30 * pt
+        color: "#DFE1E6"
+
+        Text {
+            anchors.fill: parent
+            anchors.leftMargin: 18 * pt
+            verticalAlignment: Qt.AlignVCenter
+            text: section
+            font.family: "Roboto"
+            font.pixelSize: 12 * pt
+            color: "#5F5F63"
+        }
+    }
+
+}
diff --git a/CellFrameDashboardGUI/DapUiQmlWidgetSettingsNetwork.qml b/CellFrameDashboardGUI/DapUiQmlWidgetSettingsNetwork.qml
index ee4a537..30286e2 100644
--- a/CellFrameDashboardGUI/DapUiQmlWidgetSettingsNetwork.qml
+++ b/CellFrameDashboardGUI/DapUiQmlWidgetSettingsNetwork.qml
@@ -17,7 +17,6 @@ DapUiQmlWidgetSettingsNetworkForm {
         currentIndex: dapSettingsNetworkModel.getCurrentIndex()
 
         onCurrentTextChanged: {
-            console.debug(currentText);
             if(dapSettingsNetworkModel.getCurrentIndex() !== currentIndex) {
                 dapSettingsNetworkModel.setCurrentNetwork(currentText, currentIndex);
             }
diff --git a/CellFrameDashboardGUI/qml.qrc b/CellFrameDashboardGUI/qml.qrc
index 182598d..5f7955c 100755
--- a/CellFrameDashboardGUI/qml.qrc
+++ b/CellFrameDashboardGUI/qml.qrc
@@ -62,5 +62,6 @@
         <file>DapUiQmlWidgetSettingsNetworkForm.ui.qml</file>
         <file>DapUiQmlScreenSettings.qml</file>
         <file>DapUiQmlScreenSettingsForm.ui.qml</file>
+        <file>DapUiQmlScreenSettingsSection.qml</file>
     </qresource>
 </RCC>
diff --git a/CellFrameDashboardService/DapChainDashboardService.h b/CellFrameDashboardService/DapChainDashboardService.h
index 0baa963..b7ae8b6 100755
--- a/CellFrameDashboardService/DapChainDashboardService.h
+++ b/CellFrameDashboardService/DapChainDashboardService.h
@@ -105,9 +105,11 @@ public slots:
     /// Get history
     /// @return QList data history
     QVariant getHistory() const;
-
+    /// Get network list
+    /// @return Network list
     QStringList getNetworkList() const;
-
+    /// Change current network
+    /// @param name of network whcih was selected
     void changeCurrentNetwork(const QString& aNetwork);
 
 private slots:
diff --git a/CellFrameDashboardService/DapChainNetworkHandler.h b/CellFrameDashboardService/DapChainNetworkHandler.h
index 5cbdde5..515cd22 100644
--- a/CellFrameDashboardService/DapChainNetworkHandler.h
+++ b/CellFrameDashboardService/DapChainNetworkHandler.h
@@ -17,6 +17,8 @@ private:
 public:
     explicit DapChainNetworkHandler(QObject *parent = nullptr);
 
+    /// Get network list
+    /// @return Network list
     QStringList getNetworkList();
 };
 
-- 
GitLab