PRCYCoin  2.0.0.7rc1
P2P Digital Currency
prcycoin.cpp
Go to the documentation of this file.
1 // Copyright (c) 2009-2014 The Bitcoin developers
2 // Copyright (c) 2014-2015 The Dash developers
3 // Copyright (c) 2015-2018 The PIVX developers
4 // Copyright (c) 2018-2020 The DAPS Project developers
5 // Distributed under the MIT/X11 software license, see the accompanying
6 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
7 
8 #if defined(HAVE_CONFIG_H)
10 #endif
11 
12 #include "bitcoingui.h"
13 
14 #include "clientmodel.h"
15 #include "guiconstants.h"
16 #include "guiutil.h"
17 #include "intro.h"
18 #include "net.h"
19 #include "networkstyle.h"
20 #include "optionsmodel.h"
21 #include "splashscreen.h"
22 #include "utilitydialog.h"
23 
24 #include "importorcreate.h"
25 #include "winshutdownmonitor.h"
26 
27 #ifdef ENABLE_WALLET
28 #include "paymentserver.h"
29 #include "walletmodel.h"
30 #endif
31 #include "masternodeconfig.h"
32 
33 #include "init.h"
34 #include "fs.h"
35 #include "main.h"
36 #include "rpc/server.h"
37 #include "guiinterface.h"
38 #include "util.h"
39 
40 #ifdef ENABLE_WALLET
41 #include "wallet/wallet.h"
42 #endif
43 
44 #include "encryptdialog.h"
45 #include "entermnemonics.h"
46 
47 #include <signal.h>
48 #include <stdint.h>
49 #include <unistd.h>
50 
51 #ifndef Q_OS_WIN
52 #include <execinfo.h>
53 #endif
54 
55 #include <boost/thread.hpp>
56 
57 #include <QApplication>
58 #include <QDebug>
59 #include <QLibraryInfo>
60 #include <QLocale>
61 #include <QMessageBox>
62 #include <QProcess>
63 #include <QSettings>
64 #include <QThread>
65 #include <QTimer>
66 #include <QTranslator>
67 
68 #if defined(QT_STATICPLUGIN)
69 #include <QtPlugin>
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 //Q_IMPORT_PLUGIN(QGifPlugin);
78 #endif
79 
80 #define DEBUG_BACKTRACE 1
81 
82 static bool needShowRecoveryDialog = false;
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 static void ShowRecoveryDialog()
94 {
95  needShowRecoveryDialog = true;
96 }
97 
98 /*
99  Translate string to current locale using Qt.
100  */
101 static std::string Translate(const char* psz)
102 {
103  return QCoreApplication::translate("prcycoin-core", psz).toStdString();
104 }
105 
106 static QString GetLangTerritory()
107 {
108  QSettings settings;
109  // Get desired locale (e.g. "de_DE")
110  // 1) System default language
111  QString lang_territory = QLocale::system().name();
112  // 2) Language from QSettings
113  QString lang_territory_qsettings = settings.value("language", "").toString();
114  if (!lang_territory_qsettings.isEmpty())
115  lang_territory = lang_territory_qsettings;
116  // 3) -lang command line argument
117  lang_territory = QString::fromStdString(GetArg("-lang", lang_territory.toStdString()));
118  return lang_territory;
119 }
120 
122 static void initTranslations(QTranslator& qtTranslatorBase, QTranslator& qtTranslator, QTranslator& translatorBase, QTranslator& translator)
123 {
124  // Remove old translators
125  QApplication::removeTranslator(&qtTranslatorBase);
126  QApplication::removeTranslator(&qtTranslator);
127  QApplication::removeTranslator(&translatorBase);
128  QApplication::removeTranslator(&translator);
129 
130  // Get desired locale (e.g. "de_DE")
131  // 1) System default language
132  QString lang_territory = GetLangTerritory();
133 
134  // Convert to "de" only by truncating "_DE"
135  QString lang = lang_territory;
136  lang.truncate(lang_territory.lastIndexOf('_'));
137 
138  // Load language files for configured locale:
139  // - First load the translator for the base language, without territory
140  // - Then load the more specific locale translator
141 
142  // Load e.g. qt_de.qm
143  if (qtTranslatorBase.load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
144  QApplication::installTranslator(&qtTranslatorBase);
145 
146  // Load e.g. qt_de_DE.qm
147  if (qtTranslator.load("qt_" + lang_territory, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
148  QApplication::installTranslator(&qtTranslator);
149 
150  // Load e.g. bitcoin_de.qm (shortcut "de" needs to be defined in prcycoin.qrc)
151  if (translatorBase.load(lang, ":/translations/"))
152  QApplication::installTranslator(&translatorBase);
153 
154  // Load e.g. bitcoin_de_DE.qm (shortcut "de_DE" needs to be defined in prcycoin.qrc)
155  if (translator.load(lang_territory, ":/translations/"))
156  QApplication::installTranslator(&translator);
157 }
158 
159 /* qDebug() message handler --> debug.log */
160 void DebugMessageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg)
161 {
162  Q_UNUSED(context);
163  if (type == QtDebugMsg) {
164  LogPrint(BCLog::QT, "GUI: %s\n", msg.toStdString());
165  } else {
166  LogPrintf("GUI: %s\n", msg.toStdString());
167  }
168 }
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:
192 
194  void handleRunawayException(const std::exception* e);
195 };
196 
198 class BitcoinApplication : public QApplication
199 {
200  Q_OBJECT
201 public:
202  explicit BitcoinApplication(int& argc, char** argv);
204 
205 #ifdef ENABLE_WALLET
206  void createPaymentServer();
208 #endif
209  void parameterSetup();
212  void createOptionsModel();
214  void createWindow(const NetworkStyle* networkStyle);
216  void createSplashScreen(const NetworkStyle* networkStyle);
217 
219  void requestInitialize();
221  void requestShutdown();
222 
224  int getReturnValue() { return returnValue; }
225 
227  WId getMainWinId() const;
228 
229 public Q_SLOTS:
230  void initializeResult(int retval);
231  void shutdownResult(int retval);
233  void handleRunawayException(const QString& message);
234 
235 Q_SIGNALS:
236  void requestedInitialize();
237  void requestedRestart(QStringList args);
238  void requestedShutdown();
239  void stopThread();
240  void splashFinished(QWidget* window);
241 
242 private:
243  QThread* coreThread;
248 #ifdef ENABLE_WALLET
249  PaymentServer* paymentServer;
250  WalletModel* walletModel;
251 #endif
253 
254  void startThread();
255 };
256 
257 #include "prcycoin.moc"
258 
260 {
261 }
262 
263 void BitcoinCore::handleRunawayException(const std::exception* e)
264 {
265  PrintExceptionContinue(e, "Runaway exception");
266  Q_EMIT runawayException(QString::fromStdString(strMiscWarning));
267 }
268 
270 {
271  execute_restart = true;
272 
273  try {
274  qDebug() << __func__ << ": Running AppInit2 in thread";
275  int rv = AppInit2(false);
276  Q_EMIT initializeResult(rv);
277  } catch (const std::exception& e) {
279  } catch (...) {
281  }
282 }
283 
284 void BitcoinCore::restart(QStringList args)
285 {
286  if (execute_restart) { // Only restart 1x, no matter how often a user clicks on a restart-button
287  execute_restart = false;
288  try {
289  qDebug() << __func__ << ": Running Restart in thread";
290  Interrupt();
291  PrepareShutdown();
292  qDebug() << __func__ << ": Shutdown finished";
293  Q_EMIT shutdownResult(1);
295  QProcess::startDetached(QApplication::applicationFilePath(), args);
296  qDebug() << __func__ << ": Restart initiated...";
297  QApplication::quit();
298  } catch (const std::exception& e) {
300  } catch (...) {
302  }
303  }
304 }
305 
307 {
308  try {
309  qDebug() << __func__ << ": Running Shutdown in thread";
310  Interrupt();
311  Shutdown();
312  qDebug() << __func__ << ": Shutdown finished";
313  Q_EMIT shutdownResult(1);
314  } catch (const std::exception& e) {
316  } catch (...) {
318  }
319 }
320 
321 BitcoinApplication::BitcoinApplication(int& argc, char** argv) : QApplication(argc, argv),
322  coreThread(0),
323  optionsModel(0),
324  clientModel(0),
325  window(0),
326  pollShutdownTimer(0),
327 #ifdef ENABLE_WALLET
328  paymentServer(0),
329  walletModel(0),
330 #endif
331  returnValue(0)
332 {
333  setQuitOnLastWindowClosed(false);
334 }
335 
337 {
338  if (coreThread) {
339  qDebug() << __func__ << ": Stopping thread";
340  Q_EMIT stopThread();
341  coreThread->wait();
342  qDebug() << __func__ << ": Stopped thread";
343  }
344 
345  delete window;
346  window = 0;
347 #ifdef ENABLE_WALLET
348  delete paymentServer;
349  paymentServer = 0;
350 #endif
351  // Delete Qt-settings if user clicked on "Reset Options"
352  QSettings settings;
354  settings.clear();
355  settings.sync();
356  }
357  delete optionsModel;
358  optionsModel = 0;
359 }
360 
361 #ifdef ENABLE_WALLET
362 void BitcoinApplication::createPaymentServer()
363 {
364  paymentServer = new PaymentServer(this);
365 }
366 #endif
367 
369 {
370  optionsModel = new OptionsModel();
371 }
372 
374 {
375  window = new BitcoinGUI(networkStyle, 0);
376 
377  pollShutdownTimer = new QTimer(window);
378  connect(pollShutdownTimer, SIGNAL(timeout()), window, SLOT(detectShutdown()));
379 }
380 
382 {
383  SplashScreen* splash = new SplashScreen(0, networkStyle);
384  // We don't hold a direct pointer to the splash screen after creation, so use
385  // Qt::WA_DeleteOnClose to make sure that the window will be deleted eventually.
386  splash->setAttribute(Qt::WA_DeleteOnClose);
387  splash->show();
388  connect(this, SIGNAL(splashFinished(QWidget*)), splash, SLOT(slotFinish(QWidget*)));
389 }
390 
392 {
393  if (coreThread)
394  return;
395  coreThread = new QThread(this);
396  BitcoinCore* executor = new BitcoinCore();
397  executor->moveToThread(coreThread);
398 
399  /* communication to and from thread */
400  connect(executor, SIGNAL(initializeResult(int)), this, SLOT(initializeResult(int)));
401  connect(executor, SIGNAL(shutdownResult(int)), this, SLOT(shutdownResult(int)));
402  connect(executor, SIGNAL(runawayException(QString)), this, SLOT(handleRunawayException(QString)));
403  connect(this, SIGNAL(requestedInitialize()), executor, SLOT(initialize()));
404  connect(this, SIGNAL(requestedShutdown()), executor, SLOT(shutdown()));
405  connect(window, SIGNAL(requestedRestart(QStringList)), executor, SLOT(restart(QStringList)));
406  /* make sure executor object is deleted in its own thread */
407  connect(this, SIGNAL(stopThread()), executor, SLOT(deleteLater()));
408  connect(this, SIGNAL(stopThread()), coreThread, SLOT(quit()));
409 
410  coreThread->start();
411 }
412 
414 {
415  // Default printtoconsole to false for the GUI. GUI programs should not
416  // print to the console unnecessarily.
417  SoftSetBoolArg("-printtoconsole", false);
418 
419  InitLogging();
421 }
422 
424 {
425  qDebug() << __func__ << ": Requesting initialize";
426  startThread();
427  Q_EMIT requestedInitialize();
428 }
429 
431 {
432  qDebug() << __func__ << ": Requesting shutdown";
433  startThread();
434  window->hide();
436  pollShutdownTimer->stop();
437 
438 #ifdef ENABLE_WALLET
439  window->removeAllWallets();
440  delete walletModel;
441  walletModel = 0;
442 #endif
443  delete clientModel;
444  clientModel = 0;
445 
446  // Show a simple window indicating shutdown status
448 
449  // Request shutdown from core thread
450  Q_EMIT requestedShutdown();
451 }
452 
454 {
455  qDebug() << __func__ << ": Initialization result: " << retval;
456  // Set exit result: 0 if successful, 1 if failure
457  returnValue = retval ? 0 : 1;
458  if (retval) {
459 #ifdef ENABLE_WALLET
460  paymentServer->setOptionsModel(optionsModel);
461 #endif
464 
465  bool walletUnlocked = false;
466 #ifdef ENABLE_WALLET
467  if (pwalletMain) {
468  if (needShowRecoveryDialog) {
469  ImportOrCreate importOrCreate;
470  importOrCreate.setStyleSheet(GUIUtil::loadStyleSheet());
471  importOrCreate.setWindowFlags(Qt::WindowStaysOnTopHint);
472  importOrCreate.exec();
473 
474  if (importOrCreate.willRecover) {
475  EnterMnemonics enterMnemonics;
476  enterMnemonics.setStyleSheet(GUIUtil::loadStyleSheet());
477  enterMnemonics.setWindowFlags(Qt::WindowStaysOnTopHint);
478  enterMnemonics.exec();
479  }
480  }
481 
482  walletModel = new WalletModel(pwalletMain, optionsModel);
483  window->addWallet(BitcoinGUI::DEFAULT_WALLET, walletModel);
484  window->setCurrentWallet(BitcoinGUI::DEFAULT_WALLET);
485  }
486 #endif
487  // If -min option passed, start window minimized.
488  if (GetBoolArg("-min", false)) {
489  window->showMinimized();
490  } else {
491  window->show();
492  }
493  Q_EMIT splashFinished(window);
494 
495 #ifdef ENABLE_WALLET
496  // Now that initialization/startup is done, process any command-line
497  // PRCYcoin: URIs or payment requests:
498  connect(window, SIGNAL(receivedURI(QString)),
499  paymentServer, SLOT(handleURIOrFile(QString)));
500  connect(paymentServer, SIGNAL(message(QString, QString, unsigned int)),
501  window, SLOT(message(QString, QString, unsigned int)));
502  QTimer::singleShot(100, paymentServer, SLOT(uiReady()));
503  if (pwalletMain) {
504  if (walletModel->getEncryptionStatus() == WalletModel::Locked && !GetBoolArg("-min", false) && !GetBoolArg("-bypasslogin", false)) {
505  WalletModel::UnlockContext ctx(walletModel->requestUnlock(AskPassphraseDialog::Context::Unlock_Full, true));
506  if (ctx.isValid()) {
507  walletUnlocked = true;
508  if (fLiteMode) {
510  }
511  }
512  }
513  if (!walletUnlocked && walletModel->getEncryptionStatus() == WalletModel::Unencrypted) {
514  EncryptDialog dlg;
515  dlg.setModel(walletModel);
516  dlg.setWindowTitle("Encrypt Wallet");
517  dlg.setStyleSheet(GUIUtil::loadStyleSheet());
518  dlg.exec();
519 
520  walletModel->updateStatus();
521  }
522  }
523 #endif
524  pollShutdownTimer->start(200);
525  } else {
526  quit(); // Exit main loop
527  }
528 }
529 
531 {
532  qDebug() << __func__ << ": Shutdown result: " << retval;
533  quit(); // Exit main loop after shutdown finished
534 }
535 
536 void BitcoinApplication::handleRunawayException(const QString& message)
537 {
538  QMessageBox::critical(0, "Runaway exception", BitcoinGUI::tr("A fatal error occurred. PRCY can no longer continue safely and will quit.") + QString("\n\n") + message);
539  ::exit(1);
540 }
541 
543 {
544  if (!window)
545  return 0;
546 
547  return window->winId();
548 }
549 #ifndef Q_OS_WIN
550 #ifdef DEBUG_BACKTRACE
551 void handler(int sig)
552 {
553  void* array[50];
554  size_t size;
555 
556  // get void*'s for all entries on the stack
557  size = backtrace(array, 50);
558 
559  // print out all the frames to stderr
560  fprintf(stderr, "Error: signal %d:\n", sig);
561  backtrace_symbols_fd(array, size, STDERR_FILENO);
562  exit(1);
563 }
564 #endif
565 #endif
566 
567 #ifndef BITCOIN_QT_TEST
568 int main(int argc, char* argv[])
569 {
570 #ifndef Q_OS_WIN
571 #ifdef DEBUG_BACKTRACE
572  signal(SIGSEGV, handler); // install our handler
573 #endif
574 #endif
576 
578  // Command-line options take precedence:
579  ParseParameters(argc, argv);
580 
581 // Do not refer to data directory yet, this can be overridden by Intro::pickDataDirectory
582 
584  Q_INIT_RESOURCE(prcycoin_locale);
585  Q_INIT_RESOURCE(prcycoin);
586 
587  BitcoinApplication app(argc, argv);
588  // Generate high-dpi pixmaps
589  QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
590 #if QT_VERSION >= 0x050600
591  QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
592 #endif
593 #ifdef Q_OS_MAC
594  QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
595 #endif
596 
597  // Register meta types used for QMetaObject::invokeMethod
598  qRegisterMetaType<bool*>();
599  // Need to pass name here as CAmount is a typedef (see http://qt-project.org/doc/qt-5/qmetatype.html#qRegisterMetaType)
600  // IMPORTANT if it is no longer a typedef use the normal variant above
601  qRegisterMetaType<CAmount>("CAmount");
602 
604  // must be set before OptionsModel is initialized or translations are loaded,
605  // as it is used to locate QSettings
606  QApplication::setOrganizationName(QAPP_ORG_NAME);
607  QApplication::setOrganizationDomain(QAPP_ORG_DOMAIN);
608  QApplication::setApplicationName(QAPP_APP_NAME_DEFAULT);
609 
611  // Now that QSettings are accessible, initialize translations
612  QTranslator qtTranslatorBase, qtTranslator, translatorBase, translator;
613  initTranslations(qtTranslatorBase, qtTranslator, translatorBase, translator);
614  uiInterface.Translate.connect(Translate);
615 
616  // Show help message immediately after parsing command-line options (for "-lang") and setting locale,
617  // but before showing splash screen.
618  if (mapArgs.count("-?") || mapArgs.count("-help") || mapArgs.count("-version")) {
619  HelpMessageDialog help(NULL, mapArgs.count("-version"));
620  help.showOrPrint();
621  return 1;
622  }
623 
625  // User language is set up: pick a data directory
627  return 0;
628 
631  if (!fs::is_directory(GetDataDir(false))) {
632  QMessageBox::critical(0, QObject::tr("PRCY"),
633  QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(mapArgs["-datadir"])));
634  return 1;
635  }
636  try {
638  } catch (const std::exception& e) {
639  QMessageBox::critical(0, QObject::tr("PRCY"),
640  QObject::tr("Error: Cannot parse configuration file: %1. Only use key=value syntax.").arg(e.what()));
641  return 0;
642  }
643 
645  // - Do not call Params() before this step
646  // - Do this after parsing the configuration file, as the network can be switched there
647  // - QSettings() will use the new application name after this, resulting in network-specific settings
648  // - Needs to be done before createOptionsModel
649 
650  // Check for -testnet or -regtest parameter (Params() calls are only valid after this clause)
652  QMessageBox::critical(0, QObject::tr("PRCY"), QObject::tr("Error: Invalid combination of -regtest and -testnet."));
653  return 1;
654  }
655 #ifdef ENABLE_WALLET
656  // Parse URIs on command line -- this can affect Params()
658 #endif
659 
660  QScopedPointer<const NetworkStyle> networkStyle(NetworkStyle::instantiate(QString::fromStdString(Params().NetworkIDString())));
661  assert(!networkStyle.isNull());
662  // Allow for separate UI settings for testnets
663  QApplication::setApplicationName(networkStyle->getAppName());
664  // Re-initialize translations after changing application name (language in network-specific settings can be different)
665  initTranslations(qtTranslatorBase, qtTranslator, translatorBase, translator);
666 
667 #ifdef ENABLE_WALLET
668  std::string strErr;
670  if (!masternodeConfig.read(strErr)) {
671  QMessageBox::critical(0, QObject::tr("PRCY"),
672  QObject::tr("Error reading masternode configuration file: %1").arg(strErr.c_str()));
673  return 0;
674  }
675 
677  // - Do this early as we don't want to bother initializing if we are just calling IPC
678  // - Do this *after* setting up the data directory, as the data directory hash is used in the name
679  // of the server.
680  // - Do this after creating app and setting up translations, so errors are
681  // translated properly.
683  exit(0);
684 
685  // Start up the payment server early, too, so impatient users that click on
686  // prcycoin: links repeatedly have their payment requests routed to this process:
687  app.createPaymentServer();
688 #endif
689 
691  // Install global event filter that makes sure that long tooltips can be word-wrapped
692  app.installEventFilter(new GUIUtil::ToolTipToRichTextFilter(TOOLTIP_WRAP_THRESHOLD, &app));
693 #if defined(Q_OS_WIN)
694  // Install global event filter for processing Windows session related Windows messages (WM_QUERYENDSESSION and WM_ENDSESSION)
695  qApp->installNativeEventFilter(new WinShutdownMonitor());
696 #endif
697  // Install qDebug() message handler to route to debug.log
698  qInstallMessageHandler(DebugMessageHandler);
699  // Allow parameter interaction before we create the options model
700  app.parameterSetup();
701  // Load GUI settings from QSettings
702  app.createOptionsModel();
703 
704  // Subscribe to global signals from core
705  uiInterface.InitMessage.connect(InitMessage);
706  uiInterface.ShowRecoveryDialog.connect(ShowRecoveryDialog);
707 
708  if (GetBoolArg("-splash", true) && !GetBoolArg("-min", false))
709  app.createSplashScreen(networkStyle.data());
710 
711  try {
712  app.createWindow(networkStyle.data());
713  app.requestInitialize();
714 #if defined(Q_OS_WIN)
715  WinShutdownMonitor::registerShutdownBlockReason(QObject::tr("PRCY didn't yet exit safely..."), (HWND)app.getMainWinId());
716 #endif
717  app.exec();
718  app.requestShutdown();
719  app.exec();
720  } catch (const std::exception& e) {
721  PrintExceptionContinue(&e, "Runaway exception");
722  app.handleRunawayException(QString::fromStdString(strMiscWarning));
723  } catch (...) {
724  PrintExceptionContinue(NULL, "Runaway exception");
725  app.handleRunawayException(QString::fromStdString(strMiscWarning));
726  }
727  return app.getReturnValue();
728 }
729 #endif // BITCOIN_QT_TEST
winshutdownmonitor.h
BitcoinCore::handleRunawayException
void handleRunawayException(const std::exception *e)
Pass fatal exception message to UI thread.
Definition: prcycoin.cpp:263
BitcoinCore::shutdownResult
void shutdownResult(int retval)
InitLogging
void InitLogging()
Initialize the logging infrastructure.
Definition: init.cpp:880
DebugMessageHandler
void DebugMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
Definition: prcycoin.cpp:160
GUIUtil::ToolTipToRichTextFilter
Definition: guiutil.h:155
EncryptDialog::setModel
void setModel(WalletModel *model)
Definition: encryptdialog.cpp:29
BitcoinApplication::createSplashScreen
void createSplashScreen(const NetworkStyle *networkStyle)
Create splash screen.
Definition: prcycoin.cpp:381
BitcoinCore::runawayException
void runawayException(const QString &message)
SetupEnvironment
void SetupEnvironment()
Definition: util.cpp:600
BitcoinApplication::requestedRestart
void requestedRestart(QStringList args)
QAPP_ORG_NAME
#define QAPP_ORG_NAME
Definition: guiconstants.h:57
WalletModel::UnlockContext::isValid
bool isValid() const
Definition: walletmodel.h:195
BitcoinApplication::~BitcoinApplication
~BitcoinApplication()
Definition: prcycoin.cpp:336
BitcoinGUI::DEFAULT_WALLET
static const QString DEFAULT_WALLET
Definition: bitcoingui.h:53
SoftSetBoolArg
bool SoftSetBoolArg(const std::string &strArg, bool fValue)
Set a boolean argument if it doesn't already have a value.
Definition: util.cpp:270
WalletModel
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:102
HelpMessageDialog
"Help message" dialog box
Definition: utilitydialog.h:20
fs.h
BitcoinApplication::handleRunawayException
void handleRunawayException(const QString &message)
Handle runaway exceptions. Shows a message box with the problem and quits the program.
Definition: prcycoin.cpp:536
BitcoinApplication::pollShutdownTimer
QTimer * pollShutdownTimer
Definition: prcycoin.cpp:247
ReadConfigFile
void ReadConfigFile(std::map< std::string, std::string > &mapSettingsRet, std::map< std::string, std::vector< std::string > > &mapMultiSettingsRet)
Definition: util.cpp:395
importorcreate.h
AppInit2
bool AppInit2(bool isDaemon)
Initialize prcy.
Definition: init.cpp:909
intro.h
uiInterface
CClientUIInterface uiInterface
Definition: init.cpp:101
walletmodel.h
Interrupt
void Interrupt()
Interrupt threads.
Definition: init.cpp:166
utilitydialog.h
mapArgs
std::map< std::string, std::string > mapArgs
Definition: util.cpp:111
SelectParamsFromCommandLine
bool SelectParamsFromCommandLine()
Looks for -regtest or -testnet and then calls SelectParams as appropriate.
Definition: chainparams.cpp:490
wallet.h
BitcoinApplication::stopThread
void stopThread()
strMiscWarning
std::string strMiscWarning
Definition: util.cpp:115
BitcoinApplication::optionsModel
OptionsModel * optionsModel
Definition: prcycoin.cpp:244
NetworkStyle
Definition: networkstyle.h:13
BitcoinApplication::splashFinished
void splashFinished(QWidget *window)
BitcoinApplication::requestedInitialize
void requestedInitialize()
BitcoinApplication::getReturnValue
int getReturnValue()
Get process return value.
Definition: prcycoin.cpp:224
PaymentServer::ipcParseCommandLine
static void ipcParseCommandLine(int argc, char *argv[])
Definition: paymentserver.cpp:76
guiinterface.h
BitcoinCore::restart
void restart(QStringList args)
Definition: prcycoin.cpp:284
PrintExceptionContinue
void PrintExceptionContinue(const std::exception *pex, const char *pszThread)
Definition: util.cpp:309
entermnemonics.h
encryptdialog.h
ENABLE_WALLET
#define ENABLE_WALLET
Definition: prcycoin-config.h:39
BitcoinApplication::requestedShutdown
void requestedShutdown()
PaymentServer::ipcSendCommandLine
static bool ipcSendCommandLine()
Definition: paymentserver.cpp:111
CClientUIInterface::InitMessage
boost::signals2::signal< void(const std::string &message)> InitMessage
Progress message during initialization.
Definition: guiinterface.h:83
PrepareShutdown
void PrepareShutdown()
Preparing steps before shutting down or restarting the wallet.
Definition: init.cpp:176
OptionsModel
Interface from Qt to configuration data structure for Bitcoin client.
Definition: optionsmodel.h:18
EncryptDialog
Definition: encryptdialog.h:11
PaymentServer
Definition: paymentserver.h:51
BitcoinApplication::createWindow
void createWindow(const NetworkStyle *networkStyle)
Create main window.
Definition: prcycoin.cpp:373
ImportOrCreate
Definition: importorcreate.h:13
BitcoinGUI::setClientModel
void setClientModel(ClientModel *clientModel)
Set the client model.
Definition: bitcoingui.cpp:693
prcycoin-config.h
QAPP_APP_NAME_DEFAULT
#define QAPP_APP_NAME_DEFAULT
Definition: guiconstants.h:59
BitcoinCore::shutdown
void shutdown()
Definition: prcycoin.cpp:306
init.h
fLiteMode
bool fLiteMode
Definition: util.cpp:100
BitcoinApplication::requestInitialize
void requestInitialize()
Request core initialization.
Definition: prcycoin.cpp:423
AskPassphraseDialog::Context::Unlock_Full
@ Unlock_Full
Unlock wallet from menu
GetBoolArg
bool GetBoolArg(const std::string &strArg, bool fDefault)
Return boolean argument or default value.
Definition: util.cpp:255
CMasternodeConfig::read
bool read(std::string &strErr)
Definition: masternodeconfig.cpp:21
WalletModel::Unencrypted
@ Unencrypted
Definition: walletmodel.h:125
LogPrintf
#define LogPrintf(...)
Definition: logging.h:147
CAmount
int64_t CAmount
Amount in PRCY (Can be negative)
Definition: amount.h:17
BitcoinApplication::returnValue
int returnValue
Definition: prcycoin.cpp:252
BitcoinApplication::shutdownResult
void shutdownResult(int retval)
Definition: prcycoin.cpp:530
guiutil.h
BCLog::QT
@ QT
Definition: logging.h:59
BitcoinCore::initialize
void initialize()
Definition: prcycoin.cpp:269
InitParameterInteraction
void InitParameterInteraction()
Parameter interaction: change current parameters depending on various rules.
Definition: init.cpp:811
OptionsModel::resetSettings
bool resetSettings
Definition: optionsmodel.h:68
WalletModel::Locked
@ Locked
Definition: walletmodel.h:126
LogPrint
#define LogPrint(category,...)
Definition: logging.h:162
BitcoinCore::BitcoinCore
BitcoinCore()
Definition: prcycoin.cpp:259
BitcoinApplication::coreThread
QThread * coreThread
Definition: prcycoin.cpp:243
BitcoinApplication::window
BitcoinGUI * window
Definition: prcycoin.cpp:246
masternodeConfig
CMasternodeConfig masternodeConfig
Definition: masternodeconfig.cpp:13
handler
void handler(int sig)
Definition: prcycoin.cpp:551
BitcoinCore
Class encapsulating PRCY startup and shutdown.
Definition: prcycoin.cpp:173
ClientModel
Model for PRCY network client.
Definition: clientmodel.h:44
SplashScreen
Class for the splashscreen with information of the running client.
Definition: splashscreen.h:18
guiconstants.h
BitcoinCore::initializeResult
void initializeResult(int retval)
NetworkStyle::instantiate
static const NetworkStyle * instantiate(const QString &networkId)
Get style associated with provided network id, or 0 if not known.
Definition: networkstyle.cpp:31
Shutdown
void Shutdown()
Shutdown is split into 2 parts: Part 1: shut down everything but the main wallet instance (done in Pr...
Definition: init.cpp:274
WalletModel::UnlockContext
Definition: walletmodel.h:189
BitcoinApplication::startThread
void startThread()
Definition: prcycoin.cpp:391
help
UniValue help(const UniValue &params, bool fHelp)
Definition: server.cpp:231
Intro::pickDataDirectory
static bool pickDataDirectory()
Determine data directory.
Definition: intro.cpp:151
splashscreen.h
networkstyle.h
main.h
BitcoinApplication::requestShutdown
void requestShutdown()
Request core shutdown.
Definition: prcycoin.cpp:430
ImportOrCreate::willRecover
bool willRecover
Definition: importorcreate.h:20
BitcoinApplication::createOptionsModel
void createOptionsModel()
Create options model.
Definition: prcycoin.cpp:368
ParseParameters
void ParseParameters(int argc, const char *const argv[])
Definition: util.cpp:208
GetDataDir
const fs::path & GetDataDir(bool fNetSpecific)
Definition: util.cpp:349
Params
const CChainParams & Params()
Return the currently selected parameters.
Definition: chainparams.cpp:463
BitcoinApplication::initializeResult
void initializeResult(int retval)
Definition: prcycoin.cpp:453
CClientUIInterface::ShowRecoveryDialog
boost::signals2::signal< void()> ShowRecoveryDialog
Show recovery dialog.
Definition: guiinterface.h:86
bitcoingui.h
BitcoinApplication::getMainWinId
WId getMainWinId() const
Get window identifier of QMainWindow (BitcoinGUI)
Definition: prcycoin.cpp:542
CClientUIInterface::Translate
boost::signals2::signal< std::string(const char *psz)> Translate
Translate a message to the native language of the user.
Definition: guiinterface.h:89
BitcoinApplication::BitcoinApplication
BitcoinApplication(int &argc, char **argv)
Definition: prcycoin.cpp:321
ShutdownWindow::showShutdownWindow
static void showShutdownWindow(BitcoinGUI *window)
Definition: utilitydialog.cpp:162
optionsmodel.h
CWallet::WriteStakingStatus
bool WriteStakingStatus(bool status)
Definition: wallet.cpp:366
GUIUtil::loadStyleSheet
QString loadStyleSheet()
Load global CSS theme.
Definition: guiutil.cpp:721
server.h
mapMultiArgs
std::map< std::string, std::vector< std::string > > mapMultiArgs
Definition: util.cpp:112
net.h
GetArg
std::string GetArg(const std::string &strArg, const std::string &strDefault)
Return string argument or default value.
Definition: util.cpp:241
pwalletMain
CWallet * pwalletMain
Definition: wallet.cpp:49
BitcoinGUI
Bitcoin GUI main class.
Definition: bitcoingui.h:48
BitcoinApplication::parameterSetup
void parameterSetup()
parameter interaction/setup based on rules
Definition: prcycoin.cpp:413
BitcoinApplication
Main PRCY application object.
Definition: prcycoin.cpp:198
CExplicitNetCleanup::callCleanup
static void callCleanup()
Definition: net.cpp:2021
masternodeconfig.h
EnterMnemonics
Definition: entermnemonics.h:13
clientmodel.h
BitcoinCore::execute_restart
bool execute_restart
Flag indicating a restart.
Definition: prcycoin.cpp:191
QAPP_ORG_DOMAIN
#define QAPP_ORG_DOMAIN
Definition: guiconstants.h:58
BitcoinApplication::clientModel
ClientModel * clientModel
Definition: prcycoin.cpp:245
main
int main(int argc, char *argv[])
Definition: prcycoin.cpp:568
paymentserver.h