aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorJoão Barbosa <joao.paulo.barbosa@gmail.com>2019-01-11 23:49:36 +0000
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2019-01-15 16:23:55 +0000
commitfe7048b39bc655d65557ca95dda37c364947ddbf (patch)
tree036dd18d66a507fc37e6f1802a31bf6de7f1565a /src/qt
parent8a792611249fdefb31a8c69efd9c5022092e25cf (diff)
gui: Show current wallet name in window title
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/bitcoingui.cpp27
-rw-r--r--src/qt/bitcoingui.h1
-rw-r--r--src/qt/walletframe.cpp8
-rw-r--r--src/qt/walletframe.h3
4 files changed, 28 insertions, 11 deletions
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)
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index 606c6d375c..4eb5e43f5e 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -243,6 +243,7 @@ public Q_SLOTS:
private:
/** Set the proxy-enabled icon as shown in the UI. */
void updateProxyIcon();
+ void updateWindowTitle();
public Q_SLOTS:
#ifdef ENABLE_WALLET
diff --git a/src/qt/walletframe.cpp b/src/qt/walletframe.cpp
index 4f8b6d363e..466f2278eb 100644
--- a/src/qt/walletframe.cpp
+++ b/src/qt/walletframe.cpp
@@ -208,11 +208,17 @@ void WalletFrame::usedReceivingAddresses()
walletView->usedReceivingAddresses();
}
-WalletView *WalletFrame::currentWalletView()
+WalletView* WalletFrame::currentWalletView() const
{
return qobject_cast<WalletView*>(walletStack->currentWidget());
}
+WalletModel* WalletFrame::currentWalletModel() const
+{
+ WalletView* wallet_view = currentWalletView();
+ return wallet_view ? wallet_view->getWalletModel() : nullptr;
+}
+
void WalletFrame::outOfSyncWarningClicked()
{
Q_EMIT requestedSyncWarningInfo();
diff --git a/src/qt/walletframe.h b/src/qt/walletframe.h
index 10d063b2b7..6a74fde9fd 100644
--- a/src/qt/walletframe.h
+++ b/src/qt/walletframe.h
@@ -60,7 +60,8 @@ private:
const PlatformStyle *platformStyle;
public:
- WalletView *currentWalletView();
+ WalletView* currentWalletView() const;
+ WalletModel* currentWalletModel() const;
public Q_SLOTS:
/** Switch to overview (home) page */