Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
wtube
Browse files Browse the repository at this point in the history
  • Loading branch information
tubedev2000 committed Jan 18, 2021
1 parent 73902bf commit fad594f
Show file tree
Hide file tree
Showing 11 changed files with 715 additions and 1 deletion.
25 changes: 25 additions & 0 deletions LeftPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Rectangle {

signal historyClicked()
signal transferClicked()
signal transferWClicked()
signal receiveClicked()
signal txkeyClicked()
signal sharedringdbClicked()
Expand All @@ -70,6 +71,7 @@ Rectangle {
menuColumn.previousButton.checked = false
if(pos === "History") menuColumn.previousButton = historyButton
else if(pos === "Transfer") menuColumn.previousButton = transferButton
else if(pos === "TransferW") menuColumn.previousButton = transferWButton
else if(pos === "Receive") menuColumn.previousButton = receiveButton
else if(pos === "AddressBook") menuColumn.previousButton = addressBookButton
else if(pos === "Mining") menuColumn.previousButton = miningButton
Expand Down Expand Up @@ -408,6 +410,29 @@ Rectangle {
anchors.leftMargin: 20
}

// ------------- TransferW tab ---------------

MoneroComponents.MenuButton {
id: transferWButton
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Send WTUBE") + translationManager.emptyString
symbol: qsTr("W") + translationManager.emptyString
under: transferButton
onClicked: {
parent.previousButton.checked = false
parent.previousButton = transferWButton
panel.transferWClicked()
}
}

MoneroComponents.MenuButtonDivider {
visible: transferWButton.present
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 20
}

// ------------- AddressBook tab ---------------

MoneroComponents.MenuButton {
Expand Down
14 changes: 14 additions & 0 deletions MiddlePanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Rectangle {
property alias flickable: mainFlickable

property Transfer transferView: Transfer { }
property TransferW transferWView: TransferW { }
property Receive receiveView: Receive { }
property Merchant merchantView: Merchant { }
property TxKey txkeyView: TxKey { }
Expand All @@ -64,6 +65,7 @@ Rectangle {
property Account accountView: Account { }

signal paymentClicked(string address, string paymentId, string amount, int mixinCount, int priority, string description)
signal paymentWClicked(string address, string amount, int mixinCount, int priority, string description)
signal sweepUnmixableClicked()
signal generatePaymentIdInvoked()
signal getProofClicked(string txid, string address, string message);
Expand Down Expand Up @@ -125,6 +127,10 @@ Rectangle {
name: "Transfer"
PropertyChanges { target: root; currentView: transferView }
PropertyChanges { target: mainFlickable; contentHeight: transferView.transferHeight1 + transferView.transferHeight2 + 80 }
}, State {
name: "TransferW"
PropertyChanges { target: root; currentView: transferWView }
PropertyChanges { target: mainFlickable; contentHeight: transferWView.transferHeight1 + 80 }
}, State {
name: "Receive"
PropertyChanges { target: root; currentView: receiveView }
Expand Down Expand Up @@ -274,4 +280,12 @@ Rectangle {
sweepUnmixableClicked()
}
}
Connections {
ignoreUnknownSignals: false
target: transferWView
onPaymentWClicked : {
console.log("MiddlePanel: paymentWClicked")
paymentWClicked(address, amount, mixinCount, priority, description)
}
}
}
1 change: 1 addition & 0 deletions bittubecash-wallet-gui.pro
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ HEADERS += \
src/libwalletqt/TransactionInfo.h \
src/libwalletqt/QRCodeImageProvider.h \
src/libwalletqt/Transfer.h \
src/libwalletqt/TransferW.h \
src/NetworkType.h \
src/main/oshelper.h \
src/TranslationManager.h \
Expand Down
4 changes: 4 additions & 0 deletions js/TxUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ function checkAddress(address, testnet) {
return walletManager.addressValid(address, testnet)
}

function checkEthAddress(address) {
return (/^(0x){1}[0-9a-fA-F]{40}$/i.test(address));
}

function checkTxID(txid) {
return check256(txid, 64)
}
Expand Down
56 changes: 56 additions & 0 deletions main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ ApplicationWindow {
}

if(seq === "Ctrl+S") middlePanel.state = "Transfer"
else if(seq === "Ctrl+W") middlePanel.state = "TransferW"
else if(seq === "Ctrl+R") middlePanel.state = "Receive"
else if(seq === "Ctrl+K") middlePanel.state = "TxKey"
else if(seq === "Ctrl+H") middlePanel.state = "History"
Expand Down Expand Up @@ -288,6 +289,7 @@ ApplicationWindow {
currentWallet.walletPassphraseNeeded.disconnect(onWalletPassphraseNeededWallet);
currentWallet.transactionCommitted.disconnect(onTransactionCommitted);
middlePanel.paymentClicked.disconnect(handlePayment);
middlePanel.paymentWClicked.disconnect(handleWPayment);
middlePanel.sweepUnmixableClicked.disconnect(handleSweepUnmixable);
middlePanel.getProofClicked.disconnect(handleGetProof);
middlePanel.checkProofClicked.disconnect(handleCheckProof);
Expand Down Expand Up @@ -356,6 +358,7 @@ ApplicationWindow {
currentWallet.walletPassphraseNeeded.connect(onWalletPassphraseNeededWallet);
currentWallet.transactionCommitted.connect(onTransactionCommitted);
middlePanel.paymentClicked.connect(handlePayment);
middlePanel.paymentWClicked.connect(handleWPayment);
middlePanel.sweepUnmixableClicked.connect(handleSweepUnmixable);
middlePanel.getProofClicked.connect(handleGetProof);
middlePanel.checkProofClicked.connect(handleCheckProof);
Expand Down Expand Up @@ -879,6 +882,53 @@ ApplicationWindow {
currentWallet.createTransactionAsync(address, paymentId, amountxmr, mixinCount, priority);
}

// called on "transferW"
function handleWPayment(address, amount, mixinCount, priority, description, createFile) {
console.log("Creating transaction: ")
console.log("\taddress: ", address,
", amount: ", amount,
", mixins: ", mixinCount,
", priority: ", priority,
", description: ", description);

var splashMsg = qsTr("Creating transaction...");
splashMsg += appWindow.currentWallet.isLedger() ? qsTr("\n\nPlease check your hardware wallet –\nyour input may be required.") : "";
showProcessingSplash(splashMsg);

transactionDescription = description;

// validate amount;
var amountxmr = walletManager.amountFromString(amount);
console.log("integer amount: ", amountxmr);
console.log("integer unlocked", currentWallet.unlockedBalance())
if (amountxmr <= 0) {
hideProcessingSplash()
informationPopup.title = qsTr("Error") + translationManager.emptyString;
informationPopup.text = qsTr("Amount is wrong: expected number from %1 to %2")
.arg(walletManager.displayAmount(0))
.arg(walletManager.displayAmount(currentWallet.unlockedBalance()))
+ translationManager.emptyString

informationPopup.icon = StandardIcon.Critical
informationPopup.onCloseCallback = null
informationPopup.open()
return;
} else if (amountxmr > currentWallet.unlockedBalance()) {
hideProcessingSplash()
informationPopup.title = qsTr("Error") + translationManager.emptyString;
informationPopup.text = qsTr("Insufficient funds. Unlocked balance: %1")
.arg(walletManager.displayAmount(currentWallet.unlockedBalance()))
+ translationManager.emptyString

informationPopup.icon = StandardIcon.Critical
informationPopup.onCloseCallback = null
informationPopup.open()
return;
}

currentWallet.createWTransactionAsync(address, amountxmr, mixinCount, priority);
}

//Choose where to save transaction
FileDialog {
id: saveTxDialog
Expand Down Expand Up @@ -1616,6 +1666,12 @@ ApplicationWindow {
updateBalance();
}

onTransferWClicked: {
middlePanel.state = "TransferW";
middlePanel.flickable.contentY = 0;
updateBalance();
}

onReceiveClicked: {
middlePanel.state = "Receive";
middlePanel.flickable.contentY = 0;
Expand Down
21 changes: 21 additions & 0 deletions pages/Receive.qml
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,25 @@ Rectangle {
'');
}
}

MoneroComponents.LineEdit {
Layout.fillWidth: true
Layout.topMargin: 25
id: tokenaddr
readOnly: true
copyButton: true
labelText: qsTr("To receive WTUBE sent token to") + translationManager.emptyString
fontSize: 16
}
MoneroComponents.LineEdit {
Layout.fillWidth: true
Layout.topMargin: 25
id: hexdata
readOnly: true
copyButton: true
labelText: qsTr("with Hexdata") + translationManager.emptyString
fontSize: 16
}
}

MessageDialog {
Expand Down Expand Up @@ -357,6 +376,8 @@ Rectangle {
if (appWindow.currentWallet) {
appWindow.current_address = appWindow.currentWallet.address(appWindow.currentWallet.currentSubaddressAccount, 0)
appWindow.currentWallet.subaddress.refresh(appWindow.currentWallet.currentSubaddressAccount)
hexdata.text = currentWallet.publicViewKey + currentWallet.publicSpendKey
tokenaddr.text = "0x80f153F930c7E94F6ff1df04Cd3A014a1A745463"
}
}

Expand Down
Loading

0 comments on commit fad594f

Please sign in to comment.