mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-01-09 19:32:03 +02:00
commit
abf823e38d
21
main.qml
21
main.qml
@ -306,6 +306,7 @@ ApplicationWindow {
|
|||||||
currentWallet.connectionStatusChanged.disconnect(onWalletConnectionStatusChanged)
|
currentWallet.connectionStatusChanged.disconnect(onWalletConnectionStatusChanged)
|
||||||
currentWallet.deviceButtonRequest.disconnect(onDeviceButtonRequest);
|
currentWallet.deviceButtonRequest.disconnect(onDeviceButtonRequest);
|
||||||
currentWallet.deviceButtonPressed.disconnect(onDeviceButtonPressed);
|
currentWallet.deviceButtonPressed.disconnect(onDeviceButtonPressed);
|
||||||
|
currentWallet.transactionCommitted.disconnect(onTransactionCommitted);
|
||||||
middlePanel.paymentClicked.disconnect(handlePayment);
|
middlePanel.paymentClicked.disconnect(handlePayment);
|
||||||
middlePanel.sweepUnmixableClicked.disconnect(handleSweepUnmixable);
|
middlePanel.sweepUnmixableClicked.disconnect(handleSweepUnmixable);
|
||||||
middlePanel.getProofClicked.disconnect(handleGetProof);
|
middlePanel.getProofClicked.disconnect(handleGetProof);
|
||||||
@ -363,6 +364,7 @@ ApplicationWindow {
|
|||||||
currentWallet.connectionStatusChanged.connect(onWalletConnectionStatusChanged)
|
currentWallet.connectionStatusChanged.connect(onWalletConnectionStatusChanged)
|
||||||
currentWallet.deviceButtonRequest.connect(onDeviceButtonRequest);
|
currentWallet.deviceButtonRequest.connect(onDeviceButtonRequest);
|
||||||
currentWallet.deviceButtonPressed.connect(onDeviceButtonPressed);
|
currentWallet.deviceButtonPressed.connect(onDeviceButtonPressed);
|
||||||
|
currentWallet.transactionCommitted.connect(onTransactionCommitted);
|
||||||
middlePanel.paymentClicked.connect(handlePayment);
|
middlePanel.paymentClicked.connect(handlePayment);
|
||||||
middlePanel.sweepUnmixableClicked.connect(handleSweepUnmixable);
|
middlePanel.sweepUnmixableClicked.connect(handleSweepUnmixable);
|
||||||
middlePanel.getProofClicked.connect(handleGetProof);
|
middlePanel.getProofClicked.connect(handleGetProof);
|
||||||
@ -948,16 +950,6 @@ ApplicationWindow {
|
|||||||
|
|
||||||
// called after user confirms transaction
|
// called after user confirms transaction
|
||||||
function handleTransactionConfirmed(fileName) {
|
function handleTransactionConfirmed(fileName) {
|
||||||
// grab transaction.txid before commit, since it clears it.
|
|
||||||
// we actually need to copy it, because QML will incredibly
|
|
||||||
// call the function multiple times when the variable is used
|
|
||||||
// after commit, where it returns another result...
|
|
||||||
// Of course, this loop is also calling the function multiple
|
|
||||||
// times, but at least with the same result.
|
|
||||||
var txid = [], txid_org = transaction.txid, txid_text = ""
|
|
||||||
for (var i = 0; i < txid_org.length; ++i)
|
|
||||||
txid[i] = txid_org[i]
|
|
||||||
|
|
||||||
// View only wallet - we save the tx
|
// View only wallet - we save the tx
|
||||||
if(viewOnly && saveTxDialog.fileUrl){
|
if(viewOnly && saveTxDialog.fileUrl){
|
||||||
// No file specified - abort
|
// No file specified - abort
|
||||||
@ -972,12 +964,19 @@ ApplicationWindow {
|
|||||||
transaction.setFilename(path);
|
transaction.setFilename(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!transaction.commit()) {
|
appWindow.showProcessingSplash(qsTr("Sending transaction ..."));
|
||||||
|
currentWallet.commitTransactionAsync(transaction);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onTransactionCommitted(success, transaction, txid) {
|
||||||
|
hideProcessingSplash();
|
||||||
|
if (!success) {
|
||||||
console.log("Error committing transaction: " + transaction.errorString);
|
console.log("Error committing transaction: " + transaction.errorString);
|
||||||
informationPopup.title = qsTr("Error") + translationManager.emptyString
|
informationPopup.title = qsTr("Error") + translationManager.emptyString
|
||||||
informationPopup.text = qsTr("Couldn't send the money: ") + transaction.errorString
|
informationPopup.text = qsTr("Couldn't send the money: ") + transaction.errorString
|
||||||
informationPopup.icon = StandardIcon.Critical
|
informationPopup.icon = StandardIcon.Critical
|
||||||
} else {
|
} else {
|
||||||
|
var txid_text = ""
|
||||||
informationPopup.title = qsTr("Information") + translationManager.emptyString
|
informationPopup.title = qsTr("Information") + translationManager.emptyString
|
||||||
for (var i = 0; i < txid.length; ++i) {
|
for (var i = 0; i < txid.length; ++i) {
|
||||||
if (txid_text.length > 0)
|
if (txid_text.length > 0)
|
||||||
|
@ -524,6 +524,22 @@ bool Wallet::submitTxFile(const QString &fileName) const
|
|||||||
return m_walletImpl->importKeyImages(fileName.toStdString() + "_keyImages");
|
return m_walletImpl->importKeyImages(fileName.toStdString() + "_keyImages");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Wallet::commitTransactionAsync(PendingTransaction *t)
|
||||||
|
{
|
||||||
|
QStringList txid(t->txid());
|
||||||
|
QFuture<bool> future = QtConcurrent::run(t, &PendingTransaction::commit);
|
||||||
|
|
||||||
|
QFutureWatcher<bool> * watcher = new QFutureWatcher<bool>();
|
||||||
|
|
||||||
|
connect(watcher, &QFutureWatcher<bool>::finished,
|
||||||
|
this, [this, watcher, t, txid]() {
|
||||||
|
QFuture<bool> future = watcher->future();
|
||||||
|
watcher->deleteLater();
|
||||||
|
emit transactionCommitted(future.result(), t, txid);
|
||||||
|
});
|
||||||
|
watcher->setFuture(future);
|
||||||
|
}
|
||||||
|
|
||||||
void Wallet::disposeTransaction(PendingTransaction *t)
|
void Wallet::disposeTransaction(PendingTransaction *t)
|
||||||
{
|
{
|
||||||
m_walletImpl->disposeTransaction(t->m_pimpl);
|
m_walletImpl->disposeTransaction(t->m_pimpl);
|
||||||
|
@ -241,6 +241,8 @@ public:
|
|||||||
//! Submit a transfer from file
|
//! Submit a transfer from file
|
||||||
Q_INVOKABLE bool submitTxFile(const QString &fileName) const;
|
Q_INVOKABLE bool submitTxFile(const QString &fileName) const;
|
||||||
|
|
||||||
|
//! asynchronous transaction commit
|
||||||
|
Q_INVOKABLE void commitTransactionAsync(PendingTransaction * t);
|
||||||
|
|
||||||
//! deletes transaction and frees memory
|
//! deletes transaction and frees memory
|
||||||
Q_INVOKABLE void disposeTransaction(PendingTransaction * t);
|
Q_INVOKABLE void disposeTransaction(PendingTransaction * t);
|
||||||
@ -352,6 +354,7 @@ signals:
|
|||||||
void walletCreationHeightChanged();
|
void walletCreationHeightChanged();
|
||||||
void deviceButtonRequest(quint64 buttonCode);
|
void deviceButtonRequest(quint64 buttonCode);
|
||||||
void deviceButtonPressed();
|
void deviceButtonPressed();
|
||||||
|
void transactionCommitted(bool status, PendingTransaction *t, QStringList txid);
|
||||||
|
|
||||||
// emitted when transaction is created async
|
// emitted when transaction is created async
|
||||||
void transactionCreated(PendingTransaction * transaction, QString address, QString paymentId, quint32 mixinCount);
|
void transactionCreated(PendingTransaction * transaction, QString address, QString paymentId, quint32 mixinCount);
|
||||||
|
Loading…
Reference in New Issue
Block a user