4 * W.J. van der Laan 2011-2012
5 * The Bitcoin Developers 2011-2012
7 #include "bitcoingui.h"
8 #include "transactiontablemodel.h"
9 #include "addressbookpage.h"
10 #include "sendcoinsdialog.h"
11 #include "signverifymessagedialog.h"
12 #include "secondauthdialog.h"
13 #include "multisigdialog.h"
14 #include "optionsdialog.h"
15 #include "aboutdialog.h"
16 #include "clientmodel.h"
17 #include "walletmodel.h"
18 #include "editaddressdialog.h"
19 #include "optionsmodel.h"
20 #include "transactiondescdialog.h"
21 #include "addresstablemodel.h"
22 #include "transactionview.h"
23 #include "overviewpage.h"
24 #include "bitcoinunits.h"
25 #include "guiconstants.h"
26 #include "askpassphrasedialog.h"
27 #include "notificator.h"
29 #include "interface.h"
30 #include "rpcconsole.h"
31 #include "mintingview.h"
34 #include "macdockiconhandler.h"
37 #include <QApplication>
38 #if QT_VERSION < 0x050000
39 #include <QMainWindow>
45 #include <QVBoxLayout>
50 #include <QPushButton>
52 #include <QMessageBox>
53 #include <QProgressBar>
54 #include <QStackedWidget>
57 #include <QFileDialog>
58 #if QT_VERSION < 0x050000
59 #include <QDesktopServices>
61 #include <QStandardPaths>
64 #include <QDragEnterEvent>
65 #if QT_VERSION < 0x050000
73 extern bool fWalletUnlockMintOnly;
74 extern uint64_t nStakeInputsMapSize;
76 BitcoinGUI::BitcoinGUI(QWidget *parent):
80 signVerifyMessageDialog(0),
83 encryptWalletAction(0),
85 unlockWalletAction(0),
86 unlockWalletMiningAction(0),
87 changePassphraseAction(0),
96 setWindowTitle(tr("NovaCoin") + " - " + tr("Wallet"));
98 qApp->setWindowIcon(QIcon(":icons/bitcoin"));
99 setWindowIcon(QIcon(":icons/bitcoin"));
101 setUnifiedTitleAndToolBarOnMac(true);
102 QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
105 int nQtStyle = GetArg("-qtstyle", 0);
106 if(nQtStyle < 0) nQtStyle = 0;
110 qApp->setStyleSheet("");
111 } else if(nQtStyle == 1) {
114 qApp->setStyleSheet("QToolBar QToolButton { text-align: center; width: 100%; \
115 padding-left: 5px; padding-right: 5px; padding-top: 2px; padding-bottom: 2px; \
117 QToolBar QToolButton:hover { font-weight: bold; } \
118 #toolbar { border: none; height: 100%; min-width: 150px; max-width: 150px; } \
119 QMenuBar { min-height: 20px; }");
121 qApp->setStyleSheet("QToolBar QToolButton { text-align: center; width: 100%; \
122 padding-left: 5px; padding-right: 5px; padding-top: 2px; padding-bottom: 2px; \
124 QToolBar QToolButton:hover { font-weight: bold; background-color: transparent; } \
125 #toolbar { border: none; height: 100%; min-width: 150px; max-width: 150px; }");
130 qApp->setStyleSheet("QToolBar QToolButton { text-align: center; width: 100%; \
131 color: white; background-color: grey; padding-left: 5px; padding-right: 5px; \
132 padding-top: 2px; padding-bottom: 2px; margin-top: 2px; } \
133 QToolBar QToolButton:hover { font-weight: bold; \
134 background-color: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 2, \
135 stop: 0 #808080, stop: 1 #d2d2d2); } \
136 #toolbar { border: none; height: 100%; min-width: 150px; max-width: 150px; \
137 background-color: grey; } \
138 QMenuBar { color: white; background-color: grey; } \
139 QMenuBar::item { color: white; background-color: grey; \
140 padding-top: 6px; padding-bottom: 6px; \
141 padding-left: 10px; padding-right: 10px; } \
142 QMenuBar::item:selected { background-color: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 2, \
143 stop: 0 #808080, stop: 1 #d2d2d2); } \
144 QMenu { border: 1px solid; color: black; background-color: grey; } \
145 QMenu::item { background-color: grey; } \
146 QMenu::item:disabled { color: gray; } \
147 QMenu::item:enabled:selected { color: white; background-color: grey; } \
148 QMenu::separator { height: 4px; }");
150 qApp->setStyleSheet("QToolBar QToolButton { text-align: center; width: 100%; \
151 color: white; padding-left: 5px; padding-right: 5px; \
152 padding-top: 2px; padding-bottom: 2px; margin-top: 2px; } \
153 QToolBar QToolButton:hover { font-weight: bold; \
154 background-color: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 2, \
155 stop: 0 #808080, stop: 1 #d2d2d2); } \
156 #toolbar { border: none; height: 100%; min-width: 150px; max-width: 150px; \
157 background-color: grey; }");
161 // Accept D&D of URIs
162 setAcceptDrops(true);
164 // Create actions for the toolbar, menu bar and tray/dock icon
165 createActions(nQtStyle);
167 // Create application menu bar
170 // Create the toolbars
171 createToolBars(nQtStyle);
173 // Create the tray icon (or setup the dock icon)
177 overviewPage = new OverviewPage();
179 transactionsPage = new QWidget(this);
180 QVBoxLayout *vbox = new QVBoxLayout();
181 transactionView = new TransactionView(this);
182 vbox->addWidget(transactionView);
183 transactionsPage->setLayout(vbox);
185 mintingPage = new QWidget(this);
186 QVBoxLayout *vboxMinting = new QVBoxLayout();
187 mintingView = new MintingView(this);
188 vboxMinting->addWidget(mintingView);
189 mintingPage->setLayout(vboxMinting);
191 addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);
193 receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);
195 sendCoinsPage = new SendCoinsDialog(this);
197 signVerifyMessageDialog = new SignVerifyMessageDialog(0);
199 secondAuthDialog = new SecondAuthDialog(0);
201 multisigPage = new MultisigDialog(0);
203 centralWidget = new QStackedWidget(this);
204 centralWidget->addWidget(overviewPage);
205 centralWidget->addWidget(transactionsPage);
206 centralWidget->addWidget(mintingPage);
207 centralWidget->addWidget(addressBookPage);
208 centralWidget->addWidget(receiveCoinsPage);
209 centralWidget->addWidget(sendCoinsPage);
210 setCentralWidget(centralWidget);
215 // Status bar notification icons
216 QFrame *frameBlocks = new QFrame();
217 frameBlocks->setContentsMargins(0,0,0,0);
218 frameBlocks->setMinimumWidth(72);
219 frameBlocks->setMaximumWidth(72);
220 QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
221 frameBlocksLayout->setContentsMargins(3,0,3,0);
222 frameBlocksLayout->setSpacing(3);
223 labelEncryptionIcon = new QLabel();
224 labelMiningIcon = new QLabel();
225 labelConnectionsIcon = new QLabel();
226 labelBlocksIcon = new QLabel();
227 frameBlocksLayout->addStretch();
228 frameBlocksLayout->addWidget(labelEncryptionIcon);
229 frameBlocksLayout->addStretch();
230 frameBlocksLayout->addWidget(labelMiningIcon);
231 frameBlocksLayout->addStretch();
232 frameBlocksLayout->addWidget(labelConnectionsIcon);
233 frameBlocksLayout->addStretch();
234 frameBlocksLayout->addWidget(labelBlocksIcon);
235 frameBlocksLayout->addStretch();
237 // Progress bar and label for blocks download
238 progressBarLabel = new QLabel();
239 progressBarLabel->setVisible(false);
240 progressBar = new QProgressBar();
241 progressBar->setAlignment(Qt::AlignCenter);
242 progressBar->setVisible(false);
244 // Override style sheet for progress bar for styles that have a segmented progress bar,
245 // as they make the text unreadable (workaround for issue #1071)
246 // See https://qt-project.org/doc/qt-4.8/gallery.html
247 QString curStyle = qApp->style()->metaObject()->className();
248 if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle")
250 progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange); border-radius: 7px; margin: 0px; }");
253 statusBar()->addWidget(progressBarLabel);
254 statusBar()->addWidget(progressBar);
255 statusBar()->addPermanentWidget(frameBlocks);
257 syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);
259 // Clicking on a transaction on the overview page simply sends you to transaction history page
260 connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
261 connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));
263 // Double-clicking on a transaction on the transaction history page shows details
264 connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));
266 rpcConsole = new RPCConsole(0);
267 connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));
268 connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(raise()));
270 aboutDialog = new AboutDialog(0);
271 optionsDialog = new OptionsDialog(0);
273 // Clicking on "Verify Message" in the address book sends you to the verify message tab
274 connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
275 // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
276 connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));
281 BitcoinGUI::~BitcoinGUI()
283 if(trayIcon) // Hide tray icon, as deleting will let it linger until quit (on Ubuntu)
291 delete optionsDialog;
293 delete secondAuthDialog;
294 delete signVerifyMessageDialog;
297 void BitcoinGUI::createActions(int nQtStyle)
299 QActionGroup *tabGroup = new QActionGroup(this);
301 overviewAction = new QAction(QIcon(":/icons/overview"), tr("&Overview"), this);
302 overviewAction->setToolTip(tr("Show general overview of wallet"));
303 overviewAction->setCheckable(true);
304 overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1));
305 tabGroup->addAction(overviewAction);
307 sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send coins"), this);
308 sendCoinsAction->setToolTip(tr("Send coins to a NovaCoin address"));
309 sendCoinsAction->setCheckable(true);
310 sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2));
311 tabGroup->addAction(sendCoinsAction);
313 receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive coins"), this);
314 receiveCoinsAction->setToolTip(tr("Show the list of addresses for receiving payments"));
315 receiveCoinsAction->setCheckable(true);
316 receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3));
317 tabGroup->addAction(receiveCoinsAction);
319 historyAction = new QAction(QIcon(":/icons/history"), tr("&Transactions"), this);
320 historyAction->setToolTip(tr("Browse transaction history"));
321 historyAction->setCheckable(true);
322 historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
323 tabGroup->addAction(historyAction);
325 mintingAction = new QAction(QIcon(":/icons/history"), tr("&Minting"), this);
326 mintingAction->setToolTip(tr("Show your minting capacity"));
327 mintingAction->setCheckable(true);
328 mintingAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5));
329 tabGroup->addAction(mintingAction);
331 addressBookAction = new QAction(QIcon(":/icons/address-book"), tr("&Address Book"), this);
332 addressBookAction->setToolTip(tr("Edit the list of stored addresses and labels"));
333 addressBookAction->setCheckable(true);
334 addressBookAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_6));
335 tabGroup->addAction(addressBookAction);
337 multisigAction = new QAction(QIcon(":/icons/send"), tr("Multisig"), this);
338 multisigAction->setStatusTip(tr("Open window for working with multisig addresses"));
339 tabGroup->addAction(multisigAction);
341 connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
342 connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage()));
343 connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
344 connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
345 connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
346 connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
347 connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
348 connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
349 connect(mintingAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
350 connect(mintingAction, SIGNAL(triggered()), this, SLOT(gotoMintingPage()));
351 connect(addressBookAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
352 connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage()));
353 connect(multisigAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
354 connect(multisigAction, SIGNAL(triggered()), this, SLOT(gotoMultisigPage()));
356 quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
357 quitAction->setStatusTip(tr("Quit application"));
358 quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
359 quitAction->setMenuRole(QAction::QuitRole);
360 aboutAction = new QAction(QIcon(":/icons/bitcoin"), tr("&About NovaCoin"), this);
361 aboutAction->setStatusTip(tr("Show information about NovaCoin"));
362 aboutAction->setMenuRole(QAction::AboutRole);
363 #if QT_VERSION < 0x050000
364 aboutQtAction = new QAction(QIcon(":/trolltech/qmessagebox/images/qtlogo-64.png"), tr("About &Qt"), this);
366 aboutQtAction = new QAction(QIcon(":/qt-project.org/qmessagebox/images/qtlogo-64.png"), tr("About &Qt"), this);
368 aboutQtAction->setStatusTip(tr("Show information about Qt"));
369 aboutQtAction->setMenuRole(QAction::AboutQtRole);
370 optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this);
371 optionsAction->setStatusTip(tr("Modify configuration options for NovaCoin"));
372 optionsAction->setMenuRole(QAction::PreferencesRole);
373 toggleHideAction = new QAction(QIcon(":/icons/bitcoin"), tr("&Show / Hide"), this);
374 encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this);
375 encryptWalletAction->setStatusTip(tr("Encrypt or decrypt wallet"));
376 encryptWalletAction->setCheckable(true);
377 backupWalletAction = new QAction(QIcon(":/icons/filesave"), tr("&Backup Wallet..."), this);
378 backupWalletAction->setStatusTip(tr("Backup wallet to another location"));
379 dumpWalletAction = new QAction(QIcon(":/icons/dump"), tr("&Dump Wallet..."), this);
380 dumpWalletAction->setStatusTip(tr("Dump keys to a text file"));
381 importWalletAction = new QAction(QIcon(":/icons/import"), tr("&Import Wallet..."), this);
382 importWalletAction->setStatusTip(tr("Import keys into a wallet"));
383 changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase..."), this);
384 changePassphraseAction->setStatusTip(tr("Change the passphrase used for wallet encryption"));
385 signMessageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message..."), this);
386 signMessageAction->setStatusTip(tr("Sign messages with your Novacoin addresses to prove you own them"));
387 verifyMessageAction = new QAction(QIcon(":/icons/transaction_0"), tr("&Verify message..."), this);
388 verifyMessageAction->setStatusTip(tr("Verify messages to ensure they were signed with specified Novacoin addresses"));
389 secondAuthAction = new QAction(QIcon(":/icons/key"), tr("Second &auth..."), this);
390 secondAuthAction->setStatusTip(tr("Second auth with your Novacoin addresses"));
392 lockWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Lock wallet"), this);
393 lockWalletAction->setStatusTip(tr("Lock wallet"));
394 lockWalletAction->setCheckable(true);
396 unlockWalletAction = new QAction(QIcon(":/icons/lock_open"), tr("Unlo&ck wallet"), this);
397 unlockWalletAction->setStatusTip(tr("Unlock wallet"));
398 unlockWalletAction->setCheckable(true);
400 unlockWalletMiningAction = new QAction(QIcon(":/icons/mining_active"), tr("Unlo&ck wallet for mining"), this);
401 unlockWalletMiningAction->setStatusTip(tr("Unlock wallet for mining"));
402 unlockWalletMiningAction->setCheckable(true);
404 exportAction = new QAction(QIcon(":/icons/export"), tr("&Export..."), this);
405 exportAction->setStatusTip(tr("Export the data in the current tab to a file"));
406 openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug window"), this);
407 openRPCConsoleAction->setStatusTip(tr("Open debugging and diagnostic console"));
409 connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
410 connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked()));
411 connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
412 connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked()));
413 connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden()));
414 connect(encryptWalletAction, SIGNAL(triggered(bool)), this, SLOT(encryptWallet(bool)));
415 connect(lockWalletAction, SIGNAL(triggered(bool)), this, SLOT(lockWallet()));
416 connect(unlockWalletAction, SIGNAL(triggered(bool)), this, SLOT(unlockWallet()));
417 connect(unlockWalletMiningAction, SIGNAL(triggered(bool)), this, SLOT(unlockWalletMining(bool)));
418 connect(backupWalletAction, SIGNAL(triggered()), this, SLOT(backupWallet()));
419 connect(dumpWalletAction, SIGNAL(triggered()), this, SLOT(dumpWallet()));
420 connect(importWalletAction, SIGNAL(triggered()), this, SLOT(importWallet()));
421 connect(changePassphraseAction, SIGNAL(triggered()), this, SLOT(changePassphrase()));
422 connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab()));
423 connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab()));
424 connect(secondAuthAction, SIGNAL(triggered()), this, SLOT(gotoSecondAuthPage()));
427 void BitcoinGUI::createMenuBar()
430 // Create a decoupled menu bar on Mac which stays even if the window is closed
431 appMenuBar = new QMenuBar();
433 // Get the main window's menu bar on other platforms
434 appMenuBar = menuBar();
437 // Configure the menus
438 QMenu *file = appMenuBar->addMenu(tr("&File"));
439 file->addAction(backupWalletAction);
440 file->addSeparator();
441 file->addAction(dumpWalletAction);
442 file->addAction(importWalletAction);
443 file->addAction(exportAction);
444 file->addAction(signMessageAction);
445 file->addAction(verifyMessageAction);
446 file->addAction(secondAuthAction);
447 file->addAction(multisigAction);
448 file->addSeparator();
449 file->addAction(quitAction);
451 QMenu *settings = appMenuBar->addMenu(tr("&Settings"));
452 QMenu *securityMenu = settings->addMenu(QIcon(":/icons/key"), tr("&Wallet security"));
453 securityMenu->addAction(encryptWalletAction);
454 securityMenu->addAction(changePassphraseAction);
455 securityMenu->addAction(unlockWalletAction);
456 securityMenu->addAction(unlockWalletMiningAction);
457 securityMenu->addAction(lockWalletAction);
458 settings->addAction(optionsAction);
460 QMenu *help = appMenuBar->addMenu(tr("&Help"));
461 help->addAction(openRPCConsoleAction);
462 help->addSeparator();
463 help->addAction(aboutAction);
464 help->addAction(aboutQtAction);
467 void BitcoinGUI::createToolBars(int nQtStyle)
469 QToolBar *toolbar = addToolBar(tr("Primary tool bar"));
470 toolbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
471 toolbar->setMovable(false);
472 toolbar->setIconSize(QSize(32, 32));
475 toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
477 toolbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
478 toolbar->setObjectName("toolbar");
479 addToolBar(Qt::LeftToolBarArea, toolbar);
480 toolbar->setOrientation(Qt::Vertical);
483 toolbar->addAction(overviewAction);
484 toolbar->addAction(sendCoinsAction);
485 toolbar->addAction(receiveCoinsAction);
486 toolbar->addAction(historyAction);
487 toolbar->addAction(mintingAction);
488 toolbar->addAction(addressBookAction);
490 QToolBar *toolbar2 = addToolBar(tr("Actions toolbar"));
491 toolbar2->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
492 toolbar2->addAction(exportAction);
493 toolbar2->setVisible(false);
497 void BitcoinGUI::setClientModel(ClientModel *clientModel)
499 this->clientModel = clientModel;
502 // Replace some strings and icons, when using the testnet
503 if(clientModel->isTestNet())
505 setWindowTitle(windowTitle() + QString(" ") + tr("[testnet]"));
507 qApp->setWindowIcon(QIcon(":icons/bitcoin_testnet"));
508 setWindowIcon(QIcon(":icons/bitcoin_testnet"));
510 MacDockIconHandler::instance()->setIcon(QIcon(":icons/bitcoin_testnet"));
514 trayIcon->setToolTip(tr("NovaCoin client") + QString(" ") + tr("[testnet]"));
515 trayIcon->setIcon(QIcon(":/icons/toolbar_testnet"));
516 toggleHideAction->setIcon(QIcon(":/icons/toolbar_testnet"));
519 aboutAction->setIcon(QIcon(":/icons/toolbar_testnet"));
522 // Keep up to date with client
523 setNumConnections(clientModel->getNumConnections());
524 connect(clientModel, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int)));
526 setNumBlocks(clientModel->getNumBlocks(), clientModel->getNumBlocksOfPeers());
527 connect(clientModel, SIGNAL(numBlocksChanged(int,int)), this, SLOT(setNumBlocks(int,int)));
529 QTimer *timer = new QTimer(this);
530 connect(timer, SIGNAL(timeout()), this, SLOT(updateMining()));
531 timer->start(10*1000); //10 seconds
533 // Report errors from network/worker thread
534 connect(clientModel, SIGNAL(error(QString,QString,bool)), this, SLOT(error(QString,QString,bool)));
536 rpcConsole->setClientModel(clientModel);
537 addressBookPage->setOptionsModel(clientModel->getOptionsModel());
538 receiveCoinsPage->setOptionsModel(clientModel->getOptionsModel());
542 void BitcoinGUI::setWalletModel(WalletModel *walletModel)
544 this->walletModel = walletModel;
547 // Report errors from wallet thread
548 connect(walletModel, SIGNAL(error(QString,QString,bool)), this, SLOT(error(QString,QString,bool)));
550 // Put transaction list in tabs
551 transactionView->setModel(walletModel);
552 mintingView->setModel(walletModel);
554 overviewPage->setModel(walletModel);
555 addressBookPage->setModel(walletModel->getAddressTableModel());
556 receiveCoinsPage->setModel(walletModel->getAddressTableModel());
557 sendCoinsPage->setModel(walletModel);
558 signVerifyMessageDialog->setModel(walletModel);
559 secondAuthDialog->setModel(walletModel);
560 multisigPage->setModel(walletModel);
562 setEncryptionStatus(walletModel->getEncryptionStatus());
563 connect(walletModel, SIGNAL(encryptionStatusChanged(int)), this, SLOT(setEncryptionStatus(int)));
564 connect(walletModel, SIGNAL(encryptionStatusChanged(int)), this, SLOT(updateMining()));
566 // Balloon pop-up for new transaction
567 connect(walletModel->getTransactionTableModel(), SIGNAL(rowsInserted(QModelIndex,int,int)),
568 this, SLOT(incomingTransaction(QModelIndex,int,int)));
570 // Ask for passphrase if needed
571 connect(walletModel, SIGNAL(requireUnlock()), this, SLOT(unlockWallet()));
575 void BitcoinGUI::createTrayIcon()
579 trayIcon = new QSystemTrayIcon(this);
580 trayIconMenu = new QMenu(this);
581 trayIcon->setContextMenu(trayIconMenu);
582 trayIcon->setToolTip(tr("NovaCoin client"));
583 trayIcon->setIcon(QIcon(":/icons/toolbar"));
584 connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
585 this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason)));
588 // Note: On Mac, the dock icon is used to provide the tray's functionality.
589 MacDockIconHandler *dockIconHandler = MacDockIconHandler::instance();
590 dockIconHandler->setMainWindow((QMainWindow *)this);
591 trayIconMenu = dockIconHandler->dockMenu();
594 // Configuration of the tray icon (or dock icon) icon menu
595 trayIconMenu->addAction(toggleHideAction);
596 trayIconMenu->addSeparator();
597 trayIconMenu->addAction(sendCoinsAction);
598 trayIconMenu->addAction(multisigAction);
599 trayIconMenu->addAction(receiveCoinsAction);
600 trayIconMenu->addSeparator();
601 trayIconMenu->addAction(signMessageAction);
602 trayIconMenu->addAction(verifyMessageAction);
603 trayIconMenu->addAction(secondAuthAction);
604 trayIconMenu->addSeparator();
605 trayIconMenu->addAction(optionsAction);
606 trayIconMenu->addAction(openRPCConsoleAction);
608 // This is built-in on Mac
609 trayIconMenu->addSeparator();
610 trayIconMenu->addAction(quitAction);
612 notificator = new Notificator(QApplication::applicationName(), trayIcon, this);
616 void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
618 if(reason == QSystemTrayIcon::Trigger)
620 // Click on system tray icon triggers show/hide of the main window
621 toggleHideAction->trigger();
626 void BitcoinGUI::optionsClicked()
628 if(!clientModel || !clientModel->getOptionsModel())
631 optionsDialog->setModel(clientModel->getOptionsModel());
632 optionsDialog->setWindowModality(Qt::ApplicationModal);
633 optionsDialog->show();
636 void BitcoinGUI::aboutClicked()
638 aboutDialog->setModel(clientModel);
639 aboutDialog->setWindowModality(Qt::ApplicationModal);
643 void BitcoinGUI::setNumConnections(int count)
648 case 0: icon = ":/icons/connect_0"; break;
649 case 1: case 2: case 3: icon = ":/icons/connect_1"; break;
650 case 4: case 5: case 6: icon = ":/icons/connect_2"; break;
651 case 7: case 8: case 9: icon = ":/icons/connect_3"; break;
652 default: icon = ":/icons/connect_4"; break;
654 labelConnectionsIcon->setPixmap(QIcon(icon).pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
655 labelConnectionsIcon->setToolTip(tr("%n active connection(s) to NovaCoin network", "", count));
658 void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks)
660 // don't show / hide progress bar and its label if we have no connection to the network
661 if (!clientModel || clientModel->getNumConnections() == 0)
663 progressBarLabel->setVisible(false);
664 progressBar->setVisible(false);
669 QString strStatusBarWarnings = clientModel->getStatusBarWarnings();
672 if(count < nTotalBlocks)
674 int nRemainingBlocks = nTotalBlocks - count;
675 float nPercentageDone = count / (nTotalBlocks * 0.01f);
677 if (strStatusBarWarnings.isEmpty())
679 progressBarLabel->setText(tr("Synchronizing with network..."));
680 progressBarLabel->setVisible(true);
681 progressBar->setFormat(tr("~%n block(s) remaining", "", nRemainingBlocks));
682 progressBar->setMaximum(nTotalBlocks);
683 progressBar->setValue(count);
684 progressBar->setVisible(true);
687 tooltip = tr("Downloaded %1 of %2 blocks of transaction history (%3% done).").arg(count).arg(nTotalBlocks).arg(nPercentageDone, 0, 'f', 2);
691 if (strStatusBarWarnings.isEmpty())
692 progressBarLabel->setVisible(false);
694 progressBar->setVisible(false);
695 tooltip = tr("Downloaded %1 blocks of transaction history.").arg(count);
698 // Override progressBarLabel text and hide progress bar, when we have warnings to display
699 if (!strStatusBarWarnings.isEmpty())
701 progressBarLabel->setText(strStatusBarWarnings);
702 progressBarLabel->setVisible(true);
703 progressBar->setVisible(false);
706 tooltip = tr("Current PoW difficulty is %1.").arg(clientModel->getDifficulty(false)) + QString("<br>") + tooltip;
707 tooltip = tr("Current PoS difficulty is %1.").arg(clientModel->getDifficulty(true)) + QString("<br>") + tooltip;
709 QDateTime lastBlockDate = clientModel->getLastBlockDate();
710 int secs = lastBlockDate.secsTo(QDateTime::currentDateTime());
713 // Represent time from last generated block in human readable text
716 // Fully up to date. Leave text empty.
720 text = tr("%n second(s) ago","",secs);
722 else if(secs < 60*60)
724 text = tr("%n minute(s) ago","",secs/60);
726 else if(secs < 24*60*60)
728 text = tr("%n hour(s) ago","",secs/(60*60));
732 text = tr("%n day(s) ago","",secs/(60*60*24));
735 // Set icon state: spinning if catching up, tick otherwise
736 if(secs < 90*60 && count >= nTotalBlocks)
738 tooltip = tr("Up to date") + QString(".<br>") + tooltip;
739 labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
741 overviewPage->showOutOfSyncWarning(false);
745 tooltip = tr("Catching up...") + QString("<br>") + tooltip;
746 labelBlocksIcon->setMovie(syncIconMovie);
747 syncIconMovie->start();
749 overviewPage->showOutOfSyncWarning(true);
754 tooltip += QString("<br>");
755 tooltip += tr("Last received block was generated %1.").arg(text);
758 // Don't word-wrap this (fixed-width) tooltip
759 tooltip = QString("<nobr>") + tooltip + QString("</nobr>");
761 labelBlocksIcon->setToolTip(tooltip);
762 progressBarLabel->setToolTip(tooltip);
763 progressBar->setToolTip(tooltip);
766 void BitcoinGUI::updateMining()
771 labelMiningIcon->setPixmap(QIcon(":/icons/mining_inactive").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
773 if (!clientModel->getNumConnections())
775 labelMiningIcon->setToolTip(tr("Wallet is offline"));
779 if (walletModel->getEncryptionStatus() == WalletModel::Locked)
781 labelMiningIcon->setToolTip(tr("Wallet is locked"));
785 if (clientModel->inInitialBlockDownload() || clientModel->getNumBlocksOfPeers() > clientModel->getNumBlocks())
787 labelMiningIcon->setToolTip(tr("Blockchain download is in progress"));
791 if (nStakeInputsMapSize > 0)
793 labelMiningIcon->setPixmap(QIcon(":/icons/mining_active").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
795 uint64_t nNetworkWeight = clientModel->getPoSKernelPS();
797 labelMiningIcon->setToolTip(QString("<nobr>")+tr("Stake miner is active<br>%1 inputs being used for mining<br>Network weight is %3").arg(nStakeInputsMapSize).arg(nNetworkWeight)+QString("<\nobr>"));
800 labelMiningIcon->setToolTip(tr("No suitable inputs were found"));
803 void BitcoinGUI::message(const QString &title, const QString &message, unsigned int style, const QString &detail)
805 QString strTitle = tr("NovaCoin") + " - ";
806 // Default to information icon
807 int nMBoxIcon = QMessageBox::Information;
808 int nNotifyIcon = Notificator::Information;
811 // Check for usage of predefined title
813 case CClientUIInterface::MSG_ERROR:
814 strTitle += tr("Error");
816 case CClientUIInterface::MSG_WARNING:
817 strTitle += tr("Warning");
819 case CClientUIInterface::MSG_INFORMATION:
820 strTitle += tr("Information");
823 strTitle += title; // Use supplied title
826 // Check for error/warning icon
827 if (style & CClientUIInterface::ICON_ERROR) {
828 nMBoxIcon = QMessageBox::Critical;
829 nNotifyIcon = Notificator::Critical;
831 else if (style & CClientUIInterface::ICON_WARNING) {
832 nMBoxIcon = QMessageBox::Warning;
833 nNotifyIcon = Notificator::Warning;
837 if (style & CClientUIInterface::MODAL) {
838 // Check for buttons, use OK as default, if none was supplied
839 QMessageBox::StandardButton buttons;
840 buttons = QMessageBox::Ok;
842 QMessageBox mBox((QMessageBox::Icon)nMBoxIcon, strTitle, message, buttons);
844 if(!detail.isEmpty()) { mBox.setDetailedText(detail); }
849 notificator->notify((Notificator::Class)nNotifyIcon, strTitle, message);
853 void BitcoinGUI::changeEvent(QEvent *e)
855 QMainWindow::changeEvent(e);
856 #ifndef Q_OS_MAC // Ignored on Mac
857 if(e->type() == QEvent::WindowStateChange)
859 if(clientModel && clientModel->getOptionsModel()->getMinimizeToTray())
861 QWindowStateChangeEvent *wsevt = static_cast<QWindowStateChangeEvent*>(e);
862 if(!(wsevt->oldState() & Qt::WindowMinimized) && isMinimized())
864 QTimer::singleShot(0, this, SLOT(hide()));
872 void BitcoinGUI::closeEvent(QCloseEvent *event)
876 #ifndef Q_OS_MAC // Ignored on Mac
877 if(!clientModel->getOptionsModel()->getMinimizeOnClose())
883 // close rpcConsole in case it was open to make some space for the shutdown window
886 QMainWindow::closeEvent(event);
889 void BitcoinGUI::askFee(qint64 nFeeRequired, bool *payFee)
892 tr("This transaction is over the size limit. You can still send it for a fee of %1, "
893 "which goes to the nodes that process your transaction and helps to support the network. "
894 "Do you want to pay the fee?").arg(
895 BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, nFeeRequired));
896 QMessageBox::StandardButton retval = QMessageBox::question(
897 this, tr("Confirm transaction fee"), strMessage,
898 QMessageBox::Yes|QMessageBox::Cancel, QMessageBox::Yes);
899 *payFee = (retval == QMessageBox::Yes);
902 void BitcoinGUI::incomingTransaction(const QModelIndex & parent, int start, int end)
904 if(!walletModel || !clientModel)
906 TransactionTableModel *ttm = walletModel->getTransactionTableModel();
907 qint64 amount = ttm->index(start, TransactionTableModel::Amount, parent)
908 .data(Qt::EditRole).toULongLong();
909 if(!clientModel->inInitialBlockDownload())
911 // On new transaction, make an info balloon
912 // Unless the initial block download is in progress, to prevent balloon-spam
913 QString date = ttm->index(start, TransactionTableModel::Date, parent)
915 QString type = ttm->index(start, TransactionTableModel::Type, parent)
917 QString address = ttm->index(start, TransactionTableModel::ToAddress, parent)
919 QIcon icon = qvariant_cast<QIcon>(ttm->index(start,
920 TransactionTableModel::ToAddress, parent)
921 .data(Qt::DecorationRole));
923 notificator->notify(Notificator::Information,
924 (amount)<0 ? tr("Sent transaction") :
925 tr("Incoming transaction"),
931 .arg(BitcoinUnits::formatWithUnit(walletModel->getOptionsModel()->getDisplayUnit(), amount, true))
933 .arg(address), icon);
937 void BitcoinGUI::gotoOverviewPage()
939 overviewAction->setChecked(true);
940 centralWidget->setCurrentWidget(overviewPage);
942 exportAction->setEnabled(false);
943 disconnect(exportAction, SIGNAL(triggered()), 0, 0);
946 void BitcoinGUI::gotoHistoryPage()
948 historyAction->setChecked(true);
949 centralWidget->setCurrentWidget(transactionsPage);
951 exportAction->setEnabled(true);
952 disconnect(exportAction, SIGNAL(triggered()), 0, 0);
953 connect(exportAction, SIGNAL(triggered()), transactionView, SLOT(exportClicked()));
956 void BitcoinGUI::gotoMintingPage()
958 mintingAction->setChecked(true);
959 centralWidget->setCurrentWidget(mintingPage);
961 exportAction->setEnabled(true);
962 disconnect(exportAction, SIGNAL(triggered()), 0, 0);
963 connect(exportAction, SIGNAL(triggered()), mintingView, SLOT(exportClicked()));
967 void BitcoinGUI::gotoAddressBookPage()
969 addressBookAction->setChecked(true);
970 centralWidget->setCurrentWidget(addressBookPage);
972 exportAction->setEnabled(true);
973 disconnect(exportAction, SIGNAL(triggered()), 0, 0);
974 connect(exportAction, SIGNAL(triggered()), addressBookPage, SLOT(exportClicked()));
977 void BitcoinGUI::gotoReceiveCoinsPage()
979 receiveCoinsAction->setChecked(true);
980 centralWidget->setCurrentWidget(receiveCoinsPage);
982 exportAction->setEnabled(true);
983 disconnect(exportAction, SIGNAL(triggered()), 0, 0);
984 connect(exportAction, SIGNAL(triggered()), receiveCoinsPage, SLOT(exportClicked()));
987 void BitcoinGUI::gotoSendCoinsPage()
989 sendCoinsAction->setChecked(true);
990 centralWidget->setCurrentWidget(sendCoinsPage);
992 exportAction->setEnabled(false);
993 disconnect(exportAction, SIGNAL(triggered()), 0, 0);
996 void BitcoinGUI::gotoSignMessageTab(QString addr)
998 // call show() in showTab_SM()
999 signVerifyMessageDialog->showTab_SM(true);
1002 signVerifyMessageDialog->setAddress_SM(addr);
1005 void BitcoinGUI::gotoVerifyMessageTab(QString addr)
1007 // call show() in showTab_VM()
1008 signVerifyMessageDialog->showTab_VM(true);
1011 signVerifyMessageDialog->setAddress_VM(addr);
1014 void BitcoinGUI::gotoSecondAuthPage(QString addr)
1016 secondAuthDialog->show();
1017 secondAuthDialog->raise();
1018 secondAuthDialog->activateWindow();
1021 void BitcoinGUI::gotoMultisigPage()
1023 multisigPage->show();
1024 multisigPage->raise();
1025 multisigPage->activateWindow();
1028 void BitcoinGUI::dragEnterEvent(QDragEnterEvent *event)
1031 if(event->mimeData()->hasUrls())
1032 event->acceptProposedAction();
1035 void BitcoinGUI::dropEvent(QDropEvent *event)
1037 if(event->mimeData()->hasUrls())
1039 int nValidUrisFound = 0;
1040 QList<QUrl> uris = event->mimeData()->urls();
1041 foreach(const QUrl &uri, uris)
1043 if (sendCoinsPage->handleURI(uri.toString()))
1047 // if valid URIs were found
1048 if (nValidUrisFound)
1049 gotoSendCoinsPage();
1051 notificator->notify(Notificator::Warning, tr("URI handling"), tr("URI can not be parsed! This can be caused by an invalid NovaCoin address or malformed URI parameters."));
1054 event->acceptProposedAction();
1057 void BitcoinGUI::handleURI(QString strURI)
1059 // URI has to be valid
1060 if (sendCoinsPage->handleURI(strURI))
1062 showNormalIfMinimized();
1063 gotoSendCoinsPage();
1066 notificator->notify(Notificator::Warning, tr("URI handling"), tr("URI can not be parsed! This can be caused by an invalid NovaCoin address or malformed URI parameters."));
1069 void BitcoinGUI::setEncryptionStatus(int status)
1073 case WalletModel::Unencrypted:
1074 labelEncryptionIcon->hide();
1075 encryptWalletAction->setChecked(false);
1076 changePassphraseAction->setEnabled(false);
1077 lockWalletAction->setEnabled(false);
1078 unlockWalletAction->setEnabled(false);
1079 unlockWalletMiningAction->setEnabled(false);
1080 encryptWalletAction->setEnabled(true);
1082 case WalletModel::Unlocked:
1083 labelEncryptionIcon->show();
1084 labelEncryptionIcon->setPixmap(QIcon(":/icons/lock_open").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
1085 labelEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>unlocked</b>"));
1086 encryptWalletAction->setChecked(true);
1087 changePassphraseAction->setEnabled(true);
1088 encryptWalletAction->setEnabled(true);
1090 lockWalletAction->setEnabled(true);
1091 lockWalletAction->setChecked(false);
1092 unlockWalletAction->setEnabled(false);
1093 unlockWalletMiningAction->setEnabled(false);
1095 if (fWalletUnlockMintOnly)
1096 unlockWalletMiningAction->setChecked(true);
1098 unlockWalletAction->setChecked(true);
1101 case WalletModel::Locked:
1102 labelEncryptionIcon->show();
1103 labelEncryptionIcon->setPixmap(QIcon(":/icons/lock_closed").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
1104 labelEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>locked</b>"));
1105 encryptWalletAction->setChecked(true);
1106 changePassphraseAction->setEnabled(true);
1107 encryptWalletAction->setEnabled(true);
1109 lockWalletAction->setChecked(true);
1110 unlockWalletAction->setChecked(false);
1111 unlockWalletMiningAction->setChecked(false);
1113 lockWalletAction->setEnabled(false);
1114 unlockWalletAction->setEnabled(true);
1115 unlockWalletMiningAction->setEnabled(true);
1120 void BitcoinGUI::encryptWallet(bool status)
1124 AskPassphraseDialog dlg(status ? AskPassphraseDialog::Encrypt:
1125 AskPassphraseDialog::Decrypt, this);
1126 dlg.setModel(walletModel);
1129 setEncryptionStatus(walletModel->getEncryptionStatus());
1132 void BitcoinGUI::unlockWalletMining(bool status)
1137 // Unlock wallet when requested by wallet model
1138 if(walletModel->getEncryptionStatus() == WalletModel::Locked)
1140 AskPassphraseDialog dlg(AskPassphraseDialog::UnlockMining, this);
1141 dlg.setModel(walletModel);
1146 void BitcoinGUI::backupWallet()
1148 #if QT_VERSION < 0x050000
1149 QString saveDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
1151 QString saveDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
1153 QString filename = QFileDialog::getSaveFileName(this, tr("Backup Wallet"), saveDir, tr("Wallet Data (*.dat)"));
1154 if(!filename.isEmpty()) {
1155 if(!walletModel->backupWallet(filename)) {
1156 QMessageBox::warning(this, tr("Backup Failed"), tr("There was an error trying to save the wallet data to the new location."));
1161 void BitcoinGUI::dumpWallet()
1166 WalletModel::UnlockContext ctx(walletModel->requestUnlock());
1169 // Unlock wallet failed or was cancelled
1173 #if QT_VERSION < 0x050000
1174 QString saveDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
1176 QString saveDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
1178 QString filename = QFileDialog::getSaveFileName(this, tr("Dump Wallet"), saveDir, tr("Wallet dump (*.txt)"));
1179 if(!filename.isEmpty()) {
1180 if(!walletModel->dumpWallet(filename)) {
1181 message(tr("Dump failed"),
1182 tr("An error happened while trying to save the keys to your location.\n"
1183 "Keys were not saved.")
1184 ,CClientUIInterface::MSG_ERROR);
1187 message(tr("Dump successful"),
1188 tr("Keys were saved to this file:\n%2")
1190 ,CClientUIInterface::MSG_INFORMATION);
1194 void BitcoinGUI::importWallet()
1199 WalletModel::UnlockContext ctx(walletModel->requestUnlock());
1202 // Unlock wallet failed or was cancelled
1206 #if QT_VERSION < 0x050000
1207 QString openDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
1209 QString openDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
1211 QString filename = QFileDialog::getOpenFileName(this, tr("Import Wallet"), openDir, tr("Wallet dump (*.txt)"));
1212 if(!filename.isEmpty()) {
1213 if(!walletModel->importWallet(filename)) {
1214 message(tr("Import Failed"),
1215 tr("An error happened while trying to import the keys.\n"
1216 "Some or all keys from:\n %1,\n were not imported into your wallet.")
1218 ,CClientUIInterface::MSG_ERROR);
1221 message(tr("Import Successful"),
1222 tr("All keys from:\n %1,\n were imported into your wallet.")
1224 ,CClientUIInterface::MSG_INFORMATION);
1229 void BitcoinGUI::changePassphrase()
1231 AskPassphraseDialog dlg(AskPassphraseDialog::ChangePass, this);
1232 dlg.setModel(walletModel);
1236 void BitcoinGUI::unlockWallet()
1240 // Unlock wallet when requested by wallet model
1241 if(walletModel->getEncryptionStatus() == WalletModel::Locked)
1243 AskPassphraseDialog dlg(AskPassphraseDialog::Unlock, this);
1244 dlg.setModel(walletModel);
1249 void BitcoinGUI::lockWallet()
1254 walletModel->setWalletLocked(true);
1257 void BitcoinGUI::showNormalIfMinimized(bool fToggleHidden)
1259 // activateWindow() (sometimes) helps with keyboard focus on Windows
1262 // Make sure the window is not minimized
1263 setWindowState(windowState() & (~Qt::WindowMinimized | Qt::WindowActive));
1269 else if (isMinimized())
1275 else if (GUIUtil::isObscured(this))
1282 if (GUIUtil::isObscured(this))
1286 else if(fToggleHidden)
1290 void BitcoinGUI::toggleHidden()
1292 showNormalIfMinimized(true);
1295 void BitcoinGUI::error(const QString &title, const QString &message, bool modal)
1297 // Report errors from network/worker thread
1300 QMessageBox::critical(this, title, message, QMessageBox::Ok, QMessageBox::Ok);
1302 notificator->notify(Notificator::Critical, title, message);