PIVX Core  5.6.99
P2P Digital Currency
pivxgui.cpp
Go to the documentation of this file.
1 // Copyright (c) 2019-2022 The PIVX 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 #include "pivxgui.h"
6 
7 #ifdef Q_OS_MAC
8 #include "macdockiconhandler.h"
9 #endif
10 
11 #include "clientmodel.h"
12 #include "defaultdialog.h"
13 #include "guiinterface.h"
14 #include "interfaces/handler.h"
15 #include "networkstyle.h"
16 #include "notificator.h"
17 #include "optionsmodel.h"
18 #include "qt/guiutil.h"
19 #include "qtutils.h"
20 #include "shutdown.h"
21 #include "util/system.h"
22 
23 #include <QApplication>
24 #include <QColor>
25 #include <QHBoxLayout>
26 #include <QKeySequence>
27 #include <QScreen>
28 #include <QShortcut>
29 #include <QWindowStateChangeEvent>
30 
31 
32 #define BASE_WINDOW_WIDTH 1200
33 #define BASE_WINDOW_HEIGHT 740
34 #define BASE_WINDOW_MIN_HEIGHT 620
35 #define BASE_WINDOW_MIN_WIDTH 1100
36 
37 
38 const QString PIVXGUI::DEFAULT_WALLET = "~Default";
39 
40 PIVXGUI::PIVXGUI(const NetworkStyle* networkStyle, QWidget* parent) :
41  QMainWindow(parent),
42  clientModel(0){
43 
44  /* Open CSS when configured */
45  this->setStyleSheet(GUIUtil::loadStyleSheet());
46  this->setMinimumSize(BASE_WINDOW_MIN_WIDTH, BASE_WINDOW_MIN_HEIGHT);
47 
48 
49  // Adapt screen size
50  QRect rec = QGuiApplication::primaryScreen()->geometry();
51  int adaptedHeight = (rec.height() < BASE_WINDOW_HEIGHT) ? BASE_WINDOW_MIN_HEIGHT : BASE_WINDOW_HEIGHT;
52  int adaptedWidth = (rec.width() < BASE_WINDOW_WIDTH) ? BASE_WINDOW_MIN_WIDTH : BASE_WINDOW_WIDTH;
54  "nWindow",
55  QSize(adaptedWidth, adaptedHeight),
56  this
57  );
58 
59 #ifdef ENABLE_WALLET
60  /* if compiled with wallet support, -disablewallet can still disable the wallet */
61  enableWallet = !gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET);
62 #else
63  enableWallet = false;
64 #endif // ENABLE_WALLET
65 
66  QString windowTitle = QString::fromStdString(gArgs.GetArg("-windowtitle", ""));
67  if (windowTitle.isEmpty()) {
68  windowTitle = QString{PACKAGE_NAME} + " - ";
69  windowTitle += ((enableWallet) ? tr("Wallet") : tr("Node"));
70  }
71  windowTitle += " " + networkStyle->getTitleAddText();
72  setWindowTitle(windowTitle);
73 
74  QApplication::setWindowIcon(networkStyle->getAppIcon());
75  setWindowIcon(networkStyle->getAppIcon());
76 
77 #ifdef ENABLE_WALLET
78  // Create wallet frame
79  if (enableWallet) {
80  QFrame* centralWidget = new QFrame(this);
81  this->setMinimumWidth(BASE_WINDOW_MIN_WIDTH);
82  this->setMinimumHeight(BASE_WINDOW_MIN_HEIGHT);
83  QHBoxLayout* centralWidgetLayouot = new QHBoxLayout();
84  centralWidget->setLayout(centralWidgetLayouot);
85  centralWidgetLayouot->setContentsMargins(0,0,0,0);
86  centralWidgetLayouot->setSpacing(0);
87 
88  centralWidget->setProperty("cssClass", "container");
89  centralWidget->setStyleSheet("padding:0px; border:none; margin:0px;");
90 
91  // First the nav
92  navMenu = new NavMenuWidget(this);
93  centralWidgetLayouot->addWidget(navMenu);
94 
95  this->setCentralWidget(centralWidget);
96  this->setContentsMargins(0,0,0,0);
97 
98  QFrame *container = new QFrame(centralWidget);
99  container->setContentsMargins(0,0,0,0);
100  centralWidgetLayouot->addWidget(container);
101 
102  // Then topbar + the stackedWidget
103  QVBoxLayout *baseScreensContainer = new QVBoxLayout(this);
104  baseScreensContainer->setMargin(0);
105  baseScreensContainer->setSpacing(0);
106  baseScreensContainer->setContentsMargins(0,0,0,0);
107  container->setLayout(baseScreensContainer);
108 
109  // Insert the topbar
110  topBar = new TopBar(this);
111  topBar->setContentsMargins(0,0,0,0);
112  baseScreensContainer->addWidget(topBar);
113 
114  // Now stacked widget
115  stackedContainer = new QStackedWidget(this);
116  QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
117  stackedContainer->setSizePolicy(sizePolicy);
118  stackedContainer->setContentsMargins(0,0,0,0);
119  baseScreensContainer->addWidget(stackedContainer);
120 
121  // Init
122  dashboard = new DashboardWidget(this);
123  sendWidget = new SendWidget(this);
124  receiveWidget = new ReceiveWidget(this);
125  addressesWidget = new AddressesWidget(this);
129  settingsWidget = new SettingsWidget(this);
130 
131  // Add to parent
132  stackedContainer->addWidget(dashboard);
133  stackedContainer->addWidget(sendWidget);
134  stackedContainer->addWidget(receiveWidget);
135  stackedContainer->addWidget(addressesWidget);
139  stackedContainer->addWidget(settingsWidget);
140  stackedContainer->setCurrentWidget(dashboard);
141 
142  } else
143 #endif
144  {
145  // When compiled without wallet or -disablewallet is provided,
146  // the central widget is the rpc console.
147  rpcConsole = new RPCConsole(enableWallet ? this : 0);
148  setCentralWidget(rpcConsole);
149  }
150 
151  // Create actions for the toolbar, menu bar and tray/dock icon
152  createActions(networkStyle);
153 
154  // Create system tray icon and notification
155  createTrayIcon(networkStyle);
156 
157  // Connect events
158  connectActions();
159 
160  // TODO: Add event filter??
161  // // Install event filter to be able to catch status tip events (QEvent::StatusTip)
162  // this->installEventFilter(this);
163 
164  // Subscribe to notifications from core
166 
167 }
168 
169 void PIVXGUI::createActions(const NetworkStyle* networkStyle)
170 {
171  toggleHideAction = new QAction(networkStyle->getAppIcon(), tr("&Show / Hide"), this);
172  toggleHideAction->setStatusTip(tr("Show or hide the main Window"));
173 
174  quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
175  quitAction->setStatusTip(tr("Quit application"));
176  quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
177  quitAction->setMenuRole(QAction::QuitRole);
178 
179  connect(toggleHideAction, &QAction::triggered, this, &PIVXGUI::toggleHidden);
180  connect(quitAction, &QAction::triggered, qApp, &QApplication::quit);
181 }
182 
187 {
188  QShortcut *consoleShort = new QShortcut(this);
189  consoleShort->setKey(QKeySequence(SHORT_KEY + Qt::Key_C));
190  connect(consoleShort, &QShortcut::activated, [this](){
193  goToSettings();
194  });
195  connect(topBar, &TopBar::showHide, this, &PIVXGUI::showHide);
209 }
210 
211 
212 void PIVXGUI::createTrayIcon(const NetworkStyle* networkStyle)
213 {
214 #ifndef Q_OS_MAC
215  trayIcon = new QSystemTrayIcon(this);
216  QString toolTip = tr("%1 client").arg(PACKAGE_NAME) + " " + networkStyle->getTitleAddText();
217  trayIcon->setToolTip(toolTip);
218  trayIcon->setIcon(networkStyle->getAppIcon());
219  trayIcon->hide();
220 #endif
221  notificator = new Notificator(QApplication::applicationName(), trayIcon, this);
222 }
223 
225 {
226  // Unsubscribe from notifications from core
228 
229  GUIUtil::saveWindowGeometry("nWindow", this);
230  if (trayIcon) // Hide tray icon, as deleting will let it linger until quit (on Ubuntu)
231  trayIcon->hide();
232 #ifdef Q_OS_MAC
234 #endif
235 }
236 
237 
239 void PIVXGUI::handleRestart(QStringList args)
240 {
241  if (!ShutdownRequested())
242  Q_EMIT requestedRestart(args);
243 }
244 
245 
247 {
248  this->clientModel = _clientModel;
249  if (this->clientModel) {
250  // Create system tray menu (or setup the dock menu) that late to prevent users from calling actions,
251  // while the client has not yet fully loaded
253 
260 
261  // Receive and report messages from client model
263  connect(clientModel, &ClientModel::alertsChanged, [this](const QString& _alertStr) {
264  message(tr("Alert!"), _alertStr, CClientUIInterface::MSG_WARNING);
265  });
269 
270  // Get restart command-line parameters and handle restart
271  connect(settingsWidget, &SettingsWidget::handleRestart, [this](QStringList arg){handleRestart(arg);});
272 
273  if (rpcConsole) {
275  }
276 
277  if (trayIcon) {
278  trayIcon->show();
279  }
280  } else {
281  // Disable possibility to show main window via action
282  toggleHideAction->setEnabled(false);
283  if (trayIconMenu) {
284  // Disable context menu on tray icon
285  trayIconMenu->clear();
286  }
287  }
288 }
289 
291 {
292 #ifndef Q_OS_MAC
293  // return if trayIcon is unset (only on non-macOSes)
294  if (!trayIcon)
295  return;
296 
297  trayIconMenu = new QMenu(this);
298  trayIcon->setContextMenu(trayIconMenu);
299 
300  connect(trayIcon, &QSystemTrayIcon::activated, this, &PIVXGUI::trayIconActivated);
301 #else
302  // Note: On macOS, the Dock icon is used to provide the tray's functionality.
304  connect(dockIconHandler, &MacDockIconHandler::dockIconClicked, this, &PIVXGUI::macosDockIconActivated);
305 
306  trayIconMenu = new QMenu(this);
307  trayIconMenu->setAsDockMenu();
308 #endif
309 
310  // Configuration of the tray icon (or Dock icon) icon menu
311  trayIconMenu->addAction(toggleHideAction);
312  trayIconMenu->addSeparator();
313 
314 #ifndef Q_OS_MAC // This is built-in on macOS
315  trayIconMenu->addSeparator();
316  trayIconMenu->addAction(quitAction);
317 #endif
318 }
319 
320 #ifndef Q_OS_MAC
321 void PIVXGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
322 {
323  if (reason == QSystemTrayIcon::Trigger) {
324  // Click on system tray icon triggers show/hide of the main window
325  toggleHidden();
326  }
327 }
328 #else
329 void PIVXGUI::macosDockIconActivated()
330  {
331  show();
332  activateWindow();
333  }
334 #endif
335 
336 void PIVXGUI::changeEvent(QEvent* e)
337 {
338  QMainWindow::changeEvent(e);
339 #ifndef Q_OS_MAC // Ignored on Mac
340  if (e->type() == QEvent::WindowStateChange) {
342  QWindowStateChangeEvent* wsevt = static_cast<QWindowStateChangeEvent*>(e);
343  if (!(wsevt->oldState() & Qt::WindowMinimized) && isMinimized()) {
344  QTimer::singleShot(0, this, &PIVXGUI::hide);
345  e->ignore();
346  } else if ((wsevt->oldState() & Qt::WindowMinimized) && !isMinimized()) {
347  QTimer::singleShot(0, this, &PIVXGUI::show);
348  e->ignore();
349  }
350  }
351  }
352 #endif
353 }
354 
355 void PIVXGUI::closeEvent(QCloseEvent* event)
356 {
357 #ifndef Q_OS_MAC // Ignored on Mac
360  QApplication::quit();
361  } else {
362  QMainWindow::showMinimized();
363  event->ignore();
364  }
365  }
366 #else
367  QMainWindow::closeEvent(event);
368 #endif
369 }
370 
371 
372 void PIVXGUI::messageInfo(const QString& text)
373 {
374  if (!this->snackBar) this->snackBar = new SnackBar(this, this);
375  this->snackBar->setText(text);
376  this->snackBar->resize(this->width(), snackBar->height());
377  openDialog(this->snackBar, this);
378 }
379 
380 
381 void PIVXGUI::message(const QString& title, const QString& message, unsigned int style, bool* ret)
382 {
383  QString strTitle = QString{PACKAGE_NAME}; // default title
384  // Default to information icon
385  int nNotifyIcon = Notificator::Information;
386 
387  QString msgType;
388 
389  // Prefer supplied title over style based title
390  if (!title.isEmpty()) {
391  msgType = title;
392  } else {
393  switch (style) {
395  msgType = tr("Error");
396  break;
398  msgType = tr("Warning");
399  break;
401  msgType = tr("Information");
402  break;
403  default:
404  msgType = tr("System Message");
405  break;
406  }
407  }
408 
409  // Check for error/warning icon
410  if (style & CClientUIInterface::ICON_ERROR) {
411  nNotifyIcon = Notificator::Critical;
412  } else if (style & CClientUIInterface::ICON_WARNING) {
413  nNotifyIcon = Notificator::Warning;
414  }
415 
416  // Display message
417  if (style & CClientUIInterface::MODAL) {
418  // Check for buttons, use OK as default, if none was supplied
419  int r = 0;
421  if (style & CClientUIInterface::BTN_MASK) {
422  r = openStandardDialog(
423  (title.isEmpty() ? strTitle : title), message, "OK", "CANCEL"
424  );
425  } else {
426  r = openStandardDialog((title.isEmpty() ? strTitle : title), message, "OK");
427  }
428  if (ret != nullptr)
429  *ret = r;
430  } else if (style & CClientUIInterface::MSG_INFORMATION_SNACK) {
432  } else {
433  // Append title to "PIVX - "
434  if (!msgType.isEmpty())
435  strTitle += " - " + msgType;
436  notificator->notify(static_cast<Notificator::Class>(nNotifyIcon), strTitle, message);
437  }
438 }
439 
440 bool PIVXGUI::openStandardDialog(QString title, QString body, QString okBtn, QString cancelBtn)
441 {
442  DefaultDialog *dialog;
443  if (isVisible()) {
444  showHide(true);
445  dialog = new DefaultDialog(this);
446  dialog->setText(title, body, okBtn, cancelBtn);
447  dialog->adjustSize();
448  openDialogWithOpaqueBackground(dialog, this);
449  } else {
450  dialog = new DefaultDialog();
451  dialog->setText(title, body, okBtn);
452  dialog->setWindowTitle(PACKAGE_NAME);
453  dialog->adjustSize();
454  dialog->raise();
455  dialog->exec();
456  }
457  bool ret = dialog->isOk;
458  dialog->deleteLater();
459  return ret;
460 }
461 
462 
463 void PIVXGUI::showNormalIfMinimized(bool fToggleHidden)
464 {
465  if (!clientModel)
466  return;
467  if (!isHidden() && !isMinimized() && !GUIUtil::isObscured(this) && fToggleHidden) {
468  hide();
469  } else {
470  GUIUtil::bringToFront(this);
471  }
472 }
473 
475 {
476  showNormalIfMinimized(true);
477 }
478 
480 {
481  if (ShutdownRequested()) {
482  if (rpcConsole)
483  rpcConsole->hide();
484  qApp->quit();
485  }
486 }
487 
489 {
490  if (stackedContainer->currentWidget() != dashboard) {
491  stackedContainer->setCurrentWidget(dashboard);
492  topBar->showBottom();
493  }
494 }
495 
497 {
499 }
500 
502 {
504 }
505 
507 {
510 }
511 
513 {
515 }
516 
518 {
520 }
521 
524 }
525 
527 {
530  goToSettings();
531 }
532 
534 {
536 }
537 
539 {
541 }
542 
543 void PIVXGUI::showTop(QWidget* view)
544 {
545  if (stackedContainer->currentWidget() != view) {
546  stackedContainer->setCurrentWidget(view);
547  topBar->showTop();
548  }
549 }
550 
552 {
553 
554  QString css = GUIUtil::loadStyleSheet();
555  this->setStyleSheet(css);
556 
557  // Notify
558  Q_EMIT themeChanged(isLightTheme, css);
559 
560  // Update style
561  updateStyle(this);
562 }
563 
564 void PIVXGUI::resizeEvent(QResizeEvent* event)
565 {
566  // Parent..
567  QMainWindow::resizeEvent(event);
568  // background
570  // Notify
571  Q_EMIT windowResizeEvent(event);
572 }
573 
574 bool PIVXGUI::execDialog(QDialog *dialog, int xDiv, int yDiv)
575 {
576  return openDialogWithOpaqueBackgroundY(dialog, this);
577 }
578 
579 void PIVXGUI::showHide(bool show)
580 {
581  if (!op) op = new QLabel(this);
582  if (!show) {
583  op->setVisible(false);
584  opEnabled = false;
585  } else {
586  QColor bg("#000000");
587  bg.setAlpha(200);
588  if (!isLightTheme()) {
589  bg = QColor("#00000000");
590  bg.setAlpha(150);
591  }
592 
593  QPalette palette;
594  palette.setColor(QPalette::Window, bg);
595  op->setAutoFillBackground(true);
596  op->setPalette(palette);
597  op->setWindowFlags(Qt::CustomizeWindowHint);
598  op->move(0,0);
599  op->show();
600  op->activateWindow();
601  op->resize(width(), height());
602  op->setVisible(true);
603  opEnabled = true;
604  }
605 }
606 
608 {
609  return this->navMenu->width();
610 }
611 
613 {
614  showHide(true);
615  SettingsFaqWidget* dialog = new SettingsFaqWidget(this, mnModel);
616  dialog->setSection(section);
618  dialog->deleteLater();
619 }
620 
621 
622 #ifdef ENABLE_WALLET
623 void PIVXGUI::setGovModel(GovernanceModel* govModel)
624 {
625  if (!stackedContainer || !clientModel) return;
626  governancewidget->setGovModel(govModel);
627 }
628 
629 void PIVXGUI::setMNModel(MNModel* _mnModel)
630 {
631  if (!stackedContainer || !clientModel) return;
632  mnModel = _mnModel;
635 }
636 
637 bool PIVXGUI::addWallet(const QString& name, WalletModel* walletModel)
638 {
639  // Single wallet supported for now..
640  if (!stackedContainer || !clientModel || !walletModel)
641  return false;
642 
643  // set the model for every view
644  navMenu->setWalletModel(walletModel);
645  dashboard->setWalletModel(walletModel);
646  topBar->setWalletModel(walletModel);
647  receiveWidget->setWalletModel(walletModel);
648  sendWidget->setWalletModel(walletModel);
649  addressesWidget->setWalletModel(walletModel);
650  masterNodesWidget->setWalletModel(walletModel);
651  coldStakingWidget->setWalletModel(walletModel);
652  governancewidget->setWalletModel(walletModel);
653  settingsWidget->setWalletModel(walletModel);
654 
655  // Connect actions..
656  connect(walletModel, &WalletModel::message, this, &PIVXGUI::message);
659  connect(topBar, &TopBar::message, this, &PIVXGUI::message);
665 
666  // Pass through transaction notifications
668 
669  return true;
670 }
671 
672 bool PIVXGUI::setCurrentWallet(const QString& name)
673 {
674  // Single wallet supported.
675  return true;
676 }
677 
678 void PIVXGUI::removeAllWallets()
679 {
680  // Single wallet supported.
681 }
682 
683 void PIVXGUI::incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address)
684 {
685  // Only send notifications when not disabled
687  // On new transaction, make an info balloon
688  message(amount < 0 ? tr("Sent transaction") : tr("Incoming transaction"),
689  tr("Date: %1\n"
690  "Amount: %2\n"
691  "Type: %3\n"
692  "Address: %4\n")
693  .arg(date)
694  .arg(BitcoinUnits::formatWithUnit(unit, amount, true))
695  .arg(type)
696  .arg(address),
698  }
699 }
700 
701 #endif // ENABLE_WALLET
702 
703 
704 static bool ThreadSafeMessageBox(PIVXGUI* gui, const std::string& message, const std::string& caption, unsigned int style)
705 {
706  bool modal = (style & CClientUIInterface::MODAL);
707  // The SECURE flag has no effect in the Qt GUI.
708  // bool secure = (style & CClientUIInterface::SECURE);
709  style &= ~CClientUIInterface::SECURE;
710  bool ret = false;
711  std::cout << "thread safe box: " << message << std::endl;
712  // In case of modal message, use blocking connection to wait for user to click a button
713  QMetaObject::invokeMethod(gui, "message",
714  modal ? GUIUtil::blockingGUIThreadConnection() : Qt::QueuedConnection,
715  Q_ARG(QString, QString::fromStdString(caption)),
716  Q_ARG(QString, QString::fromStdString(message)),
717  Q_ARG(unsigned int, style),
718  Q_ARG(bool*, &ret));
719  return ret;
720 }
721 
722 
724 {
725  // Connect signals to client
726  m_handler_message_box = interfaces::MakeHandler(uiInterface.ThreadSafeMessageBox.connect(std::bind(ThreadSafeMessageBox, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)));
727 }
728 
730 {
731  // Disconnect signals from client
732  m_handler_message_box->disconnect();
733 }
int64_t CAmount
Amount in PIV (Can be negative)
Definition: amount.h:13
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
Definition: system.cpp:449
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
Definition: system.cpp:465
static QString formatWithUnit(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
Format as string (with unit)
Signals for UI communication.
Definition: guiinterface.h:32
@ BTN_MASK
Mask of all available buttons in CClientUIInterface::MessageBoxFlags This needs to be updated,...
Definition: guiinterface.h:62
@ MSG_INFORMATION
Predefined combinations for certain default usage cases.
Definition: guiinterface.h:77
@ MODAL
Force blocking, modal message box dialog (not just OS notification)
Definition: guiinterface.h:71
boost::signals2::signal< bool(const std::string &message, const std::string &caption, unsigned int style), boost::signals2::last_value< bool > > ThreadSafeMessageBox
Show message box.
Definition: guiinterface.h:84
Model for PIVX network client.
Definition: clientmodel.h:50
void message(const QString &title, const QString &message, unsigned int style, bool *ret=nullptr)
Fired when a message should be reported to the user.
void alertsChanged(const QString &warnings)
OptionsModel * getOptionsModel()
void walletSynced(bool sync)
void incomingTransaction(const QString &date, int unit, const CAmount &amount, const QString &type, const QString &address)
Notify that a new transaction appeared.
void walletSynced(bool isSync)
void setText(const QString &title="", const QString &message="", const QString &okBtnText="", const QString &cancelBtnText="")
void setGovModel(GovernanceModel *_model)
void setMNModel(MNModel *_mnModel)
void tierTwoSynced(bool IsSync)
Macintosh-specific dock icon handler.
static MacDockIconHandler * instance()
void setMNModel(MNModel *_mnModel)
void onShowHideColdStakingChanged(bool show)
const QString & getTitleAddText() const
Definition: networkstyle.h:21
const QIcon & getAppIcon() const
Definition: networkstyle.h:20
Cross-platform desktop notification client.
Definition: notificator.h:26
@ Information
Informational message.
Definition: notificator.h:38
@ Critical
An error occurred.
Definition: notificator.h:40
@ Warning
Notify user of potential problem.
Definition: notificator.h:39
void notify(Class cls, const QString &title, const QString &text, const QIcon &icon=QIcon(), int millisTimeout=10000)
Show notification message.
bool getMinimizeOnClose()
Definition: optionsmodel.h:73
bool getMinimizeToTray()
Definition: optionsmodel.h:72
PIVX GUI main class.
Definition: pivxgui.h:46
MasterNodesWidget * masterNodesWidget
Definition: pivxgui.h:144
RPCConsole * rpcConsole
Definition: pivxgui.h:151
void goToReceive()
Definition: pivxgui.cpp:533
void createTrayIcon(const NetworkStyle *networkStyle)
Create system tray icon and notification.
Definition: pivxgui.cpp:212
QAction * toggleHideAction
Definition: pivxgui.h:133
bool execDialog(QDialog *dialog, int xDiv=3, int yDiv=5)
Definition: pivxgui.cpp:574
AddressesWidget * addressesWidget
Definition: pivxgui.h:143
std::unique_ptr< interfaces::Handler > m_handler_message_box
Definition: pivxgui.h:125
void unsubscribeFromCoreSignals()
Disconnect core signals from GUI client.
Definition: pivxgui.cpp:729
QLabel * op
Definition: pivxgui.h:158
void showNormalIfMinimized(bool fToggleHidden=false)
Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHid...
Definition: pivxgui.cpp:463
void themeChanged(bool isLightTheme, QString &theme)
SnackBar * snackBar
Definition: pivxgui.h:149
QSystemTrayIcon * trayIcon
Definition: pivxgui.h:154
~PIVXGUI()
Definition: pivxgui.cpp:224
void requestedRestart(QStringList args)
Restart handling.
void closeEvent(QCloseEvent *event) override
Definition: pivxgui.cpp:355
bool enableWallet
Definition: pivxgui.h:127
bool openStandardDialog(QString title="", QString body="", QString okBtn="OK", QString cancelBtn="CANCEL")
Definition: pivxgui.cpp:440
void goToSend()
Definition: pivxgui.cpp:496
void detectShutdown()
called by a timer to check if ShutdownRequested()
Definition: pivxgui.cpp:479
void incomingTransaction(const QString &date, int unit, const CAmount &amount, const QString &type, const QString &address)
Show incoming transaction notification for new transactions.
void createActions(const NetworkStyle *networkStyle)
Create the main UI actions.
Definition: pivxgui.cpp:169
void goToDashboard()
Definition: pivxgui.cpp:488
void changeEvent(QEvent *e) override
Definition: pivxgui.cpp:336
int getNavWidth()
Definition: pivxgui.cpp:607
void showHide(bool show)
Definition: pivxgui.cpp:579
TopBar * topBar
Definition: pivxgui.h:137
NavMenuWidget * navMenu
Definition: pivxgui.h:136
void messageInfo(const QString &message)
Definition: pivxgui.cpp:372
SendWidget * sendWidget
Definition: pivxgui.h:141
ClientModel * clientModel
Definition: pivxgui.h:128
void resizeEvent(QResizeEvent *event) override
Definition: pivxgui.cpp:564
bool opEnabled
Definition: pivxgui.h:159
void trayIconActivated(QSystemTrayIcon::ActivationReason reason)
Handle tray icon clicked.
Definition: pivxgui.cpp:321
void message(const QString &title, const QString &message, unsigned int style, bool *ret=nullptr)
Notify the user of an event from the core network or transaction handling code.
Definition: pivxgui.cpp:381
void goToSettings()
Definition: pivxgui.cpp:522
static const QString DEFAULT_WALLET
Definition: pivxgui.h:50
void goToAddresses()
Definition: pivxgui.cpp:501
GovernanceWidget * governancewidget
Definition: pivxgui.h:146
void subscribeToCoreSignals()
Connect core signals to GUI client.
Definition: pivxgui.cpp:723
void goToGovernance()
Definition: pivxgui.cpp:517
QMenu * trayIconMenu
Definition: pivxgui.h:155
QStackedWidget * stackedContainer
Definition: pivxgui.h:138
ColdStakingWidget * coldStakingWidget
Definition: pivxgui.h:145
ReceiveWidget * receiveWidget
Definition: pivxgui.h:142
MNModel * mnModel
Definition: pivxgui.h:129
SettingsWidget * settingsWidget
Definition: pivxgui.h:147
PIVXGUI(const NetworkStyle *networkStyle, QWidget *parent=0)
Definition: pivxgui.cpp:40
void changeTheme(bool isLightTheme)
Definition: pivxgui.cpp:551
DashboardWidget * dashboard
Definition: pivxgui.h:140
void goToColdStaking()
Definition: pivxgui.cpp:512
void connectActions()
Here add every event connection.
Definition: pivxgui.cpp:186
QAction * quitAction
Definition: pivxgui.h:132
void openNetworkMonitor()
Definition: pivxgui.cpp:538
void windowResizeEvent(QResizeEvent *event)
void goToMasterNodes()
Definition: pivxgui.cpp:506
Notificator * notificator
Definition: pivxgui.h:156
void showTop(QWidget *view)
Definition: pivxgui.cpp:543
void setClientModel(ClientModel *clientModel)
Set the client model.
Definition: pivxgui.cpp:246
void openFAQ(SettingsFaqWidget::Section section=SettingsFaqWidget::Section::INTRO)
Open FAQ dialog.
Definition: pivxgui.cpp:612
void handleRestart(QStringList args)
Get restart command-line parameters and request restart.
Definition: pivxgui.cpp:239
void goToSettingsInfo()
Definition: pivxgui.cpp:526
void toggleHidden()
Simply calls showNormalIfMinimized(true) for use in SLOT() macro.
Definition: pivxgui.cpp:474
void createTrayIconMenu()
Create system tray menu (or setup the dock menu)
Definition: pivxgui.cpp:290
void setClientModel(ClientModel *model)
Definition: pwidget.cpp:21
void setWalletModel(WalletModel *model)
Definition: pwidget.cpp:27
bool execDialog(QDialog *dialog, int xDiv=3, int yDiv=5)
void message(const QString &title, const QString &body, unsigned int style, bool *ret=nullptr)
void showHide(bool show)
Local Bitcoin RPC console.
Definition: rpcconsole.h:33
void setClientModel(ClientModel *model)
Definition: rpcconsole.cpp:173
void setSection(Section _section)
Definition: faqwidget.cpp:191
void handleRestart(QStringList args)
Get restart command-line parameters and handle restart.
void setText(const QString &text)
Definition: snackbar.cpp:51
Definition: topbar.h:27
void showTop()
Definition: topbar.cpp:362
void walletSynced(bool isSync)
void showBottom()
Definition: topbar.cpp:372
void onShowHideColdStakingChanged(bool show)
void tierTwoSynced(bool isSync)
void themeChanged(bool isLight)
Interface to PIVX wallet from Qt view code.
Definition: walletmodel.h:109
void message(const QString &title, const QString &body, unsigned int style, bool *ret=nullptr)
CClientUIInterface uiInterface
Definition: init.cpp:109
bool isObscured(QWidget *w)
Definition: guiutil.cpp:374
Qt::ConnectionType blockingGUIThreadConnection()
Get connection type to call object slot in GUI thread with invokeMethod.
Definition: guiutil.cpp:358
QString loadStyleSheet()
Load global CSS theme.
Definition: guiutil.cpp:639
void saveWindowGeometry(const QString &strSetting, QWidget *parent)
Save window size and position.
Definition: guiutil.cpp:606
void bringToFront(QWidget *w)
Definition: guiutil.cpp:379
void restoreWindowGeometry(const QString &strSetting, const QSize &defaultSize, QWidget *parent)
Restore window size and position.
Definition: guiutil.cpp:613
std::unique_ptr< Handler > MakeHandler(boost::signals2::connection connection)
Return handler wrapping a boost signal connection.
Definition: handler.cpp:26
#define PACKAGE_NAME
Definition: pivx-config.h:366
#define BASE_WINDOW_WIDTH
Definition: pivxgui.cpp:32
#define BASE_WINDOW_MIN_HEIGHT
Definition: pivxgui.cpp:34
#define BASE_WINDOW_MIN_WIDTH
Definition: pivxgui.cpp:35
#define BASE_WINDOW_HEIGHT
Definition: pivxgui.cpp:33
bool isLightTheme()
Definition: qtutils.cpp:210
bool openDialogWithOpaqueBackgroundFullScreen(QDialog *widget, PIVXGUI *gui)
Definition: qtutils.cpp:81
bool openDialogWithOpaqueBackgroundY(QDialog *widget, PIVXGUI *gui, double posX, int posY, bool hideOpaqueBackground)
Definition: qtutils.cpp:59
Qt::Modifier SHORT_KEY
Definition: qtutils.cpp:19
bool openDialogWithOpaqueBackground(QDialog *widget, PIVXGUI *gui, double posX)
Definition: qtutils.cpp:76
bool openDialog(QDialog *widget, QWidget *gui)
Definition: qtutils.cpp:23
void updateStyle(QWidget *widget)
Definition: qtutils.cpp:225
const char * name
Definition: rest.cpp:37
bool ShutdownRequested()
Definition: shutdown.cpp:22
ArgsManager gArgs
Definition: system.cpp:89
bool bdisableSystemnotifications
Definition: wallet.cpp:40