5#include <bitcoin-build-config.h>
36#include <chainparams.h>
42#include <validation.h>
47#include <QActionGroup>
48#include <QApplication>
52#include <QDragEnterEvent>
53#include <QInputDialog>
54#include <QKeySequence>
60#include <QProgressDialog>
64#include <QStackedWidget>
67#include <QSystemTrayIcon>
84#if defined(Q_OS_MACOS)
86#elif defined(Q_OS_WIN)
96 trayIconMenu{new QMenu()},
97 platformStyle(_platformStyle),
98 m_network_style(networkStyle)
101 if (!restoreGeometry(settings.value(
"MainWindowGeometry").toByteArray())) {
103 move(QGuiApplication::primaryScreen()->availableGeometry().center() - frameGeometry().center());
106 setContextMenuPolicy(Qt::PreventContextMenu);
141 setAcceptDrops(
true);
154 if (QSystemTrayIcon::isSystemTrayAvailable()) {
163 statusBar()->setSizeGripEnabled(
false);
166 QFrame *frameBlocks =
new QFrame();
167 frameBlocks->setContentsMargins(0,0,0,0);
168 frameBlocks->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
169 QHBoxLayout *frameBlocksLayout =
new QHBoxLayout(frameBlocks);
170 frameBlocksLayout->setContentsMargins(3,0,3,0);
171 frameBlocksLayout->setSpacing(3);
180 frameBlocksLayout->addStretch();
182 frameBlocksLayout->addStretch();
189 frameBlocksLayout->addStretch();
191 frameBlocksLayout->addStretch();
193 frameBlocksLayout->addStretch();
205 QString curStyle = QApplication::style()->metaObject()->className();
206 if(curStyle ==
"QWindowsStyle" || curStyle ==
"QWindowsXPStyle")
208 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; }");
213 statusBar()->addPermanentWidget(frameBlocks);
216 this->installEventFilter(
this);
244 settings.setValue(
"MainWindowGeometry", saveGeometry());
248 delete m_app_nap_inhibitor;
257 QActionGroup *tabGroup =
new QActionGroup(
this);
261 overviewAction->setStatusTip(tr(
"Show general overview of wallet"));
264 overviewAction->setShortcut(QKeySequence(QStringLiteral(
"Alt+1")));
275 receiveCoinsAction->setStatusTip(tr(
"Request payments (generates QR codes and bitcoin: URIs)"));
282 historyAction->setStatusTip(tr(
"Browse transaction history"));
285 historyAction->setShortcut(QKeySequence(QStringLiteral(
"Alt+4")));
292 connect(
overviewAction, &QAction::triggered,
this, &BitcoinGUI::gotoOverviewPage);
294 connect(
sendCoinsAction, &QAction::triggered, [
this]{ gotoSendCoinsPage(); });
296 connect(
receiveCoinsAction, &QAction::triggered,
this, &BitcoinGUI::gotoReceiveCoinsPage);
298 connect(
historyAction, &QAction::triggered,
this, &BitcoinGUI::gotoHistoryPage);
302 quitAction->setStatusTip(tr(
"Quit application"));
303 quitAction->setShortcut(QKeySequence(tr(
"Ctrl+Q")));
305 aboutAction =
new QAction(tr(
"&About %1").arg(CLIENT_NAME),
this);
306 aboutAction->setStatusTip(tr(
"Show information about %1").arg(CLIENT_NAME));
310 aboutQtAction->setStatusTip(tr(
"Show information about Qt"));
313 optionsAction->setStatusTip(tr(
"Modify configuration options for %1").arg(CLIENT_NAME));
318 encryptWalletAction->setStatusTip(tr(
"Encrypt the private keys that belong to your wallet"));
325 signMessageAction->setStatusTip(tr(
"Sign messages with your Bitcoin addresses to prove you own them"));
327 verifyMessageAction->setStatusTip(tr(
"Verify messages to ensure they were signed with specified Bitcoin addresses"));
344 openAction =
new QAction(tr(
"Open &URI…"),
this);
345 openAction->setStatusTip(tr(
"Open a bitcoin: URI"));
375 showHelpMessageAction->setStatusTip(tr(
"Show the %1 help message to get a list with possible Bitcoin command-line options").arg(CLIENT_NAME));
384 connect(
aboutQtAction, &QAction::triggered, qApp, QApplication::aboutQt);
398 connect(
signMessageAction, &QAction::triggered, [
this]{ gotoSignMessageTab(); });
405 connect(
openAction, &QAction::triggered,
this, &BitcoinGUI::openClicked);
409 const auto& [loaded, format] = info;
410 QString name = GUIUtil::WalletDisplayName(path);
413 name.replace(QChar(
'&'), QString(
"&&"));
414 bool is_legacy = format ==
"bdb";
416 name +=
" (needs migration)";
420 if (loaded || is_legacy) {
422 action->setEnabled(
false);
426 connect(action, &QAction::triggered, [
this, path] {
430 activity->open(path);
435 action->setEnabled(
false);
440 QString name_data_file = tr(
"Wallet Data");
443 QString title_windows = tr(
"Load Wallet Backup");
445 QString backup_file =
GUIUtil::getOpenFileName(
this, title_windows, QString(), name_data_file + QLatin1String(
" (*.dat)"),
nullptr);
446 if (backup_file.isEmpty())
return;
451 QString title = tr(
"Restore Wallet");
453 QString label = tr(
"Wallet Name");
454 QString wallet_name = QInputDialog::getText(
this, title, label, QLineEdit::Normal,
"", &wallet_name_ok);
455 if (!wallet_name_ok || wallet_name.isEmpty())
return;
462 activity->restore(backup_file_path, wallet_name.toStdString());
474 const auto& [loaded, format] = info;
476 if (format !=
"bdb") {
483 name.replace(QChar(
'&'), QString(
"&&"));
486 connect(action, &QAction::triggered, [
this, wallet_name] {
489 activity->migrate(wallet_name);
494 action->setEnabled(
false);
497 QAction* restore_migrate_file_action =
m_migrate_wallet_menu->addAction(tr(
"Restore and Migrate Wallet File..."));
498 restore_migrate_file_action->setEnabled(
true);
500 connect(restore_migrate_file_action, &QAction::triggered, [
this] {
501 QString name_data_file = tr(
"Wallet Data");
502 QString title_windows = tr(
"Restore and Migrate Wallet Backup");
504 QString backup_file =
GUIUtil::getOpenFileName(
this, title_windows, QString(), name_data_file + QLatin1String(
" (*.dat)"),
nullptr);
505 if (backup_file.isEmpty())
return;
510 QString title = tr(
"Restore and Migrate Wallet");
512 QString label = tr(
"Wallet Name");
513 QString wallet_name = QInputDialog::getText(
this, title, label, QLineEdit::Normal,
"", &wallet_name_ok);
514 if (!wallet_name_ok || wallet_name.isEmpty())
return;
520 activity->restore_and_migrate(backup_file_path, wallet_name.toStdString());
524 connect(m_mask_values_action, &QAction::toggled,
this, &BitcoinGUI::enableHistoryAction);
529 connect(
new QShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_D),
this), &QShortcut::activated,
this, &
BitcoinGUI::showDebugWindow);
537 QMenu *file =
appMenuBar->addMenu(tr(
"&File"));
545 file->addSeparator();
548 file->addSeparator();
554 file->addSeparator();
558 QMenu *settings =
appMenuBar->addMenu(tr(
"&Settings"));
563 settings->addSeparator();
565 settings->addSeparator();
569 QMenu* window_menu =
appMenuBar->addMenu(tr(
"&Window"));
571 QAction* minimize_action = window_menu->addAction(tr(
"&Minimize"));
572 minimize_action->setShortcut(QKeySequence(tr(
"Ctrl+M")));
573 connect(minimize_action, &QAction::triggered, [] {
574 QApplication::activeWindow()->showMinimized();
576 connect(qApp, &QApplication::focusWindowChanged,
this, [minimize_action] (QWindow* window) {
577 minimize_action->setEnabled(window !=
nullptr && (window->flags() & Qt::Dialog) != Qt::Dialog && window->windowState() != Qt::WindowMinimized);
581 QAction* zoom_action = window_menu->addAction(tr(
"Zoom"));
582 connect(zoom_action, &QAction::triggered, [] {
583 QWindow* window = qApp->focusWindow();
584 if (window->windowState() != Qt::WindowMaximized) {
585 window->showMaximized();
587 window->showNormal();
591 connect(qApp, &QApplication::focusWindowChanged,
this, [zoom_action] (QWindow* window) {
592 zoom_action->setEnabled(window !=
nullptr);
598 window_menu->addSeparator();
599 QAction* main_window_action = window_menu->addAction(tr(
"Main Window"));
600 connect(main_window_action, &QAction::triggered, [
this] {
604 window_menu->addSeparator();
609 window_menu->addSeparator();
613 connect(tab_action, &QAction::triggered, [
this, tab_type] {
621 help->addSeparator();
630 QToolBar *toolbar = addToolBar(tr(
"Tabs toolbar"));
632 toolbar->setMovable(
false);
633 toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
641 QWidget *spacer =
new QWidget();
642 spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
643 toolbar->addWidget(spacer);
647 connect(
m_wallet_selector, qOverload<int>(&QComboBox::currentIndexChanged),
this, &BitcoinGUI::setCurrentWalletBySelectorIndex);
735void BitcoinGUI::enableHistoryAction(
bool privacy)
743void BitcoinGUI::setWalletController(
WalletController* wallet_controller,
bool show_loading_minimized)
746 assert(wallet_controller);
759 connect(wallet_controller, &WalletController::destroyed,
this, [
this] {
765 activity->load(show_loading_minimized);
773void BitcoinGUI::addWallet(
WalletModel* walletModel)
799 enableHistoryAction(privacy);
804void BitcoinGUI::removeWallet(
WalletModel* walletModel)
825void BitcoinGUI::setCurrentWallet(
WalletModel* wallet_model)
838void BitcoinGUI::setCurrentWalletBySelectorIndex(
int index)
841 if (wallet_model) setCurrentWallet(wallet_model);
844void BitcoinGUI::removeAllWallets()
873 assert(QSystemTrayIcon::isSystemTrayAvailable());
876 if (QSystemTrayIcon::isSystemTrayAvailable()) {
891 QAction* show_hide_action{
nullptr};
898 QAction* send_action{
nullptr};
899 QAction* receive_action{
nullptr};
900 QAction* sign_action{
nullptr};
901 QAction* verify_action{
nullptr};
911 options_action->setMenuRole(QAction::PreferencesRole);
913 QAction* quit_action{
nullptr};
920 connect(
trayIcon, &QSystemTrayIcon::activated, [
this](QSystemTrayIcon::ActivationReason reason) {
921 if (reason == QSystemTrayIcon::Trigger) {
941 [
this, show_hide_action, send_action, receive_action, sign_action, verify_action, options_action, node_window_action, quit_action] {
942 if (m_node.shutdownRequested()) return;
944 if (show_hide_action) show_hide_action->setText(
945 (!isHidden() && !isMinimized() && !GUIUtil::isObscured(this)) ?
948 if (QApplication::activeModalWidget()) {
949 for (QAction* a : trayIconMenu.get()->actions()) {
950 a->setEnabled(false);
953 if (show_hide_action) show_hide_action->setEnabled(true);
955 send_action->setEnabled(sendCoinsAction->isEnabled());
956 receive_action->setEnabled(receiveCoinsAction->isEnabled());
957 sign_action->setEnabled(signMessageAction->isEnabled());
958 verify_action->setEnabled(verifyMessageAction->isEnabled());
962 if (quit_action) quit_action->setEnabled(
true);
999void BitcoinGUI::openClicked()
1008void BitcoinGUI::gotoOverviewPage()
1014void BitcoinGUI::gotoHistoryPage()
1020void BitcoinGUI::gotoReceiveCoinsPage()
1026void BitcoinGUI::gotoSendCoinsPage(QString addr)
1032void BitcoinGUI::gotoSignMessageTab(QString addr)
1037void BitcoinGUI::gotoVerifyMessageTab(QString addr)
1041void BitcoinGUI::gotoLoadPSBT(
bool from_clipboard)
1054 case 0: icon =
":/icons/connect_0";
break;
1055 case 1:
case 2:
case 3: icon =
":/icons/connect_1";
break;
1056 case 4:
case 5:
case 6: icon =
":/icons/connect_2";
break;
1057 case 7:
case 8:
case 9: icon =
":/icons/connect_3";
break;
1058 default: icon =
":/icons/connect_4";
break;
1065 tooltip = tr(
"%n active connection(s) to Bitcoin network.",
"",
count);
1068 tooltip = tr(
"Network activity disabled.");
1069 icon =
":/icons/network_disabled";
1073 tooltip = QLatin1String(
"<nobr>") + tooltip + QLatin1String(
"<br>") +
1075 tr(
"Click for more actions.") + QLatin1String(
"</nobr>");
1092 tr(
"Show Peers tab"),
1100 tr(
"Disable network activity") :
1102 tr(
"Enable network activity"),
1112 progressBarLabel->setText(tr(
"Syncing Headers (%1%)…").arg(QString::number(100.0 / (headersTipHeight+estHeadersLeft)*headersTipHeight,
'f', 1)));
1119 progressBarLabel->setText(tr(
"Pre-syncing Headers (%1%)…").arg(QString::number(100.0 / (height+estHeadersLeft)*height,
'f', 1)));
1129 dlg->setCurrentTab(tab);
1140 m_app_nap_inhibitor->enableAppNap();
1142 m_app_nap_inhibitor->disableAppNap();
1157 statusBar()->clearMessage();
1161 switch (blockSource) {
1190 QDateTime currentDate = QDateTime::currentDateTime();
1191 qint64 secs = blockDate.secsTo(currentDate);
1193 tooltip = tr(
"Processed %n block(s) of transaction history.",
"",
count);
1197 tooltip = tr(
"Up to date") + QString(
".<br>") + tooltip;
1216 progressBar->setFormat(tr(
"%1 behind").arg(timeBehindText));
1218 progressBar->setValue(nVerificationProgress * 1000000000.0 + 0.5);
1221 tooltip = tr(
"Catching up…") + QString(
"<br>") + tooltip;
1225 QString(
":/animation/spinner-%1").arg(
spinnerFrame, 3, 10, QChar(
'0')),
1239 tooltip += QString(
"<br>");
1240 tooltip += tr(
"Last received block was generated %1 ago.").arg(timeBehindText);
1241 tooltip += QString(
"<br>");
1242 tooltip += tr(
"Transactions after this will not yet be visible.");
1246 tooltip = QString(
"<nobr>") + tooltip + QString(
"</nobr>");
1263void BitcoinGUI::message(
const QString& title, QString message,
unsigned int style,
bool*
ret,
const QString& detailed_message)
1266 QString strTitle{CLIENT_NAME};
1268 int nMBoxIcon = QMessageBox::Information;
1272 if (!title.isEmpty()) {
1277 msgType = tr(
"Error");
1281 msgType = tr(
"Warning");
1285 msgType = tr(
"Information");
1293 if (!msgType.isEmpty()) {
1294 strTitle +=
" - " + msgType;
1298 nMBoxIcon = QMessageBox::Critical;
1307 QMessageBox::StandardButton buttons;
1309 buttons = QMessageBox::Ok;
1312 QMessageBox mBox(
static_cast<QMessageBox::Icon
>(nMBoxIcon), strTitle,
message, buttons,
this);
1313 mBox.setTextFormat(Qt::PlainText);
1314 mBox.setDetailedText(detailed_message);
1315 int r = mBox.exec();
1317 *
ret = r == QMessageBox::Ok;
1325 if (e->type() == QEvent::PaletteChange) {
1332 QMainWindow::changeEvent(e);
1335 if(e->type() == QEvent::WindowStateChange)
1339 QWindowStateChangeEvent *wsevt =
static_cast<QWindowStateChangeEvent*
>(e);
1340 if(!(wsevt->oldState() & Qt::WindowMinimized) && isMinimized())
1342 QTimer::singleShot(0,
this, &BitcoinGUI::hide);
1345 else if((wsevt->oldState() & Qt::WindowMinimized) && !isMinimized())
1347 QTimer::singleShot(0,
this, &BitcoinGUI::show);
1369 QMainWindow::showMinimized();
1374 QMainWindow::closeEvent(event);
1387void BitcoinGUI::incomingTransaction(
const QString& date,
BitcoinUnit unit,
const CAmount& amount,
const QString& type,
const QString& address,
const QString& label,
const QString& walletName)
1390 QString
msg = tr(
"Date: %1\n").arg(date) +
1393 msg += tr(
"Wallet: %1\n").arg(walletName);
1395 msg += tr(
"Type: %1\n").arg(type);
1396 if (!label.isEmpty())
1397 msg += tr(
"Label: %1\n").arg(label);
1398 else if (!address.isEmpty())
1399 msg += tr(
"Address: %1\n").arg(address);
1400 message((amount)<0 ? tr(
"Sent transaction") : tr(
"Incoming transaction"),
1408 if(event->mimeData()->hasUrls())
1409 event->acceptProposedAction();
1414 if(event->mimeData()->hasUrls())
1416 for (
const QUrl &uri : event->mimeData()->urls())
1421 event->acceptProposedAction();
1427 if (event->type() == QEvent::StatusTip)
1433 return QMainWindow::eventFilter(
object, event);
1443 gotoSendCoinsPage();
1449void BitcoinGUI::setHDStatus(
bool privkeyDisabled,
int hdEnabled)
1452 labelWalletHDStatusIcon->setToolTip(privkeyDisabled ? tr(
"Private key <b>disabled</b>") : hdEnabled ? tr(
"HD key generation is <b>enabled</b>") : tr(
"HD key generation is <b>disabled</b>"));
1456void BitcoinGUI::setEncryptionStatus(
int status)
1491void BitcoinGUI::updateWalletStatus()
1507 std::string ip_port;
1510 if (proxy_enabled) {
1512 QString ip_port_q = QString::fromStdString(ip_port);
1514 labelProxyIcon->setToolTip(tr(
"Proxy is <b>enabled</b>: %1").arg(ip_port_q));
1525 QString window_title = CLIENT_NAME;
1529 if (wallet_model && !wallet_model->
getWalletName().isEmpty()) {
1537 setWindowTitle(window_title);
1569 if (nProgress == 0) {
1575 }
else if (nProgress == 100) {
1600 QString detailed_message;
1602 detailed_message = BitcoinGUI::tr(
"Original message:") +
"\n" + QString::fromStdString(message.
original);
1606 bool invoked = QMetaObject::invokeMethod(gui,
"message",
1608 Q_ARG(QString, QString::fromStdString(caption)),
1609 Q_ARG(QString, QString::fromStdString(message.
translated)),
1610 Q_ARG(
unsigned int, style),
1612 Q_ARG(QString, detailed_message));
1638 : m_platform_style{platformStyle}
1641 setToolTip(tr(
"Unit to show amounts in. Click to select another unit."));
1644 const QFontMetrics fm(font());
1648 setMinimumSize(max_width, 0);
1649 setAlignment(Qt::AlignRight | Qt::AlignVCenter);
1661 if (e->type() == QEvent::PaletteChange) {
1663 if (style != styleSheet()) {
1664 setStyleSheet(style);
1668 QLabel::changeEvent(e);
1674 menu =
new QMenu(
this);
1705 QPoint globalPos = mapToGlobal(point);
1706 menu->exec(globalPos);
int64_t CAmount
Amount in satoshis (Can be negative)
static constexpr int64_t MAX_BLOCK_TIME_GAP
Maximum gap between node time and block time used for the "Catching up..." mode in GUI.
static bool ThreadSafeMessageBox(BitcoinGUI *gui, const bilingual_str &message, const std::string &caption, unsigned int style)
const CChainParams & Params()
Return the currently selected parameters.
void updateHeadersPresyncProgressLabel(int64_t height, const QDateTime &blockDate)
GUIUtil::ClickableProgressBar * progressBar
QAction * m_close_all_wallets_action
void showEvent(QShowEvent *event) override
QLabel * progressBarLabel
QAction * m_open_wallet_action
static const std::string DEFAULT_UIPLATFORM
void createWallet()
Launch the wallet creation modal (no-op if wallet is not compiled)
void setNumBlocks(int count, const QDateTime &blockDate, double nVerificationProgress, SyncType synctype, SynchronizationState sync_state)
Set number of blocks and last block date shown in the UI.
void setClientModel(ClientModel *clientModel=nullptr, interfaces::BlockAndHeaderTipInfo *tip_info=nullptr)
Set the client model.
GUIUtil::ClickableLabel * connectionsControl
void receivedURI(const QString &uri)
Signal raised when a URI was entered or dragged to the GUI.
ModalOverlay * modalOverlay
GUIUtil::ThemedLabel * labelWalletEncryptionIcon
QAction * changePassphraseAction
void openOptionsDialogWithTab(OptionsDialog::Tab tab)
Open the OptionsDialog on the specified tab index.
int prevBlocks
Keep track of previous number of blocks, to detect progress.
QAction * openRPCConsoleAction
const NetworkStyle *const m_network_style
void changeEvent(QEvent *e) override
GUIUtil::ClickableLabel * labelProxyIcon
void optionsClicked()
Show configuration dialog.
bool eventFilter(QObject *object, QEvent *event) override
QMenu * m_open_wallet_menu
void createTrayIcon()
Create system tray icon and notification.
QAction * m_load_psbt_clipboard_action
void setNetworkActive(bool network_active)
Set network state shown in the UI.
void setPrivacy(bool privacy)
QProgressDialog * progressDialog
BitcoinGUI(interfaces::Node &node, const PlatformStyle *platformStyle, const NetworkStyle *networkStyle, QWidget *parent=nullptr)
std::unique_ptr< interfaces::Handler > m_handler_message_box
WalletFrame * walletFrame
void updateProxyIcon()
Set the proxy-enabled icon as shown in the UI.
QAction * m_restore_wallet_action
QAction * receiveCoinsAction
const std::unique_ptr< QMenu > trayIconMenu
QAction * usedSendingAddressesAction
void unsubscribeFromCoreSignals()
Disconnect core signals from GUI client.
void closeEvent(QCloseEvent *event) override
QAction * verifyMessageAction
QAction * m_migrate_wallet_action
void createTrayIconMenu()
Create system tray menu (or setup the dock menu)
HelpMessageDialog * helpMessageDialog
void aboutClicked()
Show about dialog.
void toggleHidden()
Simply calls showNormalIfMinimized(true)
QAction * encryptWalletAction
void updateNetworkState()
Update UI with latest network info from model.
void createActions()
Create the main UI actions.
void showDebugWindow()
Show debug window.
QAction * m_mask_values_action
void consoleShown(RPCConsole *console)
Signal raised when RPC console shown.
bool isPrivacyModeActivated() const
QMenu * m_migrate_wallet_menu
void showDebugWindowActivateConsole()
Show debug window and set focus to the console.
void dropEvent(QDropEvent *event) override
void showProgress(const QString &title, int nProgress)
Show progress dialog e.g.
QAction * usedReceivingAddressesAction
void subscribeToCoreSignals()
Connect core signals to GUI client.
void createToolBars()
Create the toolbars.
QAction * m_wallet_selector_action
UnitDisplayStatusBarControl * unitDisplayControl
void setWalletActionsEnabled(bool enabled)
Enable or disable all wallet-related actions.
const PlatformStyle * platformStyle
void dragEnterEvent(QDragEnterEvent *event) override
QAction * m_close_wallet_action
GUIUtil::ClickableLabel * labelBlocksIcon
interfaces::Node & m_node
QAction * m_create_wallet_action
QAction * m_load_psbt_action
void detectShutdown()
called by a timer to check if shutdown has been requested
QAction * m_wallet_selector_label_action
WalletController * m_wallet_controller
QMenu * m_network_context_menu
QAction * backupWalletAction
QAction * showHelpMessageAction
QComboBox * m_wallet_selector
QLabel * m_wallet_selector_label
void showNormalIfMinimized()
Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHid...
ClientModel * clientModel
void updateHeadersSyncProgressLabel()
void createMenuBar()
Create the menu bar and sub-menus.
QSystemTrayIcon * trayIcon
void message(const QString &title, QString message, unsigned int style, bool *ret=nullptr, const QString &detailed_message=QString())
Notify the user of an event from the core network or transaction handling code.
void showHelpMessageClicked()
Show help message dialog.
QAction * sendCoinsAction
void setNumConnections(int count)
Set number of connections shown in the UI.
QAction * signMessageAction
GUIUtil::ThemedLabel * labelWalletHDStatusIcon
Notificator * notificator
std::unique_ptr< interfaces::Handler > m_handler_question
static QList< Unit > availableUnits()
Get list of units, for drop-down box.
static QString longName(Unit unit)
Long name.
static QString formatWithUnit(Unit unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD)
Format as string (with unit)
const Consensus::Params & GetConsensus() const
Signals for UI communication.
@ BTN_MASK
Mask of all available buttons in CClientUIInterface::MessageBoxFlags This needs to be updated,...
@ MSG_INFORMATION
Predefined combinations for certain default usage cases.
@ MODAL
Force blocking, modal message box dialog (not just OS notification)
Model for Bitcoin network client.
void showProgress(const QString &title, int nProgress)
int getHeaderTipHeight() const
void message(const QString &title, const QString &message, unsigned int style)
Fired when a message should be reported to the user.
void numConnectionsChanged(int count)
BlockSource getBlockSource() const
Returns the block source of the current importing/syncing state.
int64_t getHeaderTipTime() const
int getNumConnections(unsigned int flags=CONNECTIONS_ALL) const
Return number of connections, default is in- and outbound (total)
void numBlocksChanged(int count, const QDateTime &blockDate, double nVerificationProgress, SyncType header, SynchronizationState sync_state)
OptionsModel * getOptionsModel()
bool getProxyInfo(std::string &ip_port) const
void networkActiveChanged(bool networkActive)
void created(WalletModel *wallet_model)
void clicked(const QPoint &point)
Emitted when the label is clicked.
void clicked(const QPoint &point)
Emitted when the progressbar is clicked.
void setThemedPixmap(const QString &image_filename, int width, int height)
"Help message" dialog box
macOS-specific Dock icon handler.
static MacDockIconHandler * instance()
void migrated(WalletModel *wallet_model)
Modal overlay to display information about the chain-sync state.
void showHide(bool hide=false, bool userRequested=false)
void tipUpdate(int count, const QDateTime &blockDate, double nVerificationProgress)
void triggered(bool hidden)
bool isLayerVisible() const
void setKnownBestHeight(int count, const QDateTime &blockDate, bool presync)
const QIcon & getTrayAndWindowIcon() const
const QString & getTitleAddText() const
Cross-platform desktop notification client.
@ Information
Informational message.
@ Critical
An error occurred.
@ Warning
Notify user of potential problem.
void notify(Class cls, const QString &title, const QString &text, const QIcon &icon=QIcon(), int millisTimeout=10000)
Show notification message.
void opened(WalletModel *wallet_model)
Interface from Qt to configuration data structure for Bitcoin client.
void displayUnitChanged(BitcoinUnit unit)
void showTrayIconChanged(bool)
bool getMinimizeToTray() const
BitcoinUnit getDisplayUnit() const
bool getShowTrayIcon() const
QVariant getOption(OptionID option, const std::string &suffix="") const
bool getMinimizeOnClose() const
void setDisplayUnit(const QVariant &new_unit)
Updates current unit in memory, settings and emits displayUnitChanged(new_unit) signal.
Local Bitcoin RPC console.
std::vector< TabTypes > tabs() const
QString tabTitle(TabTypes tab_type) const
QKeySequence tabShortcut(TabTypes tab_type) const
void setClientModel(ClientModel *model=nullptr, int bestblock_height=0, int64_t bestblock_date=0, double verification_progress=0.0)
void setTabFocus(enum TabTypes tabType)
set which tab has the focus (is visible)
void restored(WalletModel *wallet_model)
void changeEvent(QEvent *e) override
void mousePressEvent(QMouseEvent *event) override
So that it responds to left-button clicks.
void createContextMenu()
Creates context menu, its actions, and wires up all the relevant signals for mouse events.
void updateDisplayUnit(BitcoinUnit newUnits)
When Display Units are changed on OptionsModel it will refresh the display text of the control on the...
OptionsModel * optionsModel
UnitDisplayStatusBarControl(const PlatformStyle *platformStyle)
void onMenuSelection(QAction *action)
Tells underlying optionsModel to update its current display unit.
const PlatformStyle * m_platform_style
void setOptionsModel(OptionsModel *optionsModel)
Lets the control know about the Options Model (and its signals)
void onDisplayUnitsClicked(const QPoint &point)
Shows context menu with Display Unit options by the mouse coordinates.
Controller between interfaces::Node, WalletModel instances and the GUI.
void walletAdded(WalletModel *wallet_model)
void closeAllWallets(QWidget *parent=nullptr)
void walletRemoved(WalletModel *wallet_model)
void closeWallet(WalletModel *wallet_model, QWidget *parent=nullptr)
std::map< std::string, std::pair< bool, std::string > > listWalletDir() const
Returns all wallet names in the wallet dir mapped to whether the wallet is loaded.
A container for embedding all wallet-related controls into BitcoinGUI.
bool addView(WalletView *walletView)
void changePassphrase()
Change encrypted wallet passphrase.
WalletModel * currentWalletModel() const
void gotoHistoryPage()
Switch to history (transactions) page.
void gotoSignMessageTab(QString addr="")
Show Sign/Verify Message dialog and switch to sign message tab.
WalletView * currentWalletView() const
void gotoOverviewPage()
Switch to overview (home) page.
void gotoSendCoinsPage(QString addr="")
Switch to send coins page.
void removeWallet(WalletModel *wallet_model)
void setClientModel(ClientModel *clientModel)
void backupWallet()
Backup the wallet.
void usedSendingAddresses()
Show used sending addresses.
void createWalletButtonClicked()
void encryptWallet()
Encrypt the wallet.
void usedReceivingAddresses()
Show used receiving addresses.
void message(const QString &title, const QString &message, unsigned int style)
void setCurrentWallet(WalletModel *wallet_model)
bool handlePaymentRequest(const SendCoinsRecipient &recipient)
void gotoLoadPSBT(bool from_clipboard=false)
Load Partially Signed Bitcoin Transaction.
void showOutOfSyncWarning(bool fShow)
void gotoReceiveCoinsPage()
Switch to receive coins page.
void gotoVerifyMessageTab(QString addr="")
Show Sign/Verify Message dialog and switch to verify message tab.
Interface to Bitcoin wallet from Qt view code.
EncryptionStatus getEncryptionStatus() const
interfaces::Wallet & wallet() const
QString getDisplayName() const
static bool isWalletEnabled()
QString getWalletName() const
void outOfSyncWarningClicked()
Notify that the out of sync warning icon has been pressed.
WalletModel * getWalletModel() const noexcept
void message(const QString &title, const QString &message, unsigned int style)
Fired when a message should be reported to the user.
void incomingTransaction(const QString &date, BitcoinUnit unit, const CAmount &amount, const QString &type, const QString &address, const QString &label, const QString &walletName)
Notify that a new transaction appeared.
void transactionClicked()
void setPrivacy(bool privacy)
void encryptionStatusChanged()
Encryption status of wallet changed.
Top-level interface for a bitcoin node (bitcoind process).
virtual void setNetworkActive(bool active)=0
Set network active.
virtual std::unique_ptr< Handler > handleMessageBox(MessageBoxFn fn)=0
virtual bool getNetworkActive()=0
Get network active.
virtual std::unique_ptr< Handler > handleQuestion(QuestionFn fn)=0
virtual WalletLoader & walletLoader()=0
Get wallet loader.
virtual bool shutdownRequested()=0
Return whether shutdown was requested.
virtual bool hdEnabled()=0
virtual bool privateKeysDisabled()=0
virtual std::vector< std::unique_ptr< Wallet > > getWallets()=0
Return interfaces for accessing wallets (if any).
static path PathFromString(const std::string &string)
Convert byte string to path object.
static const int STATUSBAR_ICONSIZE
static constexpr int HEADER_HEIGHT_DELTA_SYNC
The required delta of headers to the estimated number of available headers until we show the IBD prog...
bool isObscured(QWidget *w)
Qt::ConnectionType blockingGUIThreadConnection()
Get connection type to call object slot in GUI thread with invokeMethod.
QString WalletDisplayName(const QString &name)
void PopupMenu(QMenu *menu, const QPoint &point, QAction *at_action)
Call QMenu::popup() only on supported QT_QPA_PLATFORM.
void ShowModalDialogAsynchronously(QDialog *dialog)
Shows a QDialog instance asynchronously, and deletes it on close.
void handleCloseWindowShortcut(QWidget *w)
void PolishProgressDialog(QProgressDialog *dialog)
QString getOpenFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedSuffixOut)
Get open filename, convenience wrapper for QFileDialog::getOpenFileName.
ClickableProgressBar ProgressBar
void bringToFront(QWidget *w)
bool HasPixmap(const QLabel *label)
Returns true if pixmap has been set.
QString formatNiceTimeOffset(qint64 secs)
auto ExceptionSafeConnect(Sender sender, Signal signal, Receiver receiver, Slot method, Qt::ConnectionType type=Qt::AutoConnection)
A drop-in replacement of QObject::connect function (see: https://doc.qt.io/qt-5/qobject....
int TextWidth(const QFontMetrics &fm, const QString &text)
Returns the distance in pixels appropriate for drawing a subsequent character after text.
int64_t nPowTargetSpacing
Block and header tip information.
double verification_progress
int64_t GetTime()
DEPRECATED Use either ClockType::now() or Now<TimePointType>() if a cast is needed.
SynchronizationState
Current sync state passed to tip changed callbacks.