Skip to content

Commit

Permalink
omnicore_qtutils : add PopulateTXSentDialog()
Browse files Browse the repository at this point in the history
  • Loading branch information
zathras-crypto committed Apr 14, 2015
1 parent 0346243 commit 8a19404
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/mastercore_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand All @@ -33,7 +33,7 @@ enum MPRPCErrorCode

inline std::string error_str(int ec) {
std::string ec_str;

switch (ec)
{
case MP_INSUF_FUNDS_BPENDI:
Expand Down
19 changes: 18 additions & 1 deletion src/qt/omnicore_qtutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,29 @@
#include <QPushButton>
#include <QObject>
#include <QWidget>
#include <QMessageBox>

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
*/
Expand Down
5 changes: 5 additions & 0 deletions src/qt/omnicore_qtutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 8a19404

Please sign in to comment.