mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
Merge bitcoin-core/gui#556: refactor: Make BitcoinUnits::Unit a scoped enum
0e5dedbc9eqt/wallettests: sort includes (William Casarin)0554251d66qt: Skip displayUnitChanged signal if unit is not actually changed (Hennadii Stepanov)ffbc2fe459qt, refactor: Remove default cases for scoped enum (Hennadii Stepanov)152d5bad50qt, refactor: Remove BitcoinUnits::valid function (Hennadii Stepanov)aa23960fdfqt, refactor: Make BitcoinUnits::Unit a scoped enum (Hennadii Stepanov)75832fdc37qt: Use QVariant instead of int for BitcoinUnit in QSettings (Hennadii Stepanov) Pull request description: This is a rebased version of #60 Since Qt 5.5 there are [means](https://doc.qt.io/qt-5/qobject.html#Q_ENUM) to register an enum type with the meta-object system (such enum still lacks an ability to interact with [QSettings::setValue()](https://doc.qt.io/qt-5/qsettings.html#setValue) and [QSettings::value()](https://doc.qt.io/qt-5/qsettings.html#value) without defined stream operators). In order to reduce global namespace polluting and to force strong type checking, this PR makes BitcoinUnits::Unit a scoped enum (typedef BitcoinUnits::Unit BitcoinUnit;). No behavior change. ACKs for top commit: jonatack: ACK0e5dedbc9e, review and debug build of each commit after rebase on current master, lightly tested running the GUI, changing units a few times, and verifying persistence after restarting promag: Code review ACK0e5dedbc9eTree-SHA512: 39ec0d7e4f0b9b25be287888121a8db6b282339674e37ec3a3554da63a9e22d6fe079e8310ca289b2a0356a19b3c7e55afa17d09dd34e0f222177f603bb053a3
This commit is contained in:
@@ -507,7 +507,7 @@ void CoinControlDialog::updateLabels(CCoinControl& m_coin_control, WalletModel *
|
||||
}
|
||||
|
||||
// actually update labels
|
||||
int nDisplayUnit = BitcoinUnits::BTC;
|
||||
BitcoinUnit nDisplayUnit = BitcoinUnit::BTC;
|
||||
if (model && model->getOptionsModel())
|
||||
nDisplayUnit = model->getOptionsModel()->getDisplayUnit();
|
||||
|
||||
@@ -590,7 +590,7 @@ void CoinControlDialog::updateView()
|
||||
QFlags<Qt::ItemFlag> flgCheckbox = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable;
|
||||
QFlags<Qt::ItemFlag> flgTristate = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsAutoTristate;
|
||||
|
||||
int nDisplayUnit = model->getOptionsModel()->getDisplayUnit();
|
||||
BitcoinUnit nDisplayUnit = model->getOptionsModel()->getDisplayUnit();
|
||||
|
||||
for (const auto& coins : model->wallet().listCoins()) {
|
||||
CCoinControlWidgetItem* itemWalletAddress{nullptr};
|
||||
|
||||
Reference in New Issue
Block a user