From 8a1940476d65fed1739bcbe6ab6b4669682e62f2 Mon Sep 17 00:00:00 2001 From: zathras-crypto Date: Mon, 13 Apr 2015 19:36:31 -0700 Subject: [PATCH] omnicore_qtutils : add PopulateTXSentDialog() --- src/mastercore_errors.h | 8 ++++---- src/qt/omnicore_qtutils.cpp | 19 ++++++++++++++++++- src/qt/omnicore_qtutils.h | 5 +++++ 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/mastercore_errors.h b/src/mastercore_errors.h index 13e3bd2e4b770..739d475f17429 100644 --- a/src/mastercore_errors.h +++ b/src/mastercore_errors.h @@ -9,8 +9,8 @@ enum MPRPCErrorCode MP_INSUF_FUNDS_BPENDI = -1, // balance before pending MP_INSUF_FUNDS_APENDI = -2, // balance after pending MP_INPUT_NOT_IN_RANGE = -11, // input value larger than supported - - //ClassB_send + + //ClassAgnosticWalletTXBuilder( MP_INPUTS_INVALID = -212, MP_REDEMP_ILLEGAL = -233, MP_REDEMP_BAD_KEYID = -220, @@ -21,7 +21,7 @@ enum MPRPCErrorCode MP_ERR_INPUTSELECT_FAIL = -206, MP_ERR_CREATE_TX = -211, MP_ERR_COMMIT_TX = -213, - + //gettransaction_MP, listtransactions_MP MP_TX_NOT_FOUND = -3331, // No information available about transaction. (GetTransaction failed) MP_TX_UNCONFIRMED = -3332, // Unconfirmed transactions are not supported. (blockHash is 0) @@ -33,7 +33,7 @@ enum MPRPCErrorCode inline std::string error_str(int ec) { std::string ec_str; - + switch (ec) { case MP_INSUF_FUNDS_BPENDI: diff --git a/src/qt/omnicore_qtutils.cpp b/src/qt/omnicore_qtutils.cpp index 14fc96f030b37..7536461a9e6b2 100644 --- a/src/qt/omnicore_qtutils.cpp +++ b/src/qt/omnicore_qtutils.cpp @@ -9,12 +9,29 @@ #include #include #include +#include namespace mastercore { /** - * Sets up a simple dialog layout that can be used to provide selectable text to the user + * Displays a 'transaction sent' message box containing the transaction ID and an extra button to copy txid to clipboard + */ +void PopulateTXSentDialog(const std::string& txidStr) +{ + std::string strSentText = "Your Omni Layer transaction has been sent.\n\nThe transaction ID is:\n\n" + txidStr + "\n\n"; + QMessageBox sentDialog; + sentDialog.setIcon(QMessageBox::Information); + sentDialog.setWindowTitle("Transaction broadcast successfully"); + sentDialog.setText(QString::fromStdString(strSentText)); + sentDialog.setStandardButtons(QMessageBox::Yes|QMessageBox::Ok); + sentDialog.setDefaultButton(QMessageBox::Ok); + sentDialog.setButtonText( QMessageBox::Yes, "Copy TXID to clipboard" ); + if(sentDialog.exec() == QMessageBox::Yes) GUIUtil::setClipboard(QString::fromStdString(txidStr)); +} + +/** + * Displays a simple dialog layout that can be used to provide selectable text to the user * * Note: used in place of standard dialogs in cases where text selection & copy to clipboard functions are useful */ diff --git a/src/qt/omnicore_qtutils.h b/src/qt/omnicore_qtutils.h index d0148963ffb98..1cd34eb351490 100644 --- a/src/qt/omnicore_qtutils.h +++ b/src/qt/omnicore_qtutils.h @@ -15,6 +15,11 @@ namespace mastercore * Strips trailing zeros from a string containing a divisible value */ std::string StripTrailingZeros(const std::string& inputStr); + + /** + * Displays a 'transaction sent' message box containing the transaction ID and an extra button to copy txid to clipboard + */ + void PopulateTXSentDialog(const std::string& txidStr); } #endif // OMNICORE_QTUTILS