From ce9238b574036b02d0c561d6cb235792ecf06aaa Mon Sep 17 00:00:00 2001
From: "evgenii.tagiltsev" <tagiltsev.evgenii@gmail.com>
Date: Wed, 16 Oct 2019 15:41:53 +0200
Subject: [PATCH] [*] code refactoring

---
 .../DapCommandController.cpp                  | 16 +-------------
 .../DapChainDashboardService.cpp              |  7 +++++-
 .../DapChainWalletHandler.cpp                 | 22 -------------------
 3 files changed, 7 insertions(+), 38 deletions(-)

diff --git a/CellFrameDashboardGUI/DapCommandController.cpp b/CellFrameDashboardGUI/DapCommandController.cpp
index faea4056a..e3f459199 100755
--- a/CellFrameDashboardGUI/DapCommandController.cpp
+++ b/CellFrameDashboardGUI/DapCommandController.cpp
@@ -154,22 +154,8 @@ void DapCommandController::processGetWalletInfo()
     QString address = reply->response().toJsonValue().toVariant().toStringList().at(1);
     QStringList temp = reply->response().toJsonValue().toVariant().toStringList();
     QStringList tokens = temp.mid(3, temp.count());
-    QStringList balance;
-//    for(int x{2}; x < temp.count(); x++)
-//    {
-//        if(x%2)
-//        {
-//           tokens.append(temp[x]);
-//           qDebug() << "TOKKEN " << temp[x];
-//        }
-//        else
-//        {
-//            balance.append(temp[x]);
-//            qDebug() << "BALANCE " << temp[x];
-//        }
-//    }
     
-    emit sigWalletInfoChanged(name, address, balance, tokens);
+    emit sigWalletInfoChanged(name, address, QStringList(), tokens);
 }
 
 void DapCommandController::processGetNodeNetwork()
diff --git a/CellFrameDashboardService/DapChainDashboardService.cpp b/CellFrameDashboardService/DapChainDashboardService.cpp
index d12ef4577..d92d11a27 100755
--- a/CellFrameDashboardService/DapChainDashboardService.cpp
+++ b/CellFrameDashboardService/DapChainDashboardService.cpp
@@ -116,7 +116,12 @@ void DapChainDashboardService::changeCurrentNetwork(const QString& aNetwork)
 
 void DapChainDashboardService::doRequestWallets()
 {
-    m_pDapChainHistoryHandler->onRequestNewHistory(m_pDapChainWalletHandler->getWallets());
+    QMap<QString, QVariant> wallets = m_pDapChainWalletHandler->getWallets();
+    m_pDapChainHistoryHandler->onRequestNewHistory(wallets);
+    /// TODO: for future
+//    QVariantList params = QVariantList() << wallets;
+//    DapRpcMessage request = DapRpcMessage::createRequest("RPCClient.setNewWallets", QJsonArray::fromVariantList(params));
+//    m_pServer->notifyConnectedClients(request);
 }
 
 void DapChainDashboardService::doSendNewHistory(const QVariant& aData)
diff --git a/CellFrameDashboardService/DapChainWalletHandler.cpp b/CellFrameDashboardService/DapChainWalletHandler.cpp
index 3ef3f4c21..309c0988d 100755
--- a/CellFrameDashboardService/DapChainWalletHandler.cpp
+++ b/CellFrameDashboardService/DapChainWalletHandler.cpp
@@ -51,28 +51,6 @@ QMap<QString, QVariant> DapChainWalletHandler::getWallets()
         map[match.captured(1)] = match.captured(2);
     }
 
-
-//    QString str = QString::fromLatin1(process.readAll());
-//    QRegExp rx(":{1,1}([\\s\\w\\W]+)(\\n|\\r){1,1}" );
-//    rx.setMinimal(true);
-//    int pos = 0;
-//    int x {0};
-//    QString tempName;
-//    while ((pos = rx.indexIn(str, pos)) != -1)
-//    {
-//        if(x == 0)
-//        {
-//            tempName = rx.cap(1);
-//            ++x;
-//        }
-//        else
-//        {
-//            map.insert(tempName, rx.cap(1));
-//            x = 0;
-//        }
-//        pos += rx.matchedLength();
-//    }
-
     return map;
 }
 
-- 
GitLab