diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2012-12-12 21:17:40 -0800 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2012-12-12 21:17:40 -0800 |
commit | 07c3f846c260020aa07af92d28f384509d79a086 (patch) | |
tree | f5decf0b0bfee4654b502250006ce8af9ef9a53c /src | |
parent | 5fe3f4652ed20780b3e93ddbe3f5b67d646a704a (diff) | |
parent | 50ecd7b68970062bfb540798370dbfab6d376086 (diff) |
Merge pull request #2045 from Diapolo/use_message
use new message() function in BitcoinGUI
Diffstat (limited to 'src')
-rw-r--r-- | src/qt/bitcoingui.cpp | 60 | ||||
-rw-r--r-- | src/qt/bitcoingui.h | 2 |
2 files changed, 31 insertions, 31 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 3fe86501f6..9cd22ed297 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -697,39 +697,33 @@ void BitcoinGUI::askFee(qint64 nFeeRequired, bool *payFee) *payFee = (retval == QMessageBox::Yes); } -void BitcoinGUI::incomingTransaction(const QModelIndex & parent, int start, int end) +void BitcoinGUI::incomingTransaction(const QModelIndex& parent, int start, int /*end*/) { - if(!walletModel || !clientModel) + // Prevent balloon-spam when initial block download is in progress + if(!walletModel || !clientModel || clientModel->inInitialBlockDownload()) return; + TransactionTableModel *ttm = walletModel->getTransactionTableModel(); + + QString date = ttm->index(start, TransactionTableModel::Date, parent) + .data().toString(); qint64 amount = ttm->index(start, TransactionTableModel::Amount, parent) - .data(Qt::EditRole).toULongLong(); - if(!clientModel->inInitialBlockDownload()) - { - // On new transaction, make an info balloon - // Unless the initial block download is in progress, to prevent balloon-spam - QString date = ttm->index(start, TransactionTableModel::Date, parent) - .data().toString(); - QString type = ttm->index(start, TransactionTableModel::Type, parent) + .data(Qt::EditRole).toULongLong(); + QString type = ttm->index(start, TransactionTableModel::Type, parent) + .data().toString(); + QString address = ttm->index(start, TransactionTableModel::ToAddress, parent) .data().toString(); - QString address = ttm->index(start, TransactionTableModel::ToAddress, parent) - .data().toString(); - QIcon icon = qvariant_cast<QIcon>(ttm->index(start, - TransactionTableModel::ToAddress, parent) - .data(Qt::DecorationRole)); - notificator->notify(Notificator::Information, - (amount)<0 ? tr("Sent transaction") : - tr("Incoming transaction"), - tr("Date: %1\n" - "Amount: %2\n" - "Type: %3\n" - "Address: %4\n") - .arg(date) - .arg(BitcoinUnits::formatWithUnit(walletModel->getOptionsModel()->getDisplayUnit(), amount, true)) - .arg(type) - .arg(address), icon); - } + // On new transaction, make an info balloon + message((amount)<0 ? tr("Sent transaction") : tr("Incoming transaction"), + tr("Date: %1\n" + "Amount: %2\n" + "Type: %3\n" + "Address: %4\n") + .arg(date) + .arg(BitcoinUnits::formatWithUnit(walletModel->getOptionsModel()->getDisplayUnit(), amount, true)) + .arg(type) + .arg(address), CClientUIInterface::MSG_INFORMATION); } void BitcoinGUI::gotoOverviewPage() @@ -821,7 +815,8 @@ void BitcoinGUI::dropEvent(QDropEvent *event) if (nValidUrisFound) gotoSendCoinsPage(); else - notificator->notify(Notificator::Warning, tr("URI handling"), tr("URI can not be parsed! This can be caused by an invalid Bitcoin address or malformed URI parameters.")); + message(tr("URI handling"), tr("URI can not be parsed! This can be caused by an invalid Bitcoin address or malformed URI parameters."), + CClientUIInterface::ICON_WARNING); } event->acceptProposedAction(); @@ -848,7 +843,8 @@ void BitcoinGUI::handleURI(QString strURI) gotoSendCoinsPage(); } else - notificator->notify(Notificator::Warning, tr("URI handling"), tr("URI can not be parsed! This can be caused by an invalid Bitcoin address or malformed URI parameters.")); + message(tr("URI handling"), tr("URI can not be parsed! This can be caused by an invalid Bitcoin address or malformed URI parameters."), + CClientUIInterface::ICON_WARNING); } void BitcoinGUI::setEncryptionStatus(int status) @@ -898,8 +894,12 @@ void BitcoinGUI::backupWallet() QString filename = QFileDialog::getSaveFileName(this, tr("Backup Wallet"), saveDir, tr("Wallet Data (*.dat)")); if(!filename.isEmpty()) { if(!walletModel->backupWallet(filename)) { - QMessageBox::warning(this, tr("Backup Failed"), tr("There was an error trying to save the wallet data to the new location.")); + message(tr("Backup Failed"), tr("There was an error trying to save the wallet data to the new location."), + CClientUIInterface::MSG_ERROR); } + else + message(tr("Backup Successful"), tr("The wallet data was successfully saved to the new location."), + CClientUIInterface::MSG_INFORMATION); } } diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 3faf6d948c..b7afdb1c8c 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -168,7 +168,7 @@ private slots: The new items are those between start and end inclusive, under the given parent item. */ - void incomingTransaction(const QModelIndex & parent, int start, int end); + void incomingTransaction(const QModelIndex& parent, int start, int /*end*/); /** Encrypt the wallet */ void encryptWallet(bool status); /** Backup the wallet */ |