Skip to content

Commit 2468292

Browse files
committed
Merge #8517: [Qt] show wallet HD state in statusbar
914154f [Qt] add HD enabled/disabled icon to the status bar (Jonas Schnelli)
2 parents 56ac046 + 914154f commit 2468292

15 files changed

+107
-18
lines changed

contrib/debian/copyright

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ Files: src/qt/res/icons/tx_mined.png
5959
src/qt/res/src/mine.svg
6060
src/qt/res/icons/fontbigger.png
6161
src/qt/res/icons/fontsmaller.png
62+
src/qt/res/icons/hd_disabled.png
63+
src/qt/res/src/hd_disabled.svg
64+
src/qt/res/icons/hd_enabled.png
65+
src/qt/res/src/hd_enabled.svg
6266
Copyright: Jonas Schnelli
6367
License: Expat
6468
Comment:

src/Makefile.qt.include

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ RES_ICONS = \
257257
qt/res/icons/filesave.png \
258258
qt/res/icons/fontbigger.png \
259259
qt/res/icons/fontsmaller.png \
260+
qt/res/icons/hd_disabled.png \
261+
qt/res/icons/hd_enabled.png \
260262
qt/res/icons/history.png \
261263
qt/res/icons/info.png \
262264
qt/res/icons/key.png \
@@ -271,14 +273,14 @@ RES_ICONS = \
271273
qt/res/icons/synced.png \
272274
qt/res/icons/transaction0.png \
273275
qt/res/icons/transaction2.png \
276+
qt/res/icons/transaction_abandoned.png \
274277
qt/res/icons/transaction_conflicted.png \
275278
qt/res/icons/tx_inout.png \
276279
qt/res/icons/tx_input.png \
277280
qt/res/icons/tx_output.png \
278281
qt/res/icons/tx_mined.png \
279282
qt/res/icons/warning.png \
280-
qt/res/icons/verify.png \
281-
qt/res/icons/transaction_abandoned.png
283+
qt/res/icons/verify.png
282284

283285
BITCOIN_QT_CPP = \
284286
qt/bantablemodel.cpp \

src/qt/bitcoin.qrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
<file alias="fontsmaller">res/icons/fontsmaller.png</file>
5151
<file alias="prompticon">res/icons/chevron.png</file>
5252
<file alias="transaction_abandoned">res/icons/transaction_abandoned.png</file>
53+
<file alias="hd_enabled">res/icons/hd_enabled.png</file>
54+
<file alias="hd_disabled">res/icons/hd_disabled.png</file>
5355
</qresource>
5456
<qresource prefix="/movies">
5557
<file alias="spinner-000">res/movies/spinner-000.png</file>

src/qt/bitcoingui.cpp

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *n
8080
clientModel(0),
8181
walletFrame(0),
8282
unitDisplayControl(0),
83-
labelEncryptionIcon(0),
83+
labelWalletEncryptionIcon(0),
84+
labelWalletHDStatusIcon(0),
8485
labelConnectionsIcon(0),
8586
labelBlocksIcon(0),
8687
progressBarLabel(0),
@@ -194,15 +195,17 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *n
194195
frameBlocksLayout->setContentsMargins(3,0,3,0);
195196
frameBlocksLayout->setSpacing(3);
196197
unitDisplayControl = new UnitDisplayStatusBarControl(platformStyle);
197-
labelEncryptionIcon = new QLabel();
198+
labelWalletEncryptionIcon = new QLabel();
199+
labelWalletHDStatusIcon = new QLabel();
198200
labelConnectionsIcon = new QLabel();
199201
labelBlocksIcon = new QLabel();
200202
if(enableWallet)
201203
{
202204
frameBlocksLayout->addStretch();
203205
frameBlocksLayout->addWidget(unitDisplayControl);
204206
frameBlocksLayout->addStretch();
205-
frameBlocksLayout->addWidget(labelEncryptionIcon);
207+
frameBlocksLayout->addWidget(labelWalletEncryptionIcon);
208+
frameBlocksLayout->addWidget(labelWalletHDStatusIcon);
206209
}
207210
frameBlocksLayout->addStretch();
208211
frameBlocksLayout->addWidget(labelConnectionsIcon);
@@ -988,28 +991,37 @@ bool BitcoinGUI::handlePaymentRequest(const SendCoinsRecipient& recipient)
988991
return false;
989992
}
990993

994+
void BitcoinGUI::setHDStatus(int hdEnabled)
995+
{
996+
labelWalletHDStatusIcon->setPixmap(platformStyle->SingleColorIcon(hdEnabled ? ":/icons/hd_enabled" : ":/icons/hd_disabled").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
997+
labelWalletHDStatusIcon->setToolTip(hdEnabled ? tr("HD key generation is <b>enabled</b>") : tr("HD key generation is <b>disabled</b>"));
998+
999+
// eventually disable the QLabel to set its opacity to 50%
1000+
labelWalletHDStatusIcon->setEnabled(hdEnabled);
1001+
}
1002+
9911003
void BitcoinGUI::setEncryptionStatus(int status)
9921004
{
9931005
switch(status)
9941006
{
9951007
case WalletModel::Unencrypted:
996-
labelEncryptionIcon->hide();
1008+
labelWalletEncryptionIcon->hide();
9971009
encryptWalletAction->setChecked(false);
9981010
changePassphraseAction->setEnabled(false);
9991011
encryptWalletAction->setEnabled(true);
10001012
break;
10011013
case WalletModel::Unlocked:
1002-
labelEncryptionIcon->show();
1003-
labelEncryptionIcon->setPixmap(platformStyle->SingleColorIcon(":/icons/lock_open").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
1004-
labelEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>unlocked</b>"));
1014+
labelWalletEncryptionIcon->show();
1015+
labelWalletEncryptionIcon->setPixmap(platformStyle->SingleColorIcon(":/icons/lock_open").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
1016+
labelWalletEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>unlocked</b>"));
10051017
encryptWalletAction->setChecked(true);
10061018
changePassphraseAction->setEnabled(true);
10071019
encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported
10081020
break;
10091021
case WalletModel::Locked:
1010-
labelEncryptionIcon->show();
1011-
labelEncryptionIcon->setPixmap(platformStyle->SingleColorIcon(":/icons/lock_closed").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
1012-
labelEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>locked</b>"));
1022+
labelWalletEncryptionIcon->show();
1023+
labelWalletEncryptionIcon->setPixmap(platformStyle->SingleColorIcon(":/icons/lock_closed").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
1024+
labelWalletEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>locked</b>"));
10131025
encryptWalletAction->setChecked(true);
10141026
changePassphraseAction->setEnabled(true);
10151027
encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported

src/qt/bitcoingui.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ class BitcoinGUI : public QMainWindow
8282
WalletFrame *walletFrame;
8383

8484
UnitDisplayStatusBarControl *unitDisplayControl;
85-
QLabel *labelEncryptionIcon;
85+
QLabel *labelWalletEncryptionIcon;
86+
QLabel *labelWalletHDStatusIcon;
8687
QLabel *labelConnectionsIcon;
8788
QLabel *labelBlocksIcon;
8889
QLabel *progressBarLabel;
@@ -169,6 +170,12 @@ public Q_SLOTS:
169170
*/
170171
void setEncryptionStatus(int status);
171172

173+
/** Set the hd-enabled status as shown in the UI.
174+
@param[in] status current hd enabled status
175+
@see WalletModel::EncryptionStatus
176+
*/
177+
void setHDStatus(int hdEnabled);
178+
172179
bool handlePaymentRequest(const SendCoinsRecipient& recipient);
173180

174181
/** Show incoming transaction notification for new transactions. */

src/qt/res/icons/hd_disabled.png

4.23 KB
Loading

src/qt/res/icons/hd_enabled.png

1.84 KB
Loading

src/qt/res/src/hd_disabled.svg

Lines changed: 26 additions & 0 deletions
Loading

src/qt/res/src/hd_enabled.svg

Lines changed: 13 additions & 0 deletions
Loading

src/qt/walletmodel.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,3 +683,8 @@ bool WalletModel::abandonTransaction(uint256 hash) const
683683
LOCK2(cs_main, wallet->cs_wallet);
684684
return wallet->AbandonTransaction(hash);
685685
}
686+
687+
bool WalletModel::hdEnabled() const
688+
{
689+
return wallet->IsHDEnabled();
690+
}

0 commit comments

Comments
 (0)