aboutsummaryrefslogtreecommitdiff
path: root/src/qt/transactiontablemodel.cpp
diff options
context:
space:
mode:
authorgubatron <gubatron@gmail.com>2014-06-07 02:20:22 -0400
committergubatron <gubatron@gmail.com>2014-06-25 14:53:05 -0400
commit8969828d069e4e55108618a493749535edc12ec7 (patch)
treeb3e65acdf948412304e2179cb2baac4afaab120b /src/qt/transactiontablemodel.cpp
parent343feecf562a39e7d898ece2fd745fcb9d4c90e9 (diff)
downloadbitcoin-8969828d069e4e55108618a493749535edc12ec7.tar.xz
[Qt] New status bar Unit Display Control and related changes.
- New status bar control shows the current Unit of Display. When clicked (left,or right button) it shows a context menu that allows the user to switch the current Unit of Display (BTC, mBTC, uBTC) - Recent Requests and Transaction Table headers are now updated when unit of display is changed, because their "Amount" column now displays the current unit of display. - Takes care of issue #3970 Units in transaction export csv file. - Small refactors for reusability. - Demo Video https://www.youtube.com/watch?v=wwcr0Yh68go&list=UUG3jF2hgofmLWP0tRPisQAQ - changes after Diapolo's feedback. Have not been able to build after last pool, issues with boost on MacOSX, will test on Ubuntu these changes. - removed return statement on switch - renamed onDisplayUnitsChanged(int) to updateDisplayUnit(int) - now getAmountColumnTitle(int unit) takes a simple unit parameter. moved to BitcoinUnits.
Diffstat (limited to 'src/qt/transactiontablemodel.cpp')
-rw-r--r--src/qt/transactiontablemodel.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp
index b9fcd0d6b0..e34238d805 100644
--- a/src/qt/transactiontablemodel.cpp
+++ b/src/qt/transactiontablemodel.cpp
@@ -235,8 +235,7 @@ TransactionTableModel::TransactionTableModel(CWallet* wallet, WalletModel *paren
walletModel(parent),
priv(new TransactionTablePriv(wallet, this))
{
- columns << QString() << tr("Date") << tr("Type") << tr("Address") << tr("Amount");
-
+ columns << QString() << tr("Date") << tr("Type") << tr("Address") << BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit());
priv->refreshWallet();
connect(walletModel->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
@@ -247,6 +246,13 @@ TransactionTableModel::~TransactionTableModel()
delete priv;
}
+/** Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. */
+void TransactionTableModel::updateAmountColumnTitle()
+{
+ columns[Amount] = BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit());
+ emit headerDataChanged(Qt::Horizontal,Amount,Amount);
+}
+
void TransactionTableModel::updateTransaction(const QString &hash, int status)
{
uint256 updated;
@@ -624,5 +630,6 @@ QModelIndex TransactionTableModel::index(int row, int column, const QModelIndex
void TransactionTableModel::updateDisplayUnit()
{
// emit dataChanged to update Amount column with the current unit
+ updateAmountColumnTitle();
emit dataChanged(index(0, Amount), index(priv->size()-1, Amount));
}