@@ -77,28 +77,21 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
77
77
QMainWindow(parent),
78
78
m_node(node),
79
79
trayIconMenu{new QMenu ()},
80
- platformStyle (_platformStyle)
80
+ platformStyle (_platformStyle),
81
+ m_network_style(networkStyle)
81
82
{
82
83
QSettings settings;
83
84
if (!restoreGeometry (settings.value (" MainWindowGeometry" ).toByteArray ())) {
84
85
// Restore failed (perhaps missing setting), center the window
85
86
move (QApplication::desktop ()->availableGeometry ().center () - frameGeometry ().center ());
86
87
}
87
88
88
- QString windowTitle = tr (PACKAGE_NAME) + " - " ;
89
89
#ifdef ENABLE_WALLET
90
90
enableWallet = WalletModel::isWalletEnabled ();
91
91
#endif // ENABLE_WALLET
92
- if (enableWallet)
93
- {
94
- windowTitle += tr (" Wallet" );
95
- } else {
96
- windowTitle += tr (" Node" );
97
- }
98
- windowTitle += " " + networkStyle->getTitleAddText ();
99
- QApplication::setWindowIcon (networkStyle->getTrayAndWindowIcon ());
100
- setWindowIcon (networkStyle->getTrayAndWindowIcon ());
101
- setWindowTitle (windowTitle);
92
+ QApplication::setWindowIcon (m_network_style->getTrayAndWindowIcon ());
93
+ setWindowIcon (m_network_style->getTrayAndWindowIcon ());
94
+ updateWindowTitle ();
102
95
103
96
rpcConsole = new RPCConsole (node, _platformStyle, nullptr );
104
97
helpMessageDialog = new HelpMessageDialog (node, this , false );
@@ -133,7 +126,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
133
126
134
127
// Create system tray icon and notification
135
128
if (QSystemTrayIcon::isSystemTrayAvailable ()) {
136
- createTrayIcon (networkStyle );
129
+ createTrayIcon ();
137
130
}
138
131
notificator = new Notificator (QApplication::applicationName (), trayIcon, this );
139
132
@@ -572,10 +565,9 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel)
572
565
}
573
566
574
567
#ifdef ENABLE_WALLET
575
- bool BitcoinGUI::addWallet (WalletModel * walletModel)
568
+ void BitcoinGUI::addWallet (WalletModel* walletModel)
576
569
{
577
- if (!walletFrame)
578
- return false ;
570
+ if (!walletFrame) return ;
579
571
const QString display_name = walletModel->getDisplayName ();
580
572
setWalletActionsEnabled (true );
581
573
m_wallet_selector->addItem (display_name, QVariant::fromValue (walletModel));
@@ -584,12 +576,12 @@ bool BitcoinGUI::addWallet(WalletModel *walletModel)
584
576
m_wallet_selector_action->setVisible (true );
585
577
}
586
578
rpcConsole->addWallet (walletModel);
587
- return walletFrame->addWallet (walletModel);
579
+ walletFrame->addWallet (walletModel);
588
580
}
589
581
590
- bool BitcoinGUI::removeWallet (WalletModel* walletModel)
582
+ void BitcoinGUI::removeWallet (WalletModel* walletModel)
591
583
{
592
- if (!walletFrame) return false ;
584
+ if (!walletFrame) return ;
593
585
int index = m_wallet_selector->findData (QVariant::fromValue (walletModel));
594
586
m_wallet_selector->removeItem (index);
595
587
if (m_wallet_selector->count () == 0 ) {
@@ -599,20 +591,21 @@ bool BitcoinGUI::removeWallet(WalletModel* walletModel)
599
591
m_wallet_selector_action->setVisible (false );
600
592
}
601
593
rpcConsole->removeWallet (walletModel);
602
- return walletFrame->removeWallet (walletModel);
594
+ walletFrame->removeWallet (walletModel);
595
+ updateWindowTitle ();
603
596
}
604
597
605
- bool BitcoinGUI::setCurrentWallet (WalletModel* wallet_model)
598
+ void BitcoinGUI::setCurrentWallet (WalletModel* wallet_model)
606
599
{
607
- if (!walletFrame)
608
- return false ;
609
- return walletFrame-> setCurrentWallet (wallet_model );
600
+ if (!walletFrame) return ;
601
+ walletFrame-> setCurrentWallet (wallet_model) ;
602
+ updateWindowTitle ( );
610
603
}
611
604
612
- bool BitcoinGUI::setCurrentWalletBySelectorIndex (int index)
605
+ void BitcoinGUI::setCurrentWalletBySelectorIndex (int index)
613
606
{
614
607
WalletModel* wallet_model = m_wallet_selector->itemData (index).value <WalletModel*>();
615
- return setCurrentWallet (wallet_model);
608
+ setCurrentWallet (wallet_model);
616
609
}
617
610
618
611
void BitcoinGUI::removeAllWallets ()
@@ -642,14 +635,14 @@ void BitcoinGUI::setWalletActionsEnabled(bool enabled)
642
635
openAction->setEnabled (enabled);
643
636
}
644
637
645
- void BitcoinGUI::createTrayIcon (const NetworkStyle *networkStyle )
638
+ void BitcoinGUI::createTrayIcon ()
646
639
{
647
640
assert (QSystemTrayIcon::isSystemTrayAvailable ());
648
641
649
642
#ifndef Q_OS_MAC
650
643
if (QSystemTrayIcon::isSystemTrayAvailable ()) {
651
- trayIcon = new QSystemTrayIcon (networkStyle ->getTrayAndWindowIcon (), this );
652
- QString toolTip = tr (" %1 client" ).arg (tr (PACKAGE_NAME)) + " " + networkStyle ->getTitleAddText ();
644
+ trayIcon = new QSystemTrayIcon (m_network_style ->getTrayAndWindowIcon (), this );
645
+ QString toolTip = tr (" %1 client" ).arg (tr (PACKAGE_NAME)) + " " + m_network_style ->getTitleAddText ();
653
646
trayIcon->setToolTip (toolTip);
654
647
}
655
648
#endif
@@ -1208,6 +1201,21 @@ void BitcoinGUI::updateProxyIcon()
1208
1201
}
1209
1202
}
1210
1203
1204
+ void BitcoinGUI::updateWindowTitle ()
1205
+ {
1206
+ QString window_title = tr (PACKAGE_NAME) + " - " ;
1207
+ #ifdef ENABLE_WALLET
1208
+ if (walletFrame) {
1209
+ WalletModel* const wallet_model = walletFrame->currentWalletModel ();
1210
+ if (wallet_model && !wallet_model->getWalletName ().isEmpty ()) {
1211
+ window_title += wallet_model->getDisplayName () + " - " ;
1212
+ }
1213
+ }
1214
+ #endif
1215
+ window_title += m_network_style->getTitleAddText ();
1216
+ setWindowTitle (window_title);
1217
+ }
1218
+
1211
1219
void BitcoinGUI::showNormalIfMinimized (bool fToggleHidden )
1212
1220
{
1213
1221
if (!clientModel)
0 commit comments