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