Skip to content

Commit 8a79261

Browse files
committed
gui: Keep network style in BitcoinGUI
1 parent f411c8b commit 8a79261

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/qt/bitcoingui.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
7676
QMainWindow(parent),
7777
m_node(node),
7878
trayIconMenu{new QMenu()},
79-
platformStyle(_platformStyle)
79+
platformStyle(_platformStyle),
80+
m_network_style(networkStyle)
8081
{
8182
QSettings settings;
8283
if (!restoreGeometry(settings.value("MainWindowGeometry").toByteArray())) {
@@ -94,9 +95,9 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
9495
} else {
9596
windowTitle += tr("Node");
9697
}
97-
windowTitle += " " + networkStyle->getTitleAddText();
98-
QApplication::setWindowIcon(networkStyle->getTrayAndWindowIcon());
99-
setWindowIcon(networkStyle->getTrayAndWindowIcon());
98+
windowTitle += " " + m_network_style->getTitleAddText();
99+
QApplication::setWindowIcon(m_network_style->getTrayAndWindowIcon());
100+
setWindowIcon(m_network_style->getTrayAndWindowIcon());
100101
setWindowTitle(windowTitle);
101102

102103
rpcConsole = new RPCConsole(node, _platformStyle, nullptr);
@@ -132,7 +133,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
132133

133134
// Create system tray icon and notification
134135
if (QSystemTrayIcon::isSystemTrayAvailable()) {
135-
createTrayIcon(networkStyle);
136+
createTrayIcon();
136137
}
137138
notificator = new Notificator(QApplication::applicationName(), trayIcon, this);
138139

@@ -639,14 +640,14 @@ void BitcoinGUI::setWalletActionsEnabled(bool enabled)
639640
openAction->setEnabled(enabled);
640641
}
641642

642-
void BitcoinGUI::createTrayIcon(const NetworkStyle *networkStyle)
643+
void BitcoinGUI::createTrayIcon()
643644
{
644645
assert(QSystemTrayIcon::isSystemTrayAvailable());
645646

646647
#ifndef Q_OS_MAC
647648
if (QSystemTrayIcon::isSystemTrayAvailable()) {
648-
trayIcon = new QSystemTrayIcon(networkStyle->getTrayAndWindowIcon(), this);
649-
QString toolTip = tr("%1 client").arg(tr(PACKAGE_NAME)) + " " + networkStyle->getTitleAddText();
649+
trayIcon = new QSystemTrayIcon(m_network_style->getTrayAndWindowIcon(), this);
650+
QString toolTip = tr("%1 client").arg(tr(PACKAGE_NAME)) + " " + m_network_style->getTitleAddText();
650651
trayIcon->setToolTip(toolTip);
651652
}
652653
#endif

src/qt/bitcoingui.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ class BitcoinGUI : public QMainWindow
161161
int spinnerFrame = 0;
162162

163163
const PlatformStyle *platformStyle;
164+
const NetworkStyle* const m_network_style;
164165

165166
/** Create the main UI actions. */
166167
void createActions();
@@ -169,7 +170,7 @@ class BitcoinGUI : public QMainWindow
169170
/** Create the toolbars */
170171
void createToolBars();
171172
/** Create system tray icon and notification */
172-
void createTrayIcon(const NetworkStyle *networkStyle);
173+
void createTrayIcon();
173174
/** Create system tray menu (or setup the dock menu) */
174175
void createTrayIconMenu();
175176

0 commit comments

Comments
 (0)