From e06b9097691fe362ca0cb78bdc0765abbaf03042 Mon Sep 17 00:00:00 2001
From: Evgenii Tagiltsev <tagiltsev.ebgenii@gmail.com>
Date: Mon, 12 Aug 2019 19:10:00 +0200
Subject: [PATCH] [*] edit model and design

---
 KelvinDashboardGUI/DapScreenHistoryModel.cpp |  27 ++-
 KelvinDashboardGUI/DapUiQmlScreenHistory.qml | 199 ++++++++++++-------
 2 files changed, 146 insertions(+), 80 deletions(-)

diff --git a/KelvinDashboardGUI/DapScreenHistoryModel.cpp b/KelvinDashboardGUI/DapScreenHistoryModel.cpp
index 779bc194f..cde9f7dd2 100644
--- a/KelvinDashboardGUI/DapScreenHistoryModel.cpp
+++ b/KelvinDashboardGUI/DapScreenHistoryModel.cpp
@@ -9,7 +9,9 @@ DapScreenHistoryModel::DapScreenHistoryModel(QObject *parent)
         element.TokenName = QString("token %1").arg(i);
         element.Date = "today";
         element.WalletNumber = "number wallet";
-        element.Status = "sent";
+        element.Status = "Sent";
+        element.Currency = QString("$ 1020201010%1").arg(i);
+        element.Cryptocurrency = QString("KLV 4443222111%1").arg(i);
         m_elementList.append(element);
     }
 
@@ -19,9 +21,20 @@ DapScreenHistoryModel::DapScreenHistoryModel(QObject *parent)
         element.TokenName = QString("token %1").arg(i);
         element.Date = "yesterday";
         element.WalletNumber = "number wallet";
-        element.Status = "sent";
+        element.Status = "Error";
+        element.Currency = QString("$ 15647475623820%1").arg(i);
+        element.Cryptocurrency = QString("KLV 454535453%1").arg(i);
         m_elementList.append(element);
     }
+
+//    DapTransactionItem element;
+//    element.TokenName = QString("token new");
+//    element.Date = "today";
+//    element.WalletNumber = "number wallet 1221";
+//    element.Status = "sent";
+//    element.Currency = QString("$ 1555444");
+//    element.Cryptocurrency = QString("KLV 44433");
+//    m_elementList.append(element);
 }
 
 DapScreenHistoryModel& DapScreenHistoryModel::getInstance()
@@ -36,16 +49,15 @@ QHash<int, QByteArray> DapScreenHistoryModel::roleNames() const
     names[DisplayDateRole] = "date";
     names[DisplayNameTokenRole] = "tokenName";
     names[DisplayNumberWalletRole] = "numberWallet";
+    names[DisplayStatusRole] = "txStatus";
+    names[DisplayCryptocurrency] = "cryptocurrency";
+    names[DisplayCurrency] = "currency";
     return names;
 }
 
 int DapScreenHistoryModel::rowCount(const QModelIndex &parent) const
 {
-    // For list models only the root node (an invalid parent) should return the list's size. For all
-    // other (valid) parents, rowCount() should return 0 so that it does not become a tree model.
     if (parent.isValid()) return 0;
-
-    // FIXME: Implement me!
     return m_elementList.count();
 }
 
@@ -58,6 +70,9 @@ QVariant DapScreenHistoryModel::data(const QModelIndex &index, int role) const
         case DisplayDateRole: return m_elementList.at(index.row()).Date;
         case DisplayNameTokenRole: return m_elementList.at(index.row()).TokenName;
         case DisplayNumberWalletRole: return m_elementList.at(index.row()).WalletNumber;
+        case DisplayStatusRole: return m_elementList.at(index.row()).Status;
+        case DisplayCryptocurrency: return m_elementList.at(index.row()).Cryptocurrency;
+        case DisplayCurrency: return m_elementList.at(index.row()).Currency;
         default: return QVariant();
     }
 }
diff --git a/KelvinDashboardGUI/DapUiQmlScreenHistory.qml b/KelvinDashboardGUI/DapUiQmlScreenHistory.qml
index a0a21b19a..07e675f0c 100644
--- a/KelvinDashboardGUI/DapUiQmlScreenHistory.qml
+++ b/KelvinDashboardGUI/DapUiQmlScreenHistory.qml
@@ -3,17 +3,9 @@ import QtQuick.Controls 2.2
 import QtQuick.Layouts 1.12
 
 Page {
-//    ListModel {
-//        id: modeListView
-
-//        ListElement { nameToken: "token1"; numberWallet: "123"; txStatus: "Error"; date: "today" }
-//        ListElement { nameToken: "token2"; numberWallet: "234"; txStatus: "Sent"; date: "tomorrow" }
-//    }
-
     ListView {
         id: dapListView
         anchors.fill: parent
-//        model: modeListView
         model: dapHistoryModel
         delegate: dapDelegate
         section.property: "date"
@@ -41,83 +33,142 @@ Page {
     Component {
         id: dapDelegate
 
-        Rectangle {
-            id: dapDelegateContent
-            border.color: "#000000"
-            border.width: 1
-            height: 60
-            width: dapListView.width
-            anchors.leftMargin: 30
-            anchors.rightMargin: 20
-
-            RowLayout {
-                anchors.fill: parent
-                spacing: 30
-
-                Rectangle {
-                    id: dapToken
-                    border.color: "#000000"
-                    border.width: 1
-                    width: 60
-                    height: parent.height
-
-                    Image {
-                        id: dapPicToken
+        Column {
+            Rectangle {
+                id: dapDelegateContent
+                height: 60
+                width: dapListView.width
+                anchors.leftMargin: 30
+                anchors.rightMargin: 20
+
+                RowLayout {
+                    anchors.fill: parent
+                    spacing: 30
+
+                    Rectangle {
                         width: 30
-                        height: 30
-                        anchors.topMargin: 15
-                        anchors.bottomMargin: 15
-                        anchors.left: parent.right
-                        fillMode: Image.PreserveAspectFit
                     }
-                }
 
-                Rectangle {
-                    width: 246
-                    height: dapTokenName.contentHeight
-                    anchors.topMargin: 24
-                    anchors.bottomMargin: 24
-
-                    Text {
-                        id: dapTokenName
-                        text: tokenName
-                        color: "#4F5357"
-                        font.family: "Regular"
-                        font.pointSize: 12
+                    RowLayout {
+                        spacing: 14
+
+                        Rectangle {
+                            id: dapToken
+                            border.color: "#000000"
+                            border.width: 1
+                            width: 30
+                            height: 30
+                            anchors.topMargin: 15
+                            anchors.bottomMargin: 15
+
+                            Image {
+                                id: dapPicToken
+//                                anchors.left: parent.right
+                                fillMode: Image.PreserveAspectFit
+                            }
+                        }
+
+                        Rectangle {
+                            width: 246
+                            height: dapTokenName.contentHeight
+                            anchors.topMargin: 24
+                            anchors.bottomMargin: 24
+
+                            Text {
+                                id: dapTokenName
+                                anchors.fill: parent
+                                text: tokenName
+                                color: "#4F5357"
+                                font.family: "Regular"
+                                font.pointSize: 12
+                            }
+                        }
                     }
 
-                }
-
-                Rectangle {
-                    width: 330
-                    height: dapNumberWallet.contentHeight
-                    anchors.topMargin: 24
-                    anchors.bottomMargin: 24
-
-                    Text {
-                        id: dapNumberWallet
-                        text: numberWallet
-                        color: "#4F5357"
-                        font.family: "Regular"
-                        font.pointSize: 12
+                    Rectangle {
+                        width: 330
+                        height: dapNumberWallet.contentHeight
+                        anchors.topMargin: 24
+                        anchors.bottomMargin: 24
+
+                        Text {
+                            id: dapNumberWallet
+                            anchors.fill: parent
+                            text: numberWallet
+                            color: "#4F5357"
+                            font.family: "Regular"
+                            font.pointSize: 12
+                        }
                     }
-                }
 
 
-                Rectangle {
-                    width: 100
-                    height: dapStatus.contentHeight
-                    anchors.topMargin: 24
-                    anchors.bottomMargin: 24
+                    Rectangle {
+                        width: 100
+                        height: dapStatus.contentHeight
+                        anchors.topMargin: 24
+                        anchors.bottomMargin: 24
+
+                        Text {
+                            id: dapStatus
+                            anchors.fill: parent
+                            text: txStatus
+                            color: "#4F5357"
+                            font.family: "Regular"
+                            font.pointSize: 12
+                        }
+                    }
 
-                    Text {
-                        id: dapStatus
-                        text: txStatus
-                        color: "#4F5357"
-                        font.family: "Regular"
-                        font.pointSize: 12
+                    Rectangle {
+                        width: 264
+                        height: parent.height
+
+                        Column {
+                            anchors.fill: parent
+                            spacing: 9
+
+                            Rectangle {
+                                width: parent.width
+                                height: 6
+                            }
+
+
+                            Text {
+                                id: dapCurrency
+                                width: parent.width
+                                height: font.pointSize
+                                horizontalAlignment: Qt.AlignRight
+                                text: qsTr("KLV 123156315")
+                                color: "#4F5357"
+                                font.family: "Regular"
+                                font.pointSize: 12
+                            }
+
+
+                            Text {
+                                width: parent.width
+                                height: font.pointSize
+                                horizontalAlignment: Qt.AlignRight
+                                text: qsTr("$ 122125455568868")
+                                color: "#C2CAD1"
+                                font.family: "Regular"
+                                font.pointSize: 11
+                            }
+
+                            Rectangle {
+                                width: parent.width
+                                height: 6
+                            }
+                        }
                     }
                 }
+
+            }
+
+            Rectangle {
+//                anchors.left: dapToken.left
+                width: parent.width
+                height: 1
+                color: "#C2CAD1"
             }
         }
     }
-- 
GitLab