From 71135113b37d692903ed0f9107c9335cefc43656 Mon Sep 17 00:00:00 2001 From: "andrey.daragan" <daragan.andrey@demlabs.net> Date: Thu, 13 Feb 2020 11:41:57 +0000 Subject: [PATCH] features-3108 --- .../DapServiceController.cpp | 2 +- .../desktop/Dashboard/DapDashboardScreen.qml | 2 +- .../DapNewPaymentMainRightPanelForm.ui.qml | 5 +- .../desktop/History/DapHistoryScreen.qml | 76 +++++++------------ .../History/DapHistoryScreenForm.ui.qml | 3 +- .../DapWalletHistoryEvent.cpp | 26 +++++-- .../DapWalletHistoryEvent.h | 5 ++ .../Handlers/DapGetWalletHistoryCommand.cpp | 1 + 8 files changed, 61 insertions(+), 59 deletions(-) diff --git a/CellFrameDashboardGUI/DapServiceController.cpp b/CellFrameDashboardGUI/DapServiceController.cpp index 79c47f2..ac7a4f1 100644 --- a/CellFrameDashboardGUI/DapServiceController.cpp +++ b/CellFrameDashboardGUI/DapServiceController.cpp @@ -81,6 +81,7 @@ void DapServiceController::requestToService(const QString &asServiceName, const { DapAbstractCommand * transceiver = dynamic_cast<DapAbstractCommand*>(m_DAPRpcSocket->findService(asServiceName)); Q_ASSERT(transceiver); + disconnect(transceiver, SIGNAL(serviceResponded(QVariant)), this, SLOT(findEmittedSignal(QVariant))); connect(transceiver, SIGNAL(serviceResponded(QVariant)), SLOT(findEmittedSignal(QVariant))); transceiver->requestToService(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); } @@ -186,7 +187,6 @@ void DapServiceController::registerCommand() void DapServiceController::findEmittedSignal(const QVariant &aValue) { DapAbstractCommand * transceiver = dynamic_cast<DapAbstractCommand *>(sender()); - disconnect(transceiver, SIGNAL(serviceResponded(QVariant)), this, SLOT(findEmittedSignal(QVariant))); Q_ASSERT(transceiver); auto service = std::find_if(m_transceivers.begin(), m_transceivers.end(), [=] (const QPair<DapAbstractCommand*, QString>& it) { diff --git a/CellFrameDashboardGUI/screen/desktop/Dashboard/DapDashboardScreen.qml b/CellFrameDashboardGUI/screen/desktop/Dashboard/DapDashboardScreen.qml index 6f50966..84bf34b 100644 --- a/CellFrameDashboardGUI/screen/desktop/Dashboard/DapDashboardScreen.qml +++ b/CellFrameDashboardGUI/screen/desktop/Dashboard/DapDashboardScreen.qml @@ -82,7 +82,7 @@ DapDashboardScreenForm height: 16 * pt hoverEnabled: true - onClicked: textMetworkAddress.copy() + onClicked: textMetworkAddress.copyFullText() Image diff --git a/CellFrameDashboardGUI/screen/desktop/Dashboard/RightPanel/DapNewPaymentMainRightPanelForm.ui.qml b/CellFrameDashboardGUI/screen/desktop/Dashboard/RightPanel/DapNewPaymentMainRightPanelForm.ui.qml index 21400ed..aacee3a 100644 --- a/CellFrameDashboardGUI/screen/desktop/Dashboard/RightPanel/DapNewPaymentMainRightPanelForm.ui.qml +++ b/CellFrameDashboardGUI/screen/desktop/Dashboard/RightPanel/DapNewPaymentMainRightPanelForm.ui.qml @@ -18,7 +18,7 @@ DapAbstractRightPanel property string dapCurrentWallet - property alias dapTextSenderWalletAddress: textSenderWalletAddress.text + property alias dapTextSenderWalletAddress: textSenderWalletAddress.fullText /// @param dapTextInputRecipientWalletAddress Recipient wallet address input field. property alias dapTextInputRecipientWalletAddress: textInputRecipientWalletAddress @@ -154,7 +154,7 @@ DapAbstractRightPanel anchors.leftMargin: 20 * pt anchors.rightMargin: 20 * pt } - Text + DapText { id: textSenderWalletAddress width: 328 * pt @@ -169,7 +169,6 @@ DapAbstractRightPanel font.styleName: "Normal" font.weight: Font.Normal color: "#757184" - elide: Text.ElideRight } } diff --git a/CellFrameDashboardGUI/screen/desktop/History/DapHistoryScreen.qml b/CellFrameDashboardGUI/screen/desktop/History/DapHistoryScreen.qml index daeb6ba..2b38345 100644 --- a/CellFrameDashboardGUI/screen/desktop/History/DapHistoryScreen.qml +++ b/CellFrameDashboardGUI/screen/desktop/History/DapHistoryScreen.qml @@ -8,55 +8,35 @@ DapHistoryScreenForm id: historyScreen ListModel { - id: testModel - ListElement - { - date: "6, february" - token: "KELT" - status: "Sent" - amount: "165489878556" - } - ListElement - { - date: "6, february" - token: "DAG" - status: "Received" - amount: "333559878556" - } - ListElement - { - date: "5, february" - token: "KELT" - status: "Error" - amount: "165489878556" - } - ListElement - { - date: "5, february" - token: "DAG" - status: "Panding" - amount: "333559878556" - } - ListElement - { - date: "7, february" - token: "DAG" - status: "Received" - amount: "333559878556" - } - ListElement + id: modelHistory + } + + Component.onCompleted: + { + for(var i=0; i < dapModelWallets.count; ++i) { - date: "3, february" - token: "KELT" - status: "Error" - amount: "165489878556" + modelHistory.clear() + dapServiceController.requestToService("DapGetWalletHistoryCommand", + dapServiceController.CurrentNetwork, + dapServiceController.CurrentChain, + dapWallets[i].findAddress(dapServiceController.CurrentNetwork), + dapWallets[i].Name) } - ListElement + } + + Connections + { + target: dapServiceController + onWalletHistoryReceived: { - date: "5, february" - token: "DAG" - status: "Panding" - amount: "333559878556" + for (var q = 0; q < walletHistory.length; ++q) + { + modelHistory.append({ "wallet" : walletHistory[q].Wallet, + "name" : walletHistory[q].Name, + "status" : walletHistory[q].Status, + "amount" : walletHistory[q].Amount, + "date" : walletHistory[q].Date}) + } } } @@ -130,7 +110,7 @@ DapHistoryScreenForm { id: textTokenName anchors.fill: parent - text: token + text: name color: "#070023" font.family: "Roboto" font.styleName: "Normal" @@ -195,7 +175,7 @@ DapHistoryScreenForm id: lblAmount width: parent.width property string sign: (status === "Sent" || status === "Pending") ? "- " : "+ " - text: sign + amount + " " + token + text: sign + amount + " " + name color: "#070023" font.family: "Roboto" font.styleName: "Normal" diff --git a/CellFrameDashboardGUI/screen/desktop/History/DapHistoryScreenForm.ui.qml b/CellFrameDashboardGUI/screen/desktop/History/DapHistoryScreenForm.ui.qml index 19eadaf..98ce907 100644 --- a/CellFrameDashboardGUI/screen/desktop/History/DapHistoryScreenForm.ui.qml +++ b/CellFrameDashboardGUI/screen/desktop/History/DapHistoryScreenForm.ui.qml @@ -11,10 +11,11 @@ DapAbstractScreen anchors.topMargin: 24 * pt anchors.leftMargin: 24 * pt anchors.rightMargin: 24 * pt - model: testModel + model: modelHistory delegate: delegateToken section.property: "date" section.criteria: ViewSection.FullString section.delegate: delegateDate + clip: true } } diff --git a/libCellFrameDashboardCommon/DapWalletHistoryEvent.cpp b/libCellFrameDashboardCommon/DapWalletHistoryEvent.cpp index 0d6a1a5..e56e150 100644 --- a/libCellFrameDashboardCommon/DapWalletHistoryEvent.cpp +++ b/libCellFrameDashboardCommon/DapWalletHistoryEvent.cpp @@ -2,11 +2,11 @@ DapWalletHistoryEvent::DapWalletHistoryEvent(QObject *parent) : QObject(parent) { - + } DapWalletHistoryEvent::DapWalletHistoryEvent(const DapWalletHistoryEvent &aHistoryEvent) - : m_sName(aHistoryEvent.m_sName), m_sStatus(aHistoryEvent.m_sStatus), + : QObject(aHistoryEvent.parent()),m_sWallet(aHistoryEvent.m_sWallet), m_sName(aHistoryEvent.m_sName), m_sStatus(aHistoryEvent.m_sStatus), m_dAmount(aHistoryEvent.m_dAmount), m_sDate(aHistoryEvent.m_sDate) { @@ -14,6 +14,7 @@ DapWalletHistoryEvent::DapWalletHistoryEvent(const DapWalletHistoryEvent &aHisto DapWalletHistoryEvent &DapWalletHistoryEvent::operator=(const DapWalletHistoryEvent &aHistoryEvent) { + m_sWallet = aHistoryEvent.m_sWallet; m_sName = aHistoryEvent.m_sName; m_sStatus = aHistoryEvent.m_sStatus; m_dAmount = aHistoryEvent.m_dAmount; @@ -23,12 +24,25 @@ DapWalletHistoryEvent &DapWalletHistoryEvent::operator=(const DapWalletHistoryEv bool DapWalletHistoryEvent::operator==(const DapWalletHistoryEvent &aHistoryEvent) const { - return (m_sName == aHistoryEvent.m_sName) + return (m_sWallet == aHistoryEvent.m_sWallet) + && (m_sName == aHistoryEvent.m_sName) && (m_sStatus == aHistoryEvent.m_sStatus) && (m_dAmount == aHistoryEvent.m_dAmount) && (m_sDate == aHistoryEvent.m_sDate); } +QString DapWalletHistoryEvent::getWallet() const +{ + return m_sWallet; +} + +void DapWalletHistoryEvent::setWallet(const QString &sWallet) +{ + m_sWallet = sWallet; + + emit walletChanged(m_sWallet); +} + QString DapWalletHistoryEvent::getName() const { return m_sName; @@ -79,7 +93,8 @@ void DapWalletHistoryEvent::setDate(const QString &sDate) QDataStream& operator << (QDataStream& aOut, const DapWalletHistoryEvent& aHistoryEvent) { - aOut << aHistoryEvent.m_sName + aOut << aHistoryEvent.m_sWallet + << aHistoryEvent.m_sName << aHistoryEvent.m_dAmount << aHistoryEvent.m_sStatus << aHistoryEvent.m_sDate; @@ -88,7 +103,8 @@ QDataStream& operator << (QDataStream& aOut, const DapWalletHistoryEvent& aHisto QDataStream& operator >> (QDataStream& aOut, DapWalletHistoryEvent& aHistoryEvent) { - aOut >> aHistoryEvent.m_sName; + aOut >> aHistoryEvent.m_sWallet + >> aHistoryEvent.m_sName; aOut.setFloatingPointPrecision(QDataStream::DoublePrecision); aOut >> aHistoryEvent.m_dAmount; aOut >> aHistoryEvent.m_sStatus diff --git a/libCellFrameDashboardCommon/DapWalletHistoryEvent.h b/libCellFrameDashboardCommon/DapWalletHistoryEvent.h index 6bbb933..5e6c1b4 100644 --- a/libCellFrameDashboardCommon/DapWalletHistoryEvent.h +++ b/libCellFrameDashboardCommon/DapWalletHistoryEvent.h @@ -9,6 +9,7 @@ class DapWalletHistoryEvent : public QObject { Q_OBJECT + QString m_sWallet; /// Token name. QString m_sName; /// Token balance. @@ -24,6 +25,7 @@ public: DapWalletHistoryEvent& operator=(const DapWalletHistoryEvent& aHistoryEvent); bool operator==(const DapWalletHistoryEvent& aHistoryEvent) const; + Q_PROPERTY(QString Wallet MEMBER m_sWallet READ getWallet WRITE setWallet NOTIFY walletChanged) Q_PROPERTY(QString Name MEMBER m_sName READ getName WRITE setName NOTIFY nameChanged) Q_PROPERTY(double Amount MEMBER m_dAmount READ getAmount WRITE setAmount NOTIFY amountChanged) Q_PROPERTY(QString Status MEMBER m_sName READ getStatus WRITE setStatus NOTIFY statusChanged) @@ -33,12 +35,15 @@ public: friend QDataStream& operator >> (QDataStream& aOut, DapWalletHistoryEvent& aHistoryEvent); signals: + void walletChanged(const QString& asWallet); void nameChanged(const QString& asName); void amountChanged(const double& adAmount); void statusChanged(const QString& asStatus); void dateChanged(const QString& asDate); public slots: + QString getWallet() const; + void setWallet(const QString &sWallet); QString getName() const; void setName(const QString &sName); double getAmount() const; diff --git a/libCellFrameDashboardCommon/Handlers/DapGetWalletHistoryCommand.cpp b/libCellFrameDashboardCommon/Handlers/DapGetWalletHistoryCommand.cpp index 8571bd6..5007026 100644 --- a/libCellFrameDashboardCommon/Handlers/DapGetWalletHistoryCommand.cpp +++ b/libCellFrameDashboardCommon/Handlers/DapGetWalletHistoryCommand.cpp @@ -50,6 +50,7 @@ QVariant DapGetWalletHistoryCommand::respondToClient(const QVariant &arg1, const event.setStatus(match.captured(4) == "send" ? "Sent" : "Received"); event.setAmount(match.captured(5).toDouble()); event.setName(match.captured(6)); + event.setWallet(arg4.toString()); events.append(event); } } -- GitLab