Dogecoin Core  1.14.2
P2P Digital Currency
bitcoin.cpp
Go to the documentation of this file.
1 // Copyright (c) 2011-2016 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #if defined(HAVE_CONFIG_H)
6 #include "config/bitcoin-config.h"
7 #endif
8 
9 #include "bitcoingui.h"
10 
11 #include "chainparams.h"
12 #include "clientmodel.h"
13 #include "guiconstants.h"
14 #include "guiutil.h"
15 #include "intro.h"
16 #include "networkstyle.h"
17 #include "optionsmodel.h"
18 #include "platformstyle.h"
19 #include "splashscreen.h"
20 #include "utilitydialog.h"
21 #include "winshutdownmonitor.h"
22 
23 #ifdef ENABLE_WALLET
24 #include "paymentserver.h"
25 #include "walletmodel.h"
26 #endif
27 
28 #include "init.h"
29 #include "rpc/server.h"
30 #include "scheduler.h"
31 #include "ui_interface.h"
32 #include "util.h"
33 #include "warnings.h"
34 
35 #ifdef ENABLE_WALLET
36 #include "wallet/wallet.h"
37 #endif
38 
39 #include <stdint.h>
40 
41 #include <boost/filesystem/operations.hpp>
42 #include <boost/thread.hpp>
43 
44 #include <QApplication>
45 #include <QDebug>
46 #include <QLibraryInfo>
47 #include <QLocale>
48 #include <QMessageBox>
49 #include <QSettings>
50 #include <QThread>
51 #include <QTimer>
52 #include <QTranslator>
53 #include <QSslConfiguration>
54 
55 #if defined(QT_STATICPLUGIN)
56 #include <QtPlugin>
57 #if QT_VERSION < 0x050000
58 Q_IMPORT_PLUGIN(qcncodecs)
59 Q_IMPORT_PLUGIN(qjpcodecs)
60 Q_IMPORT_PLUGIN(qtwcodecs)
61 Q_IMPORT_PLUGIN(qkrcodecs)
62 Q_IMPORT_PLUGIN(qtaccessiblewidgets)
63 #else
64 #if QT_VERSION < 0x050400
65 Q_IMPORT_PLUGIN(AccessibleFactory)
66 #endif
67 #if defined(QT_QPA_PLATFORM_XCB)
68 Q_IMPORT_PLUGIN(QXcbIntegrationPlugin);
69 #elif defined(QT_QPA_PLATFORM_WINDOWS)
70 Q_IMPORT_PLUGIN(QMinimalIntegrationPlugin);
71 Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
72 Q_IMPORT_PLUGIN(QWindowsPrinterSupportPlugin);
73 #elif defined(QT_QPA_PLATFORM_COCOA)
74 Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin);
75 #endif
76 #endif
77 #endif
78 
79 #if QT_VERSION < 0x050000
80 #include <QTextCodec>
81 #endif
82 
83 // Declare meta types used for QMetaObject::invokeMethod
84 Q_DECLARE_METATYPE(bool*)
85 Q_DECLARE_METATYPE(CAmount)
86 
87 static void InitMessage(const std::string &message)
88 {
89  LogPrintf("init message: %s\n", message);
90 }
91 
92 /*
93  Translate string to current locale using Qt.
94  */
95 static std::string Translate(const char* psz)
96 {
97  return QCoreApplication::translate("bitcoin-core", psz).toStdString();
98 }
99 
100 static QString GetLangTerritory()
101 {
102  QSettings settings;
103  // Get desired locale (e.g. "de_DE")
104  // 1) System default language
105  QString lang_territory = QLocale::system().name();
106  // 2) Language from QSettings
107  QString lang_territory_qsettings = settings.value("language", "").toString();
108  if(!lang_territory_qsettings.isEmpty())
109  lang_territory = lang_territory_qsettings;
110  // 3) -lang command line argument
111  lang_territory = QString::fromStdString(GetArg("-lang", lang_territory.toStdString()));
112  return lang_territory;
113 }
114 
116 static void initTranslations(QTranslator &qtTranslatorBase, QTranslator &qtTranslator, QTranslator &translatorBase, QTranslator &translator)
117 {
118  // Remove old translators
119  QApplication::removeTranslator(&qtTranslatorBase);
120  QApplication::removeTranslator(&qtTranslator);
121  QApplication::removeTranslator(&translatorBase);
122  QApplication::removeTranslator(&translator);
123 
124  // Get desired locale (e.g. "de_DE")
125  // 1) System default language
126  QString lang_territory = GetLangTerritory();
127 
128  // Convert to "de" only by truncating "_DE"
129  QString lang = lang_territory;
130  lang.truncate(lang_territory.lastIndexOf('_'));
131 
132  // Load language files for configured locale:
133  // - First load the translator for the base language, without territory
134  // - Then load the more specific locale translator
135 
136  // Load e.g. qt_de.qm
137  if (qtTranslatorBase.load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
138  QApplication::installTranslator(&qtTranslatorBase);
139 
140  // Load e.g. qt_de_DE.qm
141  if (qtTranslator.load("qt_" + lang_territory, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
142  QApplication::installTranslator(&qtTranslator);
143 
144  // Load e.g. bitcoin_de.qm (shortcut "de" needs to be defined in bitcoin.qrc)
145  if (translatorBase.load(lang, ":/translations/"))
146  QApplication::installTranslator(&translatorBase);
147 
148  // Load e.g. bitcoin_de_DE.qm (shortcut "de_DE" needs to be defined in bitcoin.qrc)
149  if (translator.load(lang_territory, ":/translations/"))
150  QApplication::installTranslator(&translator);
151 }
152 
153 /* qDebug() message handler --> debug.log */
154 #if QT_VERSION < 0x050000
155 void DebugMessageHandler(QtMsgType type, const char *msg)
156 {
157  const char *category = (type == QtDebugMsg) ? "qt" : NULL;
158  LogPrint(category, "GUI: %s\n", msg);
159 }
160 #else
161 void DebugMessageHandler(QtMsgType type, const QMessageLogContext& context, const QString &msg)
162 {
163  Q_UNUSED(context);
164  const char *category = (type == QtDebugMsg) ? "qt" : NULL;
165  LogPrint(category, "GUI: %s\n", msg.toStdString());
166 }
167 #endif
168 
172 class BitcoinCore: public QObject
173 {
174  Q_OBJECT
175 public:
176  explicit BitcoinCore();
177 
178 public Q_SLOTS:
179  void initialize();
180  void shutdown();
181 
182 Q_SIGNALS:
183  void initializeResult(int retval);
184  void shutdownResult(int retval);
185  void runawayException(const QString &message);
186 
187 private:
188  boost::thread_group threadGroup;
190 
192  void handleRunawayException(const std::exception *e);
193 };
194 
196 class BitcoinApplication: public QApplication
197 {
198  Q_OBJECT
199 public:
200  explicit BitcoinApplication(int &argc, char **argv);
202 
203 #ifdef ENABLE_WALLET
205  void createPaymentServer();
206 #endif
208  void parameterSetup();
210  void createOptionsModel(bool resetSettings);
212  void createWindow(const NetworkStyle *networkStyle);
214  void createSplashScreen(const NetworkStyle *networkStyle);
215 
217  void requestInitialize();
219  void requestShutdown();
220 
222  int getReturnValue() { return returnValue; }
223 
225  WId getMainWinId() const;
226 
227 public Q_SLOTS:
228  void initializeResult(int retval);
229  void shutdownResult(int retval);
231  void handleRunawayException(const QString &message);
232 
233 Q_SIGNALS:
236  void stopThread();
237  void splashFinished(QWidget *window);
238 
239 private:
240  QThread *coreThread;
245 #ifdef ENABLE_WALLET
246  PaymentServer* paymentServer;
247  WalletModel *walletModel;
248 #endif
251  std::unique_ptr<QWidget> shutdownWindow;
252 
253  void startThread();
254 };
255 
256 #include "bitcoin.moc"
257 
259  QObject()
260 {
261 }
262 
263 void BitcoinCore::handleRunawayException(const std::exception *e)
264 {
265  PrintExceptionContinue(e, "Runaway exception");
266  Q_EMIT runawayException(QString::fromStdString(GetWarnings("gui")));
267 }
268 
270 {
271  try
272  {
273  qDebug() << __func__ << ": Running AppInit2 in thread";
274  if (!AppInitBasicSetup())
275  {
276  Q_EMIT initializeResult(false);
277  return;
278  }
280  {
281  Q_EMIT initializeResult(false);
282  return;
283  }
284  if (!AppInitSanityChecks())
285  {
286  Q_EMIT initializeResult(false);
287  return;
288  }
289  int rv = AppInitMain(threadGroup, scheduler);
290  Q_EMIT initializeResult(rv);
291  } catch (const std::exception& e) {
293  } catch (...) {
295  }
296 }
297 
299 {
300  try
301  {
302  qDebug() << __func__ << ": Running Shutdown in thread";
304  threadGroup.join_all();
305  Shutdown();
306  qDebug() << __func__ << ": Shutdown finished";
307  Q_EMIT shutdownResult(1);
308  } catch (const std::exception& e) {
310  } catch (...) {
312  }
313 }
314 
316  QApplication(argc, argv),
317  coreThread(0),
318  optionsModel(0),
319  clientModel(0),
320  window(0),
321  pollShutdownTimer(0),
322 #ifdef ENABLE_WALLET
323  paymentServer(0),
324  walletModel(0),
325 #endif
326  returnValue(0)
327 {
328  setQuitOnLastWindowClosed(false);
329 
330  // UI per-platform customization
331  // This must be done inside the BitcoinApplication constructor, or after it, because
332  // PlatformStyle::instantiate requires a QApplication
333  std::string platformName;
334  platformName = GetArg("-uiplatform", BitcoinGUI::DEFAULT_UIPLATFORM);
335  platformStyle = PlatformStyle::instantiate(QString::fromStdString(platformName));
336  if (!platformStyle) // Fall back to "other" if specified name not found
338  assert(platformStyle);
339 }
340 
342 {
343  if(coreThread)
344  {
345  qDebug() << __func__ << ": Stopping thread";
346  Q_EMIT stopThread();
347  coreThread->wait();
348  qDebug() << __func__ << ": Stopped thread";
349  }
350 
351  delete window;
352  window = 0;
353 #ifdef ENABLE_WALLET
354  delete paymentServer;
355  paymentServer = 0;
356 #endif
357  delete optionsModel;
358  optionsModel = 0;
359  delete platformStyle;
360  platformStyle = 0;
361 }
362 
363 #ifdef ENABLE_WALLET
364 void BitcoinApplication::createPaymentServer()
365 {
366  paymentServer = new PaymentServer(this);
367 }
368 #endif
369 
371 {
372  optionsModel = new OptionsModel(NULL, resetSettings);
373 }
374 
376 {
377  window = new BitcoinGUI(platformStyle, networkStyle, 0);
378 
379  pollShutdownTimer = new QTimer(window);
380  connect(pollShutdownTimer, SIGNAL(timeout()), window, SLOT(detectShutdown()));
381  pollShutdownTimer->start(200);
382 }
383 
385 {
386  SplashScreen *splash = new SplashScreen(0, networkStyle);
387  // We don't hold a direct pointer to the splash screen after creation, but the splash
388  // screen will take care of deleting itself when slotFinish happens.
389  splash->show();
390  connect(this, SIGNAL(splashFinished(QWidget*)), splash, SLOT(slotFinish(QWidget*)));
391  connect(this, SIGNAL(requestedShutdown()), splash, SLOT(close()));
392 }
393 
395 {
396  if(coreThread)
397  return;
398  coreThread = new QThread(this);
399  BitcoinCore *executor = new BitcoinCore();
400  executor->moveToThread(coreThread);
401 
402  /* communication to and from thread */
403  connect(executor, SIGNAL(initializeResult(int)), this, SLOT(initializeResult(int)));
404  connect(executor, SIGNAL(shutdownResult(int)), this, SLOT(shutdownResult(int)));
405  connect(executor, SIGNAL(runawayException(QString)), this, SLOT(handleRunawayException(QString)));
406  connect(this, SIGNAL(requestedInitialize()), executor, SLOT(initialize()));
407  connect(this, SIGNAL(requestedShutdown()), executor, SLOT(shutdown()));
408  /* make sure executor object is deleted in its own thread */
409  connect(this, SIGNAL(stopThread()), executor, SLOT(deleteLater()));
410  connect(this, SIGNAL(stopThread()), coreThread, SLOT(quit()));
411 
412  coreThread->start();
413 }
414 
416 {
417  InitLogging();
419 }
420 
422 {
423  qDebug() << __func__ << ": Requesting initialize";
424  startThread();
425  Q_EMIT requestedInitialize();
426 }
427 
429 {
430  // Show a simple window indicating shutdown status
431  // Do this first as some of the steps may take some time below,
432  // for example the RPC console may still be executing a command.
434 
435  qDebug() << __func__ << ": Requesting shutdown";
436  startThread();
437  window->hide();
439  pollShutdownTimer->stop();
440 
441 #ifdef ENABLE_WALLET
442  window->removeAllWallets();
443  delete walletModel;
444  walletModel = 0;
445 #endif
446  delete clientModel;
447  clientModel = 0;
448 
449  StartShutdown();
450 
451  // Request shutdown from core thread
452  Q_EMIT requestedShutdown();
453 }
454 
456 {
457  qDebug() << __func__ << ": Initialization result: " << retval;
458  // Set exit result: 0 if successful, 1 if failure
459  returnValue = retval ? 0 : 1;
460  if(retval)
461  {
462  // Log this only after AppInit2 finishes, as then logging setup is guaranteed complete
463  qWarning() << "Platform customization:" << platformStyle->getName();
464 #ifdef ENABLE_WALLET
466  paymentServer->setOptionsModel(optionsModel);
467 #endif
468 
471 
472 #ifdef ENABLE_WALLET
473  if(pwalletMain)
474  {
475  walletModel = new WalletModel(platformStyle, pwalletMain, optionsModel);
476 
477  window->addWallet(BitcoinGUI::DEFAULT_WALLET, walletModel);
478  window->setCurrentWallet(BitcoinGUI::DEFAULT_WALLET);
479 
480  connect(walletModel, SIGNAL(coinsSent(CWallet*,SendCoinsRecipient,QByteArray)),
481  paymentServer, SLOT(fetchPaymentACK(CWallet*,const SendCoinsRecipient&,QByteArray)));
482  }
483 #endif
484 
485  // If -min option passed, start window minimized.
486  if(GetBoolArg("-min", false))
487  {
488  window->showMinimized();
489  }
490  else
491  {
492  window->show();
493  }
494  Q_EMIT splashFinished(window);
495 
496 #ifdef ENABLE_WALLET
497  // Now that initialization/startup is done, process any command-line
498  // bitcoin: URIs or payment requests:
499  connect(paymentServer, SIGNAL(receivedPaymentRequest(SendCoinsRecipient)),
500  window, SLOT(handlePaymentRequest(SendCoinsRecipient)));
501  connect(window, SIGNAL(receivedURI(QString)),
502  paymentServer, SLOT(handleURIOrFile(QString)));
503  connect(paymentServer, SIGNAL(message(QString,QString,unsigned int)),
504  window, SLOT(message(QString,QString,unsigned int)));
505  QTimer::singleShot(100, paymentServer, SLOT(uiReady()));
506 #endif
507  } else {
508  quit(); // Exit main loop
509  }
510 }
511 
513 {
514  qDebug() << __func__ << ": Shutdown result: " << retval;
515  quit(); // Exit main loop after shutdown finished
516 }
517 
518 void BitcoinApplication::handleRunawayException(const QString &message)
519 {
520  QMessageBox::critical(0, "Runaway exception", BitcoinGUI::tr("A fatal error occurred. Dogecoin can no longer continue safely and will quit.") + QString("\n\n") + message);
521  ::exit(EXIT_FAILURE);
522 }
523 
525 {
526  if (!window)
527  return 0;
528 
529  return window->winId();
530 }
531 
532 #ifndef BITCOIN_QT_TEST
533 int main(int argc, char *argv[])
534 {
536 
538  // Command-line options take precedence:
539  ParseParameters(argc, argv);
540 
541  // Do not refer to data directory yet, this can be overridden by Intro::pickDataDirectory
542 
544 #if QT_VERSION < 0x050000
545  // Internal string conversion is all UTF-8
546  QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
547  QTextCodec::setCodecForCStrings(QTextCodec::codecForTr());
548 #endif
549 
550  Q_INIT_RESOURCE(bitcoin);
551  Q_INIT_RESOURCE(bitcoin_locale);
552 
553  BitcoinApplication app(argc, argv);
554 #if QT_VERSION > 0x050100
555  // Generate high-dpi pixmaps
556  QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
557 #endif
558 #if QT_VERSION >= 0x050600
559  QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
560 #endif
561 #ifdef Q_OS_MAC
562  QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
563 #endif
564 #if QT_VERSION >= 0x050500
565  // Because of the POODLE attack it is recommended to disable SSLv3 (https://disablessl3.com/),
566  // so set SSL protocols to TLS1.0+.
567  QSslConfiguration sslconf = QSslConfiguration::defaultConfiguration();
568  sslconf.setProtocol(QSsl::TlsV1_0OrLater);
569  QSslConfiguration::setDefaultConfiguration(sslconf);
570 #endif
571 
572  // Register meta types used for QMetaObject::invokeMethod
573  qRegisterMetaType< bool* >();
574  // Need to pass name here as CAmount is a typedef (see http://qt-project.org/doc/qt-5/qmetatype.html#qRegisterMetaType)
575  // IMPORTANT if it is no longer a typedef use the normal variant above
576  qRegisterMetaType< CAmount >("CAmount");
577 
579  // must be set before OptionsModel is initialized or translations are loaded,
580  // as it is used to locate QSettings
581  QApplication::setOrganizationName(QAPP_ORG_NAME);
582  QApplication::setOrganizationDomain(QAPP_ORG_DOMAIN);
583  QApplication::setApplicationName(QAPP_APP_NAME_DEFAULT);
584  GUIUtil::SubstituteFonts(GetLangTerritory());
585 
587  // Now that QSettings are accessible, initialize translations
588  QTranslator qtTranslatorBase, qtTranslator, translatorBase, translator;
589  initTranslations(qtTranslatorBase, qtTranslator, translatorBase, translator);
590  translationInterface.Translate.connect(Translate);
591 
592  // Show help message immediately after parsing command-line options (for "-lang") and setting locale,
593  // but before showing splash screen.
594  if (IsArgSet("-?") || IsArgSet("-h") || IsArgSet("-help") || IsArgSet("-version"))
595  {
596  HelpMessageDialog help(NULL, IsArgSet("-version"));
597  help.showOrPrint();
598  return EXIT_SUCCESS;
599  }
600 
602  // User language is set up: pick a data directory
604  return EXIT_SUCCESS;
605 
608  if (!boost::filesystem::is_directory(GetDataDir(false)))
609  {
610  QMessageBox::critical(0, QObject::tr(PACKAGE_NAME),
611  QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(GetArg("-datadir", ""))));
612  return EXIT_FAILURE;
613  }
614  try {
616  } catch (const std::exception& e) {
617  QMessageBox::critical(0, QObject::tr(PACKAGE_NAME),
618  QObject::tr("Error: Cannot parse configuration file: %1. Only use key=value syntax.").arg(e.what()));
619  return EXIT_FAILURE;
620  }
621 
623  // - Do not call Params() before this step
624  // - Do this after parsing the configuration file, as the network can be switched there
625  // - QSettings() will use the new application name after this, resulting in network-specific settings
626  // - Needs to be done before createOptionsModel
627 
628  // Check for -testnet or -regtest parameter (Params() calls are only valid after this clause)
629  try {
631  } catch(std::exception &e) {
632  QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), QObject::tr("Error: %1").arg(e.what()));
633  return EXIT_FAILURE;
634  }
635 #ifdef ENABLE_WALLET
636  // Parse URIs on command line -- this can affect Params()
638 #endif
639 
640  QScopedPointer<const NetworkStyle> networkStyle(NetworkStyle::instantiate(QString::fromStdString(Params().NetworkIDString())));
641  assert(!networkStyle.isNull());
642  // Allow for separate UI settings for testnets
643  QApplication::setApplicationName(networkStyle->getAppName());
644  // Re-initialize translations after changing application name (language in network-specific settings can be different)
645  initTranslations(qtTranslatorBase, qtTranslator, translatorBase, translator);
646 
647 #ifdef ENABLE_WALLET
649  // - Do this early as we don't want to bother initializing if we are just calling IPC
650  // - Do this *after* setting up the data directory, as the data directory hash is used in the name
651  // of the server.
652  // - Do this after creating app and setting up translations, so errors are
653  // translated properly.
655  exit(EXIT_SUCCESS);
656 
657  // Start up the payment server early, too, so impatient users that click on
658  // bitcoin: links repeatedly have their payment requests routed to this process:
659  app.createPaymentServer();
660 #endif
661 
663  // Install global event filter that makes sure that long tooltips can be word-wrapped
664  app.installEventFilter(new GUIUtil::ToolTipToRichTextFilter(TOOLTIP_WRAP_THRESHOLD, &app));
665 #if QT_VERSION < 0x050000
666  // Install qDebug() message handler to route to debug.log
667  qInstallMsgHandler(DebugMessageHandler);
668 #else
669 #if defined(Q_OS_WIN)
670  // Install global event filter for processing Windows session related Windows messages (WM_QUERYENDSESSION and WM_ENDSESSION)
671  qApp->installNativeEventFilter(new WinShutdownMonitor());
672 #endif
673  // Install qDebug() message handler to route to debug.log
674  qInstallMessageHandler(DebugMessageHandler);
675 #endif
676  // Allow parameter interaction before we create the options model
677  app.parameterSetup();
678  // Load GUI settings from QSettings
679  app.createOptionsModel(IsArgSet("-resetguisettings"));
680 
681  // Subscribe to global signals from core
682  uiInterface.InitMessage.connect(InitMessage);
683 
684  if (GetBoolArg("-splash", DEFAULT_SPLASHSCREEN) && !GetBoolArg("-min", false))
685  app.createSplashScreen(networkStyle.data());
686 
687  try
688  {
689  app.createWindow(networkStyle.data());
690  app.requestInitialize();
691 #if defined(Q_OS_WIN) && QT_VERSION >= 0x050000
692  WinShutdownMonitor::registerShutdownBlockReason(QObject::tr("%1 didn't yet exit safely...").arg(QObject::tr(PACKAGE_NAME)), (HWND)app.getMainWinId());
693 #endif
694  app.exec();
695  app.requestShutdown();
696  app.exec();
697  } catch (const std::exception& e) {
698  PrintExceptionContinue(&e, "Runaway exception");
699  app.handleRunawayException(QString::fromStdString(GetWarnings("gui")));
700  } catch (...) {
701  PrintExceptionContinue(NULL, "Runaway exception");
702  app.handleRunawayException(QString::fromStdString(GetWarnings("gui")));
703  }
704  return app.getReturnValue();
705 }
706 #endif // BITCOIN_QT_TEST
CWallet * pwalletMain
Definition: wallet.cpp:38
int64_t CAmount
Amount in satoshis (Can be negative)
Definition: amount.h:15
int main(int argc, char *argv[])
Definition: bitcoin.cpp:533
void DebugMessageHandler(QtMsgType type, const char *msg)
Definition: bitcoin.cpp:155
void SelectParams(const std::string &network)
Sets the params returned by Params() to those for the given BIP70 chain name.
const CChainParams & Params()
Return the currently selected parameters.
std::string ChainNameFromCommandLine()
Looks for -regtest, -testnet and returns the appropriate BIP70 chain name.
Main Bitcoin application object.
Definition: bitcoin.cpp:197
void requestedInitialize()
ClientModel * clientModel
Definition: bitcoin.cpp:242
void splashFinished(QWidget *window)
void createSplashScreen(const NetworkStyle *networkStyle)
Create splash screen.
Definition: bitcoin.cpp:384
void requestShutdown()
Request core shutdown.
Definition: bitcoin.cpp:428
QThread * coreThread
Definition: bitcoin.cpp:240
QTimer * pollShutdownTimer
Definition: bitcoin.cpp:244
BitcoinGUI * window
Definition: bitcoin.cpp:243
const PlatformStyle * platformStyle
Definition: bitcoin.cpp:250
void createWindow(const NetworkStyle *networkStyle)
Create main window.
Definition: bitcoin.cpp:375
void parameterSetup()
parameter interaction/setup based on rules
Definition: bitcoin.cpp:415
void handleRunawayException(const QString &message)
Handle runaway exceptions. Shows a message box with the problem and quits the program.
Definition: bitcoin.cpp:518
OptionsModel * optionsModel
Definition: bitcoin.cpp:241
int getReturnValue()
Get process return value.
Definition: bitcoin.cpp:222
void createOptionsModel(bool resetSettings)
Create options model.
Definition: bitcoin.cpp:370
void shutdownResult(int retval)
Definition: bitcoin.cpp:512
void initializeResult(int retval)
Definition: bitcoin.cpp:455
std::unique_ptr< QWidget > shutdownWindow
Definition: bitcoin.cpp:251
void requestInitialize()
Request core initialization.
Definition: bitcoin.cpp:421
WId getMainWinId() const
Get window identifier of QMainWindow (BitcoinGUI)
Definition: bitcoin.cpp:524
BitcoinApplication(int &argc, char **argv)
Definition: bitcoin.cpp:315
Class encapsulating Bitcoin Core startup and shutdown.
Definition: bitcoin.cpp:173
void shutdownResult(int retval)
void initializeResult(int retval)
void runawayException(const QString &message)
boost::thread_group threadGroup
Definition: bitcoin.cpp:188
void handleRunawayException(const std::exception *e)
Pass fatal exception message to UI thread.
Definition: bitcoin.cpp:263
CScheduler scheduler
Definition: bitcoin.cpp:189
void shutdown()
Definition: bitcoin.cpp:298
void initialize()
Definition: bitcoin.cpp:269
Bitcoin GUI main class.
Definition: bitcoingui.h:47
static const std::string DEFAULT_UIPLATFORM
Definition: bitcoingui.h:52
void setClientModel(ClientModel *clientModel)
Set the client model.
Definition: bitcoingui.cpp:489
static const QString DEFAULT_WALLET
Display name for default wallet name.
Definition: bitcoingui.h:51
boost::signals2::signal< void(const std::string &message)> InitMessage
Progress message during initialization.
Definition: ui_interface.h:83
boost::signals2::signal< std::string(const char *psz)> Translate
Translate a message to the native language of the user.
Definition: util.h:41
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,...
Definition: wallet.h:493
Model for Bitcoin network client.
Definition: clientmodel.h:42
Qt event filter that intercepts ToolTipChange events, and replaces the tooltip with a rich text repre...
Definition: guiutil.h:125
"Help message" dialog box
Definition: utilitydialog.h:46
static bool pickDataDirectory()
Determine data directory.
Definition: intro.cpp:173
static const NetworkStyle * instantiate(const QString &networkId)
Get style associated with provided BIP70 network id, or 0 if not known.
Interface from Qt to configuration data structure for Bitcoin client.
Definition: optionsmodel.h:23
static bool ipcSendCommandLine()
static void ipcParseCommandLine(int argc, char *argv[])
static void LoadRootCAs(X509_STORE *store=NULL)
const QString & getName() const
Definition: platformstyle.h:19
static const PlatformStyle * instantiate(const QString &platformId)
Get style associated with provided platform name, or 0 if not known.
static QWidget * showShutdownWindow(BitcoinGUI *window)
Class for the splashscreen with information of the running client.
Definition: splashscreen.h:20
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:99
#define QAPP_ORG_NAME
Definition: guiconstants.h:51
#define QAPP_APP_NAME_DEFAULT
Definition: guiconstants.h:53
#define QAPP_ORG_DOMAIN
Definition: guiconstants.h:52
bool AppInitMain(boost::thread_group &threadGroup, CScheduler &scheduler)
Bitcoin core main initialization.
Definition: init.cpp:1156
void InitParameterInteraction()
Parameter interaction: change current parameters depending on various rules.
Definition: init.cpp:719
bool AppInitParameterInteraction()
Initialization: parameter interaction.
Definition: init.cpp:879
bool AppInitBasicSetup()
Initialize bitcoin core: Basic context setup.
Definition: init.cpp:821
bool AppInitSanityChecks()
Initialization sanity checks: ecc init, sanity checks, dir lock.
Definition: init.cpp:1140
void InitLogging()
Initialize the logging infrastructure.
Definition: init.cpp:787
void Shutdown()
Definition: init.cpp:184
void StartShutdown()
Definition: init.cpp:134
void Interrupt(boost::thread_group &threadGroup)
Interrupt threads.
Definition: init.cpp:172
void SubstituteFonts(const QString &language)
Definition: guiutil.cpp:416
UniValue help(const JSONRPCRequest &jsonRequest)
Definition: server.cpp:247
CClientUIInterface uiInterface
Definition: ui_interface.cpp:8
CTranslationInterface translationInterface
Definition: util.cpp:121
std::string GetArg(const std::string &strArg, const std::string &strDefault)
Return string argument or default value.
Definition: util.cpp:395
void ParseParameters(int argc, const char *const argv[])
Definition: util.cpp:353
void ReadConfigFile(const std::string &confPath)
Definition: util.cpp:560
bool GetBoolArg(const std::string &strArg, bool fDefault)
Return boolean argument or default value.
Definition: util.cpp:411
void SetupEnvironment()
Definition: util.cpp:797
void PrintExceptionContinue(const std::exception *pex, const char *pszThread)
Definition: util.cpp:475
const boost::filesystem::path & GetDataDir(bool fNetSpecific)
Definition: util.cpp:513
const char *const BITCOIN_CONF_FILENAME
Definition: util.cpp:106
bool IsArgSet(const std::string &strArg)
Return true if the given argument has been manually set.
Definition: util.cpp:389
#define LogPrint(category,...)
Definition: util.h:76
#define LogPrintf(...)
Definition: util.h:82
std::string GetWarnings(const std::string &strFor)
Format a string that describes several potential problems detected by the core.
Definition: warnings.cpp:51