Move to standard UI transaction
This commit is contained in:
@@ -796,20 +796,7 @@ void MainWindow::postToZBoard() {
|
|||||||
tx.fee = Settings::getMinerFee();
|
tx.fee = Settings::getMinerFee();
|
||||||
|
|
||||||
// And send the Tx
|
// And send the Tx
|
||||||
rpc->executeTransaction(tx, [=] (QString opid) {
|
rpc->executeStandardUITransaction(tx);
|
||||||
ui->statusBar->showMessage(tr("Computing Tx: ") % opid);
|
|
||||||
},
|
|
||||||
[=] (QString /*opid*/, QString txid) {
|
|
||||||
ui->statusBar->showMessage(Settings::txidStatusMessage + " " + txid);
|
|
||||||
},
|
|
||||||
[=] (QString opid, QString errStr) {
|
|
||||||
ui->statusBar->showMessage(QObject::tr(" Tx ") % opid % QObject::tr(" failed"), 15 * 1000);
|
|
||||||
|
|
||||||
if (!opid.isEmpty())
|
|
||||||
errStr = QObject::tr("The transaction with id ") % opid % QObject::tr(" failed. The error was") + ":\n\n" + errStr;
|
|
||||||
|
|
||||||
QMessageBox::critical(this, QObject::tr("Transaction Error"), errStr, QMessageBox::Ok);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
23
src/rpc.cpp
23
src/rpc.cpp
@@ -962,6 +962,29 @@ void RPC::addNewTxToWatch(const QString& newOpid, WatchedTx wtx) {
|
|||||||
watchTxStatus();
|
watchTxStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute a transaction with the standard UI. i.e., standard status bar message and standard error
|
||||||
|
* handling
|
||||||
|
*/
|
||||||
|
void RPC::executeStandardUITransaction(Tx tx) {
|
||||||
|
executeTransaction(tx,
|
||||||
|
[=] (QString opid) {
|
||||||
|
ui->statusBar->showMessage(QObject::tr("Computing Tx: ") % opid);
|
||||||
|
},
|
||||||
|
[=] (QString, QString txid) {
|
||||||
|
ui->statusBar->showMessage(Settings::txidStatusMessage + " " + txid);
|
||||||
|
},
|
||||||
|
[=] (QString opid, QString errStr) {
|
||||||
|
ui->statusBar->showMessage(QObject::tr(" Tx ") % opid % QObject::tr(" failed"), 15 * 1000);
|
||||||
|
|
||||||
|
if (!opid.isEmpty())
|
||||||
|
errStr = QObject::tr("The transaction with id ") % opid % QObject::tr(" failed. The error was") + ":\n\n" + errStr;
|
||||||
|
|
||||||
|
QMessageBox::critical(main, QObject::tr("Transaction Error"), errStr, QMessageBox::Ok);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Execute a transaction!
|
// Execute a transaction!
|
||||||
void RPC::executeTransaction(Tx tx,
|
void RPC::executeTransaction(Tx tx,
|
||||||
|
|||||||
@@ -58,6 +58,8 @@ public:
|
|||||||
void refreshZECPrice();
|
void refreshZECPrice();
|
||||||
void getZboardTopics(std::function<void(QMap<QString, QString>)> cb);
|
void getZboardTopics(std::function<void(QMap<QString, QString>)> cb);
|
||||||
|
|
||||||
|
void executeStandardUITransaction(Tx tx);
|
||||||
|
|
||||||
void executeTransaction(Tx tx,
|
void executeTransaction(Tx tx,
|
||||||
const std::function<void(QString opid)> submitted,
|
const std::function<void(QString opid)> submitted,
|
||||||
const std::function<void(QString opid, QString txid)> computed,
|
const std::function<void(QString opid, QString txid)> computed,
|
||||||
|
|||||||
Reference in New Issue
Block a user