diff options
Diffstat (limited to 'src/qt/walletframe.cpp')
-rw-r--r-- | src/qt/walletframe.cpp | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/qt/walletframe.cpp b/src/qt/walletframe.cpp index 04eea59169..fead022928 100644 --- a/src/qt/walletframe.cpp +++ b/src/qt/walletframe.cpp @@ -10,6 +10,7 @@ #include <cstdio> #include <QHBoxLayout> +#include <QLabel> WalletFrame::WalletFrame(BitcoinGUI *_gui) : QFrame(_gui), @@ -21,6 +22,10 @@ WalletFrame::WalletFrame(BitcoinGUI *_gui) : walletStack = new QStackedWidget(this); walletFrameLayout->setContentsMargins(0,0,0,0); walletFrameLayout->addWidget(walletStack); + + QLabel *noWallet = new QLabel(tr("No wallet has been loaded.")); + noWallet->setAlignment(Qt::AlignCenter); + walletStack->addWidget(noWallet); } WalletFrame::~WalletFrame() @@ -85,7 +90,7 @@ void WalletFrame::removeAllWallets() bool WalletFrame::handlePaymentRequest(const SendCoinsRecipient &recipient) { - WalletView *walletView = (WalletView*)walletStack->currentWidget(); + WalletView *walletView = currentWalletView(); if (!walletView) return false; @@ -130,56 +135,62 @@ void WalletFrame::gotoSendCoinsPage(QString addr) void WalletFrame::gotoSignMessageTab(QString addr) { - WalletView *walletView = (WalletView*)walletStack->currentWidget(); + WalletView *walletView = currentWalletView(); if (walletView) walletView->gotoSignMessageTab(addr); } void WalletFrame::gotoVerifyMessageTab(QString addr) { - WalletView *walletView = (WalletView*)walletStack->currentWidget(); + WalletView *walletView = currentWalletView(); if (walletView) walletView->gotoVerifyMessageTab(addr); } void WalletFrame::encryptWallet(bool status) { - WalletView *walletView = (WalletView*)walletStack->currentWidget(); + WalletView *walletView = currentWalletView(); if (walletView) walletView->encryptWallet(status); } void WalletFrame::backupWallet() { - WalletView *walletView = (WalletView*)walletStack->currentWidget(); + WalletView *walletView = currentWalletView(); if (walletView) walletView->backupWallet(); } void WalletFrame::changePassphrase() { - WalletView *walletView = (WalletView*)walletStack->currentWidget(); + WalletView *walletView = currentWalletView(); if (walletView) walletView->changePassphrase(); } void WalletFrame::unlockWallet() { - WalletView *walletView = (WalletView*)walletStack->currentWidget(); + WalletView *walletView = currentWalletView(); if (walletView) walletView->unlockWallet(); } void WalletFrame::usedSendingAddresses() { - WalletView *walletView = (WalletView*)walletStack->currentWidget(); + WalletView *walletView = currentWalletView(); if (walletView) walletView->usedSendingAddresses(); } void WalletFrame::usedReceivingAddresses() { - WalletView *walletView = (WalletView*)walletStack->currentWidget(); + WalletView *walletView = currentWalletView(); if (walletView) walletView->usedReceivingAddresses(); } + +WalletView *WalletFrame::currentWalletView() +{ + return qobject_cast<WalletView*>(walletStack->currentWidget()); +} + |