[Qt] fix slot connection problems when no wallet is loaded

- guard 4 connect calls by an #ifdef when no wallet is loaded to fix "No
  such slot" warnings
- also add comments when #ifdef ENABLE_WALLET end
- fixes #5175
This commit is contained in:
Philip Kaufmann 2014-10-30 07:31:34 +01:00
parent 723c752636
commit 981f7907c4
2 changed files with 16 additions and 14 deletions

View File

@ -19,7 +19,7 @@
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
#include "walletframe.h" #include "walletframe.h"
#include "walletmodel.h" #include "walletmodel.h"
#endif #endif // ENABLE_WALLET
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
#include "macdockiconhandler.h" #include "macdockiconhandler.h"
@ -106,7 +106,7 @@ BitcoinGUI::BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent) :
bool enableWallet = !GetBoolArg("-disablewallet", false); bool enableWallet = !GetBoolArg("-disablewallet", false);
#else #else
bool enableWallet = false; bool enableWallet = false;
#endif #endif // ENABLE_WALLET
if(enableWallet) if(enableWallet)
{ {
windowTitle += tr("Wallet"); windowTitle += tr("Wallet");
@ -136,7 +136,7 @@ BitcoinGUI::BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent) :
walletFrame = new WalletFrame(this); walletFrame = new WalletFrame(this);
setCentralWidget(walletFrame); setCentralWidget(walletFrame);
} else } else
#endif #endif // ENABLE_WALLET
{ {
/* When compiled without wallet or -disablewallet is provided, /* When compiled without wallet or -disablewallet is provided,
* the central widget is the rpc console. * the central widget is the rpc console.
@ -268,6 +268,7 @@ void BitcoinGUI::createActions(const NetworkStyle *networkStyle)
historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4)); historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
tabGroup->addAction(historyAction); tabGroup->addAction(historyAction);
#ifdef ENABLE_WALLET
// These showNormalIfMinimized are needed because Send Coins and Receive Coins // These showNormalIfMinimized are needed because Send Coins and Receive Coins
// can be triggered from the tray menu, and need to show the GUI to be useful. // can be triggered from the tray menu, and need to show the GUI to be useful.
connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
@ -278,6 +279,7 @@ void BitcoinGUI::createActions(const NetworkStyle *networkStyle)
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage())); connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage())); connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
#endif // ENABLE_WALLET
quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this); quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
quitAction->setStatusTip(tr("Quit application")); quitAction->setStatusTip(tr("Quit application"));
@ -343,7 +345,7 @@ void BitcoinGUI::createActions(const NetworkStyle *networkStyle)
connect(usedReceivingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedReceivingAddresses())); connect(usedReceivingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedReceivingAddresses()));
connect(openAction, SIGNAL(triggered()), this, SLOT(openClicked())); connect(openAction, SIGNAL(triggered()), this, SLOT(openClicked()));
} }
#endif #endif // ENABLE_WALLET
} }
void BitcoinGUI::createMenuBar() void BitcoinGUI::createMenuBar()
@ -433,7 +435,7 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel)
{ {
walletFrame->setClientModel(clientModel); walletFrame->setClientModel(clientModel);
} }
#endif #endif // ENABLE_WALLET
unitDisplayControl->setOptionsModel(clientModel->getOptionsModel()); unitDisplayControl->setOptionsModel(clientModel->getOptionsModel());
} else { } else {
// Disable possibility to show main window via action // Disable possibility to show main window via action
@ -469,7 +471,7 @@ void BitcoinGUI::removeAllWallets()
setWalletActionsEnabled(false); setWalletActionsEnabled(false);
walletFrame->removeAllWallets(); walletFrame->removeAllWallets();
} }
#endif #endif // ENABLE_WALLET
void BitcoinGUI::setWalletActionsEnabled(bool enabled) void BitcoinGUI::setWalletActionsEnabled(bool enabled)
{ {
@ -616,7 +618,7 @@ void BitcoinGUI::gotoVerifyMessageTab(QString addr)
{ {
if (walletFrame) walletFrame->gotoVerifyMessageTab(addr); if (walletFrame) walletFrame->gotoVerifyMessageTab(addr);
} }
#endif #endif // ENABLE_WALLET
void BitcoinGUI::setNumConnections(int count) void BitcoinGUI::setNumConnections(int count)
{ {
@ -676,7 +678,7 @@ void BitcoinGUI::setNumBlocks(int count)
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
if(walletFrame) if(walletFrame)
walletFrame->showOutOfSyncWarning(false); walletFrame->showOutOfSyncWarning(false);
#endif #endif // ENABLE_WALLET
progressBarLabel->setVisible(false); progressBarLabel->setVisible(false);
progressBar->setVisible(false); progressBar->setVisible(false);
@ -727,7 +729,7 @@ void BitcoinGUI::setNumBlocks(int count)
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
if(walletFrame) if(walletFrame)
walletFrame->showOutOfSyncWarning(true); walletFrame->showOutOfSyncWarning(true);
#endif #endif // ENABLE_WALLET
tooltip += QString("<br>"); tooltip += QString("<br>");
tooltip += tr("Last received block was generated %1 ago.").arg(timeBehindText); tooltip += tr("Last received block was generated %1 ago.").arg(timeBehindText);
@ -850,7 +852,7 @@ void BitcoinGUI::incomingTransaction(const QString& date, int unit, const CAmoun
.arg(type) .arg(type)
.arg(address), CClientUIInterface::MSG_INFORMATION); .arg(address), CClientUIInterface::MSG_INFORMATION);
} }
#endif #endif // ENABLE_WALLET
void BitcoinGUI::dragEnterEvent(QDragEnterEvent *event) void BitcoinGUI::dragEnterEvent(QDragEnterEvent *event)
{ {
@ -924,7 +926,7 @@ void BitcoinGUI::setEncryptionStatus(int status)
break; break;
} }
} }
#endif #endif // ENABLE_WALLET
void BitcoinGUI::showNormalIfMinimized(bool fToggleHidden) void BitcoinGUI::showNormalIfMinimized(bool fToggleHidden)
{ {

View File

@ -63,7 +63,7 @@ public:
bool addWallet(const QString& name, WalletModel *walletModel); bool addWallet(const QString& name, WalletModel *walletModel);
bool setCurrentWallet(const QString& name); bool setCurrentWallet(const QString& name);
void removeAllWallets(); void removeAllWallets();
#endif #endif // ENABLE_WALLET
protected: protected:
void changeEvent(QEvent *e); void changeEvent(QEvent *e);
@ -163,7 +163,7 @@ public slots:
/** Show incoming transaction notification for new transactions. */ /** Show incoming transaction notification for new transactions. */
void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address); void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address);
#endif #endif // ENABLE_WALLET
private slots: private slots:
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
@ -183,7 +183,7 @@ private slots:
/** Show open dialog */ /** Show open dialog */
void openClicked(); void openClicked();
#endif #endif // ENABLE_WALLET
/** Show configuration dialog */ /** Show configuration dialog */
void optionsClicked(); void optionsClicked();
/** Show about dialog */ /** Show about dialog */