Skip to content
Snippets Groups Projects
Commit 78431b49 authored by jonymt's avatar jonymt
Browse files

[+] added last actions widget

parent bd834faa
No related branches found
No related tags found
1 merge request!11Features 2420
Pipeline #683 passed with stage
in 3 minutes
...@@ -26,6 +26,22 @@ QHash<int, QByteArray> DapScreenHistoryModel::roleNames() const ...@@ -26,6 +26,22 @@ QHash<int, QByteArray> DapScreenHistoryModel::roleNames() const
return names; 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) void DapScreenHistoryModel::receiveNewData(const QVariant& aData)
{ {
if(!aData.isValid()) return; if(!aData.isValid()) return;
...@@ -59,6 +75,7 @@ void DapScreenHistoryModel::receiveNewData(const QVariant& aData) ...@@ -59,6 +75,7 @@ void DapScreenHistoryModel::receiveNewData(const QVariant& aData)
default: break; default: break;
} }
item.Cryptocurrency = toConvertCurrency(item.Cryptocurrency);
item.Cryptocurrency += " " + item.TokenName; item.Cryptocurrency += " " + item.TokenName;
m_elementList.append(item); m_elementList.append(item);
......
...@@ -55,6 +55,8 @@ public: ...@@ -55,6 +55,8 @@ public:
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QHash<int, QByteArray> roleNames() const override; QHash<int, QByteArray> roleNames() const override;
Q_INVOKABLE QString toConvertCurrency(const QString& aMoney) const;
public slots: public slots:
void receiveNewData(const QVariant& aData); void receiveNewData(const QVariant& aData);
}; };
......
...@@ -178,5 +178,7 @@ Page { ...@@ -178,5 +178,7 @@ Page {
source: "DapUiQmlScreenDialog.qml" source: "DapUiQmlScreenDialog.qml"
} }
} }
} }
...@@ -57,4 +57,6 @@ Page { ...@@ -57,4 +57,6 @@ Page {
listViewDapWidgets.addWidget() listViewDapWidgets.addWidget()
} }
} }
DapUiQmlWidgetLastActions {}
} }
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
}
}
}
}
}
...@@ -86,7 +86,7 @@ int main(int argc, char *argv[]) ...@@ -86,7 +86,7 @@ int main(int argc, char *argv[])
// set.setGroupPropertyValue("widgets", "name", "Services client", "visible", f); // set.setGroupPropertyValue("widgets", "name", "Services client", "visible", f);
// qDebug() << set.getGroupPropertyValue("widgets", "name", "Services client", "visible").toBool(); // qDebug() << set.getGroupPropertyValue("widgets", "name", "Services client", "visible").toBool();
// qDebug() << set.getKeyValue("user"); // qDebug() << set.getKeyValue("user");
if (engine.rootObjects().isEmpty()) if (engine.rootObjects().isEmpty())
return -1; return -1;
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
<file>DapUiQmlWidgetConsole.qml</file> <file>DapUiQmlWidgetConsole.qml</file>
<file>DapUiQmlWidgetNodeNetworkExplorer.qml</file> <file>DapUiQmlWidgetNodeNetworkExplorer.qml</file>
<file>DapUiQmlScreenHistory.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> </qresource>
</RCC> </RCC>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment