diff --git a/KelvinDashboardGUI/DapScreenHistoryModel.cpp b/KelvinDashboardGUI/DapScreenHistoryModel.cpp index 24656d6ef26e797c8a34d3729ebba18a6978e6fe..8683499828ff45a331d4697a579afc00c2855267 100644 --- a/KelvinDashboardGUI/DapScreenHistoryModel.cpp +++ b/KelvinDashboardGUI/DapScreenHistoryModel.cpp @@ -26,6 +26,22 @@ QHash<int, QByteArray> DapScreenHistoryModel::roleNames() const return names; } +QString DapScreenHistoryModel::toConvertCurrency(const QString& aMoney) const +{ + QString money; + + QStringList major = aMoney.split("."); + if(!major.isEmpty()) money = major.at(0); + else money = aMoney; + + for (int i = money.size() - 3; i >= 1; i -= 3) + money.insert(i, ' '); + + if(major.count() > 1) money.append("." + major.at(1)); + + return money; +} + void DapScreenHistoryModel::receiveNewData(const QVariant& aData) { if(!aData.isValid()) return; @@ -59,6 +75,7 @@ void DapScreenHistoryModel::receiveNewData(const QVariant& aData) default: break; } + item.Cryptocurrency = toConvertCurrency(item.Cryptocurrency); item.Cryptocurrency += " " + item.TokenName; m_elementList.append(item); diff --git a/KelvinDashboardGUI/DapScreenHistoryModel.h b/KelvinDashboardGUI/DapScreenHistoryModel.h index 4314fe2fb74fb20b37ad317ac7e24fac096b1cc0..b08ce517d93a72bdaa5aaf47d3527d53bff00925 100644 --- a/KelvinDashboardGUI/DapScreenHistoryModel.h +++ b/KelvinDashboardGUI/DapScreenHistoryModel.h @@ -55,6 +55,8 @@ public: QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; QHash<int, QByteArray> roleNames() const override; + Q_INVOKABLE QString toConvertCurrency(const QString& aMoney) const; + public slots: void receiveNewData(const QVariant& aData); }; diff --git a/KelvinDashboardGUI/DapUiQmlScreenDashboard.qml b/KelvinDashboardGUI/DapUiQmlScreenDashboard.qml index ad42c4374c14bb08a9bc2920d007cd5d9a110925..0c58bdff87d6b8a4efb52ef946e7b33ed4f6cf77 100755 --- a/KelvinDashboardGUI/DapUiQmlScreenDashboard.qml +++ b/KelvinDashboardGUI/DapUiQmlScreenDashboard.qml @@ -178,5 +178,7 @@ Page { source: "DapUiQmlScreenDialog.qml" } } + + } diff --git a/KelvinDashboardGUI/DapUiQmlScreenDialog.qml b/KelvinDashboardGUI/DapUiQmlScreenDialog.qml index 98b903eb12867843898e4c09555d6018915d510a..1b98ea59d14d267b693ede0324c13e46b57c8926 100644 --- a/KelvinDashboardGUI/DapUiQmlScreenDialog.qml +++ b/KelvinDashboardGUI/DapUiQmlScreenDialog.qml @@ -57,4 +57,6 @@ Page { listViewDapWidgets.addWidget() } } + + DapUiQmlWidgetLastActions {} } diff --git a/KelvinDashboardGUI/DapUiQmlWidgetLastActions.qml b/KelvinDashboardGUI/DapUiQmlWidgetLastActions.qml new file mode 100644 index 0000000000000000000000000000000000000000..87da7be00739196eebd4a3f3ea2ed24810fa7875 --- /dev/null +++ b/KelvinDashboardGUI/DapUiQmlWidgetLastActions.qml @@ -0,0 +1,145 @@ +import QtQuick 2.9 +import QtQml 2.12 +import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.12 + +import DapTransactionHistory 1.0 + +Rectangle { + width: 400 * pt + border.color: "#B5B5B5" + border.width: 1 * pt + color: "#EDEFF2" + + anchors { + top: parent.top + right: parent.right + bottom: parent.bottom + } + + Rectangle { + id: dapHeader + width: parent.width + height: 36 * pt + color: "#EDEFF2" + + Item { + width: childrenRect.width + height: childrenRect.height + anchors.top: parent.top + anchors.left: parent.left + + anchors.leftMargin: 16 * pt + anchors.topMargin: 13 + + Text { + text: qsTr("Last actions") + font.family: "Roboto" + font.pixelSize: 12 * pt + color: "#5F5F63" + } + } + } + + ListView { + id: dapListView + anchors.top: dapHeader.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + clip: true + + model: dapHistoryModel + delegate: dapDelegate + section.property: "date" + section.criteria: ViewSection.FullString + section.delegate: dapDate + + Component { + id: dapDate + Rectangle { + width: dapListView.width + height: 30 * pt + color: "#C2CAD1" + + Text { + anchors.fill: parent + verticalAlignment: Qt.AlignVCenter + horizontalAlignment: Qt.AlignLeft + color: "#797979" + text: section + font.family: "Roboto" + font.pixelSize: 12 * pt + leftPadding: 16 * pt + } + } + } + + Component { + id: dapDelegate + + Rectangle { + id: dapContentDelegate + width: parent.width + height: 50 * pt + color: "transparent" + + border.color: "#C2CAD1" + border.width: 1 * pt + + Rectangle { + id: dapData + width: childrenRect.width + height: childrenRect.height + Layout.alignment: Qt.AlignVCenter + anchors.left: dapContentDelegate.left + anchors.leftMargin: 16 * pt + anchors.top: parent.top + anchors.topMargin: 13 + + Column { + anchors.fill: parent + spacing: 2 + + Text { + text: tokenName + color: "#5F5F63" + font.family: "Roboto Regular" + font.pixelSize: 14 * pt + } + + Text { + text: txStatus + color: "#A7A7A7" + font.family: "Roboto" + font.pixelSize: 12 * pt + } + } + } + + Text { + anchors.left: dapData.right + anchors.top: parent.top + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.rightMargin: 20 * pt + + horizontalAlignment: Qt.AlignRight + verticalAlignment: Qt.AlignVCenter + color: "#505559" + text: cryptocurrency; + font.family: "Roboto" + font.pixelSize: 14 * pt + } + + Rectangle { + width: parent.width + height: 1 * pt + color: "#C7C9CC" + anchors.bottom: parent.bottom + } + } + } + + } +} diff --git a/KelvinDashboardGUI/main.cpp b/KelvinDashboardGUI/main.cpp index 0239d20a45384a95f552ef5eb871661320e579c9..93b34e115c8371e6394c9cfae0d18d99927ebdaf 100755 --- a/KelvinDashboardGUI/main.cpp +++ b/KelvinDashboardGUI/main.cpp @@ -86,7 +86,7 @@ int main(int argc, char *argv[]) // set.setGroupPropertyValue("widgets", "name", "Services client", "visible", f); // qDebug() << set.getGroupPropertyValue("widgets", "name", "Services client", "visible").toBool(); // qDebug() << set.getKeyValue("user"); - + if (engine.rootObjects().isEmpty()) return -1; diff --git a/KelvinDashboardGUI/qml.qrc b/KelvinDashboardGUI/qml.qrc index a3f93cb2cf1d28dc7316663de2b99bcbd4394936..ab19a46678cc4e811126b07a6163783ff9d25cf7 100755 --- a/KelvinDashboardGUI/qml.qrc +++ b/KelvinDashboardGUI/qml.qrc @@ -28,6 +28,7 @@ <file>DapUiQmlWidgetConsole.qml</file> <file>DapUiQmlWidgetNodeNetworkExplorer.qml</file> <file>DapUiQmlScreenHistory.qml</file> -<file>Resources/Icons/defaul_icon.png</file> + <file>Resources/Icons/defaul_icon.png</file> + <file>DapUiQmlWidgetLastActions.qml</file> </qresource> </RCC>