Skip to content

Commit b7f4b6d

Browse files
committed
GUI for --disable-wallet compiles and -disablewallet mode
There is not much in the GUI to be done without wallet, though it's possible to change options, watch the sync process, and use the debug console. So embed the debug console in the main window.
1 parent ec41342 commit b7f4b6d

File tree

8 files changed

+243
-77
lines changed

8 files changed

+243
-77
lines changed

configure.ac

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,9 +567,6 @@ if test x$bitcoin_enable_qt != xno; then
567567
AC_MSG_ERROR("QT Test lib not found. Use --disable-tests or --without-qt.")
568568
fi
569569
fi
570-
if test x$enable_wallet == xno; then
571-
AC_MSG_ERROR([Cannot currently build Qt GUI with wallet disabled. Use --without-qt.])
572-
fi
573570
fi
574571

575572
if test x$use_tests = xyes; then

src/qt/Makefile.am

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -150,24 +150,56 @@ RES_ICONS = res/icons/bitcoin.png res/icons/address-book.png \
150150
res/icons/qrcode.png res/icons/debugwindow.png res/icons/bitcoin.ico \
151151
res/icons/bitcoin_testnet.ico
152152

153-
BITCOIN_QT_CPP = aboutdialog.cpp addressbookpage.cpp \
154-
addresstablemodel.cpp askpassphrasedialog.cpp bitcoinaddressvalidator.cpp \
155-
bitcoinamountfield.cpp bitcoin.cpp bitcoingui.cpp \
156-
bitcoinunits.cpp clientmodel.cpp \
153+
BITCOIN_QT_CPP = \
154+
aboutdialog.cpp \
155+
bitcoinaddressvalidator.cpp \
156+
bitcoinamountfield.cpp \
157+
bitcoin.cpp \
158+
bitcoingui.cpp \
159+
bitcoinunits.cpp \
160+
clientmodel.cpp \
161+
csvmodelwriter.cpp \
162+
guiutil.cpp \
163+
intro.cpp \
164+
monitoreddatamapper.cpp \
165+
notificator.cpp \
166+
optionsdialog.cpp \
167+
optionsmodel.cpp \
168+
qvalidatedlineedit.cpp \
169+
qvaluecombobox.cpp \
170+
rpcconsole.cpp \
171+
signverifymessagedialog.cpp \
172+
splashscreen.cpp \
173+
trafficgraphwidget.cpp
174+
175+
if ENABLE_WALLET
176+
BITCOIN_QT_CPP += \
177+
addressbookpage.cpp \
178+
addresstablemodel.cpp \
179+
askpassphrasedialog.cpp \
157180
coincontroldialog.cpp \
158181
coincontroltreewidget.cpp \
159-
csvmodelwriter.cpp editaddressdialog.cpp \
160-
guiutil.cpp intro.cpp monitoreddatamapper.cpp notificator.cpp \
182+
editaddressdialog.cpp \
161183
openuridialog.cpp \
162-
optionsdialog.cpp optionsmodel.cpp overviewpage.cpp paymentrequestplus.cpp \
163-
paymentserver.cpp qvalidatedlineedit.cpp qvaluecombobox.cpp \
164-
receivecoinsdialog.cpp receiverequestdialog.cpp \
184+
overviewpage.cpp \
185+
paymentrequestplus.cpp \
186+
paymentserver.cpp \
187+
receivecoinsdialog.cpp \
188+
receiverequestdialog.cpp \
165189
recentrequeststablemodel.cpp \
166-
rpcconsole.cpp sendcoinsdialog.cpp sendcoinsentry.cpp \
167-
signverifymessagedialog.cpp splashscreen.cpp trafficgraphwidget.cpp transactiondesc.cpp \
168-
transactiondescdialog.cpp transactionfilterproxy.cpp transactionrecord.cpp \
169-
transactiontablemodel.cpp transactionview.cpp walletframe.cpp \
170-
walletmodel.cpp walletmodeltransaction.cpp walletview.cpp
190+
sendcoinsdialog.cpp \
191+
sendcoinsentry.cpp \
192+
transactiondesc.cpp \
193+
transactiondescdialog.cpp \
194+
transactionfilterproxy.cpp \
195+
transactionrecord.cpp \
196+
transactiontablemodel.cpp \
197+
transactionview.cpp \
198+
walletframe.cpp \
199+
walletmodel.cpp \
200+
walletmodeltransaction.cpp \
201+
walletview.cpp
202+
endif
171203

172204
RES_IMAGES = res/images/about.png res/images/splash.png \
173205
res/images/splash_testnet.png
@@ -203,7 +235,11 @@ endif
203235
bitcoin_qt_CPPFLAGS = $(AM_CPPFLAGS) $(QT_INCLUDES) \
204236
-I$(top_srcdir)/src/qt/forms
205237
bitcoin_qt_SOURCES = bitcoin.cpp
206-
bitcoin_qt_LDADD = libbitcoinqt.a $(LIBBITCOIN_SERVER) $(LIBBITCOIN_WALLET) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBLEVELDB) $(LIBMEMENV) \
238+
bitcoin_qt_LDADD = libbitcoinqt.a $(LIBBITCOIN_SERVER)
239+
if ENABLE_WALLET
240+
bitcoin_qt_LDADD += $(LIBBITCOIN_WALLET)
241+
endif
242+
bitcoin_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBLEVELDB) $(LIBMEMENV) \
207243
$(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS)
208244

209245
# forms/foo.h -> forms/ui_foo.h

src/qt/bitcoin.cpp

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
#include "guiutil.h"
1111
#include "intro.h"
1212
#include "optionsmodel.h"
13-
#include "paymentserver.h"
1413
#include "splashscreen.h"
14+
#ifdef ENABLE_WALLET
15+
#include "paymentserver.h"
1516
#include "walletmodel.h"
17+
#endif
1618

1719
#include "init.h"
1820
#include "main.h"
@@ -157,8 +159,10 @@ class BitcoinApplication: public QApplication
157159
explicit BitcoinApplication(int &argc, char **argv);
158160
~BitcoinApplication();
159161

162+
#ifdef ENABLE_WALLET
160163
/// Create payment server
161164
void createPaymentServer();
165+
#endif
162166
/// Create options model
163167
void createOptionsModel();
164168
/// Create main window
@@ -188,12 +192,14 @@ public slots:
188192

189193
private:
190194
QThread *coreThread;
191-
PaymentServer* paymentServer;
192195
OptionsModel *optionsModel;
193196
ClientModel *clientModel;
194197
BitcoinGUI *window;
195-
WalletModel *walletModel;
196198
QTimer *pollShutdownTimer;
199+
#ifdef ENABLE_WALLET
200+
PaymentServer* paymentServer;
201+
WalletModel *walletModel;
202+
#endif
197203
int returnValue;
198204

199205
void startThread();
@@ -246,12 +252,14 @@ void BitcoinCore::shutdown()
246252
BitcoinApplication::BitcoinApplication(int &argc, char **argv):
247253
QApplication(argc, argv),
248254
coreThread(0),
249-
paymentServer(0),
250255
optionsModel(0),
251256
clientModel(0),
252257
window(0),
253-
walletModel(0),
254258
pollShutdownTimer(0),
259+
#ifdef ENABLE_WALLET
260+
paymentServer(0),
261+
walletModel(0),
262+
#endif
255263
returnValue(0)
256264
{
257265
setQuitOnLastWindowClosed(false);
@@ -266,14 +274,21 @@ BitcoinApplication::~BitcoinApplication()
266274
LogPrintf("Stopped thread\n");
267275

268276
delete window;
277+
window = 0;
278+
#ifdef ENABLE_WALLET
269279
delete paymentServer;
280+
paymentServer = 0;
281+
#endif
270282
delete optionsModel;
283+
optionsModel = 0;
271284
}
272285

286+
#ifdef ENABLE_WALLET
273287
void BitcoinApplication::createPaymentServer()
274288
{
275289
paymentServer = new PaymentServer(this);
276290
}
291+
#endif
277292

278293
void BitcoinApplication::createOptionsModel()
279294
{
@@ -327,11 +342,13 @@ void BitcoinApplication::requestShutdown()
327342
LogPrintf("Requesting shutdown\n");
328343
window->hide();
329344
window->setClientModel(0);
330-
window->removeAllWallets();
331345
pollShutdownTimer->stop();
332346

347+
#ifdef ENABLE_WALLET
348+
window->removeAllWallets();
333349
delete walletModel;
334350
walletModel = 0;
351+
#endif
335352
delete clientModel;
336353
clientModel = 0;
337354

@@ -362,14 +379,17 @@ void BitcoinApplication::initializeResult(int retval)
362379
// Miscellaneous initialization after core is initialized
363380
optionsModel->Upgrade(); // Must be done after AppInit2
364381

382+
#ifdef ENABLE_WALLET
365383
PaymentServer::LoadRootCAs();
366384
paymentServer->setOptionsModel(optionsModel);
385+
#endif
367386

368387
emit splashFinished(window);
369388

370389
clientModel = new ClientModel(optionsModel);
371390
window->setClientModel(clientModel);
372391

392+
#ifdef ENABLE_WALLET
373393
if(pwalletMain)
374394
{
375395
walletModel = new WalletModel(pwalletMain, optionsModel);
@@ -380,6 +400,7 @@ void BitcoinApplication::initializeResult(int retval)
380400
connect(walletModel, SIGNAL(coinsSent(CWallet*,SendCoinsRecipient,QByteArray)),
381401
paymentServer, SLOT(fetchPaymentACK(CWallet*,const SendCoinsRecipient&,QByteArray)));
382402
}
403+
#endif
383404

384405
// If -min option passed, start window minimized.
385406
if(GetBoolArg("-min", false))
@@ -390,7 +411,7 @@ void BitcoinApplication::initializeResult(int retval)
390411
{
391412
window->show();
392413
}
393-
414+
#ifdef ENABLE_WALLET
394415
// Now that initialization/startup is done, process any command-line
395416
// bitcoin: URIs or payment requests:
396417
connect(paymentServer, SIGNAL(receivedPaymentRequest(SendCoinsRecipient)),
@@ -400,7 +421,7 @@ void BitcoinApplication::initializeResult(int retval)
400421
connect(paymentServer, SIGNAL(message(QString,QString,unsigned int)),
401422
window, SLOT(message(QString,QString,unsigned int)));
402423
QTimer::singleShot(100, paymentServer, SLOT(uiReady()));
403-
424+
#endif
404425
} else {
405426
quit(); // Exit main loop
406427
}
@@ -429,9 +450,11 @@ int main(int argc, char *argv[])
429450
if (!SelectParamsFromCommandLine()) {
430451
fSelParFromCLFailed = true;
431452
}
453+
#ifdef ENABLE_WALLET
432454
// Parse URIs on command line -- this can affect TestNet() / RegTest() mode
433455
if (!PaymentServer::ipcParseCommandLine(argc, argv))
434456
exit(0);
457+
#endif
435458

436459
bool isaTestNet = TestNet() || RegTest();
437460

@@ -500,6 +523,7 @@ int main(int argc, char *argv[])
500523
}
501524
ReadConfigFile(mapArgs, mapMultiArgs);
502525

526+
#ifdef ENABLE_WALLET
503527
/// 7. URI IPC sending
504528
// - Do this early as we don't want to bother initializing if we are just calling IPC
505529
// - 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[])
512536
// Start up the payment server early, too, so impatient users that click on
513537
// bitcoin: links repeatedly have their payment requests routed to this process:
514538
app.createPaymentServer();
539+
#endif
515540

516541
/// 8. Main GUI initialization
517542
// Install global event filter that makes sure that long tooltips can be word-wrapped

0 commit comments

Comments
 (0)