aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac3
-rw-r--r--src/Makefile.include1
-rw-r--r--src/qt/Makefile.am66
-rw-r--r--src/qt/bitcoin.cpp41
-rw-r--r--src/qt/bitcoingui.cpp147
-rw-r--r--src/qt/bitcoingui.h26
-rw-r--r--src/qt/optionsmodel.cpp11
-rw-r--r--src/qt/test/Makefile.am17
-rw-r--r--src/qt/test/test_main.cpp9
9 files changed, 244 insertions, 77 deletions
diff --git a/configure.ac b/configure.ac
index 11a9a3118e..82f489a06d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -567,9 +567,6 @@ if test x$bitcoin_enable_qt != xno; then
AC_MSG_ERROR("QT Test lib not found. Use --disable-tests or --without-qt.")
fi
fi
- if test x$enable_wallet == xno; then
- AC_MSG_ERROR([Cannot currently build Qt GUI with wallet disabled. Use --without-qt.])
- fi
fi
if test x$use_tests = xyes; then
diff --git a/src/Makefile.include b/src/Makefile.include
index b9e6c262ca..070902c519 100644
--- a/src/Makefile.include
+++ b/src/Makefile.include
@@ -12,6 +12,7 @@ LIBBITCOIN_CLI=$(top_builddir)/src/libbitcoin_cli.a
LIBLEVELDB=$(top_builddir)/src/leveldb/libleveldb.a
LIBMEMENV=$(top_builddir)/src/leveldb/libmemenv.a
LIBBITCOINQT=$(top_builddir)/src/qt/libbitcoinqt.a
+MOC_DEFS=$(DEFS) -I$(top_srcdir)/src
$(LIBBITCOIN):
$(MAKE) -C $(top_builddir)/src $(@F)
diff --git a/src/qt/Makefile.am b/src/qt/Makefile.am
index 99fdecb03a..53bd893fad 100644
--- a/src/qt/Makefile.am
+++ b/src/qt/Makefile.am
@@ -150,24 +150,56 @@ RES_ICONS = res/icons/bitcoin.png res/icons/address-book.png \
res/icons/qrcode.png res/icons/debugwindow.png res/icons/bitcoin.ico \
res/icons/bitcoin_testnet.ico
-BITCOIN_QT_CPP = aboutdialog.cpp addressbookpage.cpp \
- addresstablemodel.cpp askpassphrasedialog.cpp bitcoinaddressvalidator.cpp \
- bitcoinamountfield.cpp bitcoin.cpp bitcoingui.cpp \
- bitcoinunits.cpp clientmodel.cpp \
+BITCOIN_QT_CPP = \
+ aboutdialog.cpp \
+ bitcoinaddressvalidator.cpp \
+ bitcoinamountfield.cpp \
+ bitcoin.cpp \
+ bitcoingui.cpp \
+ bitcoinunits.cpp \
+ clientmodel.cpp \
+ csvmodelwriter.cpp \
+ guiutil.cpp \
+ intro.cpp \
+ monitoreddatamapper.cpp \
+ notificator.cpp \
+ optionsdialog.cpp \
+ optionsmodel.cpp \
+ qvalidatedlineedit.cpp \
+ qvaluecombobox.cpp \
+ rpcconsole.cpp \
+ signverifymessagedialog.cpp \
+ splashscreen.cpp \
+ trafficgraphwidget.cpp
+
+if ENABLE_WALLET
+BITCOIN_QT_CPP += \
+ addressbookpage.cpp \
+ addresstablemodel.cpp \
+ askpassphrasedialog.cpp \
coincontroldialog.cpp \
coincontroltreewidget.cpp \
- csvmodelwriter.cpp editaddressdialog.cpp \
- guiutil.cpp intro.cpp monitoreddatamapper.cpp notificator.cpp \
+ editaddressdialog.cpp \
openuridialog.cpp \
- optionsdialog.cpp optionsmodel.cpp overviewpage.cpp paymentrequestplus.cpp \
- paymentserver.cpp qvalidatedlineedit.cpp qvaluecombobox.cpp \
- receivecoinsdialog.cpp receiverequestdialog.cpp \
+ overviewpage.cpp \
+ paymentrequestplus.cpp \
+ paymentserver.cpp \
+ receivecoinsdialog.cpp \
+ receiverequestdialog.cpp \
recentrequeststablemodel.cpp \
- rpcconsole.cpp sendcoinsdialog.cpp sendcoinsentry.cpp \
- signverifymessagedialog.cpp splashscreen.cpp trafficgraphwidget.cpp transactiondesc.cpp \
- transactiondescdialog.cpp transactionfilterproxy.cpp transactionrecord.cpp \
- transactiontablemodel.cpp transactionview.cpp walletframe.cpp \
- walletmodel.cpp walletmodeltransaction.cpp walletview.cpp
+ sendcoinsdialog.cpp \
+ sendcoinsentry.cpp \
+ transactiondesc.cpp \
+ transactiondescdialog.cpp \
+ transactionfilterproxy.cpp \
+ transactionrecord.cpp \
+ transactiontablemodel.cpp \
+ transactionview.cpp \
+ walletframe.cpp \
+ walletmodel.cpp \
+ walletmodeltransaction.cpp \
+ walletview.cpp
+endif
RES_IMAGES = res/images/about.png res/images/splash.png \
res/images/splash_testnet.png
@@ -203,7 +235,11 @@ endif
bitcoin_qt_CPPFLAGS = $(AM_CPPFLAGS) $(QT_INCLUDES) \
-I$(top_srcdir)/src/qt/forms
bitcoin_qt_SOURCES = bitcoin.cpp
-bitcoin_qt_LDADD = libbitcoinqt.a $(LIBBITCOIN_SERVER) $(LIBBITCOIN_WALLET) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBLEVELDB) $(LIBMEMENV) \
+bitcoin_qt_LDADD = libbitcoinqt.a $(LIBBITCOIN_SERVER)
+if ENABLE_WALLET
+bitcoin_qt_LDADD += $(LIBBITCOIN_WALLET)
+endif
+bitcoin_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBLEVELDB) $(LIBMEMENV) \
$(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS)
# forms/foo.h -> forms/ui_foo.h
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index 45551657d7..82d8af77d9 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -10,9 +10,11 @@
#include "guiutil.h"
#include "intro.h"
#include "optionsmodel.h"
-#include "paymentserver.h"
#include "splashscreen.h"
+#ifdef ENABLE_WALLET
+#include "paymentserver.h"
#include "walletmodel.h"
+#endif
#include "init.h"
#include "main.h"
@@ -157,8 +159,10 @@ public:
explicit BitcoinApplication(int &argc, char **argv);
~BitcoinApplication();
+#ifdef ENABLE_WALLET
/// Create payment server
void createPaymentServer();
+#endif
/// Create options model
void createOptionsModel();
/// Create main window
@@ -188,12 +192,14 @@ signals:
private:
QThread *coreThread;
- PaymentServer* paymentServer;
OptionsModel *optionsModel;
ClientModel *clientModel;
BitcoinGUI *window;
- WalletModel *walletModel;
QTimer *pollShutdownTimer;
+#ifdef ENABLE_WALLET
+ PaymentServer* paymentServer;
+ WalletModel *walletModel;
+#endif
int returnValue;
void startThread();
@@ -246,12 +252,14 @@ void BitcoinCore::shutdown()
BitcoinApplication::BitcoinApplication(int &argc, char **argv):
QApplication(argc, argv),
coreThread(0),
- paymentServer(0),
optionsModel(0),
clientModel(0),
window(0),
- walletModel(0),
pollShutdownTimer(0),
+#ifdef ENABLE_WALLET
+ paymentServer(0),
+ walletModel(0),
+#endif
returnValue(0)
{
setQuitOnLastWindowClosed(false);
@@ -266,14 +274,21 @@ BitcoinApplication::~BitcoinApplication()
LogPrintf("Stopped thread\n");
delete window;
+ window = 0;
+#ifdef ENABLE_WALLET
delete paymentServer;
+ paymentServer = 0;
+#endif
delete optionsModel;
+ optionsModel = 0;
}
+#ifdef ENABLE_WALLET
void BitcoinApplication::createPaymentServer()
{
paymentServer = new PaymentServer(this);
}
+#endif
void BitcoinApplication::createOptionsModel()
{
@@ -327,11 +342,13 @@ void BitcoinApplication::requestShutdown()
LogPrintf("Requesting shutdown\n");
window->hide();
window->setClientModel(0);
- window->removeAllWallets();
pollShutdownTimer->stop();
+#ifdef ENABLE_WALLET
+ window->removeAllWallets();
delete walletModel;
walletModel = 0;
+#endif
delete clientModel;
clientModel = 0;
@@ -362,14 +379,17 @@ void BitcoinApplication::initializeResult(int retval)
// Miscellaneous initialization after core is initialized
optionsModel->Upgrade(); // Must be done after AppInit2
+#ifdef ENABLE_WALLET
PaymentServer::LoadRootCAs();
paymentServer->setOptionsModel(optionsModel);
+#endif
emit splashFinished(window);
clientModel = new ClientModel(optionsModel);
window->setClientModel(clientModel);
+#ifdef ENABLE_WALLET
if(pwalletMain)
{
walletModel = new WalletModel(pwalletMain, optionsModel);
@@ -380,6 +400,7 @@ void BitcoinApplication::initializeResult(int retval)
connect(walletModel, SIGNAL(coinsSent(CWallet*,SendCoinsRecipient,QByteArray)),
paymentServer, SLOT(fetchPaymentACK(CWallet*,const SendCoinsRecipient&,QByteArray)));
}
+#endif
// If -min option passed, start window minimized.
if(GetBoolArg("-min", false))
@@ -390,7 +411,7 @@ void BitcoinApplication::initializeResult(int retval)
{
window->show();
}
-
+#ifdef ENABLE_WALLET
// Now that initialization/startup is done, process any command-line
// bitcoin: URIs or payment requests:
connect(paymentServer, SIGNAL(receivedPaymentRequest(SendCoinsRecipient)),
@@ -400,7 +421,7 @@ void BitcoinApplication::initializeResult(int retval)
connect(paymentServer, SIGNAL(message(QString,QString,unsigned int)),
window, SLOT(message(QString,QString,unsigned int)));
QTimer::singleShot(100, paymentServer, SLOT(uiReady()));
-
+#endif
} else {
quit(); // Exit main loop
}
@@ -429,9 +450,11 @@ int main(int argc, char *argv[])
if (!SelectParamsFromCommandLine()) {
fSelParFromCLFailed = true;
}
+#ifdef ENABLE_WALLET
// Parse URIs on command line -- this can affect TestNet() / RegTest() mode
if (!PaymentServer::ipcParseCommandLine(argc, argv))
exit(0);
+#endif
bool isaTestNet = TestNet() || RegTest();
@@ -500,6 +523,7 @@ int main(int argc, char *argv[])
}
ReadConfigFile(mapArgs, mapMultiArgs);
+#ifdef ENABLE_WALLET
/// 7. URI IPC sending
// - Do this early as we don't want to bother initializing if we are just calling IPC
// - Do this *after* setting up the data directory, as the data directory hash is used in the name
@@ -512,6 +536,7 @@ int main(int argc, char *argv[])
// Start up the payment server early, too, so impatient users that click on
// bitcoin: links repeatedly have their payment requests routed to this process:
app.createPaymentServer();
+#endif
/// 8. Main GUI initialization
// Install global event filter that makes sure that long tooltips can be word-wrapped
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index ee27fe90a6..22c41a6201 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -14,8 +14,10 @@
#include "optionsdialog.h"
#include "optionsmodel.h"
#include "rpcconsole.h"
+#ifdef ENABLE_WALLET
#include "walletframe.h"
#include "walletmodel.h"
+#endif
#ifdef Q_OS_MAC
#include "macdockiconhandler.h"
@@ -59,6 +61,7 @@ const QString BitcoinGUI::DEFAULT_WALLET = "~Default";
BitcoinGUI::BitcoinGUI(bool fIsTestnet, QWidget *parent) :
QMainWindow(parent),
clientModel(0),
+ walletFrame(0),
encryptWalletAction(0),
changePassphraseAction(0),
aboutQtAction(0),
@@ -69,9 +72,22 @@ BitcoinGUI::BitcoinGUI(bool fIsTestnet, QWidget *parent) :
{
GUIUtil::restoreWindowGeometry("nWindow", QSize(850, 550), this);
+ QString windowTitle = tr("Bitcoin Core") + " - ";
+#ifdef ENABLE_WALLET
+ /* if compiled with wallet support, -disablewallet can still disable the wallet */
+ bool enableWallet = !GetBoolArg("-disablewallet", false);
+#else
+ bool enableWallet = false;
+#endif
+ if(enableWallet)
+ {
+ windowTitle += tr("Wallet");
+ } else {
+ windowTitle += tr("Node");
+ }
+
if (!fIsTestnet)
{
- setWindowTitle(tr("Bitcoin Core") + " - " + tr("Wallet"));
#ifndef Q_OS_MAC
QApplication::setWindowIcon(QIcon(":icons/bitcoin"));
setWindowIcon(QIcon(":icons/bitcoin"));
@@ -81,7 +97,7 @@ BitcoinGUI::BitcoinGUI(bool fIsTestnet, QWidget *parent) :
}
else
{
- setWindowTitle(tr("Bitcoin Core") + " - " + tr("Wallet") + " " + tr("[testnet]"));
+ windowTitle += " " + tr("[testnet]");
#ifndef Q_OS_MAC
QApplication::setWindowIcon(QIcon(":icons/bitcoin_testnet"));
setWindowIcon(QIcon(":icons/bitcoin_testnet"));
@@ -89,6 +105,7 @@ BitcoinGUI::BitcoinGUI(bool fIsTestnet, QWidget *parent) :
MacDockIconHandler::instance()->setIcon(QIcon(":icons/bitcoin_testnet"));
#endif
}
+ setWindowTitle(windowTitle);
#if defined(Q_OS_MAC) && QT_VERSION < 0x050000
// This property is not implemented in Qt 5. Setting it has no effect.
@@ -96,9 +113,21 @@ BitcoinGUI::BitcoinGUI(bool fIsTestnet, QWidget *parent) :
setUnifiedTitleAndToolBarOnMac(true);
#endif
- // Create wallet frame and make it the central widget
- walletFrame = new WalletFrame(this);
- setCentralWidget(walletFrame);
+ rpcConsole = new RPCConsole(enableWallet ? this : 0);
+#ifdef ENABLE_WALLET
+ if(enableWallet)
+ {
+ /** Create wallet frame and make it the central widget */
+ walletFrame = new WalletFrame(this);
+ setCentralWidget(walletFrame);
+ } else
+#endif
+ {
+ /* When compiled without wallet or -disablewallet is provided,
+ * the central widget is the rpc console.
+ */
+ setCentralWidget(rpcConsole);
+ }
// Accept D&D of URIs
setAcceptDrops(true);
@@ -160,8 +189,8 @@ BitcoinGUI::BitcoinGUI(bool fIsTestnet, QWidget *parent) :
syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);
- rpcConsole = new RPCConsole(this);
connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));
+
// prevents an oben debug window from becoming stuck/unusable on client shutdown
connect(quitAction, SIGNAL(triggered()), rpcConsole, SLOT(hide()));
@@ -286,14 +315,19 @@ void BitcoinGUI::createActions(bool fIsTestnet)
connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked()));
connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden()));
- connect(encryptWalletAction, SIGNAL(triggered(bool)), walletFrame, SLOT(encryptWallet(bool)));
- connect(backupWalletAction, SIGNAL(triggered()), walletFrame, SLOT(backupWallet()));
- connect(changePassphraseAction, SIGNAL(triggered()), walletFrame, SLOT(changePassphrase()));
- connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab()));
- connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab()));
- connect(usedSendingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedSendingAddresses()));
- connect(usedReceivingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedReceivingAddresses()));
- connect(openAction, SIGNAL(triggered()), this, SLOT(openClicked()));
+#ifdef ENABLE_WALLET
+ if(walletFrame)
+ {
+ connect(encryptWalletAction, SIGNAL(triggered(bool)), walletFrame, SLOT(encryptWallet(bool)));
+ connect(backupWalletAction, SIGNAL(triggered()), walletFrame, SLOT(backupWallet()));
+ connect(changePassphraseAction, SIGNAL(triggered()), walletFrame, SLOT(changePassphrase()));
+ connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab()));
+ connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab()));
+ connect(usedSendingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedSendingAddresses()));
+ connect(usedReceivingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedReceivingAddresses()));
+ connect(openAction, SIGNAL(triggered()), this, SLOT(openClicked()));
+ }
+#endif
}
void BitcoinGUI::createMenuBar()
@@ -308,38 +342,50 @@ void BitcoinGUI::createMenuBar()
// Configure the menus
QMenu *file = appMenuBar->addMenu(tr("&File"));
- file->addAction(openAction);
- file->addAction(backupWalletAction);
- file->addAction(signMessageAction);
- file->addAction(verifyMessageAction);
- file->addSeparator();
- file->addAction(usedSendingAddressesAction);
- file->addAction(usedReceivingAddressesAction);
- file->addSeparator();
+ if(walletFrame)
+ {
+ file->addAction(openAction);
+ file->addAction(backupWalletAction);
+ file->addAction(signMessageAction);
+ file->addAction(verifyMessageAction);
+ file->addSeparator();
+ file->addAction(usedSendingAddressesAction);
+ file->addAction(usedReceivingAddressesAction);
+ file->addSeparator();
+ }
file->addAction(quitAction);
QMenu *settings = appMenuBar->addMenu(tr("&Settings"));
- settings->addAction(encryptWalletAction);
- settings->addAction(changePassphraseAction);
- settings->addSeparator();
+ if(walletFrame)
+ {
+ settings->addAction(encryptWalletAction);
+ settings->addAction(changePassphraseAction);
+ settings->addSeparator();
+ }
settings->addAction(optionsAction);
QMenu *help = appMenuBar->addMenu(tr("&Help"));
- help->addAction(openRPCConsoleAction);
- help->addSeparator();
+ if(walletFrame)
+ {
+ help->addAction(openRPCConsoleAction);
+ help->addSeparator();
+ }
help->addAction(aboutAction);
help->addAction(aboutQtAction);
}
void BitcoinGUI::createToolBars()
{
- QToolBar *toolbar = addToolBar(tr("Tabs toolbar"));
- toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
- toolbar->addAction(overviewAction);
- toolbar->addAction(sendCoinsAction);
- toolbar->addAction(receiveCoinsAction);
- toolbar->addAction(historyAction);
- overviewAction->setChecked(true);
+ if(walletFrame)
+ {
+ QToolBar *toolbar = addToolBar(tr("Tabs toolbar"));
+ toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
+ toolbar->addAction(overviewAction);
+ toolbar->addAction(sendCoinsAction);
+ toolbar->addAction(receiveCoinsAction);
+ toolbar->addAction(historyAction);
+ overviewAction->setChecked(true);
+ }
}
void BitcoinGUI::setClientModel(ClientModel *clientModel)
@@ -362,26 +408,39 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel)
connect(clientModel, SIGNAL(message(QString,QString,unsigned int)), this, SLOT(message(QString,QString,unsigned int)));
rpcConsole->setClientModel(clientModel);
- walletFrame->setClientModel(clientModel);
+#ifdef ENABLE_WALLET
+ if(walletFrame)
+ {
+ walletFrame->setClientModel(clientModel);
+ }
+#endif
}
}
+#ifdef ENABLE_WALLET
bool BitcoinGUI::addWallet(const QString& name, WalletModel *walletModel)
{
+ if(!walletFrame)
+ return false;
setWalletActionsEnabled(true);
return walletFrame->addWallet(name, walletModel);
}
bool BitcoinGUI::setCurrentWallet(const QString& name)
{
+ if(!walletFrame)
+ return false;
return walletFrame->setCurrentWallet(name);
}
void BitcoinGUI::removeAllWallets()
{
+ if(!walletFrame)
+ return;
setWalletActionsEnabled(false);
walletFrame->removeAllWallets();
}
+#endif
void BitcoinGUI::setWalletActionsEnabled(bool enabled)
{
@@ -489,6 +548,7 @@ void BitcoinGUI::aboutClicked()
dlg.exec();
}
+#ifdef ENABLE_WALLET
void BitcoinGUI::openClicked()
{
OpenURIDialog dlg(this);
@@ -531,6 +591,7 @@ void BitcoinGUI::gotoVerifyMessageTab(QString addr)
{
if (walletFrame) walletFrame->gotoVerifyMessageTab(addr);
}
+#endif
void BitcoinGUI::setNumConnections(int count)
{
@@ -591,7 +652,10 @@ void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks)
tooltip = tr("Up to date") + QString(".<br>") + tooltip;
labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
- walletFrame->showOutOfSyncWarning(false);
+#ifdef ENABLE_WALLET
+ if(walletFrame)
+ walletFrame->showOutOfSyncWarning(false);
+#endif
progressBarLabel->setVisible(false);
progressBar->setVisible(false);
@@ -625,7 +689,10 @@ void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks)
syncIconMovie->jumpToNextFrame();
prevBlocks = count;
- walletFrame->showOutOfSyncWarning(true);
+#ifdef ENABLE_WALLET
+ if(walletFrame)
+ walletFrame->showOutOfSyncWarning(true);
+#endif
tooltip += QString("<br>");
tooltip += tr("Last received block was generated %1 ago.").arg(timeBehindText);
@@ -738,6 +805,7 @@ void BitcoinGUI::closeEvent(QCloseEvent *event)
QMainWindow::closeEvent(event);
}
+#ifdef ENABLE_WALLET
void BitcoinGUI::incomingTransaction(const QString& date, int unit, qint64 amount, const QString& type, const QString& address)
{
// On new transaction, make an info balloon
@@ -751,6 +819,7 @@ void BitcoinGUI::incomingTransaction(const QString& date, int unit, qint64 amoun
.arg(type)
.arg(address), CClientUIInterface::MSG_INFORMATION);
}
+#endif
void BitcoinGUI::dragEnterEvent(QDragEnterEvent *event)
{
@@ -783,10 +852,11 @@ bool BitcoinGUI::eventFilter(QObject *object, QEvent *event)
return QMainWindow::eventFilter(object, event);
}
+#ifdef ENABLE_WALLET
bool BitcoinGUI::handlePaymentRequest(const SendCoinsRecipient& recipient)
{
// URI has to be valid
- if (walletFrame->handlePaymentRequest(recipient))
+ if (walletFrame && walletFrame->handlePaymentRequest(recipient))
{
showNormalIfMinimized();
gotoSendCoinsPage();
@@ -824,6 +894,7 @@ void BitcoinGUI::setEncryptionStatus(int status)
break;
}
}
+#endif
void BitcoinGUI::showNormalIfMinimized(bool fToggleHidden)
{
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index f5d5bb9762..1038e2739c 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -5,6 +5,10 @@
#ifndef BITCOINGUI_H
#define BITCOINGUI_H
+#if defined(HAVE_CONFIG_H)
+#include "bitcoin-config.h"
+#endif
+
#include <QMainWindow>
#include <QMap>
#include <QSystemTrayIcon>
@@ -43,14 +47,15 @@ public:
*/
void setClientModel(ClientModel *clientModel);
+#ifdef ENABLE_WALLET
/** Set the wallet model.
The wallet model represents a bitcoin wallet, and offers access to the list of transactions, address book and sending
functionality.
*/
bool addWallet(const QString& name, WalletModel *walletModel);
bool setCurrentWallet(const QString& name);
-
void removeAllWallets();
+#endif
protected:
void changeEvent(QEvent *e);
@@ -125,11 +130,6 @@ public slots:
void setNumConnections(int count);
/** Set number of blocks shown in the UI */
void setNumBlocks(int count, int nTotalBlocks);
- /** Set the encryption status as shown in the UI.
- @param[in] status current encryption status
- @see WalletModel::EncryptionStatus
- */
- void setEncryptionStatus(int status);
/** Notify the user of an event from the core network or transaction handling code.
@param[in] title the message box / notification title
@@ -140,12 +140,21 @@ public slots:
*/
void message(const QString &title, const QString &message, unsigned int style, bool *ret = NULL);
+#ifdef ENABLE_WALLET
+ /** Set the encryption status as shown in the UI.
+ @param[in] status current encryption status
+ @see WalletModel::EncryptionStatus
+ */
+ void setEncryptionStatus(int status);
+
bool handlePaymentRequest(const SendCoinsRecipient& recipient);
/** Show incoming transaction notification for new transactions. */
void incomingTransaction(const QString& date, int unit, qint64 amount, const QString& type, const QString& address);
+#endif
private slots:
+#ifdef ENABLE_WALLET
/** Switch to overview (home) page */
void gotoOverviewPage();
/** Switch to history (transactions) page */
@@ -160,6 +169,9 @@ private slots:
/** Show Sign/Verify Message dialog and switch to verify message tab */
void gotoVerifyMessageTab(QString addr = "");
+ /** Show open dialog */
+ void openClicked();
+#endif
/** Show configuration dialog */
void optionsClicked();
/** Show about dialog */
@@ -168,8 +180,6 @@ private slots:
/** Handle tray icon clicked */
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
#endif
- /** Show open dialog */
- void openClicked();
/** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */
void showNormalIfMinimized(bool fToggleHidden = false);
diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp
index c7817a94a8..1133c457b3 100644
--- a/src/qt/optionsmodel.cpp
+++ b/src/qt/optionsmodel.cpp
@@ -14,8 +14,10 @@
#include "init.h"
#include "main.h"
#include "net.h"
+#ifdef ENABLE_WALLET
#include "wallet.h"
#include "walletdb.h"
+#endif
#include <QSettings>
#include <QStringList>
@@ -67,8 +69,10 @@ void OptionsModel::Init()
// by command-line and show this in the UI.
// Main
+#ifdef ENABLE_WALLET
if (!settings.contains("nTransactionFee"))
settings.setValue("nTransactionFee", 0);
+#endif
if (!settings.contains("nDatabaseCache"))
settings.setValue("nDatabaseCache", 25);
@@ -137,6 +141,7 @@ void OptionsModel::Upgrade()
settings.setValue("bImportFinished", true);
+#ifdef ENABLE_WALLET
// Move settings from old wallet.dat (if any):
CWalletDB walletdb(strWalletFile);
@@ -181,6 +186,7 @@ void OptionsModel::Upgrade()
walletdb.EraseSetting("addrProxy");
}
}
+#endif
Init();
}
@@ -227,6 +233,7 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
case ProxySocksVersion:
return settings.value("nSocksVersion", 5);
+#ifdef ENABLE_WALLET
case Fee:
// Attention: Init() is called before nTransactionFee is set in AppInit2()!
// To ensure we can change the fee on-the-fly update our QSetting when
@@ -236,6 +243,7 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
// Todo: Consider to revert back to use just nTransactionFee here, if we don't want
// -paytxfee to update our QSettings!
return settings.value("nTransactionFee");
+#endif
case DisplayUnit:
return nDisplayUnit;
case DisplayAddresses:
@@ -318,13 +326,14 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
}
}
break;
-
+#ifdef ENABLE_WALLET
case Fee: // core option - can be changed on-the-fly
// Todo: Add is valid check and warn via message, if not
nTransactionFee = value.toLongLong();
settings.setValue("nTransactionFee", (qint64)nTransactionFee);
emit transactionFeeChanged(nTransactionFee);
break;
+#endif
case DisplayUnit:
nDisplayUnit = value.toInt();
settings.setValue("nDisplayUnit", nDisplayUnit);
diff --git a/src/qt/test/Makefile.am b/src/qt/test/Makefile.am
index 0150524337..da54ef376b 100644
--- a/src/qt/test/Makefile.am
+++ b/src/qt/test/Makefile.am
@@ -8,16 +8,27 @@ AM_CPPFLAGS += -I$(top_srcdir)/src \
bin_PROGRAMS = test_bitcoin-qt
TESTS = test_bitcoin-qt
-TEST_QT_MOC_CPP = moc_uritests.cpp moc_paymentservertests.cpp
+TEST_QT_MOC_CPP = moc_uritests.cpp
+
+if ENABLE_WALLET
+TEST_QT_MOC_CPP += moc_paymentservertests.cpp
+endif
TEST_QT_H = uritests.h paymentservertests.h paymentrequestdata.h
BUILT_SOURCES = $(TEST_QT_MOC_CPP)
test_bitcoin_qt_CPPFLAGS = $(AM_CPPFLAGS) $(QT_INCLUDES) $(QT_TEST_INCLUDES)
-test_bitcoin_qt_SOURCES = test_main.cpp uritests.cpp paymentservertests.cpp $(TEST_QT_H)
+test_bitcoin_qt_SOURCES = test_main.cpp uritests.cpp $(TEST_QT_H)
+if ENABLE_WALLET
+test_bitcoin_qt_SOURCES += paymentservertests.cpp
+endif
nodist_test_bitcoin_qt_SOURCES = $(TEST_QT_MOC_CPP)
-test_bitcoin_qt_LDADD = $(LIBBITCOINQT) $(LIBBITCOIN_SERVER) $(LIBBITCOIN_WALLET) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBLEVELDB) \
+test_bitcoin_qt_LDADD = $(LIBBITCOINQT) $(LIBBITCOIN_SERVER)
+if ENABLE_WALLET
+test_bitcoin_qt_LDADD += $(LIBBITCOIN_WALLET)
+endif
+test_bitcoin_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBLEVELDB) \
$(LIBMEMENV) $(BOOST_LIBS) $(QT_DBUS_LIBS) $(QT_TEST_LIBS) $(QT_LIBS) \
$(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS)
diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp
index ad0dfd9823..a2adb00327 100644
--- a/src/qt/test/test_main.cpp
+++ b/src/qt/test/test_main.cpp
@@ -1,5 +1,11 @@
#include "bitcoin-config.h"
+#if defined(HAVE_CONFIG_H)
+#include "bitcoin-config.h"
+#endif
+
+#ifdef ENABLE_WALLET
#include "paymentservertests.h"
+#endif
#include "uritests.h"
#include <QCoreApplication>
@@ -27,10 +33,11 @@ int main(int argc, char *argv[])
URITests test1;
if (QTest::qExec(&test1) != 0)
fInvalid = true;
-
+#ifdef ENABLE_WALLET
PaymentServerTests test2;
if (QTest::qExec(&test2) != 0)
fInvalid = true;
+#endif
return fInvalid;
}