diff --git a/CellFrameDashboardGUI/DapServiceController.cpp b/CellFrameDashboardGUI/DapServiceController.cpp index f8c3ceea65ab60f7a618fc2a78c018689a7ab6d6..287c69994120a4121b479452c95c845714ba1675 100644 --- a/CellFrameDashboardGUI/DapServiceController.cpp +++ b/CellFrameDashboardGUI/DapServiceController.cpp @@ -93,6 +93,10 @@ void DapServiceController::registerCommand() m_transceivers.append(qMakePair(dynamic_cast<DapAbstractCommand*>(m_DAPRpcSocket->addService(new DapGetWalletAddressesCommand("DapGetWalletAddressesCommand", m_DAPRpcSocket))), QString("walletAddressesReceived"))); m_transceivers.append(qMakePair(dynamic_cast<DapAbstractCommand*>(m_DAPRpcSocket->addService(new DapGetWalletTokenInfoCommand("DapGetWalletTokenInfoCommand", m_DAPRpcSocket))), QString("walletTokensReceived"))); + // Creating a token transfer transaction between wallets + m_transceivers.append(qMakePair(dynamic_cast<DapAbstractCommand*>(m_DAPRpcSocket->addService(new DapCreateTransactionCommand("DapCreateTransactionCommand",m_DAPRpcSocket))), QString("transactionCreated"))); + // Transaction confirmation + m_transceivers.append(qMakePair(dynamic_cast<DapAbstractCommand*>(m_DAPRpcSocket->addService(new DapMempoolProcessCommand("DapMempoolProcessCommand",m_DAPRpcSocket))), QString("mempoolProcessed"))); registerEmmitedSignal(); } diff --git a/CellFrameDashboardGUI/DapServiceController.h b/CellFrameDashboardGUI/DapServiceController.h index 98d19eb7fe87e1d8c31a71a9fafdca382140004d..50270917e3aab49f2e3efb195d9b6323422ea469 100644 --- a/CellFrameDashboardGUI/DapServiceController.h +++ b/CellFrameDashboardGUI/DapServiceController.h @@ -22,6 +22,8 @@ #include "Handlers/DapGetWalletAddressesCommand.h" #include "Handlers/DapGetWalletTokenInfoCommand.h" #include "Models/DapWalletModel.h" +#include "Handlers/DapCreateTransactionCommand.h" +#include "Handlers/DapMempoolProcessCommand.h" class DapServiceController : public QObject { @@ -96,6 +98,12 @@ signals: ///A signal that is used to transmit data to the log model. /// @param logUpdated QStringList void logUpdated(const QVariant& logs); + /// A signal is emitted if a transaction is successfully created. + /// @param aResult Transaction result. + void transactionCreated(const QVariant& aResult); + /// Signal emitted in case of successful processing of the mempool. + /// @param aResult Mempool processing result. + void mempoolProcessed(const QVariant& aResult); void walletCreated(const QVariant& wallet); diff --git a/CellFrameDashboardGUI/qml.qrc b/CellFrameDashboardGUI/qml.qrc index d00e6d187cd143f10a398e6d8cd5dec47719d85a..a5825b0271d3574338a08b7ad531ec73ad57e2b7 100755 --- a/CellFrameDashboardGUI/qml.qrc +++ b/CellFrameDashboardGUI/qml.qrc @@ -139,5 +139,9 @@ <file>res/icons/tkn2_icon.png</file> <file>res/icons/tkn1_icon_light.png</file> <file>res/icons/ng_icon.png</file> + <file>screen/desktop/Dashboard/RightPanel/DapNewPaymentMainRightPanel.qml</file> + <file>screen/desktop/Dashboard/RightPanel/DapNewPaymentMainRightPanelForm.ui.qml</file> + <file>screen/desktop/Dashboard/RightPanel/DapNewPaymentDoneRightPanel.qml</file> + <file>screen/desktop/Dashboard/RightPanel/DapNewPaymentDoneRightPanelForm.ui.qml</file> </qresource> </RCC> diff --git a/CellFrameDashboardGUI/screen/DapAbstractRightPanelForm.ui.qml b/CellFrameDashboardGUI/screen/DapAbstractRightPanelForm.ui.qml index 7367ee6e757b08f2c85789e58b1ea7a64de5ff79..256e3df3b5dfee743c0dc932a7f050b51d583fc9 100644 --- a/CellFrameDashboardGUI/screen/DapAbstractRightPanelForm.ui.qml +++ b/CellFrameDashboardGUI/screen/DapAbstractRightPanelForm.ui.qml @@ -22,6 +22,5 @@ DapRightPanel } dapHeader.height: 36 * pt - dapFrame.height: parent.height color: "#F8F7FA" } diff --git a/CellFrameDashboardGUI/screen/DapAbstractScreenForm.ui.qml b/CellFrameDashboardGUI/screen/DapAbstractScreenForm.ui.qml index b97ec8ec9f6ed50157f37fecad7b39943e7439f3..07cf57f2359ff90c65029fe3a9f6e1ce0a767b27 100644 --- a/CellFrameDashboardGUI/screen/DapAbstractScreenForm.ui.qml +++ b/CellFrameDashboardGUI/screen/DapAbstractScreenForm.ui.qml @@ -4,7 +4,6 @@ import "qrc:/widgets" DapScreen { - dapFrame.height: parent.height property Button buttonTest: Button {} property Text textTest: Text {} } diff --git a/CellFrameDashboardGUI/screen/DapAbstractTabForm.ui.qml b/CellFrameDashboardGUI/screen/DapAbstractTabForm.ui.qml index a0c6d083d2d16b565e4fc424ee69beeed04ae0eb..c4b98ed4f8d0823209aae7824c56b85741a08885 100644 --- a/CellFrameDashboardGUI/screen/DapAbstractTabForm.ui.qml +++ b/CellFrameDashboardGUI/screen/DapAbstractTabForm.ui.qml @@ -3,6 +3,9 @@ import "qrc:/widgets" DapTab { + ///@detalis Currently displayed right pane + property DapRightPanel currentRightPanel + dapSeparator.width: 1 * pt dapSeparator.color: "#E3E2E6" } diff --git a/CellFrameDashboardGUI/screen/DapMainApplicationWindow.qml b/CellFrameDashboardGUI/screen/DapMainApplicationWindow.qml index 19caabf7b2b9373550619824fc0be1918ea775cc..73e879aae951404f95164cb8539956acc544e601 100644 --- a/CellFrameDashboardGUI/screen/DapMainApplicationWindow.qml +++ b/CellFrameDashboardGUI/screen/DapMainApplicationWindow.qml @@ -25,7 +25,6 @@ DapMainApplicationWindowForm Component.onCompleted: { - append({ name: qsTr("Dashboard"), page: dashboardScreen, diff --git a/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleRightPanel.qml b/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleRightPanel.qml index 6bfb0620aa94be82ee809256554bca6c63c48f17..fdd8fd57c56496c4cfb46a7ad0c5015d930036b6 100644 --- a/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleRightPanel.qml +++ b/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleRightPanel.qml @@ -2,24 +2,64 @@ import QtQuick 2.4 DapConsoleRightPanelForm { + ///@detalis commandQuery Command for history. + property string commandQuery + ///@detalis historyQuery Text of command from the command history. + property string historyQuery + ///@detalis historySize Num of history command at right panel. + property int historySize: 10 + + dapRightPanelWidth: visible ? 300 * pt : 0 * pt + ListModel { id: modelHistoryConsole ListElement { - query: "help" + query: "help1" } ListElement { - query: "wallet list" + query: "wallet list1" } ListElement { - query: "help" + query: "help2" } ListElement { - query: "wallet list" + query: "wallet list2" + } + } + + //Returns true if item 'someElement' is already exist at list 'someModel'. + function findElement(someModel, someElement) + { + console.log("someElement.query", someElement.query) + for(var i = 0; i < someModel.count; ++i) + if(someModel.get(i).query === someElement.query) + { + modelHistoryConsole.remove(i); + return true; + } + + return false; + } + + onCommandQueryChanged: + { + console.log("commandQuery", commandQuery) + //Adding only new element + if(!findElement(modelHistoryConsole, {query: commandQuery})) + { + if(commandQuery !== "") + modelHistoryConsole.insert(0, {query: commandQuery}); } + else + modelHistoryConsole.insert(0, {query: commandQuery}); + + //History is limited by historySize and realized as FIFO + if(historySize < modelHistoryConsole.count) + modelHistoryConsole.remove(modelHistoryConsole.count-1); } } diff --git a/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleRightPanelForm.ui.qml b/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleRightPanelForm.ui.qml index 5a7c8c0fc6e60c4f227fca206383ae629abb2182..cf57d06c387eab53e252477aaabd5d21ba91aaab 100644 --- a/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleRightPanelForm.ui.qml +++ b/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleRightPanelForm.ui.qml @@ -13,6 +13,7 @@ DapAbstractRightPanel { anchors.fill: parent anchors.leftMargin: 16 * pt + anchors.rightMargin: 16 * pt text: qsTr("Last actions") verticalAlignment: Qt.AlignVCenter horizontalAlignment: Text.AlignLeft @@ -54,10 +55,23 @@ DapAbstractRightPanel id: textCommand text: query color: "#070023" + width: parent.width + wrapMode: Text.Wrap font.pixelSize: 14 * pt font.family: "Roboto" font.weight: Font.Normal + //For the automatic sending selected command from history + MouseArea + { + id: historyQueryMouseArea + anchors.fill: textCommand + onDoubleClicked: historyQuery = textCommand.text + } } + //It allows to see last element of list by default + currentIndex: count - 1 + highlightFollowsCurrentItem: true + highlightRangeMode: ListView.ApplyRange } } } diff --git a/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleScreen.qml b/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleScreen.qml index 60a06a8bcef5b3361cdb63d57a2da74ca3f7b7e3..79fc3e6119ed07a655a5b11850a18b70cf694454 100644 --- a/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleScreen.qml +++ b/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleScreen.qml @@ -4,6 +4,40 @@ import QtQuick.Layouts 1.0 DapConsoleScreenForm { + ///@detalis sendCommand Text of command from the inputCommand + property string sendCommand + ///@detalis historyCommand Text of command from the command history + property string historyCommand + ///@detalis receivedAnswer Answer for the sended command + property string receivedAnswer + + + Component.onCompleted: + { + //The start point for using history + consoleHistoryIndex = modelConsoleCommand.count + } + + QtObject + { + id: themeConsole + property font inputCommandFont: + Qt.font({ + pixelSize: 18 * pt, + family: "Roboto", + styleName: "Normal", + weight: Font.Normal + }) + + property font consoleCommandFont: + Qt.font({ + pixelSize: 18 * pt, + family: "Roboto", + styleName: "Normal", + weight: Font.Normal + }) + } + ListModel { id: modelConsoleCommand @@ -12,6 +46,18 @@ DapConsoleScreenForm query: "Command" response: "This answer" } + ListElement + { + query: "Command" + response: "This answer may be very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very long" + } + ListElement + { + query: "One little query" + response: "One little response" + } + + } Component @@ -19,18 +65,59 @@ DapConsoleScreenForm id: delegateConsoleCommand Column { + width: parent.width Text { id: textQuery text: "> " + query - font.pixelSize: 14 * pt + font: themeConsole.consoleCommandFont } Text { id: textResponse text: response - font.pixelSize: 14 * pt + width: parent.width + wrapMode: Text.Wrap + font: themeConsole.consoleCommandFont + } + } + } + + //Send command from inputCommand TextArea + onSendedCommandChanged: + { + if(sendedCommand != "") + { + sendCommand = sendedCommand; + modelConsoleCommand.append({query: sendedCommand, response: receivedAnswer}); + consoleHistoryIndex = modelConsoleCommand.count; + sendedCommand = ""; + } + } + + //Send command fron right history panel + onHistoryCommandChanged: + { + sendCommand = historyCommand; + modelConsoleCommand.append({query: sendCommand, response: receivedAnswer}); + consoleHistoryIndex = modelConsoleCommand.count; + } + + //Using KeyUp and KeyDown to serf on console history + onConsoleHistoryIndexChanged: + { + if(consoleHistoryIndex >= 0) + { + if(consoleHistoryIndex >= modelConsoleCommand.count) + { + consoleHistoryIndex = modelConsoleCommand.count; + currentCommand = ""; + return; } } + else + consoleHistoryIndex = 0; + currentCommand = modelConsoleCommand.get(consoleHistoryIndex).query; + return; } } diff --git a/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleScreenForm.ui.qml b/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleScreenForm.ui.qml index 52a42384bbdd62fbe96d604bdb7714de443d227b..f2bf41aae63ddd92cb8102d541ab2368648bc66a 100644 --- a/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleScreenForm.ui.qml +++ b/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleScreenForm.ui.qml @@ -1,16 +1,31 @@ import QtQuick 2.4 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.0 +import "qrc:/widgets" import "../../" DapAbstractScreen { + id: consoleScreen + + ///@detalis sendedCommand Text of command from the inputCommand. + property string sendedCommand + ///@detalis isCommandSended Sing of sending. + property bool isCommandSended + ///@detalis currentCommand Current text in consoleCmd. + property alias currentCommand: consoleCmd.text + ///@detalis consoleHistoryIndex Index for using KeyUp and KeyDown to the navigation in console history. + property int consoleHistoryIndex + Rectangle { + id: consoleRectangle anchors.fill: parent anchors.topMargin: 24 * pt anchors.leftMargin: 20 * pt anchors.rightMargin: 20 * pt + anchors.bottomMargin: 20 * pt + ListView { @@ -18,21 +33,29 @@ DapAbstractScreen anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right - anchors.bottom: inputCommand.top + height: (contentHeight < consoleRectangle.height - inputCommand.height) ? contentHeight : consoleRectangle.height - inputCommand.height clip: true model: modelConsoleCommand delegate: delegateConsoleCommand + currentIndex: count - 1 + highlightFollowsCurrentItem: true + highlightRangeMode: ListView.ApplyRange + DapScrollViewHandling + { + id: scrollHandler + viewData: listViewConsoleCommand + scrollMouseAtArrow: consoleScroll.mouseAtArrow + } } RowLayout { id: inputCommand - spacing: 0 - - anchors.bottom: parent.bottom anchors.left: parent.left anchors.right: parent.right + anchors.top: listViewConsoleCommand.bottom + height: consoleCmd.contentHeight Text { @@ -40,9 +63,7 @@ DapAbstractScreen verticalAlignment: Qt.AlignVCenter text: ">" color: "#070023" - font.pixelSize: 18 * pt - font.family: "Roboto" - font.weight: Font.Normal + font: themeConsole.inputCommandFont } TextArea @@ -53,10 +74,31 @@ DapAbstractScreen placeholderText: qsTr("Type here...") selectByMouse: true focus: true - font.pixelSize: 18 * pt - font.family: "Roboto" - font.weight: Font.Normal - } + font: themeConsole.inputCommandFont + Keys.onReturnPressed: text.length > 0 ? sendedCommand = text : sendedCommand = "" + Keys.onEnterPressed: text.length > 0 ? sendedCommand = text : sendedCommand = "" + Keys.onUpPressed: consoleHistoryIndex -= 1 + Keys.onDownPressed: consoleHistoryIndex += 1 + } } + + } + + DapScrollView + { + id: consoleScroll + scrollDownButtonImageSource: "qrc:/res/icons/ic_scroll-down.png" + scrollDownButtonHoveredImageSource: "qrc:/res/icons/ic_scroll-down_hover.png" + scrollUpButtonImageSource: "qrc:/res/icons/ic_scroll-up.png" + scrollUpButtonHoveredImageSource: "qrc:/res/icons/ic_scroll-up_hover.png" + viewData: listViewConsoleCommand + //Assign DapScrollView with DapScrollViewHandling which must have no parent-child relationship + onClicked: scrollHandler.scrollDirectionUp = !scrollHandler.scrollDirectionUp + scrollButtonVisible: scrollHandler.scrollVisible + scrollButtonArrowUp: scrollHandler.scrollDirectionUp + scrollButtonTopMargin: 10 * pt + scrollButtonBottomMargin: 10 * pt + scrollButtonLeftMargin: 10 * pt + scrollButtonRightMargin: 10 * pt } } diff --git a/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleTab.qml b/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleTab.qml index f50b551a97ff7f2ef96fb0255aca79abd7a7a0b1..aa7a4b51a1823613013094cb20dfe2a763fe0a95 100644 --- a/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleTab.qml +++ b/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleTab.qml @@ -1,6 +1,8 @@ import QtQuick 2.4 +import "qrc:/" DapConsoleTabForm { - + //The console interface need in command handler + // Handler answer must be set to rAnswer } diff --git a/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleTabForm.ui.qml b/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleTabForm.ui.qml index 4576be55a74972450548bff0658f9f908dac14f7..c27d9ef11e4c997c7022dce9a9bfa5cde0068e56 100644 --- a/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleTabForm.ui.qml +++ b/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleTabForm.ui.qml @@ -6,9 +6,24 @@ DapAbstractTab { id: consoleTab + ///@detalis rAnswer Answer for the sended command + property string rAnswer + dapTopPanel: DapConsoleTopPanel { } - dapScreen: DapConsoleScreen { } + dapScreen: + DapConsoleScreen + { + //Set receivedAnswer of dapScreen to the external variable rAnswer for the displaying it in console + receivedAnswer: rAnswer + //Assign historyCommand of dapScreen with dapRightPanel.historyQuery for ability to use right history panel to send command to the console + historyCommand: dapRightPanel.historyQuery + } - dapRightPanel: DapConsoleRightPanel { } + dapRightPanel: + DapConsoleRightPanel + { + //Assign commandQuery of dapRightPanel with dapScreen.sendCommand for set it to right history panelfrome console + commandQuery: dapScreen.sendCommand + } } diff --git a/CellFrameDashboardGUI/screen/desktop/Dashboard/DapDashboardScreenForm.ui.qml b/CellFrameDashboardGUI/screen/desktop/Dashboard/DapDashboardScreenForm.ui.qml index 809270dec82f5843dfc8c04147fbc7e9a68fb096..f3ffbb4de216fe0fb4b5a50c60bad5b643d1f9e1 100644 --- a/CellFrameDashboardGUI/screen/desktop/Dashboard/DapDashboardScreenForm.ui.qml +++ b/CellFrameDashboardGUI/screen/desktop/Dashboard/DapDashboardScreenForm.ui.qml @@ -6,7 +6,7 @@ import "../../" DapAbstractScreen { - id: dapdashboard + id: dapDashboardScreen dapFrame.color: "#FFFFFF" anchors.fill: parent anchors.leftMargin: 24 * pt @@ -17,6 +17,8 @@ DapAbstractScreen property string ethereumImagePath: "qrc:/res/icons/tkn2_icon.png" property string newGoldImagePath: "qrc:/res/icons/ng_icon.png" property string kelvinImagePath: "qrc:/res/icons/ic_klvn.png" + ///@param dapButtonNewPayment Button to create a new payment. + property alias dapButtonNewPayment: buttonNewPayment property alias dapListViewWallets: listViewWallets @@ -69,11 +71,12 @@ DapAbstractScreen DapButton { + id: buttonNewPayment widthButton: 132 * pt heightButton: 36 * pt textButton: "New payment" - colorBackgroundButton: "#3E3853" - colorBackgroundHover: "red" + colorBackgroundHover: "#D51F5D" + colorBackgroundNormal: "#070023" colorButtonTextNormal: "#FFFFFF" colorButtonTextHover: "#FFFFFF" normalImageButton: "qrc:/res/icons/new-payment_icon.png" diff --git a/CellFrameDashboardGUI/screen/desktop/Dashboard/DapDashboardTab.qml b/CellFrameDashboardGUI/screen/desktop/Dashboard/DapDashboardTab.qml index 9a490287f05b0fb1ab636eaac4572a1acb0ab892..515f5aa9e569839134c31dbb9b27e8557e6a20c8 100644 --- a/CellFrameDashboardGUI/screen/desktop/Dashboard/DapDashboardTab.qml +++ b/CellFrameDashboardGUI/screen/desktop/Dashboard/DapDashboardTab.qml @@ -1,4 +1,5 @@ import QtQuick 2.4 +import "../../" DapDashboardTabForm { @@ -12,8 +13,10 @@ DapDashboardTabForm readonly property string doneWallet: "qrc:/screen/" + device + "/Dashboard/RightPanel/DapDoneWalletRightPanel.qml" ///@detalis Path to the right panel of last actions. readonly property string lastActionsWallet: "qrc:/screen/" + device + "/Dashboard/RightPanel/DapLastActionsRightPanel.qml" - - dapDashboardRightPanel.source: Qt.resolvedUrl(lastActionsWallet) + ///@detalis Path to the right panel of new payment. + readonly property string newPaymentMain: "qrc:/screen/" + device + "/Dashboard/RightPanel/DapNewPaymentMainRightPanel.qml" + ///@detalis Path to the right panel of new payment done. + readonly property string newPaymentDone: "qrc:/screen/" + device + "/Dashboard/RightPanel/DapNewPaymentDoneRightPanel.qml" dapDashboardTopPanel.dapComboboxWallet.onCurrentIndexChanged: { @@ -24,4 +27,25 @@ DapDashboardTabForm { id: modelWallets } + // Setting the right pane by default + dapDashboardRightPanel.initialItem: Qt.resolvedUrl(lastActionsWallet); + + // Signal-slot connection realizing panel switching depending on predefined rules + Connections + { + target: currentRightPanel + onNextActivated: + { + currentRightPanel = dapDashboardRightPanel.push(currentRightPanel.dapNextRightPanel); + } + } + + // When you click on the button for creating a new payment, open the form to fill in the payment data + dapDashboardScreen.dapButtonNewPayment.onClicked: + { + if(dapDashboardRightPanel.currentItem !== currentRightPanel) + { + currentRightPanel = dapDashboardRightPanel.push(Qt.resolvedUrl(newPaymentMain)); + } + } } diff --git a/CellFrameDashboardGUI/screen/desktop/Dashboard/DapDashboardTabForm.ui.qml b/CellFrameDashboardGUI/screen/desktop/Dashboard/DapDashboardTabForm.ui.qml index 2ec47ae43bc9074a1dc9a99e2cad8a61b4959751..81c8945d204a4f55c378d468c687ffe895e28f82 100644 --- a/CellFrameDashboardGUI/screen/desktop/Dashboard/DapDashboardTabForm.ui.qml +++ b/CellFrameDashboardGUI/screen/desktop/Dashboard/DapDashboardTabForm.ui.qml @@ -1,5 +1,5 @@ import QtQuick 2.4 -import QtQuick.Controls 2.0 +import QtQuick.Controls 1.4 import "qrc:/" import "../../" @@ -7,7 +7,7 @@ DapAbstractTab { id: dashboardTab - property alias dapDashboardRightPanel: rightPanelLoader + property alias dapDashboardRightPanel: stackViewRightPanel property alias dapDashboardTopPanel: dashboardTopPanel property alias dapDashboardScreen: dashboardScreen @@ -24,11 +24,16 @@ DapAbstractTab } dapRightPanel: - Loader + StackView { - id: rightPanelLoader + id: stackViewRightPanel anchors.fill: parent width: 400 + delegate: + StackViewDelegate + { + pushTransition: StackViewTransition { } + } } } diff --git a/CellFrameDashboardGUI/screen/desktop/Dashboard/RightPanel/DapNewPaymentDoneRightPanel.qml b/CellFrameDashboardGUI/screen/desktop/Dashboard/RightPanel/DapNewPaymentDoneRightPanel.qml new file mode 100644 index 0000000000000000000000000000000000000000..1f044c23d8747c06d5d09fb1e28693f4ff0be1a8 --- /dev/null +++ b/CellFrameDashboardGUI/screen/desktop/Dashboard/RightPanel/DapNewPaymentDoneRightPanel.qml @@ -0,0 +1,9 @@ +import QtQuick 2.4 + +DapNewPaymentDoneRightPanelForm +{ + dapButtonSend.onClicked: + { + dapServiceController.requestToService("DapMempoolProcessCommand", "private", "gdb") + } +} diff --git a/CellFrameDashboardGUI/screen/desktop/Dashboard/RightPanel/DapNewPaymentDoneRightPanelForm.ui.qml b/CellFrameDashboardGUI/screen/desktop/Dashboard/RightPanel/DapNewPaymentDoneRightPanelForm.ui.qml new file mode 100644 index 0000000000000000000000000000000000000000..3330f13f70299d57393977f5ef2ef67fc92fbe1e --- /dev/null +++ b/CellFrameDashboardGUI/screen/desktop/Dashboard/RightPanel/DapNewPaymentDoneRightPanelForm.ui.qml @@ -0,0 +1,145 @@ +import QtQuick 2.4 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import "qrc:/widgets" +import "../../../" + +DapAbstractRightPanel +{ + /// @param dapButtonSend Send button. + property alias dapButtonSend: buttonSend + + dapHeaderData: + Row + { + anchors.fill: parent + anchors.leftMargin: 16 * pt + anchors.rightMargin: 16 * pt + anchors.topMargin: 12 * pt + anchors.bottomMargin: 12 * pt + spacing: 12 * pt + + Item + { + id: itemButtonClose + data: dapButtonClose + height: dapButtonClose.height + width: dapButtonClose.width + } + + Text + { + id: textHeader + text: qsTr("New payment") + font.pixelSize: 14 * pt + color: "#3E3853" + } + } + dapContentItemData: + Rectangle + { + anchors.fill: parent + anchors.leftMargin: 16 * pt + anchors.rightMargin: 16 * pt + color: "transparent" + + Rectangle + { + id: rectangleTop + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + height: 156 * pt + color: "transparent" + } + + Text + { + id: textMessage + text: qsTr("Placed to mempool") + horizontalAlignment: Text.AlignHCenter + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: rectangleTop.bottom + anchors.topMargin: 24 * pt + color: "#070023" + font.family: DapMainApplicationWindow.dapFontRobotoRegular.name + font.pointSize: 28 * pt + } + + Rectangle + { + id: rectangleCenter + height: 48 * pt + anchors.top: textMessage.bottom + anchors.left: parent.left + anchors.right: parent.right + color: "transparent" + } + + Text + { + id: textStatus + text: qsTr("Status") + horizontalAlignment: Text.AlignHCenter + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: rectangleCenter.bottom + color: "#757184" + font.family: DapMainApplicationWindow.dapFontRobotoRegular.name + font.pointSize: 22 * pt + } + + Text + { + id: textStatusMessage + text: qsTr("Pending") + horizontalAlignment: Text.AlignHCenter + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: textStatus.bottom + anchors.topMargin: 8 * pt + color: "#070023" + font.family: DapMainApplicationWindow.dapFontRobotoRegular.name + font.pointSize: 28 * pt + } + + Rectangle + { + id: rectangleTopButton + height: 64 * pt + anchors.top: textStatusMessage.bottom + anchors.topMargin: 24 * pt + anchors.left: parent.left + anchors.right: parent.right + color: "transparent" + } + + // Button "Send" + DapButton + { + id: buttonSend + height: 44 * pt + width: 130 * pt + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: rectangleTopButton.bottom + anchors.topMargin: 24 * pt + textButton: qsTr("Send") + colorBackgroundHover: "#D51F5D" + colorBackgroundNormal: "#070023" + colorButtonTextNormal: "#FFFFFF" + horizontalAligmentText: Text.AlignHCenter + indentTextRight: 0 + fontButton.pixelSize: 18 * pt + } + + Rectangle + { + id: rectangleBottomButton + height: 190 * pt + anchors.top: buttonSend.bottom + anchors.topMargin: 24 * pt + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + color: "transparent" + } + } +} diff --git a/CellFrameDashboardGUI/screen/desktop/Dashboard/RightPanel/DapNewPaymentMainRightPanel.qml b/CellFrameDashboardGUI/screen/desktop/Dashboard/RightPanel/DapNewPaymentMainRightPanel.qml new file mode 100644 index 0000000000000000000000000000000000000000..7e49160af9ba70b04402fd73a8bd68459f545f2a --- /dev/null +++ b/CellFrameDashboardGUI/screen/desktop/Dashboard/RightPanel/DapNewPaymentMainRightPanel.qml @@ -0,0 +1,13 @@ +import QtQuick 2.4 + +DapNewPaymentMainRightPanelForm +{ + // The form displayed after clicking on the "Send" button + dapNextRightPanel: newPaymentDone + + dapButtonSend.onClicked: + { + nextActivated() + dapServiceController.requestToService("DapCreateTransactionCommand", "private", "gdb", "MyWallet", dapTextInputRecipientWalletAddress.text, dapCmboBoxToken.currentText, dapTextInputAmountPayment.text) + } +} diff --git a/CellFrameDashboardGUI/screen/desktop/Dashboard/RightPanel/DapNewPaymentMainRightPanelForm.ui.qml b/CellFrameDashboardGUI/screen/desktop/Dashboard/RightPanel/DapNewPaymentMainRightPanelForm.ui.qml new file mode 100644 index 0000000000000000000000000000000000000000..e71f0afc96238316520ca7ed99a9eaf1ff431956 --- /dev/null +++ b/CellFrameDashboardGUI/screen/desktop/Dashboard/RightPanel/DapNewPaymentMainRightPanelForm.ui.qml @@ -0,0 +1,446 @@ +import QtQuick 2.4 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import "qrc:/widgets" +import "../../../" + +DapAbstractRightPanel +{ + /// @param dapButtonSend Send funds button. + property alias dapButtonSend: buttonSend + /// @param dapTextInputAmountPayment Input field for transfer amount. + property alias dapTextInputAmountPayment: textInputAmountPayment + /// @param dapCmboBoxToken Token combobox. + property alias dapCmboBoxToken: comboBoxToken + /// @param dapTextInputRecipientWalletAddress Recipient wallet address input field. + property alias dapTextInputRecipientWalletAddress: textInputRecipientWalletAddress + + dapHeaderData: + Row + { + anchors.fill: parent + anchors.leftMargin: 16 * pt + anchors.rightMargin: 16 * pt + anchors.topMargin: 12 * pt + anchors.bottomMargin: 12 * pt + spacing: 12 * pt + + Item + { + id: itemButtonClose + data: dapButtonClose + height: dapButtonClose.height + width: dapButtonClose.width + } + + Text + { + id: textHeader + text: qsTr("New payment") + font.pixelSize: 14 * pt + color: "#3E3853" + } + } + + dapContentItemData: + Rectangle + { + anchors.fill: parent + color: "transparent" + + // Sender wallet + Rectangle + { + id: frameSenderWallet + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + anchors.topMargin: 8 * pt + anchors.bottomMargin: 8 * pt + color: "#757184" + height: 30 * pt + Text + { + id: textFrameSenderWallet + color: "#ffffff" + text: qsTr("From") + font.pixelSize: 12 * pt + horizontalAlignment: Text.AlignLeft + font.family: "Roboto" + font.styleName: "Normal" + font.weight: Font.Normal + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 16 * pt + } + } + + + + ListModel + { + id: tokenModel + ListElement + { + signatureName: "Kelvin" + } + ListElement + { + signatureName: "Token 1" + } + ListElement + { + signatureName: "Token 2" + } + ListElement + { + signatureName: "NewGold" + } + } + + Rectangle + { + id: frameSenderWalletAddress + color: "#F8F7FA" + anchors.top: frameSenderWallet.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.leftMargin: 16 * pt + anchors.rightMargin: 16 * pt + height: 120 * pt + + Rectangle + { + id: frameSenderWalletToken + color: "#F8F7FA" + anchors.top: frameSenderWalletAddress.top + anchors.left: parent.left + anchors.right: parent.right + anchors.topMargin: 20 * pt + anchors.leftMargin: 16 * pt + anchors.rightMargin: 16 * pt + height: comboBoxToken.height + DapComboBox + { + id: comboBoxToken + model: tokenModel + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + indicatorImageNormal: "qrc:/res/icons/ic_arrow_drop_down_dark.png" + indicatorImageActive: "qrc:/res/icons/ic_arrow_drop_up.png" + sidePaddingNormal: 0 * pt + sidePaddingActive: 0 * pt + normalColorText: "#070023" + hilightColorText: "#transparent" + normalColorTopText: "#070023" + hilightColorTopText: "#070023" + hilightColor: "#330F54" + normalTopColor: "transparent" + widthPopupComboBoxNormal: 148 * pt + widthPopupComboBoxActive: 180 * pt + heightComboBoxNormal: 24 * pt + heightComboBoxActive: 44 * pt + bottomIntervalListElement: 8 * pt + topEffect: false + x: popup.visible ? sidePaddingActive * (-1) : sidePaddingNormal + normalColor: "#FFFFFF" + hilightTopColor: normalColor + paddingTopItemDelegate: 8 * pt + heightListElement: 32 * pt + intervalListElement: 10 * pt + indicatorWidth: 20 * pt + indicatorHeight: indicatorWidth + indicatorLeftInterval: 8 * pt + colorTopNormalDropShadow: "#00000000" + colorDropShadow: "#40ABABAB" + fontComboBox.pixelSize: 16 * pt + fontComboBox.family: "Roboto" + } + } + Rectangle + { + id: splitLineSenderWalletToken + height: 1 * pt + width: parent.width + color: "#E3E2E6" + anchors.top: frameSenderWalletToken.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.topMargin: 14 * pt + anchors.leftMargin: 20 * pt + anchors.rightMargin: 20 * pt + } + Text + { + id: textSenderWalletAddress + width: 328 * pt + anchors.top: splitLineSenderWalletToken.top + anchors.topMargin: 20 * pt + anchors.left: parent.left + anchors.leftMargin: 20 * pt + anchors.right: parent.right + anchors.rightMargin: 20 * pt + font.pixelSize: 14 * pt + font.family: "Roboto" + font.styleName: "Normal" + font.weight: Font.Normal + color: "#757184" + text: "dsgfsghdfsht5y5wv546v76b67v66354c6565v576764657676767f5f46" + elide: Text.ElideRight + } + } + + // Amount payment + Rectangle + { + id: frameAmountPayment + anchors.top: frameSenderWalletAddress.bottom + anchors.right: parent.right + anchors.left: parent.left + color: "#757184" + height: 30 * pt + Text + { + id: textFrameamountPayment + color: "#ffffff" + text: qsTr("Amount") + font.pixelSize: 12 * pt + anchors.leftMargin: 16 * pt + anchors.left: parent.left + horizontalAlignment: Text.AlignLeft + font.styleName: "Normal" + font.family: "Roboto" + font.weight: Font.Normal + anchors.verticalCenter: parent.verticalCenter + } + } + + Rectangle + { + id: frameInputAmountPayment + height: 112 * pt + color: "#F8F7FA" + anchors.top: frameAmountPayment.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.leftMargin: 16 * pt + anchors.rightMargin: 16 * pt + Rectangle + { + id: frameAmountField + anchors.left: parent.left + anchors.leftMargin: 20 * pt + anchors.right: parent.right + anchors.rightMargin: 20 * pt + anchors.top: frameInputAmountPayment.top + anchors.topMargin: 20 * pt + height: textTokenReduction.height + color: "transparent" + TextField + { + id: textInputAmountPayment + anchors.verticalCenter: parent.verticalCenter + placeholderText: qsTr("0") + font.pixelSize: 16 * pt + font.family: "Roboto" + font.styleName: "Normal" + font.weight: Font.Normal + horizontalAlignment: Text.AlignLeft + anchors.left: parent.left + anchors.right: textTokenReduction.left + anchors.rightMargin: 20 * pt + + style: + TextFieldStyle + { + textColor: "#070023" + placeholderTextColor: "#070023" + background: + Rectangle + { + border.width: 0 + color: "transparent" + } + } + } + Text + { + id: textTokenReduction + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + font.pixelSize: 16 * pt + font.family: "Roboto" + font.styleName: "Normal" + font.weight: Font.Normal + horizontalAlignment: Text.AlignRight + color: "#070023" + text: "KLVN" + } + } + Rectangle + { + id: splitLineAmount + height: 1 * pt + width: parent.width + color: "#E3E2E6" + anchors.top: frameAmountField.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.topMargin: 16 * pt + anchors.leftMargin: 20 * pt + anchors.rightMargin: 20 * pt + } + Rectangle + { + id: frameAmountConvert + anchors.left: parent.left + anchors.leftMargin: 20 * pt + anchors.right: parent.right + anchors.rightMargin: 20 * pt + anchors.top: splitLineAmount.top + anchors.topMargin: 16 * pt + height: textAmountConvertValue.height + color: "transparent" + Text + { + id: textAmountConvertValue + anchors.verticalCenter: parent.verticalCenter + font.pixelSize: 14 * pt + font.family: "Roboto" + font.styleName: "Normal" + font.weight: Font.Normal + horizontalAlignment: Text.AlignLeft + anchors.left: parent.left + color: "#757184" + text: qsTr("0") + } + Text + { + id: textAmountConvertCurrency + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + font.pixelSize: 14 * pt + font.family: "Roboto" + font.styleName: "Normal" + font.weight: Font.Normal + horizontalAlignment: Text.AlignRight + color: "#757184" + text: qsTr("USD") + } + } + } + + // Recipient wallet + Rectangle + { + id: frameRecipientWallet + anchors.top: frameInputAmountPayment.bottom + anchors.right: parent.right + anchors.left: parent.left + color: "#757184" + height: 30 * pt + Text + { + id: textRecipientWallet + color: "#ffffff" + text: qsTr("To") + font.pixelSize: 12 * pt + anchors.leftMargin: 16 * pt + anchors.left: parent.left + horizontalAlignment: Text.AlignLeft + font.styleName: "Normal" + font.family: "Roboto" + font.weight: Font.Normal + anchors.verticalCenter: parent.verticalCenter + } + } + + Rectangle + { + id: frameRecipientWalletAddress + anchors.top: frameRecipientWallet.bottom + anchors.left: parent.left + anchors.leftMargin: 16 * pt + anchors.right: parent.right + anchors.rightMargin: 16 * pt + height: 52 * pt + color: "transparent" + + TextField + { + id: textInputRecipientWalletAddress + anchors.verticalCenter: parent.verticalCenter + placeholderText: qsTr("Recipient wallet") + font.pixelSize: 17 * pt + font.family: "Roboto" + font.styleName: "Normal" + font.weight: Font.Normal + horizontalAlignment: Text.AlignLeft + anchors.top: frameRecipientWalletAddress.top + anchors.topMargin: 12 * pt + anchors.left: parent.left + anchors.right: parent.right + anchors.leftMargin: 20 * pt + anchors.rightMargin: 20 * pt + style: + TextFieldStyle + { + textColor: "#070023" + placeholderTextColor: "#070023" + background: + Rectangle + { + border.width: 0 + color: "transparent" + } + } + } + + Rectangle + { + id: splitLineRecipientWalletAddress + height: 1 * pt + width: parent.width + color: "#E3E2E6" + anchors.top: textInputRecipientWalletAddress.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.topMargin: 12 * pt + anchors.leftMargin: 20 * pt + anchors.rightMargin: 20 * pt + } + } + + // Button "Send" + DapButton + { + id: buttonSend + height: 44 * pt + width: 130 * pt + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: frameRecipientWalletAddress.bottom + anchors.topMargin: 60 * pt + textButton: qsTr("Send") + colorBackgroundHover: "#D51F5D" + colorBackgroundNormal: "#070023" + colorButtonTextNormal: "#FFFFFF" + horizontalAligmentText: Text.AlignHCenter + indentTextRight: 0 + fontButton.pixelSize: 18 * pt + } + + Rectangle + { + id: frameBottom + height: 124 * pt + anchors.top: buttonSend.bottom + anchors.topMargin: 24 * pt + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + color: "transparent" + } + + } +} diff --git a/CellFrameDashboardService/DapServiceController.cpp b/CellFrameDashboardService/DapServiceController.cpp index 4d00cc5622736eeef00986520da763d882eb0ae6..1cdf34535478344aa3db3a4942dbcb2ce0937dc5 100755 --- a/CellFrameDashboardService/DapServiceController.cpp +++ b/CellFrameDashboardService/DapServiceController.cpp @@ -62,6 +62,10 @@ void DapServiceController::registerCommand() m_pServer->addService(new DapGetWalletAddressesCommand("DapGetWalletAddressesCommand", m_pServer)); m_pServer->addService(new DapGetWalletTokenInfoCommand("DapGetWalletTokenInfoCommand", m_pServer)); + // Creating a token transfer transaction between wallets + m_pServer->addService(new DapCreateTransactionCommand("DapCreateTransactionCommand", m_pServer, CLI_PATH)); + // Transaction confirmation + m_pServer->addService(new DapMempoolProcessCommand("DapMempoolProcessCommand", m_pServer, CLI_PATH)); } /// Initialize system tray. diff --git a/CellFrameDashboardService/DapServiceController.h b/CellFrameDashboardService/DapServiceController.h index 47fc55c6815714047963932c876692ab25cedf67..f48be4eac4e2865deeac2dcf144e3e1962613b1a 100755 --- a/CellFrameDashboardService/DapServiceController.h +++ b/CellFrameDashboardService/DapServiceController.h @@ -33,6 +33,8 @@ typedef class DapRpcLocalServer DapUiService; #include "Handlers/DapGetWalletAddressesCommand.h" #include "Handlers/DapExportLogCommand.h" #include "Handlers/DapGetWalletTokenInfoCommand.h" +#include "Handlers/DapCreateTransactionCommand.h" +#include "Handlers/DapMempoolProcessCommand.h" #include "DapSystemTrayIcon.h" #include "DapToolTipWidget.h" diff --git a/libCellFrameDashboardCommon/Handlers/DapCreateTransactionCommand.cpp b/libCellFrameDashboardCommon/Handlers/DapCreateTransactionCommand.cpp new file mode 100644 index 0000000000000000000000000000000000000000..88aacc40180f6301ad3cde51461b80f67c632a1e --- /dev/null +++ b/libCellFrameDashboardCommon/Handlers/DapCreateTransactionCommand.cpp @@ -0,0 +1,51 @@ +#include "DapCreateTransactionCommand.h" + +/// Overloaded constructor. +/// @param asServiceName Service name. +/// @param parent Parent. +/// @details The parent must be either DapRPCSocket or DapRPCLocalServer. +/// @param asCliPath The path to cli nodes. +DapCreateTransactionCommand::DapCreateTransactionCommand(const QString &asServicename, QObject *parent, const QString &asCliPath) + : DapAbstractCommand(asServicename, parent), m_sCliPath(asCliPath) +{ + +} + +/// Send a response to the client. +/// @details Performed on the service side. +/// @param arg1 Network. +/// @param arg2 Chain. +/// @param arg3 Wallet sender. +/// @param arg4 Recipient's wallet address. +/// @param arg5 Token. +/// @param arg6 Transfer amount. +/// @return Reply to client. +QVariant DapCreateTransactionCommand::respondToClient(const QVariant &arg1, const QVariant &arg2, const QVariant &arg3, const QVariant &arg4, const QVariant &arg5, const QVariant &arg6, const QVariant &arg7, const QVariant &arg8, const QVariant &arg9, const QVariant &arg10) +{ + Q_UNUSED(arg7) + Q_UNUSED(arg8) + Q_UNUSED(arg9) + Q_UNUSED(arg10) + + QProcess processCreate; + processCreate.start(QString("%1 tx_create -net %2 -chain %3 -from_wallet %3 -to_addr %4 -token %5 -value %6") + .arg(m_sCliPath) + .arg(arg1.toString()) + .arg(arg2.toString()) + .arg(arg3.toString()) + .arg(arg4.toString()) + .arg(arg5.toString()) + .arg(arg6.toString())); + + processCreate.waitForFinished(-1); + QByteArray result = processCreate.readAll(); + + QRegExp rx("transfer=(\\w+)"); + rx.indexIn(result, 0); + + if(rx.cap(1) == "Ok") + { + return true; + } + return false; +} diff --git a/libCellFrameDashboardCommon/Handlers/DapCreateTransactionCommand.h b/libCellFrameDashboardCommon/Handlers/DapCreateTransactionCommand.h new file mode 100644 index 0000000000000000000000000000000000000000..0982b424573ddb2906b0b9f34e83bb9d750dd66b --- /dev/null +++ b/libCellFrameDashboardCommon/Handlers/DapCreateTransactionCommand.h @@ -0,0 +1,38 @@ +#ifndef DAPCREATETRANSACTIONCOMMAND_H +#define DAPCREATETRANSACTIONCOMMAND_H + +#include <QProcess> + +#include "DapAbstractCommand.h" + +class DapCreateTransactionCommand : public DapAbstractCommand +{ + /// The path to cli nodes. + QString m_sCliPath; + +public: + /// Overloaded constructor. + /// @param asServiceName Service name. + /// @param parent Parent. + /// @details The parent must be either DapRPCSocket or DapRPCLocalServer. + /// @param asCliPath The path to cli nodes. + DapCreateTransactionCommand(const QString &asServicename, QObject *parent = nullptr, const QString &asCliPath = QString()); + +public slots: + /// Send a response to the client. + /// @details Performed on the service side. + /// @param arg1 Network. + /// @param arg2 Chain. + /// @param arg3 Wallet sender. + /// @param arg4 Recipient's wallet address. + /// @param arg5 Token. + /// @param arg6 Transfer amount. + /// @return Reply to client. + QVariant respondToClient(const QVariant &arg1 = QVariant(), const QVariant &arg2 = QVariant(), + const QVariant &arg3 = QVariant(), const QVariant &arg4 = QVariant(), + const QVariant &arg5 = QVariant(), const QVariant &arg6 = QVariant(), + const QVariant &arg7 = QVariant(), const QVariant &arg8 = QVariant(), + const QVariant &arg9 = QVariant(), const QVariant &arg10 = QVariant()) override; +}; + +#endif // DAPCREATETRANSACTIONCOMMAND_H diff --git a/libCellFrameDashboardCommon/Handlers/DapMempoolProcessCommand.cpp b/libCellFrameDashboardCommon/Handlers/DapMempoolProcessCommand.cpp new file mode 100644 index 0000000000000000000000000000000000000000..97e16726aa55ef24c6dfb3d917407173855834df --- /dev/null +++ b/libCellFrameDashboardCommon/Handlers/DapMempoolProcessCommand.cpp @@ -0,0 +1,43 @@ +#include "DapMempoolProcessCommand.h" + +/// Overloaded constructor. +/// @param asServiceName Service name. +/// @param parent Parent. +/// @details The parent must be either DapRPCSocket or DapRPCLocalServer. +/// @param asCliPath The path to cli nodes. +DapMempoolProcessCommand::DapMempoolProcessCommand(const QString &asServicename, QObject *parent, const QString &asCliPath) + : DapAbstractCommand(asServicename, parent), m_sCliPath(asCliPath) +{ + +} + +/// Send a response to the client. +/// @details Performed on the service side. +/// @param arg1 Network. +/// @param arg2 Chain. +/// @param arg3...arg10 Parameters. +/// @return Reply to client. +QVariant DapMempoolProcessCommand::respondToClient(const QVariant &arg1, const QVariant &arg2, const QVariant &arg3, const QVariant &arg4, const QVariant &arg5, const QVariant &arg6, const QVariant &arg7, const QVariant &arg8, const QVariant &arg9, const QVariant &arg10) +{ + Q_UNUSED(arg1) + Q_UNUSED(arg2) + Q_UNUSED(arg3) + Q_UNUSED(arg4) + Q_UNUSED(arg5) + Q_UNUSED(arg6) + Q_UNUSED(arg7) + Q_UNUSED(arg8) + Q_UNUSED(arg9) + Q_UNUSED(arg10) + + QProcess process; + process.start(QString("%1 mempool_proc -net %2 -chain %3").arg(m_sCliPath).arg(arg1.toString()).arg(arg2.toString())); + process.waitForFinished(-1); + process.readAll(); + QString result = QString::fromLatin1(process.readAll()); + if(result.isEmpty() || result.isNull() || result.contains("No records in mempool") ) + { + return false; + } + return true; +} diff --git a/libCellFrameDashboardCommon/Handlers/DapMempoolProcessCommand.h b/libCellFrameDashboardCommon/Handlers/DapMempoolProcessCommand.h new file mode 100644 index 0000000000000000000000000000000000000000..a82bad16d0a112e6a80467169c40c96230103bdc --- /dev/null +++ b/libCellFrameDashboardCommon/Handlers/DapMempoolProcessCommand.h @@ -0,0 +1,35 @@ +#ifndef DAPMEMPOOLPROCESSCOMMAND_H +#define DAPMEMPOOLPROCESSCOMMAND_H + +#include <QProcess> + +#include "DapAbstractCommand.h" + +class DapMempoolProcessCommand : public DapAbstractCommand +{ + /// The path to cli nodes. + QString m_sCliPath; + +public: + /// Overloaded constructor. + /// @param asServiceName Service name. + /// @param parent Parent. + /// @details The parent must be either DapRPCSocket or DapRPCLocalServer. + /// @param asCliPath The path to cli nodes. + DapMempoolProcessCommand(const QString &asServicename, QObject *parent = nullptr, const QString &asCliPath = QString()); + +public slots: + /// Send a response to the client. + /// @details Performed on the service side. + /// @param arg1 Network. + /// @param arg2 Chain. + /// @param arg3...arg10 Parameters. + /// @return Reply to client. + QVariant respondToClient(const QVariant &arg1 = QVariant(), const QVariant &arg2 = QVariant(), + const QVariant &arg3 = QVariant(), const QVariant &arg4 = QVariant(), + const QVariant &arg5 = QVariant(), const QVariant &arg6 = QVariant(), + const QVariant &arg7 = QVariant(), const QVariant &arg8 = QVariant(), + const QVariant &arg9 = QVariant(), const QVariant &arg10 = QVariant()) override; +}; + +#endif // DAPMEMPOOLPROCESSCOMMAND_H diff --git a/libCellFrameDashboardCommon/libCellFrameDashboardCommon.pri b/libCellFrameDashboardCommon/libCellFrameDashboardCommon.pri index 6425cb345fd2cdc472cfd491b843c491048d45ab..4edcecc762e0251cc8ec6c22f7d0b220cc6d7c4f 100755 --- a/libCellFrameDashboardCommon/libCellFrameDashboardCommon.pri +++ b/libCellFrameDashboardCommon/libCellFrameDashboardCommon.pri @@ -28,6 +28,8 @@ SOURCES +=\ $$PWD/Handlers/DapExportLogCommand.cpp \ $$PWD/Handlers/DapGetWalletAddressesCommand.cpp \ $$PWD/Handlers/DapGetWalletTokenInfoCommand.cpp \ + $$PWD/Handlers/DapCreateTransactionCommand.cpp \ + $$PWD/Handlers/DapMempoolProcessCommand.cpp \ $$PWD/Handlers/DapQuitApplicationCommand.cpp \ $$PWD/Handlers/DapAddWalletCommand.cpp \ $$PWD/Handlers/DapUpdateLogsCommand.cpp \ @@ -50,6 +52,8 @@ HEADERS +=\ $$PWD/Handlers/DapExportLogCommand.h \ $$PWD/Handlers/DapGetWalletAddressesCommand.h \ $$PWD/Handlers/DapGetWalletTokenInfoCommand.h \ + $$PWD/Handlers/DapCreateTransactionCommand.h \ + $$PWD/Handlers/DapMempoolProcessCommand.h \ $$PWD/Handlers/DapQuitApplicationCommand.h \ $$PWD/Handlers/DapAddWalletCommand.h \ $$PWD/Handlers/DapUpdateLogsCommand.h \ diff --git a/libdap-qt-ui-qml b/libdap-qt-ui-qml index 57caaca1a58415e7e54fa5f953abafc5e0ad4912..43d8780f269cf47ed375e6c1e2b87f5fca8ec056 160000 --- a/libdap-qt-ui-qml +++ b/libdap-qt-ui-qml @@ -1 +1 @@ -Subproject commit 57caaca1a58415e7e54fa5f953abafc5e0ad4912 +Subproject commit 43d8780f269cf47ed375e6c1e2b87f5fca8ec056