gui: Keep network style in BitcoinGUI

This commit is contained in:
João Barbosa 2019-01-11 23:48:58 +00:00
parent f411c8b35b
commit 8a79261124
2 changed files with 11 additions and 9 deletions

View file

@ -76,7 +76,8 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
QMainWindow(parent), QMainWindow(parent),
m_node(node), m_node(node),
trayIconMenu{new QMenu()}, trayIconMenu{new QMenu()},
platformStyle(_platformStyle) platformStyle(_platformStyle),
m_network_style(networkStyle)
{ {
QSettings settings; QSettings settings;
if (!restoreGeometry(settings.value("MainWindowGeometry").toByteArray())) { if (!restoreGeometry(settings.value("MainWindowGeometry").toByteArray())) {
@ -94,9 +95,9 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
} else { } else {
windowTitle += tr("Node"); windowTitle += tr("Node");
} }
windowTitle += " " + networkStyle->getTitleAddText(); windowTitle += " " + m_network_style->getTitleAddText();
QApplication::setWindowIcon(networkStyle->getTrayAndWindowIcon()); QApplication::setWindowIcon(m_network_style->getTrayAndWindowIcon());
setWindowIcon(networkStyle->getTrayAndWindowIcon()); setWindowIcon(m_network_style->getTrayAndWindowIcon());
setWindowTitle(windowTitle); setWindowTitle(windowTitle);
rpcConsole = new RPCConsole(node, _platformStyle, nullptr); rpcConsole = new RPCConsole(node, _platformStyle, nullptr);
@ -132,7 +133,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
// Create system tray icon and notification // Create system tray icon and notification
if (QSystemTrayIcon::isSystemTrayAvailable()) { if (QSystemTrayIcon::isSystemTrayAvailable()) {
createTrayIcon(networkStyle); createTrayIcon();
} }
notificator = new Notificator(QApplication::applicationName(), trayIcon, this); notificator = new Notificator(QApplication::applicationName(), trayIcon, this);
@ -639,14 +640,14 @@ void BitcoinGUI::setWalletActionsEnabled(bool enabled)
openAction->setEnabled(enabled); openAction->setEnabled(enabled);
} }
void BitcoinGUI::createTrayIcon(const NetworkStyle *networkStyle) void BitcoinGUI::createTrayIcon()
{ {
assert(QSystemTrayIcon::isSystemTrayAvailable()); assert(QSystemTrayIcon::isSystemTrayAvailable());
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
if (QSystemTrayIcon::isSystemTrayAvailable()) { if (QSystemTrayIcon::isSystemTrayAvailable()) {
trayIcon = new QSystemTrayIcon(networkStyle->getTrayAndWindowIcon(), this); trayIcon = new QSystemTrayIcon(m_network_style->getTrayAndWindowIcon(), this);
QString toolTip = tr("%1 client").arg(tr(PACKAGE_NAME)) + " " + networkStyle->getTitleAddText(); QString toolTip = tr("%1 client").arg(tr(PACKAGE_NAME)) + " " + m_network_style->getTitleAddText();
trayIcon->setToolTip(toolTip); trayIcon->setToolTip(toolTip);
} }
#endif #endif

View file

@ -161,6 +161,7 @@ private:
int spinnerFrame = 0; int spinnerFrame = 0;
const PlatformStyle *platformStyle; const PlatformStyle *platformStyle;
const NetworkStyle* const m_network_style;
/** Create the main UI actions. */ /** Create the main UI actions. */
void createActions(); void createActions();
@ -169,7 +170,7 @@ private:
/** Create the toolbars */ /** Create the toolbars */
void createToolBars(); void createToolBars();
/** Create system tray icon and notification */ /** Create system tray icon and notification */
void createTrayIcon(const NetworkStyle *networkStyle); void createTrayIcon();
/** Create system tray menu (or setup the dock menu) */ /** Create system tray menu (or setup the dock menu) */
void createTrayIconMenu(); void createTrayIconMenu();