From f411c8b35bbbd6ff5b5ec70fc0217ec93f01f186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Barbosa?= Date: Fri, 11 Jan 2019 23:42:01 +0000 Subject: gui: Remove unused return type in some BitcoinGUI methods --- src/qt/bitcoingui.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'src/qt/bitcoingui.cpp') diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 98ad2b38e1..a3fe3e2268 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -571,10 +571,9 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel) } #ifdef ENABLE_WALLET -bool BitcoinGUI::addWallet(WalletModel *walletModel) +void BitcoinGUI::addWallet(WalletModel* walletModel) { - if(!walletFrame) - return false; + if (!walletFrame) return; const QString display_name = walletModel->getDisplayName(); setWalletActionsEnabled(true); m_wallet_selector->addItem(display_name, QVariant::fromValue(walletModel)); @@ -583,12 +582,12 @@ bool BitcoinGUI::addWallet(WalletModel *walletModel) m_wallet_selector_action->setVisible(true); } rpcConsole->addWallet(walletModel); - return walletFrame->addWallet(walletModel); + walletFrame->addWallet(walletModel); } -bool BitcoinGUI::removeWallet(WalletModel* walletModel) +void BitcoinGUI::removeWallet(WalletModel* walletModel) { - if (!walletFrame) return false; + if (!walletFrame) return; int index = m_wallet_selector->findData(QVariant::fromValue(walletModel)); m_wallet_selector->removeItem(index); if (m_wallet_selector->count() == 0) { @@ -598,20 +597,19 @@ bool BitcoinGUI::removeWallet(WalletModel* walletModel) m_wallet_selector_action->setVisible(false); } rpcConsole->removeWallet(walletModel); - return walletFrame->removeWallet(walletModel); + walletFrame->removeWallet(walletModel); } -bool BitcoinGUI::setCurrentWallet(WalletModel* wallet_model) +void BitcoinGUI::setCurrentWallet(WalletModel* wallet_model) { - if(!walletFrame) - return false; - return walletFrame->setCurrentWallet(wallet_model); + if (!walletFrame) return; + walletFrame->setCurrentWallet(wallet_model); } -bool BitcoinGUI::setCurrentWalletBySelectorIndex(int index) +void BitcoinGUI::setCurrentWalletBySelectorIndex(int index) { WalletModel* wallet_model = m_wallet_selector->itemData(index).value(); - return setCurrentWallet(wallet_model); + setCurrentWallet(wallet_model); } void BitcoinGUI::removeAllWallets() -- cgit v1.2.3 From 8a792611249fdefb31a8c69efd9c5022092e25cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Barbosa?= Date: Fri, 11 Jan 2019 23:48:58 +0000 Subject: gui: Keep network style in BitcoinGUI --- src/qt/bitcoingui.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/qt/bitcoingui.cpp') diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index a3fe3e2268..4e9b3697ff 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -76,7 +76,8 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty QMainWindow(parent), m_node(node), trayIconMenu{new QMenu()}, - platformStyle(_platformStyle) + platformStyle(_platformStyle), + m_network_style(networkStyle) { QSettings settings; if (!restoreGeometry(settings.value("MainWindowGeometry").toByteArray())) { @@ -94,9 +95,9 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty } else { windowTitle += tr("Node"); } - windowTitle += " " + networkStyle->getTitleAddText(); - QApplication::setWindowIcon(networkStyle->getTrayAndWindowIcon()); - setWindowIcon(networkStyle->getTrayAndWindowIcon()); + windowTitle += " " + m_network_style->getTitleAddText(); + QApplication::setWindowIcon(m_network_style->getTrayAndWindowIcon()); + setWindowIcon(m_network_style->getTrayAndWindowIcon()); setWindowTitle(windowTitle); rpcConsole = new RPCConsole(node, _platformStyle, nullptr); @@ -132,7 +133,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty // Create system tray icon and notification if (QSystemTrayIcon::isSystemTrayAvailable()) { - createTrayIcon(networkStyle); + createTrayIcon(); } notificator = new Notificator(QApplication::applicationName(), trayIcon, this); @@ -639,14 +640,14 @@ void BitcoinGUI::setWalletActionsEnabled(bool enabled) openAction->setEnabled(enabled); } -void BitcoinGUI::createTrayIcon(const NetworkStyle *networkStyle) +void BitcoinGUI::createTrayIcon() { assert(QSystemTrayIcon::isSystemTrayAvailable()); #ifndef Q_OS_MAC if (QSystemTrayIcon::isSystemTrayAvailable()) { - trayIcon = new QSystemTrayIcon(networkStyle->getTrayAndWindowIcon(), this); - QString toolTip = tr("%1 client").arg(tr(PACKAGE_NAME)) + " " + networkStyle->getTitleAddText(); + trayIcon = new QSystemTrayIcon(m_network_style->getTrayAndWindowIcon(), this); + QString toolTip = tr("%1 client").arg(tr(PACKAGE_NAME)) + " " + m_network_style->getTitleAddText(); trayIcon->setToolTip(toolTip); } #endif -- cgit v1.2.3 From fe7048b39bc655d65557ca95dda37c364947ddbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Barbosa?= Date: Fri, 11 Jan 2019 23:49:36 +0000 Subject: gui: Show current wallet name in window title --- src/qt/bitcoingui.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'src/qt/bitcoingui.cpp') diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 4e9b3697ff..b866cb5c6e 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -85,20 +85,12 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty move(QApplication::desktop()->availableGeometry().center() - frameGeometry().center()); } - QString windowTitle = tr(PACKAGE_NAME) + " - "; #ifdef ENABLE_WALLET enableWallet = WalletModel::isWalletEnabled(); #endif // ENABLE_WALLET - if(enableWallet) - { - windowTitle += tr("Wallet"); - } else { - windowTitle += tr("Node"); - } - windowTitle += " " + m_network_style->getTitleAddText(); QApplication::setWindowIcon(m_network_style->getTrayAndWindowIcon()); setWindowIcon(m_network_style->getTrayAndWindowIcon()); - setWindowTitle(windowTitle); + updateWindowTitle(); rpcConsole = new RPCConsole(node, _platformStyle, nullptr); helpMessageDialog = new HelpMessageDialog(node, this, false); @@ -599,12 +591,14 @@ void BitcoinGUI::removeWallet(WalletModel* walletModel) } rpcConsole->removeWallet(walletModel); walletFrame->removeWallet(walletModel); + updateWindowTitle(); } void BitcoinGUI::setCurrentWallet(WalletModel* wallet_model) { if (!walletFrame) return; walletFrame->setCurrentWallet(wallet_model); + updateWindowTitle(); } void BitcoinGUI::setCurrentWalletBySelectorIndex(int index) @@ -1207,6 +1201,21 @@ void BitcoinGUI::updateProxyIcon() } } +void BitcoinGUI::updateWindowTitle() +{ + QString window_title = tr(PACKAGE_NAME) + " - "; +#ifdef ENABLE_WALLET + if (walletFrame) { + WalletModel* const wallet_model = walletFrame->currentWalletModel(); + if (wallet_model && !wallet_model->getWalletName().isEmpty()) { + window_title += wallet_model->getDisplayName() + " - "; + } + } +#endif + window_title += m_network_style->getTitleAddText(); + setWindowTitle(window_title); +} + void BitcoinGUI::showNormalIfMinimized(bool fToggleHidden) { if(!clientModel) -- cgit v1.2.3