diff --git a/CellFrameDashboard/Modules/DapModulesController.h b/CellFrameDashboard/Modules/DapModulesController.h index 450b3b2ff2e1ce103c11c77797e2c0916f668b9f..3321eea890a271d8f1bff76b87e0376e86e39591 100644 --- a/CellFrameDashboard/Modules/DapModulesController.h +++ b/CellFrameDashboard/Modules/DapModulesController.h @@ -64,6 +64,7 @@ public: void updateModulesData() {emit sigUpdateData();} int getCountRestart() const { return m_countRestart; } + public slots: void setNodeLoadProgress(int progress); void setIsNodeWorking(bool); @@ -119,7 +120,6 @@ private: bool m_firstDataLoad{false}; bool m_isNodeWorking = false; bool m_skinWallet = false; - }; #endif // DAPMODULESCONTROLLER_H diff --git a/CellFrameDashboard/Modules/Wallet/BalanceFuncHelper.cpp b/CellFrameDashboard/Modules/Wallet/BalanceFuncHelper.cpp index f2d25fcac9f708576a967cf9b6801d8802a067b7..d5b92011d265059b2da3a656e6ef495b09abefa8 100644 --- a/CellFrameDashboard/Modules/Wallet/BalanceFuncHelper.cpp +++ b/CellFrameDashboard/Modules/Wallet/BalanceFuncHelper.cpp @@ -67,9 +67,9 @@ QVariantMap DapModuleWallet::getAvailableBalance(QVariantMap data) DapErrors err{DAP_NO_ERROR}; QString availBalance{"0.00"}; - QString network = data.value("network").toString(); - QString walletName = data.value("wallet_name").toString(); - QString sendTicker = data.value("send_ticker").toString(); + QString network = data.value("network").toString(); + QString walletName = data.value("wallet_name").toString(); + QString sendTicker = data.value("send_ticker").toString(); const CommonWallet::FeeInfo& fee = m_modulesCtrl->getManagerController()->getFee(network); QString feeTicker = fee.validatorFee.value("fee_ticker"); @@ -98,8 +98,11 @@ QVariantMap DapModuleWallet::getAvailableBalance(QVariantMap data) if(feeTicker == sendTicker) { + QString userFee = data.value("validator_fee").toString(); + QString validatorFee = userFee.isEmpty() || userFee == "0" || userFee == "0.0" ? fee.validatorFee.value("median_fee_coins") : userFee; + Dap::Coin netFee(fee.netFee.value("fee_coins")); - Dap::Coin validatorfee(fee.validatorFee.value("median_fee_coins")); + Dap::Coin validatorfee(validatorFee); feeSum = netFee + validatorfee; mapResult.insert("feeSum", feeSum.toCoinsString()); @@ -135,20 +138,25 @@ QVariantMap DapModuleWallet::getFee(QString network) { QVariantMap mapResult; - if(m_modulesCtrl->getManagerController()->isFeeEmpty()) + const CommonWallet::FeeInfo& fee = m_modulesCtrl->getManagerController()->getFee(network); + + if(m_modulesCtrl->getManagerController()->isFeeEmpty() || fee.validatorFee.isEmpty()) { mapResult.insert("error", (int)DAP_RCV_FEE_ERROR); - mapResult.insert("fee_ticker","UNKNOWN"); + mapResult.insert("fee_ticker", m_nativeTokens.value(network)); mapResult.insert("network_fee", "0.00"); mapResult.insert("validator_fee", "0.05"); + mapResult.insert("min_fee_coins", "0.000000000000000001"); + mapResult.insert("max_validator_fee", "100.0"); return mapResult; } - const CommonWallet::FeeInfo& fee = m_modulesCtrl->getManagerController()->getFee(network); mapResult.insert("error", (int)DAP_NO_ERROR); mapResult.insert("fee_ticker", fee.validatorFee.value("fee_ticker")); mapResult.insert("network_fee", fee.netFee.value("fee_coins")); mapResult.insert("validator_fee", fee.validatorFee.value("median_fee_coins")); + mapResult.insert("min_validator_fee", fee.validatorFee.value("min_fee_coins")); + mapResult.insert("max_validator_fee", fee.validatorFee.value("max_fee_coins")); return mapResult; } diff --git a/CellFrameDashboard/Modules/Wallet/DapModuleWallet.cpp b/CellFrameDashboard/Modules/Wallet/DapModuleWallet.cpp index acb1304a6e0087e78756adbed1c06ea6359727f2..fd04137b2d65cc34c087605d844552eb53181269 100644 --- a/CellFrameDashboard/Modules/Wallet/DapModuleWallet.cpp +++ b/CellFrameDashboard/Modules/Wallet/DapModuleWallet.cpp @@ -421,16 +421,19 @@ void DapModuleWallet::sendTx(QVariantMap data) QString addrTo = data.value("wallet_to").toString(); QString amount = data.value("amount").toString(); QString sendTicker = data.value("send_ticker").toString(); + QString userFee = data.value("validator_fee").toString(); - QString nativeToken = m_modulesCtrl->getManagerController()->getFee(net).validatorFee.value("fee_ticker"); QString feeDatoshi = m_modulesCtrl->getManagerController()->getFee(net).validatorFee.value("median_fee_datoshi"); QString fee = m_modulesCtrl->getManagerController()->getFee(net).validatorFee.value("median_fee_coins"); + QString nativeToken = m_modulesCtrl->getManagerController()->getFee(net).validatorFee.value("fee_ticker"); QString feeNet = m_modulesCtrl->getManagerController()->getFee(net).netFee.value("fee_coins"); QString feeNetDatoshi = m_modulesCtrl->getManagerController()->getFee(net).netFee.value("fee_datoshi"); QString feeNetAddr = m_modulesCtrl->getManagerController()->getFee(net).netFee.value("fee_addr"); MathWorker mathWorker; amount = mathWorker.balanceToCoins(mathWorker.coinsToBalance(amount)).toString(); + QString validatorFee = userFee.isEmpty() || userFee == "0.0" ? fee : userFee; + QString validatorFeeDatoshi = mathWorker.coinsToBalance(validatorFee).toString(); if(DapNodeMode::getNodeMode() == DapNodeMode::NodeMode::REMOTE) { @@ -441,7 +444,7 @@ void DapModuleWallet::sendTx(QVariantMap data) QJsonObject txData; txData.insert(Dap::KeysParam::NETWORK_NAME, net); txData.insert(Dap::KeysParam::FEE_DATOSHI, feeDatoshi); - txData.insert(Dap::KeysParam::FEE, fee); + txData.insert(Dap::KeysParam::FEE, validatorFee); txData.insert(Dap::KeysParam::FEE_NET, feeNet); txData.insert(Dap::KeysParam::FEE_NET_DATOSHI, feeNetDatoshi); txData.insert(Dap::KeysParam::FEE_NET_ADDR, feeNetAddr); @@ -473,7 +476,7 @@ void DapModuleWallet::sendTx(QVariantMap data) listData.append(addrTo); listData.append(sendTicker); listData.append(amount); - listData.append(feeDatoshi); + listData.append(validatorFeeDatoshi); createTx(listData); } diff --git a/CellFrameDashboard/Modules/Wallet/DapModuleWallet.h b/CellFrameDashboard/Modules/Wallet/DapModuleWallet.h index a7d6121ef7c48f50fa95ba714515db3d50365660..1c1af36122b90712a3ab01ab342fd891d852deae 100644 --- a/CellFrameDashboard/Modules/Wallet/DapModuleWallet.h +++ b/CellFrameDashboard/Modules/Wallet/DapModuleWallet.h @@ -57,6 +57,7 @@ public: Q_INVOKABLE void setWalletTokenModel(const QString& network); Q_INVOKABLE QString getTokenBalance(const QString &network, const QString& tokenName, const QString& walletName = "") const; Q_INVOKABLE QString getAddressWallet(const QString &network, const QString& walletName = "") const; + Q_INVOKABLE void updateWalletList(); Q_INVOKABLE void updateWalletInfo(); Q_INVOKABLE void activateOrDeactivateWallet(const QString& walletName, @@ -123,6 +124,13 @@ private: WalletHashManager *m_walletHashManager; bool m_isFirstUpdate = false; bool m_isSendDoubleWallets = false; + + const QMap<QString, QString> m_nativeTokens = {{"Backbone", QString("CELL")} + ,{"KelVPN", QString("KEL")} + ,{"raiden", QString("tCELL")} + ,{"riemann", QString("tKEL")} + ,{"mileena", QString("tMIL")} + ,{"subzero", QString("tCELL")}}; }; #endif // DAPMODULEWALLET_H diff --git a/CellFrameDashboard/main.cpp b/CellFrameDashboard/main.cpp index 3a42410b68fcdc1b5082fa0d92507ab70f845fef..2b75d3471b5a8a5600eb8176483069b244c1b4cb 100644 --- a/CellFrameDashboard/main.cpp +++ b/CellFrameDashboard/main.cpp @@ -195,4 +195,3 @@ QByteArray scaleCalculate(int argc, char *argv[]) return QByteArray::number(scale, 'f', 1); } - diff --git a/CellFrameDashboard/screen/desktop/Dashboard/RightPanel/DapNewPaymentMainRightPanel.qml b/CellFrameDashboard/screen/desktop/Dashboard/RightPanel/DapNewPaymentMainRightPanel.qml index 23aca863df69a9fbbf565e39f80abef82b2aae0a..93d2850bc8446026ccef6a2b3269780b0ec83185 100644 --- a/CellFrameDashboard/screen/desktop/Dashboard/RightPanel/DapNewPaymentMainRightPanel.qml +++ b/CellFrameDashboard/screen/desktop/Dashboard/RightPanel/DapNewPaymentMainRightPanel.qml @@ -1,180 +1,185 @@ -import QtQuick 2.4 - -DapNewPaymentMainRightPanelForm -{ - Component.onCompleted: - { - loadIndicator.running = false - dapButtonSend.enabled = true - - walletModule.setWalletTokenModel(dapComboboxNetwork.displayText) - if (dapServiceController.ReadingChains) - dapChainGroup.visible = true - else - dapChainGroup.visible = false - - dapTextNotEnoughTokensWarning.text = "" - balance.fullText = walletTokensModel.get(dapComboBoxToken.displayText).value - + " " + dapComboBoxToken.displayText - - } - - dapComboBoxToken.onCurrentIndexChanged: - { - balance.fullText = walletTokensModel.get(dapComboBoxToken.displayText).value - + " " + dapComboBoxToken.displayText - } - - dapButtonClose.onClicked: - { - txExplorerModule.statusProcessing = true - pop() - } - - dapButtonSend.onClicked: - { - if (dapComboBoxTokenModel.count <= dapComboBoxToken.currentIndex) - { - console.warn("dapComboBoxTokenModel.count <= dapComboBoxToken.currentIndex") - } - else - { - console.log("balance:", dapComboBoxTokenModel.get(dapComboBoxToken.currentIndex).valueDatoshi) - console.log("address from:", dapComboboxNetwork.model.get(dapComboboxNetwork.currentIndex).address) - console.log("amount:", dapTextInputAmountPayment.text) - console.log("address to:", dapTextInputRecipientWalletAddress.text) - - if (dapTextInputAmountPayment.text === "" || - stringWorker.testAmount("0.0", dapTextInputAmountPayment.text)) - { - console.log("Zero value") - dapTextNotEnoughTokensWarning.text = qsTr("Zero value.") - } - else if (dapComboboxNetwork.model.get(dapComboboxNetwork.currentIndex).address === dapTextInputRecipientWalletAddress.text) - { - console.warn("An attempt to transfer tokens to your address.") - dapTextNotEnoughTokensWarning.text = qsTr("Error. An attempt to transfer tokens to your address.") - } - else if (dapTextInputRecipientWalletAddress.text.length != 104 && dapTextInputRecipientWalletAddress.text != "null") - { - console.log("Wrong address length") - dapTextNotEnoughTokensWarning.text = qsTr("Enter a valid wallet address.") - } - else - { - if (dapComboBoxTokenModel === null || dapComboBoxTokenModel.count <= dapComboBoxToken.currentIndex) - { - if (dapComboBoxTokenModel === null) - { - console.warn("dapComboBoxTokenModel === null") - dapTextNotEnoughTokensWarning.text = qsTr("Error. No tokens") - } - if (dapComboBoxTokenModel.count <= dapComboBoxToken.currentIndex) - { - console.warn("dapComboBoxTokenModel.count <= dapComboBoxToken.currentIndex") - dapTextNotEnoughTokensWarning.text = qsTr("Error. No selected token") - } - } - else - { - dapTextNotEnoughTokensWarning.text = "" - var data = { - "network" : dapComboboxNetwork.displayText, - "amount" : dapTextInputAmountPayment.text, - "send_ticker" : dapComboBoxToken.displayText, - "wallet_name" : walletInfo.name} - - var res = walletModule.approveTx(data); - - switch(res.error) { - case 0: - console.log("Correct tx data") - console.log("dapWalletMessagePopup.smartOpen") - dapWalletMessagePopup.network = dapComboboxNetwork.displayText - dapWalletMessagePopup.smartOpen( - qsTr("Confirming the transaction"), - qsTr("Attention, the transaction fee will be held ")) - break; - case 1: - console.warn("Rcv fee error") - dapTextNotEnoughTokensWarning.text = - qsTr("Error processing network information") - break; - case 2: - console.warn("Not enough tokens") - dapTextNotEnoughTokensWarning.text = - qsTr("Not enough available tokens. Maximum value with fee = %1. Enter a lower value. Current value = %2") - .arg(res.availBalance).arg(dapTextInputAmountPayment.text) - break; - case 3: - console.warn("Not enough tokens for pay fee") - dapTextNotEnoughTokensWarning.text = - qsTr("Not enough available tokens for fee. Balance = %1. Current fee value = %2") - .arg(res.availBalance).arg(res.feeSum) - break; - case 4: - console.warn("No tokens for create transaction") - dapTextNotEnoughTokensWarning.text = - qsTr("No tokens for create transaction") - break; - default: - console.warn("Unknown error") - dapTextNotEnoughTokensWarning.text = - qsTr("Unknown error") - break; - } - } - } - } - } - - dapWalletMessagePopup.onSignalAccept: - { - console.log("dapWalletMessagePopup.onSignalAccept", accept) - - if (accept) - { - dapTextNotEnoughTokensWarning.text = "" - //create tx - - var dataTx = { - "network" : dapComboboxNetwork.displayText, - "amount" : dapTextInputAmountPayment.text, - "send_ticker" : dapComboBoxToken.displayText, - "wallet_from" : walletInfo.name, - "wallet_to" : dapTextInputRecipientWalletAddress.text} - - console.info(dataTx) - walletModule.sendTx(dataTx) - } - } - - Connections - { - target: walletModule - function onSigTxCreate(aResult) - { - commandResult = aResult - if(aResult.toQueue) - { - navigator.toQueueNewPayment() - } - else - { - navigator.doneNewPayment() - } - - loadIndicator.running = false - dapButtonSend.enabled = true - } - - function onTokenModelChanged() - { - if(dapComboBoxToken.model.count > 0) - { - dapComboBoxToken.setCurrentIndex(0) - dapComboBoxToken.displayText = walletTokensModel.get(0).tokenName - } - } - } -} +import QtQuick 2.4 + +DapNewPaymentMainRightPanelForm +{ + Component.onCompleted: + { + loadIndicator.running = false + dapButtonSend.enabled = true + + walletModule.setWalletTokenModel(dapComboboxNetwork.displayText) + if (dapServiceController.ReadingChains) + dapChainGroup.visible = true + else + dapChainGroup.visible = false + + dapTextNotEnoughTokensWarning.text = "" + balance.fullText = walletTokensModel.get(dapComboBoxToken.displayText).value + + " " + dapComboBoxToken.displayText + + } + + dapComboBoxToken.onCurrentIndexChanged: + { + balance.fullText = walletTokensModel.get(dapComboBoxToken.displayText).value + + " " + dapComboBoxToken.displayText + } + + dapButtonClose.onClicked: + { + txExplorerModule.statusProcessing = true + pop() + } + + dapButtonSend.onClicked: + { + if (dapComboBoxTokenModel.count <= dapComboBoxToken.currentIndex) + { + console.warn("dapComboBoxTokenModel.count <= dapComboBoxToken.currentIndex") + } + else + { + console.log("balance:", dapComboBoxTokenModel.get(dapComboBoxToken.currentIndex).valueDatoshi) + console.log("address from:", dapComboboxNetwork.model.get(dapComboboxNetwork.currentIndex).address) + console.log("amount:", dapTextInputAmountPayment.text) + console.log("address to:", dapTextInputRecipientWalletAddress.text) + + if (dapTextInputAmountPayment.text === "" || + stringWorker.testAmount("0.0", dapTextInputAmountPayment.text)) + { + console.log("Zero value") + dapTextNotEnoughTokensWarning.text = qsTr("Zero value.") + } + else if (dapComboboxNetwork.model.get(dapComboboxNetwork.currentIndex).address === dapTextInputRecipientWalletAddress.text) + { + console.warn("An attempt to transfer tokens to your address.") + dapTextNotEnoughTokensWarning.text = qsTr("Error. An attempt to transfer tokens to your address.") + } + else if (dapTextInputRecipientWalletAddress.text.length != 104 && dapTextInputRecipientWalletAddress.text != "null") + { + console.log("Wrong address length") + dapTextNotEnoughTokensWarning.text = qsTr("Enter a valid wallet address.") + } + else + { + if (dapComboBoxTokenModel === null || dapComboBoxTokenModel.count <= dapComboBoxToken.currentIndex) + { + if (dapComboBoxTokenModel === null) + { + console.warn("dapComboBoxTokenModel === null") + dapTextNotEnoughTokensWarning.text = qsTr("Error. No tokens") + } + if (dapComboBoxTokenModel.count <= dapComboBoxToken.currentIndex) + { + console.warn("dapComboBoxTokenModel.count <= dapComboBoxToken.currentIndex") + dapTextNotEnoughTokensWarning.text = qsTr("Error. No selected token") + } + } + else + { + dapTextNotEnoughTokensWarning.text = "" + var data = { + "network" : dapComboboxNetwork.displayText, + "amount" : dapTextInputAmountPayment.text, + "send_ticker" : dapComboBoxToken.displayText, + "wallet_name" : walletInfo.name, + "validator_fee" : valueToFloat(dapFeeController.currentValue)} + + var res = walletModule.approveTx(data); + + switch(res.error) { + case 0: + console.log("Correct tx data") + console.log("dapWalletMessagePopup.smartOpen") + dapWalletMessagePopup.network = dapComboboxNetwork.displayText + dapWalletMessagePopup.smartOpen( + qsTr("Confirming the transaction"), + qsTr("Attention, the transaction fee will be held ")) + break; + case 1: + console.warn("Rcv fee error") + dapTextNotEnoughTokensWarning.text = + qsTr("Error processing network information") + break; + case 2: + console.warn("Not enough tokens") + dapTextNotEnoughTokensWarning.text = + qsTr("Not enough available tokens. Maximum value with fee = %1.") + .arg(res.availBalance) +// dapTextNotEnoughTokensWarning.text = +// qsTr("Not enough available tokens. Maximum value with fee = %1. Enter a lower value. Current value = %2") +// .arg(res.availBalance).arg(dapTextInputAmountPayment.text) + break; + case 3: + console.warn("Not enough tokens for pay fee") + dapTextNotEnoughTokensWarning.text = + qsTr("Not enough available tokens for fee. Balance = %1. Current fee value = %2") + .arg(res.availBalance).arg(res.feeSum) + break; + case 4: + console.warn("No tokens for create transaction") + dapTextNotEnoughTokensWarning.text = + qsTr("No tokens for create transaction") + break; + default: + console.warn("Unknown error") + dapTextNotEnoughTokensWarning.text = + qsTr("Unknown error") + break; + } + } + } + } + } + + dapWalletMessagePopup.onSignalAccept: + { + console.log("dapWalletMessagePopup.onSignalAccept", accept) + + if (accept) + { + dapTextNotEnoughTokensWarning.text = "" + //create tx + + var dataTx = { + "network" : dapComboboxNetwork.displayText, + "amount" : dapTextInputAmountPayment.text, + "send_ticker" : dapComboBoxToken.displayText, + "wallet_from" : walletInfo.name, + "wallet_to" : dapTextInputRecipientWalletAddress.text, + "validator_fee" : valueToFloat(dapFeeController.currentValue)} + + console.info(dataTx) + walletModule.sendTx(dataTx) + } + } + + Connections + { + target: walletModule + function onSigTxCreate(aResult) + { + commandResult = aResult + if(aResult.toQueue) + { + navigator.toQueueNewPayment() + } + else + { + navigator.doneNewPayment() + } + + loadIndicator.running = false + dapButtonSend.enabled = true + } + + function onTokenModelChanged() + { + if(dapComboBoxToken.model.count > 0) + { + dapComboBoxToken.setCurrentIndex(0) + dapComboBoxToken.displayText = walletTokensModel.get(0).tokenName + } + } + } +} diff --git a/CellFrameDashboard/screen/desktop/Dashboard/RightPanel/DapNewPaymentMainRightPanelForm.qml b/CellFrameDashboard/screen/desktop/Dashboard/RightPanel/DapNewPaymentMainRightPanelForm.qml index adcb205a1cc21c511530dacbdfae13df3dda99c0..cff7b52792546bfb5cbe94529bb1041ff3ad03de 100644 --- a/CellFrameDashboard/screen/desktop/Dashboard/RightPanel/DapNewPaymentMainRightPanelForm.qml +++ b/CellFrameDashboard/screen/desktop/Dashboard/RightPanel/DapNewPaymentMainRightPanelForm.qml @@ -1,659 +1,781 @@ -import QtQuick 2.4 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import QtQuick.Controls 2.5 as Controls -import QtQuick.Layouts 1.4 -import QtGraphicalEffects 1.0 - -import "qrc:/widgets" -import "../../../" -import "../../controls" - -DapRectangleLitAndShaded -{ - property alias dapButtonClose: itemButtonClose - - /// @param dapButtonSend Send funds button. - property alias dapButtonSend: buttonSend - /// @param dapTextInputAmountPayment Input field for transfer amount. - property alias dapTextInputAmountPayment: textInputAmountPayment - /// @param dapComboBoxTokenModel Token combobox model. - property alias dapComboBoxTokenModel: comboboxToken.model - - property alias dapComboboxNetwork: comboboxNetwork - property alias dapComboboxChain: comboboxChain - - property alias dapWalletMessagePopup: walletMessagePopup - - property alias dapChainGroup: chainGroup - - property alias dapComboBoxToken: comboboxToken - - property alias dapFrameAmountPayment: frameAmountPayment - property alias dapFrameInputAmountPayment: frameInputAmountPayment - property alias dapFrameRecipientWallet: frameRecipientWallet - property alias dapFrameRecipientWalletAddress: frameRecipientWalletAddress - - property alias dapTextNotEnoughTokensWarning: textNotEnoughTokensWarning - //@param dapSendedToken Name of token to send - property string dapSendedToken: comboboxToken.displayText - - /// @param dapTextInputRecipientWalletAddress Recipient wallet address input field. - property alias dapTextInputRecipientWalletAddress: textInputRecipientWalletAddress - - property alias loadIndicator: loadIndicator - - property alias balance: balance - - color: currTheme.secondaryBackground - radius: currTheme.frameRadius - shadowColor: currTheme.shadowColor - lightColor: currTheme.reflectionLight - - Component.onCompleted: - { - updateWindow() - } - - DapFeePopup - { - id: walletMessagePopup - dapButtonCancel.visible: true - } - - contentData: - ColumnLayout - { - anchors.fill: parent - spacing: 0 - - Item - { - Layout.fillWidth: true - height: 42 - - HeaderButtonForRightPanels{ - anchors.left: parent.left - anchors.verticalCenter: parent.verticalCenter - anchors.leftMargin: 16 - - id: itemButtonClose - height: 20 - width: 20 - heightImage: 20 - widthImage: 20 - - normalImage: "qrc:/Resources/"+pathTheme+"/icons/other/cross.svg" - hoverImage: "qrc:/Resources/"+pathTheme+"/icons/other/cross_hover.svg" - } - - Text - { - id: textHeader - text: qsTr("New payment") - verticalAlignment: Qt.AlignLeft - anchors.left: itemButtonClose.right - anchors.verticalCenter: parent.verticalCenter - anchors.leftMargin: 10 - - font: mainFont.dapFont.bold14 - color: currTheme.white - } - } - - // Sender wallet - Rectangle - { - id: frameSenderWallet - Layout.fillWidth: true - color: currTheme.mainBackground - height: 30 - Text - { - id: textFrameSenderWallet - color: currTheme.white - text: qsTr("From") - font: mainFont.dapFont.medium12 - horizontalAlignment: Text.AlignLeft - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 16 - } - } - - ColumnLayout - { - id: frameSenderWalletAddress - - Layout.fillWidth: true - spacing: 10 - Layout.margins: 10 - Layout.leftMargin: 16 - - Rectangle - { - id: frameSignatureType - height: 42 - color: "transparent" - Layout.fillWidth: true - - DapCustomComboBox - { - id: comboboxNetwork - - anchors.centerIn: parent - anchors.fill: parent - anchors.leftMargin: 5 - anchors.rightMargin: 5 - backgroundColorShow: currTheme.secondaryBackground - mainTextRole: "networkName" - font: mainFont.dapFont.regular16 - model: walletModelInfo - defaultText: qsTr("Networks") - - onCurrantDisplayTextChanged: - { - walletModule.setWalletTokenModel(dapComboboxNetwork.displayText) - updateWindow() - } - } - } - - RowLayout - { - id: chainGroup - - Layout.fillWidth: true - Layout.minimumHeight: 40 - Layout.maximumHeight: 40 - visible: false - - Text - { - Layout.fillWidth: true - color: currTheme.white - text: qsTr("Chain:") - font: mainFont.dapFont.regular14 - horizontalAlignment: Text.AlignLeft - } - - Rectangle - { - width: 200 - height: 40 - color: "transparent" - - DapCustomComboBox - { - id: comboboxChain - - anchors.centerIn: parent - anchors.fill: parent - - font: mainFont.dapFont.regular16 - } - } - } - } - - // Amount payment - Rectangle - { - id: frameAmountPayment - Layout.fillWidth: true - color: currTheme.mainBackground - height: 30 - - RowLayout{ - anchors.fill: parent - spacing: 0 - - Text - { - Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter - Layout.leftMargin: 16 - - color: currTheme.white - text: qsTr("Amount") - font: mainFont.dapFont.medium12 - horizontalAlignment: Text.AlignLeft - } - - RowLayout{ - Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - Layout.maximumWidth: 150 - spacing: 0 - - Text - { - Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - color: currTheme.gray - text: qsTr("Balance: ") - font: mainFont.dapFont.medium12 - horizontalAlignment: Text.AlignLeft - } - - DapBigText - { - id: balance - textElement.horizontalAlignment: Text.AlignRight - Layout.fillWidth: true - Layout.fillHeight: true - Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - Layout.rightMargin: 16 - textFont: mainFont.dapFont.medium12 - textColor: currTheme.white - - Component.onCompleted: - { - fullText = walletTokensModel.get(dapComboBoxToken.displayText).value + " " + dapComboBoxToken.displayText - } - } - - } - } - } - - ColumnLayout - { - property bool percentIsSelected: false - - id: frameInputAmountPayment - Layout.fillWidth: true - Layout.margins: 10 - - Layout.topMargin: 20 - Layout.leftMargin: 36 - Layout.rightMargin: 16 - - spacing: 10 - - RowLayout - { - id: frameAmountField - Layout.fillWidth: true - Layout.margins: 0 - - DapTextField - { - property string realAmount: "0.00" - property string abtAmount: "0.00" - - id: textInputAmountPayment - Layout.fillWidth: true - width: 171 - Layout.minimumHeight: 40 - Layout.maximumHeight: 40 - placeholderText: "0.0" - validator: RegExpValidator { regExp: /[0-9]*\.?[0-9]{0,18}/ } - font: mainFont.dapFont.regular16 - horizontalAlignment: Text.AlignRight - borderWidth: 1 - borderRadius: 4 - selectByMouse: true - - onTextChanged: { - if(frameInputAmountPayment.percentIsSelected) - frameInputAmountPayment.percentIsSelected = false - else - { - button25.selected = false - button50.selected = false - button75.selected = false - button100.selected = false - } - } - - - DapContextMenu{} - } - - Rectangle - { - id: frameSenderWalletToken - color: "transparent" - height: 42 - width: 125 - Layout.leftMargin: 5 - Layout.rightMargin: 0 - DapCustomComboBox - { - id: comboboxToken - anchors.fill: parent - - defaultText: qsTr("Tokens") - backgroundColorShow: currTheme.secondaryBackground - mainTextRole: "tokenName" - model: walletTokensModel - font: mainFont.dapFont.regular16 - - onCurrentTextChanged: { - textInputAmountPayment.text = "" - } - } - } - - } - - RowLayout - { - Layout.fillWidth: true - Layout.rightMargin: 20 - - DapButton - { - id: button25 - Layout.fillWidth: true - implicitHeight: 26 - textButton: qsTr("25%") - horizontalAligmentText: Text.AlignHCenter - indentTextRight: 0 - fontButton: mainFont.dapFont.medium12 - selected: false - onClicked: - { - if(button25.selected) - { - textInputAmountPayment.text = "" - return - } - - button25.selected = true - button50.selected = false - button75.selected = false - button100.selected = false - - var data = { - "network" : dapComboboxNetwork.displayText, - "percent" : "0.25", - "send_ticker" : dapComboBoxToken.displayText, - "wallet_name" : walletInfo.name} - - var res = walletModule.calculatePrecentAmount(data); - frameInputAmountPayment.percentIsSelected = true - textInputAmountPayment.text = res - textInputAmountPayment.cursorPosition = 0 - } - } - - DapButton - { - id: button50 - Layout.fillWidth: true - implicitHeight: 26 - textButton: qsTr("50%") - horizontalAligmentText: Text.AlignHCenter - indentTextRight: 0 - fontButton: mainFont.dapFont.medium12 - selected: false - onClicked: - { - if(button50.selected) - { - textInputAmountPayment.text = "" - return - } - button25.selected = false - button50.selected = true - button75.selected = false - button100.selected = false - - var data = { - "network" : dapComboboxNetwork.displayText, - "percent" : "0.5", - "send_ticker" : dapComboBoxToken.displayText, - "wallet_name" : walletInfo.name} - - var res = walletModule.calculatePrecentAmount(data); - frameInputAmountPayment.percentIsSelected = true - textInputAmountPayment.text = res - textInputAmountPayment.cursorPosition = 0 - } - } - - DapButton - { - id: button75 - Layout.fillWidth: true - implicitHeight: 26 - textButton: qsTr("75%") - horizontalAligmentText: Text.AlignHCenter - indentTextRight: 0 - fontButton: mainFont.dapFont.medium12 - selected: false - onClicked: - { - if(button75.selected) - { - textInputAmountPayment.text = "" - return - } - button25.selected = false - button50.selected = false - button75.selected = true - button100.selected = false - - var data = { - "network" : dapComboboxNetwork.displayText, - "percent" : "0.75", - "send_ticker" : dapComboBoxToken.displayText, - "wallet_name" : walletInfo.name} - - var res = walletModule.calculatePrecentAmount(data); - frameInputAmountPayment.percentIsSelected = true - textInputAmountPayment.text = res - textInputAmountPayment.cursorPosition = 0 - } - } - - DapButton - { - id: button100 - Layout.fillWidth: true - implicitHeight: 26 - textButton: qsTr("100%") - horizontalAligmentText: Text.AlignHCenter - indentTextRight: 0 - fontButton: mainFont.dapFont.medium12 - selected: false - onClicked: - { - if(button100.selected) - { - textInputAmountPayment.text = "" - return - } - - button25.selected = false - button50.selected = false - button75.selected = false - button100.selected = true - - var data = { - "network" : dapComboboxNetwork.displayText, - "percent" : "1.0", - "send_ticker" : dapComboBoxToken.displayText, - "wallet_name" : walletInfo.name} - - var res = walletModule.calculatePrecentAmount(data); - frameInputAmountPayment.percentIsSelected = true - textInputAmountPayment.text = res - textInputAmountPayment.cursorPosition = 0 - } - } - } - - Text{ - id: warnMtoken - Layout.fillWidth: true - height: 32 - visible: comboboxToken.currentText[0] === "m" - text: qsTr("Warning! To unstake you need to have the exact amount of m-tokens in the wallet you staked") - font: mainFont.dapFont.regular12 - horizontalAlignment: Text.AlignLeft - wrapMode: Text.WordWrap - color: "#FFCD44" - } - - } - - // Recipient wallet - Rectangle - { - id: frameRecipientWallet - Layout.topMargin: 10 - Layout.fillWidth: true - color: currTheme.mainBackground - height: 30 - Text - { - id: textRecipientWallet - color: currTheme.white - text: qsTr("To") - font: mainFont.dapFont.medium12 - horizontalAlignment: Text.AlignLeft - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 16 - } - } - - Rectangle - { - id: frameRecipientWalletAddress - Layout.fillWidth: true - Layout.leftMargin: 28 - Layout.rightMargin: 28 - height: 53 - color: "transparent" - Layout.alignment: Qt.AlignHCenter | Qt.AlignTop - - DapTextField - { - id: textInputRecipientWalletAddress - anchors.verticalCenter: parent.verticalCenter - anchors.fill: parent - anchors.topMargin: 20 - - placeholderText: "nTSTphWddAcMUpSNXEOTztqLUifmLuhbZMycDbGNVZCdQEelLewojIrlyQtRvwZtIFYuLEKOMoulwTEyotCdUjdZnzBEqkLnaGpQxp" - validator: RegExpValidator { regExp: /[0-9A-Za-z]+/ } - font: mainFont.dapFont.regular16 - horizontalAlignment: Text.AlignLeft - - bottomLineVisible: true - bottomLineSpacing: 6 - bottomLineLeftRightMargins: 7 - - selectByMouse: true - DapContextMenu{} - } - } - - Text - { - id: textNotEnoughTokensWarning - - Layout.fillWidth: true - Layout.maximumWidth: 281 - Layout.alignment: Qt.AlignHCenter | Qt.AlignTop - Layout.topMargin: 12 - Layout.bottomMargin: 12 - - color: currTheme.neon - text: qsTr("Not enough available tokens. Enter a lower value.") - font: mainFont.dapFont.regular12 - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - wrapMode: Text.WordWrap - visible: false - } - - Item{ - Layout.fillHeight: true - } - - DapLoadIndicator { - id: loadIndicator - Layout.alignment: Qt.AlignHCenter - Layout.bottomMargin: 12 - - indicatorSize: 32 - countElements: 6 - elementSize: 5 - visible: running - - running: true - } - - // Button "Send" - DapButton - { - id: buttonSend - - implicitHeight: 36 - Layout.fillWidth: true - Layout.leftMargin: 36 - Layout.rightMargin: 36 - - Layout.bottomMargin: 40 - Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom - horizontalAligmentText: Text.AlignHCenter - indentTextRight: 0 - fontButton: mainFont.dapFont.medium14 - textButton: "" - - Text - { - anchors.fill: parent - anchors.leftMargin: 6 - anchors.rightMargin: 6 - - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - font: mainFont.dapFont.medium14 - color: currTheme.white - - text: textInputAmountPayment.text === "" ? qsTr("Send") + " 0 " + comboboxToken.displayText - : qsTr("Send") + " " + textInputAmountPayment.text + " " + comboboxToken.displayText - - elide: Text.ElideMiddle - - } - } - } - - function updateWindow() - { - if (walletModelInfo.count <= dapComboboxNetwork.currentIndex) - { - console.warn("walletModelInfo.count <= dapComboboxNetwork.currentIndex") - } - else - { - console.log("dapComboboxNetwork.onCurrentIndexChanged") - - if (walletTokensModel.count === 0) - { - frameAmountPayment.visible = false - frameInputAmountPayment.visible = false - frameRecipientWallet.visible = false - frameRecipientWalletAddress.visible = false - textNotEnoughTokensWarning.visible = false - buttonSend.visible = false - } - else - { - frameAmountPayment.visible = true - frameInputAmountPayment.visible = true - frameRecipientWallet.visible = true - frameRecipientWalletAddress.visible = true - textNotEnoughTokensWarning.visible = true - buttonSend.visible = true - } - - balance.fullText = walletTokensModel.get(dapComboBoxToken.displayText).value - + " " + dapComboBoxToken.displayText - - } - } -} +import QtQuick 2.4 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Controls 2.5 as Controls +import QtQuick.Layouts 1.4 +import QtGraphicalEffects 1.0 + +import "qrc:/widgets" +import "../../../" +import "../../controls" + +DapRectangleLitAndShaded +{ + property alias dapButtonClose: itemButtonClose + + /// @param dapButtonSend Send funds button. + property alias dapButtonSend: buttonSend + /// @param dapTextInputAmountPayment Input field for transfer amount. + property alias dapTextInputAmountPayment: textInputAmountPayment + /// @param dapComboBoxTokenModel Token combobox model. + property alias dapComboBoxTokenModel: comboboxToken.model + + property alias dapComboboxNetwork: comboboxNetwork + property alias dapComboboxChain: comboboxChain + + property alias dapWalletMessagePopup: walletMessagePopup + + property alias dapChainGroup: chainGroup + property alias dapFeeController: feeController + + property alias dapComboBoxToken: comboboxToken + + property alias dapFrameAmountPayment: frameAmountPayment + property alias dapFrameInputAmountPayment: frameInputAmountPayment + property alias dapFrameRecipientWallet: frameRecipientWallet + property alias dapFrameRecipientWalletAddress: frameRecipientWalletAddress + + property alias dapTextNotEnoughTokensWarning: textNotEnoughTokensWarning + //@param dapSendedToken Name of token to send + property string dapSendedToken: comboboxToken.displayText + + /// @param dapTextInputRecipientWalletAddress Recipient wallet address input field. + property alias dapTextInputRecipientWalletAddress: textInputRecipientWalletAddress + + property alias loadIndicator: loadIndicator + + property alias balance: balance + + property bool showNetFeePopup: false + + color: currTheme.secondaryBackground + radius: currTheme.frameRadius + shadowColor: currTheme.shadowColor + lightColor: currTheme.reflectionLight + + Component.onCompleted: + { + updateWindow() + } + + DapFeePopup + { + id: walletMessagePopup + dapButtonCancel.visible: true + fee2Layout.visible: false + height: 258 + } + + contentData: + ColumnLayout + { + anchors.fill: parent + spacing: 0 + + Item + { + Layout.fillWidth: true + height: 42 + + HeaderButtonForRightPanels{ + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: 16 + + id: itemButtonClose + height: 20 + width: 20 + heightImage: 20 + widthImage: 20 + + normalImage: "qrc:/Resources/"+pathTheme+"/icons/other/cross.svg" + hoverImage: "qrc:/Resources/"+pathTheme+"/icons/other/cross_hover.svg" + } + + Text + { + id: textHeader + text: qsTr("New payment") + verticalAlignment: Qt.AlignLeft + anchors.left: itemButtonClose.right + anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: 10 + + font: mainFont.dapFont.bold14 + color: currTheme.white + } + } + + // Sender wallet + Rectangle + { + id: frameSenderWallet + Layout.fillWidth: true + color: currTheme.mainBackground + height: 30 + Text + { + id: textFrameSenderWallet + color: currTheme.white + text: qsTr("From") + font: mainFont.dapFont.medium12 + horizontalAlignment: Text.AlignLeft + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 16 + } + } + + ColumnLayout + { + id: frameSenderWalletAddress + + Layout.fillWidth: true + spacing: 10 + Layout.margins: 10 + Layout.leftMargin: 16 + + Rectangle + { + id: frameSignatureType + height: 42 + color: "transparent" + Layout.fillWidth: true + + DapCustomComboBox + { + id: comboboxNetwork + + anchors.centerIn: parent + anchors.fill: parent + anchors.leftMargin: 5 + anchors.rightMargin: 5 + backgroundColorShow: currTheme.secondaryBackground + mainTextRole: "networkName" + font: mainFont.dapFont.regular16 + model: walletModelInfo + defaultText: qsTr("Networks") + + onCurrentDisplayTextChanged: + { + walletModule.setWalletTokenModel(dapComboboxNetwork.displayText) + updateWindow() + } + } + } + + RowLayout + { + id: chainGroup + + Layout.fillWidth: true + Layout.minimumHeight: 40 + Layout.maximumHeight: 40 + visible: false + + Text + { + Layout.fillWidth: true + color: currTheme.white + text: qsTr("Chain:") + font: mainFont.dapFont.regular14 + horizontalAlignment: Text.AlignLeft + } + + Rectangle + { + width: 200 + height: 40 + color: "transparent" + + DapCustomComboBox + { + id: comboboxChain + + anchors.centerIn: parent + anchors.fill: parent + + font: mainFont.dapFont.regular16 + } + } + } + } + + // Amount payment + Rectangle + { + id: frameAmountPayment + Layout.fillWidth: true + color: currTheme.mainBackground + height: 30 + + RowLayout{ + anchors.fill: parent + spacing: 0 + + Text + { + Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter + Layout.leftMargin: 16 + + color: currTheme.white + text: qsTr("Amount") + font: mainFont.dapFont.medium12 + horizontalAlignment: Text.AlignLeft + } + + RowLayout{ + Layout.alignment: Qt.AlignRight | Qt.AlignVCenter + Layout.maximumWidth: 150 + spacing: 0 + + Text + { + Layout.alignment: Qt.AlignRight | Qt.AlignVCenter + color: currTheme.gray + text: qsTr("Balance: ") + font: mainFont.dapFont.medium12 + horizontalAlignment: Text.AlignLeft + } + + DapBigText + { + id: balance + textElement.horizontalAlignment: Text.AlignRight + Layout.fillWidth: true + Layout.fillHeight: true + Layout.alignment: Qt.AlignRight | Qt.AlignVCenter + Layout.rightMargin: 16 + textFont: mainFont.dapFont.medium12 + textColor: currTheme.white + + Component.onCompleted: + { + fullText = walletTokensModel.get(dapComboBoxToken.displayText).value + " " + dapComboBoxToken.displayText + } + } + + } + } + } + + ColumnLayout + { + property bool percentIsSelected: false + + id: frameInputAmountPayment + Layout.fillWidth: true + Layout.margins: 10 + + Layout.topMargin: 20 + Layout.leftMargin: 36 + Layout.rightMargin: 16 + + spacing: 10 + + RowLayout + { + id: frameAmountField + Layout.fillWidth: true + Layout.margins: 0 + + DapTextField + { + property string realAmount: "0.00" + property string abtAmount: "0.00" + + id: textInputAmountPayment + Layout.fillWidth: true + width: 171 + Layout.minimumHeight: 40 + Layout.maximumHeight: 40 + placeholderText: "0.0" + validator: RegExpValidator { regExp: /[0-9]*\.?[0-9]{0,18}/ } + font: mainFont.dapFont.regular16 + horizontalAlignment: Text.AlignRight + borderWidth: 1 + borderRadius: 4 + selectByMouse: true + + onTextChanged: { + if(frameInputAmountPayment.percentIsSelected) + frameInputAmountPayment.percentIsSelected = false + else + { + resetPercent() + } + } + + + DapContextMenu{} + } + + Rectangle + { + id: frameSenderWalletToken + color: "transparent" + height: 42 + width: 125 + Layout.leftMargin: 5 + Layout.rightMargin: 0 + DapCustomComboBox + { + id: comboboxToken + anchors.fill: parent + + defaultText: qsTr("Tokens") + backgroundColorShow: currTheme.secondaryBackground + mainTextRole: "tokenName" + model: walletTokensModel + font: mainFont.dapFont.regular16 + + onCurrentTextChanged: { + frameInputAmountPayment.percentIsSelected = false + textInputAmountPayment.text = "" + } + } + } + + } + + RowLayout + { + Layout.fillWidth: true + Layout.rightMargin: 20 + + DapButton + { + id: button25 + Layout.fillWidth: true + implicitHeight: 26 + textButton: qsTr("25%") + horizontalAligmentText: Text.AlignHCenter + indentTextRight: 0 + fontButton: mainFont.dapFont.medium12 + selected: false + onClicked: + { + if(selected) + { + textInputAmountPayment.text = "" + selected = false + return + } + + button25.selected = true + button50.selected = false + button75.selected = false + button100.selected = false + + var data = { + "network" : dapComboboxNetwork.displayText, + "percent" : "0.25", + "send_ticker" : dapComboBoxToken.displayText, + "wallet_name" : walletInfo.name, + "validator_fee" : valueToFloat(dapFeeController.currentValue)} + + var res = walletModule.calculatePrecentAmount(data); + frameInputAmountPayment.percentIsSelected = true + textInputAmountPayment.text = res + textInputAmountPayment.cursorPosition = 0 + } + } + + DapButton + { + id: button50 + Layout.fillWidth: true + implicitHeight: 26 + textButton: qsTr("50%") + horizontalAligmentText: Text.AlignHCenter + indentTextRight: 0 + fontButton: mainFont.dapFont.medium12 + selected: false + onClicked: + { + if(selected) + { + textInputAmountPayment.text = "" + selected = false + return + } + button25.selected = false + button50.selected = true + button75.selected = false + button100.selected = false + + var data = { + "network" : dapComboboxNetwork.displayText, + "percent" : "0.5", + "send_ticker" : dapComboBoxToken.displayText, + "wallet_name" : walletInfo.name, + "validator_fee" : valueToFloat(dapFeeController.currentValue)} + + var res = walletModule.calculatePrecentAmount(data); + frameInputAmountPayment.percentIsSelected = true + textInputAmountPayment.text = res + textInputAmountPayment.cursorPosition = 0 + } + } + + DapButton + { + id: button75 + Layout.fillWidth: true + implicitHeight: 26 + textButton: qsTr("75%") + horizontalAligmentText: Text.AlignHCenter + indentTextRight: 0 + fontButton: mainFont.dapFont.medium12 + selected: false + onClicked: + { + if(selected) + { + textInputAmountPayment.text = "" + selected = false + return + } + button25.selected = false + button50.selected = false + button75.selected = true + button100.selected = false + + var data = { + "network" : dapComboboxNetwork.displayText, + "percent" : "0.75", + "send_ticker" : dapComboBoxToken.displayText, + "wallet_name" : walletInfo.name, + "validator_fee" : valueToFloat(dapFeeController.currentValue)} + + var res = walletModule.calculatePrecentAmount(data); + frameInputAmountPayment.percentIsSelected = true + textInputAmountPayment.text = res + textInputAmountPayment.cursorPosition = 0 + } + } + + DapButton + { + id: button100 + Layout.fillWidth: true + implicitHeight: 26 + textButton: qsTr("100%") + horizontalAligmentText: Text.AlignHCenter + indentTextRight: 0 + fontButton: mainFont.dapFont.medium12 + selected: false + onClicked: + { + if(selected) + { + textInputAmountPayment.text = "" + selected = false + return + } + + button25.selected = false + button50.selected = false + button75.selected = false + button100.selected = true + + var data = { + "network" : dapComboboxNetwork.displayText, + "percent" : "1.0", + "send_ticker" : dapComboBoxToken.displayText, + "wallet_name" : walletInfo.name, + "validator_fee" : valueToFloat(dapFeeController.currentValue)} + + var res = walletModule.calculatePrecentAmount(data); + frameInputAmountPayment.percentIsSelected = true + textInputAmountPayment.text = res + textInputAmountPayment.cursorPosition = 0 + } + } + } + + Text{ + id: warnMtoken + Layout.fillWidth: true + height: 32 + visible: comboboxToken.currentText[0] === "m" + text: qsTr("Warning! To unstake you need to have the exact amount of m-tokens in the wallet you staked") + font: mainFont.dapFont.regular12 + horizontalAlignment: Text.AlignLeft + wrapMode: Text.WordWrap + color: "#FFCD44" + } + + } + + // Recipient wallet + Rectangle + { + id: frameRecipientWallet + Layout.topMargin: 10 + Layout.fillWidth: true + color: currTheme.mainBackground + height: 30 + Text + { + id: textRecipientWallet + color: currTheme.white + text: qsTr("To") + font: mainFont.dapFont.medium12 + horizontalAlignment: Text.AlignLeft + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 16 + } + } + + Rectangle + { + id: frameRecipientWalletAddress + Layout.fillWidth: true + Layout.leftMargin: 28 + Layout.rightMargin: 28 + height: 53 + color: "transparent" + Layout.alignment: Qt.AlignHCenter | Qt.AlignTop + + DapTextField + { + id: textInputRecipientWalletAddress + anchors.verticalCenter: parent.verticalCenter + anchors.fill: parent + anchors.topMargin: 20 + + placeholderText: "nTSTphWddAcMUpSNXEOTztqLUifmLuhbZMycDbGNVZCdQEelLewojIrlyQtRvwZtIFYuLEKOMoulwTEyotCdUjdZnzBEqkLnaGpQxp" + validator: RegExpValidator { regExp: /[0-9A-Za-z]+/ } + font: mainFont.dapFont.regular16 + horizontalAlignment: Text.AlignLeft + + bottomLineVisible: true + bottomLineSpacing: 6 + bottomLineLeftRightMargins: 7 + + selectByMouse: true + DapContextMenu{} + } + } + + DapFeeComponent + { + property string medianStr: "" + + id: feeController + + Layout.fillWidth: true + Layout.topMargin: 20 + Layout.leftMargin: 16 + Layout.rightMargin: 16 + editable: false + + onValueChange: { + + if(button25.selected || + button50.selected || + button75.selected || + button100.selected) + { + var selectedPercent = button25.selected ? "0.25" : + button50.selected ? "0.5" : + button75.selected ? "0.75" : "1.0" + + var data = { + "network" : dapComboboxNetwork.displayText, + "percent" : selectedPercent, + "send_ticker" : dapComboBoxToken.displayText, + "wallet_name" : walletInfo.name, + "validator_fee" : valueToFloat(dapFeeController.currentValue)} + + var res = walletModule.calculatePrecentAmount(data); + frameInputAmountPayment.percentIsSelected = true + textInputAmountPayment.text = res + textInputAmountPayment.cursorPosition = 0 + } + } + + + function getFeeData() + { + var resFee = walletModule.getFee(dapComboboxNetwork.displayText) + if(resFee.validator_fee !== "" && resFee.network_fee !== "") + { + valueName = resFee.fee_ticker + minimalValue = resFee.min_validator_fee + maximumValue = resFee.max_validator_fee + var new_median = resFee.validator_fee + if(new_median !== feeController.medianStr) + { + if(feeController.medianStr !== "") + { + notifyAboutChange(new_median) + } + else + { + init(generateRanges(new_median)) + } + feeController.medianStr = new_median + } + showNetFeePopup = !(resFee.network_fee === "0.0") + } + } + + function notifyAboutChange(new_median) + { + var new_ranges = generateRanges(new_median) + feeController.rangeValues = new_ranges + initStates() + dapTextNotEnoughTokensWarning.text = + qsTr("Validator fee was been changed. New median data: %1") + .arg(new_median) + } + + function generateRanges(median_str) + { + var median = valueToFloat(median_str); + return { + "veryLow": 0, + "low": median/2, + "middle": median, + "high": median * 1.5, + "veryHigh": median * 2 + } + } + } + + Text + { + id: textNotEnoughTokensWarning + + Layout.fillWidth: true + Layout.maximumWidth: 281 + Layout.alignment: Qt.AlignHCenter | Qt.AlignTop + Layout.topMargin: 12 + Layout.bottomMargin: 12 + + color: currTheme.neon + text: qsTr("Not enough available tokens. Enter a lower value.") + font: mainFont.dapFont.regular12 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + wrapMode: Text.WordWrap + visible: false + } + + Item{ + Layout.fillHeight: true + } + + DapLoadIndicator { + id: loadIndicator + Layout.alignment: Qt.AlignHCenter + Layout.bottomMargin: 12 + + indicatorSize: 32 + countElements: 6 + elementSize: 5 + visible: running + + running: true + } + + // Button "Send" + DapButton + { + id: buttonSend + + implicitHeight: 36 + Layout.fillWidth: true + Layout.leftMargin: 36 + Layout.rightMargin: 36 + + Layout.bottomMargin: 40 + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + horizontalAligmentText: Text.AlignHCenter + indentTextRight: 0 + fontButton: mainFont.dapFont.medium14 + textButton: "" + + Text + { + anchors.fill: parent + anchors.leftMargin: 6 + anchors.rightMargin: 6 + + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + font: mainFont.dapFont.medium14 + color: currTheme.white + + text: textInputAmountPayment.text === "" ? qsTr("Send") + " 0 " + comboboxToken.displayText + : qsTr("Send") + " " + textInputAmountPayment.text + " " + comboboxToken.displayText + + elide: Text.ElideMiddle + + } + } + } + + function updateWindow() + { + if (walletModelInfo.count <= dapComboboxNetwork.currentIndex) + { + console.warn("walletModelInfo.count <= dapComboboxNetwork.currentIndex") + } + else + { + console.log("dapComboboxNetwork.onCurrentIndexChanged") + + if (walletTokensModel.count === 0) + { + frameAmountPayment.visible = false + frameInputAmountPayment.visible = false + frameRecipientWallet.visible = false + frameRecipientWalletAddress.visible = false + textNotEnoughTokensWarning.visible = false + buttonSend.visible = false + } + else + { + frameAmountPayment.visible = true + frameInputAmountPayment.visible = true + frameRecipientWallet.visible = true + frameRecipientWalletAddress.visible = true + textNotEnoughTokensWarning.visible = true + buttonSend.visible = true + } + + if(comboboxNetwork.displayText !== "") + { + feeController.getFeeData() + } + + balance.fullText = walletTokensModel.get(dapComboBoxToken.displayText).value + + " " + dapComboBoxToken.displayText + + } + } + + function valueToFloat(value) + { + let result; + result = parseFloat(value); + + if (Number.isInteger(value)) { + result = value.toFixed(1) + } + + return result + } + + function resetPercent() + { + button25.selected = false + button50.selected = false + button75.selected = false + button100.selected = false + } +} diff --git a/CellFrameDashboard/screen/desktop/History/DapHistoryRightPanel.qml b/CellFrameDashboard/screen/desktop/History/DapHistoryRightPanel.qml index 292d93a2fbe59d5472c775fb6a03944be1af3deb..bb2a2fa1ecd32d61062a2329a03805233e9a17f7 100755 --- a/CellFrameDashboard/screen/desktop/History/DapHistoryRightPanel.qml +++ b/CellFrameDashboard/screen/desktop/History/DapHistoryRightPanel.qml @@ -278,7 +278,7 @@ Item return fullHeight - y < height + conteinHeight } - onCurrantDisplayTextChanged: + onCurrentDisplayTextChanged: { modelHistory.setNetworkFilter(displayText) } diff --git a/CellFrameDashboard/screen/desktop/Networks/parts/DapInfoContent.qml b/CellFrameDashboard/screen/desktop/Networks/parts/DapInfoContent.qml index 5fe5082152e3808c6cf0f947c97a1be75dcb31b5..0ac95abf0d90e926cae5b80a1334dcfc59cf6938 100644 --- a/CellFrameDashboard/screen/desktop/Networks/parts/DapInfoContent.qml +++ b/CellFrameDashboard/screen/desktop/Networks/parts/DapInfoContent.qml @@ -151,7 +151,6 @@ Item { { if(!app.getNodeMode()) { - console.log("setText()") logicNet.delay(300, function(){ if(buttonNetwork) buttonNetwork.updateFakeButton(false) }) diff --git a/CellFrameDashboard/screen/desktop/Stock/DapStockTopPanel.qml b/CellFrameDashboard/screen/desktop/Stock/DapStockTopPanel.qml index 46a9056c8932a7a37f4cd87d6b8c85038b02af9e..bf42088185321d1d8216c9844d41c498f6e5e11a 100644 --- a/CellFrameDashboard/screen/desktop/Stock/DapStockTopPanel.qml +++ b/CellFrameDashboard/screen/desktop/Stock/DapStockTopPanel.qml @@ -148,7 +148,7 @@ Controls.DapTopPanel } } - onCurrantDisplayTextChanged: + onCurrentDisplayTextChanged: { dexModule.setCurrentToken(text) } diff --git a/cellframe-sdk b/cellframe-sdk index fefaf73c7214d9dba6a776e5fece2ae1941b404b..c4e699f1427b1cf2770ecbc82bc5f050b68ad8ab 160000 --- a/cellframe-sdk +++ b/cellframe-sdk @@ -1 +1 @@ -Subproject commit fefaf73c7214d9dba6a776e5fece2ae1941b404b +Subproject commit c4e699f1427b1cf2770ecbc82bc5f050b68ad8ab diff --git a/cellframe-ui-sdk b/cellframe-ui-sdk index e2dd45e02ef396ef427d695370676f51b4c47d34..ea827a55d0084e6b84d9e2c87532a946712008b5 160000 --- a/cellframe-ui-sdk +++ b/cellframe-ui-sdk @@ -1 +1 @@ -Subproject commit e2dd45e02ef396ef427d695370676f51b4c47d34 +Subproject commit ea827a55d0084e6b84d9e2c87532a946712008b5 diff --git a/dap-ui-sdk b/dap-ui-sdk index fa22f1547a5df8484bb751d4254a82a63521f994..8d7533230fcc5b380e7a030bfc92bd9117816a8a 160000 --- a/dap-ui-sdk +++ b/dap-ui-sdk @@ -1 +1 @@ -Subproject commit fa22f1547a5df8484bb751d4254a82a63521f994 +Subproject commit 8d7533230fcc5b380e7a030bfc92bd9117816a8a diff --git a/version.mk b/version.mk index 59573d41c496d9bd718a7aed6aaabacf2d62930d..75c9dd82a7c4a3fbd41125dc13953dea3760d24b 100644 --- a/version.mk +++ b/version.mk @@ -1,4 +1,4 @@ VERSION_MAJOR=3 VERSION_MINOR=2 -VERSION_PATCH=12 +VERSION_PATCH=13