From cc2df46e8866f9510649e2c3407526c4577b41fc Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Fri, 29 Aug 2025 08:28:16 +0000 Subject: [PATCH 01/12] merge bitcoin-core/gui#594: replace deprecated Q_OS_MAC with Q_OS_MACOS --- src/qt/bitcoingui.cpp | 32 ++++++++++++++++---------------- src/qt/bitcoingui.h | 4 ++-- src/qt/guiutil.cpp | 24 ++++++++++++------------ src/qt/notificator.cpp | 8 ++++---- src/qt/notificator.h | 2 +- src/qt/optionsdialog.cpp | 6 +++--- src/qt/rpcconsole.cpp | 2 +- src/qt/test/addressbooktests.cpp | 2 +- src/qt/test/apptests.cpp | 2 +- src/qt/test/wallettests.cpp | 2 +- src/qt/transactionview.cpp | 2 +- 11 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 08d0c6a16ca5..e102d3c30840 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -26,7 +26,7 @@ #include #endif // ENABLE_WALLET -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS #include #endif @@ -74,7 +74,7 @@ const std::string BitcoinGUI::DEFAULT_UIPLATFORM = -#if defined(Q_OS_MAC) +#if defined(Q_OS_MACOS) "macosx" #elif defined(Q_OS_WIN) "windows" @@ -228,7 +228,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const NetworkStyle* networkStyle, connect(labelBlocksIcon, &GUIUtil::ClickableLabel::clicked, this, &BitcoinGUI::showModalOverlay); connect(progressBar, &GUIUtil::ClickableProgressBar::clicked, this, &BitcoinGUI::showModalOverlay); -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS m_app_nap_inhibitor = new CAppNapInhibitor; #endif @@ -261,7 +261,7 @@ BitcoinGUI::~BitcoinGUI() settings.setValue("MainWindowGeometry", saveGeometry()); if(trayIcon) // Hide tray icon, as deleting will let it linger until quit (on Ubuntu) trayIcon->hide(); -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS delete m_app_nap_inhibitor; MacDockIconHandler::cleanup(); #endif @@ -643,7 +643,7 @@ void BitcoinGUI::createMenuBar() minimize_action->setEnabled(window != nullptr && (window->flags() & Qt::Dialog) != Qt::Dialog && window->windowState() != Qt::WindowMinimized); }); -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS QAction* zoom_action = window_menu->addAction(tr("Zoom")); connect(zoom_action, &QAction::triggered, [] { QWindow* window = qApp->focusWindow(); @@ -660,7 +660,7 @@ void BitcoinGUI::createMenuBar() #endif if (walletFrame) { -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS window_menu->addSeparator(); QAction* main_window_action = window_menu->addAction(tr("Main Window")); connect(main_window_action, &QAction::triggered, [this] { @@ -818,7 +818,7 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH trayIcon->setContextMenu(trayIconMenu.get()); createIconMenu(trayIconMenu.get()); -#ifndef Q_OS_MAC +#ifndef Q_OS_MACOS // Show main window on tray icon click // Note: ignore this on Mac - this is not the way tray should work there connect(trayIcon, &QSystemTrayIcon::activated, [this](QSystemTrayIcon::ActivationReason reason) { @@ -904,7 +904,7 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH #endif // ENABLE_WALLET unitDisplayControl->setOptionsModel(nullptr); -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS if(dockIconMenu) { // Disable context menu on dock icon @@ -1070,11 +1070,11 @@ void BitcoinGUI::createIconMenu(QMenu *pmenu) { // Configuration of the tray icon (or dock icon) icon menu QAction* show_hide_action{nullptr}; -#ifndef Q_OS_MAC +#ifndef Q_OS_MACOS // Note: On macOS, the Dock icon is used to provide the tray's functionality. show_hide_action = pmenu->addAction(QString(), this, &BitcoinGUI::toggleHidden); pmenu->addSeparator(); -#endif // Q_OS_MAC +#endif // Q_OS_MACOS QAction* send_action{nullptr}; QAction* cj_send_action{nullptr}; @@ -1107,11 +1107,11 @@ void BitcoinGUI::createIconMenu(QMenu *pmenu) backups_action = pmenu->addAction(showBackupsAction->text(), showBackupsAction, &QAction::trigger); } QAction* quit_action{nullptr}; -#ifndef Q_OS_MAC +#ifndef Q_OS_MACOS // Note: On macOS, the Dock icon's menu already has Quit action. pmenu->addSeparator(); quit_action = pmenu->addAction(quitAction->text(), quitAction, &QAction::trigger); -#endif // Q_OS_MAC +#endif // Q_OS_MACOS connect( // Using QSystemTrayIcon::Context is not reliable. @@ -1489,7 +1489,7 @@ void BitcoinGUI::updateWidth() void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, const QString& blockHash, double nVerificationProgress, bool header, SynchronizationState sync_state) { -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS // Disabling macOS App Nap on initial sync, disk, reindex operations and mixing. bool disableAppNap = !m_node.masternodeSync().isSynced() || sync_state != SynchronizationState::POST_INIT; #ifdef ENABLE_WALLET @@ -1504,7 +1504,7 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, const QStri } else { m_app_nap_inhibitor->enableAppNap(); } -#endif // Q_OS_MAC +#endif // Q_OS_MACOS if (modalOverlay) { @@ -1719,7 +1719,7 @@ void BitcoinGUI::message(const QString& title, QString message, unsigned int sty void BitcoinGUI::changeEvent(QEvent *e) { QMainWindow::changeEvent(e); -#ifndef Q_OS_MAC // Ignored on macOS +#ifndef Q_OS_MACOS // Ignored on macOS if(e->type() == QEvent::WindowStateChange) { if(clientModel && clientModel->getOptionsModel() && clientModel->getOptionsModel()->getMinimizeToTray()) @@ -1753,7 +1753,7 @@ void BitcoinGUI::changeEvent(QEvent *e) void BitcoinGUI::closeEvent(QCloseEvent *event) { -#ifndef Q_OS_MAC // Ignored on macOS +#ifndef Q_OS_MACOS // Ignored on macOS if(clientModel && clientModel->getOptionsModel()) { if(!clientModel->getOptionsModel()->getMinimizeOnClose()) diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 6b04432669b8..b108ed2105d0 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -24,7 +24,7 @@ #include -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS #include #endif @@ -193,7 +193,7 @@ class BitcoinGUI : public QMainWindow QMenu* m_network_context_menu = new QMenu(this); -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS CAppNapInhibitor* m_app_nap_inhibitor = nullptr; #endif diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 1fcc3ca040d0..e244bed52c96 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -80,7 +80,7 @@ #include #include -#if defined(Q_OS_MAC) +#if defined(Q_OS_MACOS) #include @@ -118,7 +118,7 @@ static std::unique_ptr osDefaultFont; static const FontFamily defaultFontFamily = FontFamily::SystemDefault; static const int defaultFontSize = 12; static const double fontScaleSteps = 0.01; -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS static const QFont::Weight defaultFontWeightNormal = QFont::ExtraLight; static const QFont::Weight defaultFontWeightBold = QFont::Medium; static const int defaultFontScale = 0; @@ -141,7 +141,7 @@ static std::map, std::tuple> mapFontUpd // Contains a list of supported font weights for all members of GUIUtil::FontFamily static std::map> mapSupportedWeights; -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS // Contains all widgets where the macOS focus rect has been disabled. static std::set setRectsDisabled; #endif @@ -618,7 +618,7 @@ bool isObscured(QWidget *w) void bringToFront(QWidget* w) { -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS ForceActivation(); #endif @@ -656,7 +656,7 @@ void openConfigfile() if (fs::exists(pathConfig)) { // Workaround for macOS-specific behavior; see #15409. if (!QDesktopServices::openUrl(QUrl::fromLocalFile(PathToQString(pathConfig)))) { -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS QProcess::startDetached("/usr/bin/open", QStringList{"-t", PathToQString(pathConfig)}); #endif return; @@ -1308,7 +1308,7 @@ void setApplicationFont() if (fontFamily == FontFamily::Montserrat) { QString family = fontFamilyToString(FontFamily::Montserrat); -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS if (getFontWeightNormal() != getFontWeightNormalDefault()) { font = std::make_unique(getFontNormal()); } else { @@ -1465,7 +1465,7 @@ QFont getFont(FontFamily family, QFont::Weight qWeight, bool fItalic, int nPoint {QFont::DemiBold, "SemiBold"}, {QFont::ExtraBold, "ExtraBold"}, {QFont::Black, "Black"}, -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS {QFont::Normal, "Regular"}, {QFont::Bold, "Bold"}, #else @@ -1476,7 +1476,7 @@ QFont getFont(FontFamily family, QFont::Weight qWeight, bool fItalic, int nPoint assert(mapMontserratMapping.count(qWeight)); -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS QString styleName = mapMontserratMapping[qWeight]; @@ -1602,7 +1602,7 @@ void loadTheme(bool fForce) void disableMacFocusRect(const QWidget* w) { -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS for (const auto& c : w->findChildren()) { if (c->testAttribute(Qt::WA_MacShowFocusRect)) { c->setAttribute(Qt::WA_MacShowFocusRect, !dashThemeActive()); @@ -1614,7 +1614,7 @@ void disableMacFocusRect(const QWidget* w) void updateMacFocusRects() { -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS QWidgetList allWidgets = QApplication::allWidgets(); auto it = setRectsDisabled.begin(); while (it != setRectsDisabled.end()) { @@ -1633,7 +1633,7 @@ void updateButtonGroupShortcuts(QButtonGroup* buttonGroup) if (buttonGroup == nullptr) { return; } -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS auto modifier = "Ctrl"; #else auto modifier = "Alt"; @@ -1845,7 +1845,7 @@ bool ItemDelegate::eventFilter(QObject *object, QEvent *event) void PolishProgressDialog(QProgressDialog* dialog) { -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS // Workaround for macOS-only Qt bug; see: QTBUG-65750, QTBUG-70357. const int margin = TextWidth(dialog->fontMetrics(), ("X")); dialog->resize(dialog->width() + 2 * margin, dialog->height()); diff --git a/src/qt/notificator.cpp b/src/qt/notificator.cpp index 51151b0be8c6..91915580399f 100644 --- a/src/qt/notificator.cpp +++ b/src/qt/notificator.cpp @@ -18,7 +18,7 @@ #include #include #endif -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS #include #endif @@ -50,7 +50,7 @@ Notificator::Notificator(const QString &_programName, QSystemTrayIcon *_trayIcon mode = Freedesktop; } #endif -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS // check if users OS has support for NSUserNotification if( MacNotificationHandler::instance()->hasUserNotificationCenterSupport()) { mode = UserNotificationCenter; @@ -210,7 +210,7 @@ void Notificator::notifySystray(Class cls, const QString &title, const QString & trayIcon->showMessage(title, text, sicon, millisTimeout); } -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS void Notificator::notifyMacUserNotificationCenter(const QString &title, const QString &text) { // icon is not supported by the user notification center yet. OSX will use the app icon. @@ -230,7 +230,7 @@ void Notificator::notify(Class cls, const QString &title, const QString &text, c case QSystemTray: notifySystray(cls, title, text, millisTimeout); break; -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS case UserNotificationCenter: notifyMacUserNotificationCenter(title, text); break; diff --git a/src/qt/notificator.h b/src/qt/notificator.h index bac7bda62217..97880469453b 100644 --- a/src/qt/notificator.h +++ b/src/qt/notificator.h @@ -69,7 +69,7 @@ public Q_SLOTS: void notifyDBus(Class cls, const QString &title, const QString &text, const QIcon &icon, int millisTimeout); #endif void notifySystray(Class cls, const QString &title, const QString &text, int millisTimeout); -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS void notifyMacUserNotificationCenter(const QString &title, const QString &text); #endif }; diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index 8cbd3bb9a07e..44a3a562d461 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -52,7 +52,7 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) : GUIUtil::disableMacFocusRect(this); -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS /* Hide some options on Mac */ ui->showTrayIcon->hide(); ui->minimizeToTray->hide(); @@ -102,7 +102,7 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) : connect(ui->connectSocksTor, &QPushButton::toggled, this, &OptionsDialog::updateProxyValidationState); /* Window elements init */ -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS /* hide launch at startup option on macOS */ ui->bitcoinAtStartup->setVisible(false); ui->verticalLayout_Main->removeWidget(ui->bitcoinAtStartup); @@ -313,7 +313,7 @@ void OptionsDialog::setMapper() { /* Main */ mapper->addMapping(ui->bitcoinAtStartup, OptionsModel::StartAtStartup); -#ifndef Q_OS_MAC +#ifndef Q_OS_MACOS if (QSystemTrayIcon::isSystemTrayAvailable()) { mapper->addMapping(ui->showTrayIcon, OptionsModel::ShowTrayIcon); mapper->addMapping(ui->minimizeToTray, OptionsModel::MinimizeToTray); diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 55b3fb301e74..c885ec50e70a 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -971,7 +971,7 @@ void RPCConsole::clear(bool keep_prompt) ui->lineEdit->setFocus(); // Set default style sheet -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS ui->messagesWidget->setFont(GUIUtil::fixedPitchFont(/*use_embedded_font=*/true)); #else ui->messagesWidget->setFont(GUIUtil::fixedPitchFont()); diff --git a/src/qt/test/addressbooktests.cpp b/src/qt/test/addressbooktests.cpp index 14eaa0c2a05a..fb3c80f23c98 100644 --- a/src/qt/test/addressbooktests.cpp +++ b/src/qt/test/addressbooktests.cpp @@ -163,7 +163,7 @@ void TestAddAddressesToSendBook(interfaces::Node& node) void AddressBookTests::addressBookTests() { -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS if (QApplication::platformName() == "minimal") { // Disable for mac on "minimal" platform to avoid crashes inside the Qt // framework when it tries to look up unimplemented cocoa functions, diff --git a/src/qt/test/apptests.cpp b/src/qt/test/apptests.cpp index 01f43caa7e9e..1397c0edfa38 100644 --- a/src/qt/test/apptests.cpp +++ b/src/qt/test/apptests.cpp @@ -59,7 +59,7 @@ void TestRpcCommand(RPCConsole* console) //! Entry point for BitcoinApplication tests. void AppTests::appTests() { -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS if (QApplication::platformName() == "minimal") { // Disable for mac on "minimal" platform to avoid crashes inside the Qt // framework when it tries to look up unimplemented cocoa functions, diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp index 02f3b88317e1..0a7ae9bcc03a 100644 --- a/src/qt/test/wallettests.cpp +++ b/src/qt/test/wallettests.cpp @@ -278,7 +278,7 @@ void TestGUI(interfaces::Node& node) void WalletTests::walletTests() { -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS if (QApplication::platformName() == "minimal") { // Disable for mac on "minimal" platform to avoid crashes inside the Qt // framework when it tries to look up unimplemented cocoa functions, diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index 0692f1a32caf..8bf2fc058eba 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -135,7 +135,7 @@ TransactionView::TransactionView(QWidget* parent) : vlayout->addWidget(createDateRangeWidget()); vlayout->addWidget(transactionView); vlayout->setSpacing(0); -#ifndef Q_OS_MAC +#ifndef Q_OS_MACOS int width = transactionView->verticalScrollBar()->sizeHint().width(); // Cover scroll bar width with spacing hlayout->addSpacing(width); From 9e4ee656adce3ecca2d32688c8907304b215b68e Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 12 Jun 2022 11:59:50 -0300 Subject: [PATCH 02/12] merge bitcoin-core/gui#617: Reset options, notify user about backup creation --- src/qt/bitcoingui.cpp | 1 + src/qt/optionsdialog.cpp | 15 +++++++++++---- src/qt/optionsdialog.h | 3 +++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index e102d3c30840..c20ced9e99a3 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -1416,6 +1416,7 @@ void BitcoinGUI::openOptionsDialogWithTab(OptionsDialog::Tab tab) auto dlg = new OptionsDialog(this, enableWallet); connect(dlg, &OptionsDialog::quitOnReset, this, &BitcoinGUI::quitRequested); dlg->setCurrentTab(tab); + dlg->setClientModel(clientModel); dlg->setModel(clientModel->getOptionsModel()); connect(dlg, &OptionsDialog::appearanceChanged, [this]() { updateWidth(); diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index 44a3a562d461..4ddddb8e232e 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -215,6 +216,11 @@ OptionsDialog::~OptionsDialog() delete ui; } +void OptionsDialog::setClientModel(ClientModel* client_model) +{ + m_client_model = client_model; +} + void OptionsDialog::setModel(OptionsModel *_model) { this->model = _model; @@ -393,14 +399,15 @@ void OptionsDialog::setOkButtonState(bool fState) void OptionsDialog::on_resetButton_clicked() { - if(model) - { + if (model) { // confirmation dialog QMessageBox::StandardButton btnRetVal = QMessageBox::question(this, tr("Confirm options reset"), - tr("Client restart required to activate changes.") + "

" + tr("Client will be shut down. Do you want to proceed?"), + tr("Client restart required to activate changes.") + "

" + + tr("Current settings will be backed up at \"%1\".").arg(m_client_model->dataDir()) + "

" + + tr("Client will be shut down. Do you want to proceed?"), QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel); - if(btnRetVal == QMessageBox::Cancel) + if (btnRetVal == QMessageBox::Cancel) return; /* reset all options and close GUI */ diff --git a/src/qt/optionsdialog.h b/src/qt/optionsdialog.h index c9f3f73e5817..655d7ed6f6f2 100644 --- a/src/qt/optionsdialog.h +++ b/src/qt/optionsdialog.h @@ -9,6 +9,7 @@ #include class AppearanceWidget; +class ClientModel; class OptionsModel; class QValidatedLineEdit; @@ -51,6 +52,7 @@ class OptionsDialog : public QDialog TAB_APPEARANCE, }; + void setClientModel(ClientModel* client_model); void setModel(OptionsModel *model); void setMapper(); void setCurrentTab(OptionsDialog::Tab tab); @@ -86,6 +88,7 @@ private Q_SLOTS: private: Ui::OptionsDialog *ui; + ClientModel* m_client_model{nullptr}; OptionsModel *model; QDataWidgetMapper *mapper; QButtonGroup* pageButtons; From d496df033f3ffe330b21e0cdf678694769a6de4e Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Mon, 30 May 2022 17:41:37 +0200 Subject: [PATCH 03/12] merge bitcoin-core/gui#612: Drop unused `QFrame`s in `SendCoinsEntry` --- src/qt/forms/sendcoinsentry.ui | 1349 ++++---------------------------- src/qt/res/css/general.css | 3 +- src/qt/sendcoinsentry.cpp | 26 +- src/qt/sendcoinsentry.h | 6 +- 4 files changed, 164 insertions(+), 1220 deletions(-) diff --git a/src/qt/forms/sendcoinsentry.ui b/src/qt/forms/sendcoinsentry.ui index bf9883ff8281..eecf6491077d 100644 --- a/src/qt/forms/sendcoinsentry.ui +++ b/src/qt/forms/sendcoinsentry.ui @@ -1,7 +1,7 @@ SendCoinsEntry - + 0 @@ -16,1224 +16,192 @@ false - - - QFrame::NoFrame - - - - 8 + + + 8 + + + 4 + + + 12 + + + 8 + + + + + Pay &To: - - 4 + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - 12 + + payTo - - 8 + + + + + + 0 - - - - Pay &To: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - payTo - - - - - - - 0 - - - - - The Dash address to send the payment to - - - - - - - Choose previously used address - - - - - - - 22 - 22 - - - - Alt+A - - - - - - - Paste address from clipboard - - - - - - - 22 - 22 - - - - Alt+P - - - - - - - Remove this entry - - - - - - - 22 - 22 - - - - - - - - - - &Label: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - addAsLabel + + + + The Dash address to send the payment to - + - - + + - Enter a label for this address to add it to the list of used addresses - - - Enter a label for this address to add it to the list of used addresses + Choose previously used address - - - - - A&mount: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - payAmount + - - - - - - - - The amount to send in the selected unit - - - - - - - The fee will be deducted from the amount being sent. The recipient will receive a lower amount of Dash than you enter in the amount field. If multiple recipients are selected, the fee is split equally. - - - S&ubtract fee from amount - - - - - - - Use available balance - - - - - - - - - Message: + + + 22 + 22 + - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + Alt+A - + - - + + - A message that was attached to the dash: URI which will be stored with the transaction for your reference. Note: This message will not be sent over the Dash network. - - - Qt::PlainText - - - - - - - Qt::Horizontal + Paste address from clipboard - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 127 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 191 - - - - - - - 127 - 127 - 63 - - - - - - - 170 - 170 - 84 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 127 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 191 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 127 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 191 - - - - - - - 127 - 127 - 63 - - - - - - - 170 - 170 - 84 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 127 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 191 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 127 - 127 - 63 - - - - - - - 255 - 255 - 127 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 191 - - - - - - - 127 - 127 - 63 - - - - - - - 170 - 170 - 84 - - - - - - - 127 - 127 - 63 - - - - - - - 255 - 255 - 255 - - - - - - - 127 - 127 - 63 - - - - - - - 255 - 255 - 127 - - - - - - - 255 - 255 - 127 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 127 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - This is an unauthenticated payment request. - - - true - - - QFrame::NoFrame - - - - 12 - - - - Pay To: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 0 + - - - - - - - Remove this entry - - - - - - - - - - - - Memo: + + + 22 + 22 + - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + Alt+P - + - - - - Qt::PlainText + + + + Remove this entry - - - - - A&mount: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - payAmount_is - - - - - - - false - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - 140 - 232 - 119 - - - - - - - 230 - 255 - 224 - - - - - - - 185 - 243 - 171 - - - - - - - 70 - 116 - 59 - - - - - - - 93 - 155 - 79 - - - - - - - 0 - 0 - 0 - - - - - - - 155 - 255 - 147 - - - - - - - 0 - 0 - 0 - - - - - - - 119 - 255 - 233 - - - - - - - 140 - 232 - 119 - - - - - - - 0 - 0 - 0 - - - - - - - 197 - 243 - 187 - - - - - - - 125 - 194 - 122 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - 140 - 232 - 119 - - - - - - - 230 - 255 - 224 - - - - - - - 185 - 243 - 171 - - - - - - - 70 - 116 - 59 - - - - - - - 93 - 155 - 79 - - - - - - - 0 - 0 - 0 - - - - - - - 155 - 255 - 147 - - - - - - - 0 - 0 - 0 - - - - - - - 119 - 255 - 233 - - - - - - - 140 - 232 - 119 - - - - - - - 0 - 0 - 0 - - - - - - - 197 - 243 - 187 - - - - - - - 125 - 194 - 122 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 70 - 116 - 59 - - - - - - - 140 - 232 - 119 - - - - - - - 230 - 255 - 224 - - - - - - - 185 - 243 - 171 - - - - - - - 70 - 116 - 59 - - - - - - - 93 - 155 - 79 - - - - - - - 70 - 116 - 59 - - - - - - - 155 - 255 - 147 - - - - - - - 70 - 116 - 59 - - - - - - - 140 - 232 - 119 - - - - - - - 140 - 232 - 119 - - - - - - - 0 - 0 - 0 - - - - - - - 140 - 232 - 119 - - - - - - - 125 - 194 - 122 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - This is an authenticated payment request. - - - true - - - QFrame::NoFrame - - - - 12 + + + + + 22 + 22 + + + + + + + + + + &Label: - - - - Pay To: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 0 - - - - - Qt::PlainText - - - - - + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + addAsLabel + + + + + + + Enter a label for this address to add it to the list of used addresses + + + Enter a label for this address to add it to the list of used addresses + + + + + + + A&mount: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + payAmount + + + + + + + - Remove this entry - - - + The amount to send in the selected unit - - - - - - - - Memo: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + - - - - Qt::PlainText + + + + The fee will be deducted from the amount being sent. The recipient will receive a lower amount of Dash than you enter in the amount field. If multiple recipients are selected, the fee is split equally. - - - - - A&mount: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + S&ubtract fee from amount - - payAmount_s - - + - - - - false + + + + Use available balance - + - - + + + + + + Message: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + A message that was attached to the dash: URI which will be stored with the transaction for your reference. Note: This message will not be sent over the Dash network. + + + Qt::PlainText + + + + + + + Qt::Horizontal + + + + @@ -1243,8 +211,9 @@ BitcoinAmountField - QLineEdit + QWidget
qt/bitcoinamountfield.h
+ 1
@@ -1254,10 +223,6 @@ deleteButton addAsLabel payAmount - payAmount_is - deleteButton_is - payAmount_s - deleteButton_s diff --git a/src/qt/res/css/general.css b/src/qt/res/css/general.css index b0eea68c0d61..ff91b5cb4d99 100644 --- a/src/qt/res/css/general.css +++ b/src/qt/res/css/general.css @@ -1754,8 +1754,7 @@ QStackedWidget#SendCoinsEntry .QToolButton#addressBookButton { /* Address Book B QStackedWidget#SendCoinsEntry .QToolButton#addressBookButton, QStackedWidget#SendCoinsEntry .QToolButton#pasteButton, -QStackedWidget#SendCoinsEntry .QToolButton#deleteButton, -QStackedWidget#SendCoinsEntry .QToolButton#deleteButton_is { +QStackedWidget#SendCoinsEntry .QToolButton#deleteButton { } QStackedWidget#SendCoinsEntry .QLineEdit#addAsLabel { /* Pay To Input Field */ diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index 748de45ae70a..812bf4ee9ade 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -20,7 +20,7 @@ #include SendCoinsEntry::SendCoinsEntry(QWidget* parent) : - QStackedWidget(parent), + QWidget(parent), ui(new Ui::SendCoinsEntry), model(nullptr) { @@ -28,8 +28,6 @@ SendCoinsEntry::SendCoinsEntry(QWidget* parent) : GUIUtil::disableMacFocusRect(this); - setCurrentWidget(ui->SendCoins); - setButtonIcons(); // normal dash address field @@ -46,8 +44,6 @@ SendCoinsEntry::SendCoinsEntry(QWidget* parent) : connect(ui->payAmount, &BitcoinAmountField::valueChanged, this, &SendCoinsEntry::payAmountChanged); connect(ui->checkboxSubtractFeeFromAmount, &QCheckBox::toggled, this, &SendCoinsEntry::subtractFeeFromAmountChanged); connect(ui->deleteButton, &QPushButton::clicked, this, &SendCoinsEntry::deleteClicked); - connect(ui->deleteButton_is, &QPushButton::clicked, this, &SendCoinsEntry::deleteClicked); - connect(ui->deleteButton_s, &QPushButton::clicked, this, &SendCoinsEntry::deleteClicked); connect(ui->useAvailableBalanceButton, &QPushButton::clicked, this, &SendCoinsEntry::useAvailableBalanceClicked); } @@ -109,14 +105,6 @@ void SendCoinsEntry::clear() ui->messageTextLabel->clear(); ui->messageTextLabel->hide(); ui->messageLabel->hide(); - // clear UI elements for unauthenticated payment request - ui->payTo_is->clear(); - ui->memoTextLabel_is->clear(); - ui->payAmount_is->clear(); - // clear UI elements for authenticated payment request - ui->payTo_s->clear(); - ui->memoTextLabel_s->clear(); - ui->payAmount_s->clear(); // update the display unit, to not use the default ("BTC") updateDisplayUnit(); @@ -226,7 +214,7 @@ void SendCoinsEntry::setAmount(const CAmount &amount) bool SendCoinsEntry::isClear() { - return ui->payTo->text().isEmpty() && ui->payTo_is->text().isEmpty() && ui->payTo_s->text().isEmpty(); + return ui->payTo->text().isEmpty(); } void SendCoinsEntry::setFocus() @@ -236,18 +224,14 @@ void SendCoinsEntry::setFocus() void SendCoinsEntry::updateDisplayUnit() { - if(model && model->getOptionsModel()) - { - // Update payAmount with the current unit + if (model && model->getOptionsModel()) { ui->payAmount->setDisplayUnit(model->getOptionsModel()->getDisplayUnit()); - ui->payAmount_is->setDisplayUnit(model->getOptionsModel()->getDisplayUnit()); - ui->payAmount_s->setDisplayUnit(model->getOptionsModel()->getDisplayUnit()); } } void SendCoinsEntry::changeEvent(QEvent* e) { - QStackedWidget::changeEvent(e); + QWidget::changeEvent(e); if (e->type() == QEvent::StyleChange) { // Adjust button icon colors on theme changes setButtonIcons(); @@ -259,8 +243,6 @@ void SendCoinsEntry::setButtonIcons() GUIUtil::setIcon(ui->addressBookButton, "address-book"); GUIUtil::setIcon(ui->pasteButton, "editpaste"); GUIUtil::setIcon(ui->deleteButton, "remove", GUIUtil::ThemedColor::RED); - GUIUtil::setIcon(ui->deleteButton_is, "remove", GUIUtil::ThemedColor::RED); - GUIUtil::setIcon(ui->deleteButton_s, "remove", GUIUtil::ThemedColor::RED); } bool SendCoinsEntry::updateLabel(const QString &address) diff --git a/src/qt/sendcoinsentry.h b/src/qt/sendcoinsentry.h index 2bb62b610d20..87b931e68e75 100644 --- a/src/qt/sendcoinsentry.h +++ b/src/qt/sendcoinsentry.h @@ -7,7 +7,7 @@ #include -#include +#include class WalletModel; @@ -21,10 +21,8 @@ namespace Ui { /** * A single entry in the dialog for sending bitcoins. - * Stacked widget, with different UIs for payment requests - * with a strong payee identity. */ -class SendCoinsEntry : public QStackedWidget +class SendCoinsEntry : public QWidget { Q_OBJECT From 8829549cba7ea6c8a71362f93c7d89353ba86a26 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Wed, 29 Jun 2022 20:02:02 -0400 Subject: [PATCH 04/12] merge bitcoin-core/gui#627: Apply translator comments to reset options confirmation dialog --- src/qt/optionsdialog.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index 4ddddb8e232e..7a4030efa1ec 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -401,11 +401,19 @@ void OptionsDialog::on_resetButton_clicked() { if (model) { // confirmation dialog + /*: Text explaining that the settings changed will not come into effect + until the client is restarted. */ + QString reset_dialog_text = tr("Client restart required to activate changes.") + "

"; + /*: Text explaining to the user that the client's current settings + will be backed up at a specific location. %1 is a stand-in + argument for the backup location's path. */ + reset_dialog_text.append(tr("Current settings will be backed up at \"%1\".").arg(m_client_model->dataDir()) + "

"); + /*: Text asking the user to confirm if they would like to proceed + with a client shutdown. */ + reset_dialog_text.append(tr("Client will be shut down. Do you want to proceed?")); + //: Window title text of pop-up window shown when the user has chosen to reset options. QMessageBox::StandardButton btnRetVal = QMessageBox::question(this, tr("Confirm options reset"), - tr("Client restart required to activate changes.") + "

" + - tr("Current settings will be backed up at \"%1\".").arg(m_client_model->dataDir()) + "

" + - tr("Client will be shut down. Do you want to proceed?"), - QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel); + reset_dialog_text, QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel); if (btnRetVal == QMessageBox::Cancel) return; From e9b347f30708e694ed35fb06c141e827806e182b Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Tue, 14 Feb 2023 17:55:57 +0000 Subject: [PATCH 05/12] merge bitcoin-core/gui#711: Disable unused special members functions in `UnlockContext` --- src/qt/walletmodel.cpp | 8 -------- src/qt/walletmodel.h | 20 +++++++++----------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 14f18258b914..0d448689c297 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -578,14 +578,6 @@ WalletModel::UnlockContext::~UnlockContext() } } -void WalletModel::UnlockContext::CopyFrom(UnlockContext&& rhs) -{ - // Transfer context; old object no longer relocks wallet - *this = rhs; - rhs.was_locked = false; - rhs.was_mixing = false; -} - bool WalletModel::isWalletEnabled() { return !gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET); diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h index 09eacbf04c1b..523c07ad91b9 100644 --- a/src/qt/walletmodel.h +++ b/src/qt/walletmodel.h @@ -117,7 +117,7 @@ class WalletModel : public QObject bool autoBackupWallet(QString& strBackupWarningRet, QString& strBackupErrorRet); int64_t getKeysLeftSinceAutoBackup() const; - // RAI object for unlocking wallet, returned by requestUnlock() + // RAII object for unlocking wallet, returned by requestUnlock() class UnlockContext { public: @@ -126,19 +126,17 @@ class WalletModel : public QObject bool isValid() const { return valid; } - // Copy constructor is disabled. + // Disable unused copy/move constructors/assignments explicitly. UnlockContext(const UnlockContext&) = delete; - // Move operator and constructor transfer the context - UnlockContext(UnlockContext&& obj) { CopyFrom(std::move(obj)); } - UnlockContext& operator=(UnlockContext&& rhs) { CopyFrom(std::move(rhs)); return *this; } + UnlockContext(UnlockContext&&) = delete; + UnlockContext& operator=(const UnlockContext&) = delete; + UnlockContext& operator=(UnlockContext&&) = delete; + private: WalletModel *wallet; - bool valid; - mutable bool was_locked; // mutable, as it can be set to false by copying - mutable bool was_mixing; // mutable, as it can be set to false by copying - - UnlockContext& operator=(const UnlockContext&) = default; - void CopyFrom(UnlockContext&& rhs); + const bool valid; + const bool was_locked; + const bool was_mixing; }; UnlockContext requestUnlock(bool fForMixingOnly = false); From 9f103fb784bd84b3764c95d4ea792e9357fc3850 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Wed, 3 Sep 2025 08:13:55 +0000 Subject: [PATCH 06/12] fix: hide the entire transaction widget if discreet mode is enabled Currently the label moves downward when discreet mode is enabled, which is a bit visually jarring. We're better off hiding it wholesale. Co-Authored-By: UdjinM6 --- src/qt/overviewpage.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index dc08a67c3e2e..27316c6c6443 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -211,7 +211,10 @@ void OverviewPage::setPrivacy(bool privacy) coinJoinStatus(true); } + // We can't hide the frame itself as it would disturb alignment, hide inner elements instead ui->listTransactions->setVisible(!m_privacy); + ui->label_4->setVisible(!m_privacy); + ui->labelTransactionsStatus->setVisible(!m_privacy && ui->labelWalletStatus->isVisible()); const QString status_tip = m_privacy ? tr("Discreet mode activated for the Overview tab. To unmask the values, uncheck Settings->Discreet mode.") : ""; setStatusTip(status_tip); From dc3771e7087ba52401259a30c7460d12b388797b Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Tue, 30 Aug 2022 18:54:46 +0000 Subject: [PATCH 07/12] merge bitcoin-core/gui#658: Never change the prune checkbox after the user has touched it --- src/qt/intro.cpp | 8 +++++--- src/qt/intro.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index 0ad53d1f1e38..e507e922ecaf 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -143,8 +143,9 @@ Intro::Intro(QWidget *parent, int64_t blockchain_size_gb, int64_t chain_state_si const int min_prune_target_GB = std::ceil(MIN_DISK_SPACE_FOR_BLOCK_FILES / 1e9); ui->pruneGB->setRange(min_prune_target_GB, std::numeric_limits::max()); - if (gArgs.GetIntArg("-prune", 0) > 1) { // -prune=1 means enabled, above that it's a size in MiB - ui->prune->setChecked(true); + if (gArgs.IsArgSet("-prune")) { + m_prune_checkbox_is_default = false; + ui->prune->setChecked(gArgs.GetIntArg("-prune", 0) >= 1); ui->prune->setEnabled(false); } ui->pruneGB->setValue(m_prune_target_gb); @@ -153,6 +154,7 @@ Intro::Intro(QWidget *parent, int64_t blockchain_size_gb, int64_t chain_state_si UpdatePruneLabels(ui->prune->isChecked()); connect(ui->prune, &QCheckBox::toggled, [this](bool prune_checked) { + m_prune_checkbox_is_default = false; UpdatePruneLabels(prune_checked); UpdateFreeSpaceLabel(); }); @@ -293,7 +295,7 @@ void Intro::setStatus(int status, const QString &message, quint64 bytesAvailable ui->freeSpace->setText(""); } else { m_bytes_available = bytesAvailable; - if (ui->prune->isEnabled() && !(gArgs.IsArgSet("-prune") && gArgs.GetIntArg("-prune", 0) == 0)) { + if (ui->prune->isEnabled() && m_prune_checkbox_is_default) { ui->prune->setChecked(m_bytes_available < (m_blockchain_size_gb + m_chain_state_size_gb + 10) * GB_BYTES); } UpdateFreeSpaceLabel(); diff --git a/src/qt/intro.h b/src/qt/intro.h index d9c45007e115..c01d005ae243 100644 --- a/src/qt/intro.h +++ b/src/qt/intro.h @@ -64,6 +64,7 @@ private Q_SLOTS: private: Ui::Intro *ui; + bool m_prune_checkbox_is_default{true}; QThread *thread; QMutex mutex; bool signalled; From 568753a7f02bffafefeef22c787dfa4f93e29ffa Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Thu, 4 Apr 2024 21:08:38 +0100 Subject: [PATCH 08/12] merge bitcoin-core/gui#813: Don't permit port in proxy IP option --- src/qt/optionsdialog.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index 7a4030efa1ec..9b303061ad9b 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -22,6 +22,7 @@ #include // for DEFAULT_SCRIPTCHECK_THREADS and MAX_SCRIPTCHECK_THREADS #include #include // for -dbcache defaults +#include #include #include @@ -588,7 +589,10 @@ QValidator(parent) QValidator::State ProxyAddressValidator::validate(QString &input, int &pos) const { Q_UNUSED(pos); - // Validate the proxy + uint16_t port{0}; + std::string hostname; + if (!SplitHostPort(input.toStdString(), port, hostname) || port != 0) return QValidator::Invalid; + CService serv(LookupNumeric(input.toStdString(), DEFAULT_GUI_PROXY_PORT)); Proxy addrProxy = Proxy(serv, true); if (addrProxy.IsValid()) From 4e1b06bdae7b8b9b74faf258e379d6e92a1cf308 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Fri, 29 Aug 2025 11:27:54 +0000 Subject: [PATCH 09/12] merge bitcoin-core/gui#825: Show maximum mempool size in information window --- src/interfaces/node.h | 3 +++ src/node/interfaces.cpp | 1 + src/qt/clientmodel.cpp | 2 +- src/qt/clientmodel.h | 2 +- src/qt/rpcconsole.cpp | 12 +++++++----- src/qt/rpcconsole.h | 2 +- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/interfaces/node.h b/src/interfaces/node.h index 3ea9b5da6450..523e901a060d 100644 --- a/src/interfaces/node.h +++ b/src/interfaces/node.h @@ -233,6 +233,9 @@ class Node //! Get mempool dynamic usage. virtual size_t getMempoolDynamicUsage() = 0; + //! Get mempool maximum memory usage. + virtual size_t getMempoolMaxUsage() = 0; + //! Get header tip height and time. virtual bool getHeaderTip(int& height, int64_t& block_time) = 0; diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp index bccb43aafe59..d78f4e7a38f8 100644 --- a/src/node/interfaces.cpp +++ b/src/node/interfaces.cpp @@ -519,6 +519,7 @@ class NodeImpl : public Node int64_t getTotalBytesSent() override { return m_context->connman ? m_context->connman->GetTotalBytesSent() : 0; } size_t getMempoolSize() override { return m_context->mempool ? m_context->mempool->size() : 0; } size_t getMempoolDynamicUsage() override { return m_context->mempool ? m_context->mempool->DynamicMemoryUsage() : 0; } + size_t getMempoolMaxUsage() override { return gArgs.GetIntArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000; } bool getHeaderTip(int& height, int64_t& block_time) override { LOCK(::cs_main); diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index fb6b90e86ce7..759eb1a5a604 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -57,7 +57,7 @@ ClientModel::ClientModel(interfaces::Node& node, OptionsModel *_optionsModel, QO connect(timer, &QTimer::timeout, [this] { // no locking required at this point // the following calls will acquire the required lock - Q_EMIT mempoolSizeChanged(m_node.getMempoolSize(), m_node.getMempoolDynamicUsage()); + Q_EMIT mempoolSizeChanged(m_node.getMempoolSize(), m_node.getMempoolDynamicUsage(), m_node.getMempoolMaxUsage()); Q_EMIT islockCountChanged(m_node.llmq().getInstantSentLockCount()); }); connect(m_thread, &QThread::finished, timer, &QObject::deleteLater); diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index 613f8be7d428..b19af4896bf7 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -130,7 +130,7 @@ class ClientModel : public QObject void chainLockChanged(const QString& bestChainLockHash, int bestChainLockHeight); void numBlocksChanged(int count, const QDateTime& blockDate, const QString& blockHash, double nVerificationProgress, bool header, SynchronizationState sync_state); void additionalDataSyncProgressChanged(double nSyncProgress); - void mempoolSizeChanged(long count, size_t mempoolSizeInBytes); + void mempoolSizeChanged(long count, size_t mempoolSizeInBytes, size_t mempoolMaxSizeInBytes); void islockCountChanged(size_t count); void networkActiveChanged(bool networkActive); void alertsChanged(const QString &warnings); diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index c885ec50e70a..e40a7c5f3de7 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -1095,14 +1095,16 @@ void RPCConsole::updateMasternodeCount() ui->evoCount->setText(strEvoCount); } -void RPCConsole::setMempoolSize(long numberOfTxs, size_t dynUsage) +void RPCConsole::setMempoolSize(long numberOfTxs, size_t dynUsage, size_t maxUsage) { ui->mempoolNumberTxs->setText(QString::number(numberOfTxs)); - if (dynUsage < 1000000) - ui->mempoolSize->setText(QString::number(dynUsage/1000.0, 'f', 2) + " KB"); - else - ui->mempoolSize->setText(QString::number(dynUsage/1000000.0, 'f', 2) + " MB"); + const auto cur_usage_str = dynUsage < 1000000 ? + QObject::tr("%1 kB").arg(dynUsage / 1000.0, 0, 'f', 2) : + QObject::tr("%1 MB").arg(dynUsage / 1000000.0, 0, 'f', 2); + const auto max_usage_str = QObject::tr("%1 MB").arg(maxUsage / 1000000.0, 0, 'f', 2); + + ui->mempoolSize->setText(cur_usage_str + " / " + max_usage_str); } void RPCConsole::setInstantSendLockCount(size_t count) diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index 9f26085db78e..9b825f4227e9 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -128,7 +128,7 @@ public Q_SLOTS: /** Set number of blocks, last block date and last block hash shown in the UI */ void setNumBlocks(int count, const QDateTime& blockDate, const QString& blockHash, double nVerificationProgress, bool headers); /** Set size (number of transactions and memory usage) of the mempool in the UI */ - void setMempoolSize(long numberOfTxs, size_t dynUsage); + void setMempoolSize(long numberOfTxs, size_t dynUsage, size_t maxUsage); /** Set number of InstantSend locks */ void setInstantSendLockCount(size_t count); /** Go forward or back in history */ From 493768cb6bbe5ffd25f056633cd867cec044c046 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Fri, 29 Aug 2025 16:47:54 +0000 Subject: [PATCH 10/12] merge bitcoin-core/gui#626: Showing Local Addresses in Node Window --- src/interfaces/node.h | 3 ++ src/net.cpp | 7 ++++ src/net.h | 1 + src/node/interfaces.cpp | 7 ++++ src/qt/clientmodel.cpp | 5 +++ src/qt/clientmodel.h | 4 ++ src/qt/forms/debugwindow.ui | 81 ++++++++++++++++++++++++++----------- src/qt/rpcconsole.cpp | 12 ++++++ 8 files changed, 97 insertions(+), 23 deletions(-) diff --git a/src/interfaces/node.h b/src/interfaces/node.h index 523e901a060d..5a7414b84fa0 100644 --- a/src/interfaces/node.h +++ b/src/interfaces/node.h @@ -242,6 +242,9 @@ class Node //! Get num blocks. virtual int getNumBlocks() = 0; + //! Get network local addresses. + virtual std::map getNetLocalAddresses() = 0; + //! Get best block hash. virtual uint256 getBestBlockHash() = 0; diff --git a/src/net.cpp b/src/net.cpp index fb56676f3d2e..e27d2c0b7104 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -4449,10 +4449,17 @@ size_t CConnman::GetNodeCount(ConnectionDirection flags) const return nNum; } +std::map CConnman::getNetLocalAddresses() const +{ + LOCK(g_maplocalhost_mutex); + return mapLocalHost; +} + size_t CConnman::GetMaxOutboundNodeCount() { return m_max_outbound; } + size_t CConnman::GetMaxOutboundOnionNodeCount() { return m_max_outbound_onion; diff --git a/src/net.h b/src/net.h index 957aff1b4fd3..ab52b79670af 100644 --- a/src/net.h +++ b/src/net.h @@ -1489,6 +1489,7 @@ friend class CNode; void AddPendingProbeConnections(const std::set& proTxHashes); size_t GetNodeCount(ConnectionDirection) const; + std::map getNetLocalAddresses() const; size_t GetMaxOutboundNodeCount(); size_t GetMaxOutboundOnionNodeCount(); void GetNodeStats(std::vector& vstats) const; diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp index d78f4e7a38f8..a8a563b71e37 100644 --- a/src/node/interfaces.cpp +++ b/src/node/interfaces.cpp @@ -531,6 +531,13 @@ class NodeImpl : public Node } return false; } + std::map getNetLocalAddresses() override + { + if (m_context->connman) + return m_context->connman->getNetLocalAddresses(); + else + return {}; + } int getNumBlocks() override { LOCK(::cs_main); diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 759eb1a5a604..517362d880fb 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -157,6 +157,11 @@ void ClientModel::getAllGovernanceObjects(std::vector &obj) m_node.gov().getAllNewerThan(obj, 0); } +std::map ClientModel::getNetLocalAddresses() const +{ + return m_node.getNetLocalAddresses(); +} + int ClientModel::getNumBlocks() const { if (m_cached_num_blocks == -1) { diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index b19af4896bf7..4851252997c4 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -16,12 +16,15 @@ #include #include +#include + class BanTableModel; class CBlockIndex; class OptionsModel; class PeerTableModel; class PeerTableSortProxy; enum class SynchronizationState; +struct LocalServiceInfo; namespace interfaces { struct BlockTip; @@ -69,6 +72,7 @@ class ClientModel : public QObject //! Return number of connections, default is in- and outbound (total) int getNumConnections(unsigned int flags = CONNECTIONS_ALL) const; + std::map getNetLocalAddresses() const; int getNumBlocks() const; uint256 getBestBlockHash() EXCLUSIVE_LOCKS_REQUIRED(!m_cached_tip_mutex); int getHeaderTipHeight() const; diff --git a/src/qt/forms/debugwindow.ui b/src/qt/forms/debugwindow.ui index d42647588a85..8a11de69c75d 100644 --- a/src/qt/forms/debugwindow.ui +++ b/src/qt/forms/debugwindow.ui @@ -297,13 +297,48 @@ + + + Local Addresses + + + + + + + IBeamCursor + + + true + + + + 0 + 0 + + + + N/A + + + Qt::PlainText + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + Network addresses that your Dash node is currently using to communicate with other nodes. + + + + Number of regular Masternodes - + IBeamCursor @@ -316,14 +351,14 @@ - + Number of EvoNodes - + IBeamCursor @@ -336,21 +371,21 @@ - + Block chain - + Current block height - + IBeamCursor @@ -366,14 +401,14 @@ - + Last block time - + IBeamCursor @@ -389,14 +424,14 @@ - + Last block hash - + IBeamCursor @@ -412,14 +447,14 @@ - + Latest ChainLocked block hash - + IBeamCursor @@ -435,14 +470,14 @@ - + Latest ChainLocked block height - + IBeamCursor @@ -458,21 +493,21 @@ - + Memory Pool - + Current number of transactions - + IBeamCursor @@ -488,14 +523,14 @@ - + Memory usage - + IBeamCursor @@ -511,7 +546,7 @@ - + 3 @@ -551,14 +586,14 @@ - + InstantSend locks - + IBeamCursor @@ -574,7 +609,7 @@ - + Qt::Vertical diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index e40a7c5f3de7..7729460c1b0c 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -1045,6 +1045,18 @@ void RPCConsole::updateNetworkState() } ui->numberOfConnections->setText(connections); + + QString local_addresses; + std::map hosts = clientModel->getNetLocalAddresses(); + for (const auto& [addr, info] : hosts) { + local_addresses += QString::fromStdString(addr.ToStringAddr()); + if (!addr.IsI2P()) local_addresses += ":" + QString::number(info.nPort); + local_addresses += ", "; + } + local_addresses.chop(2); // remove last ", " + if (local_addresses.isEmpty()) local_addresses = tr("None"); + + ui->localAddresses->setText(local_addresses); } void RPCConsole::setNumConnections(int count) From b47b1f6995815fed48b83775ed5407423b7e3a6c Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Tue, 30 Jul 2024 17:24:36 -0300 Subject: [PATCH 11/12] merge bitcoin-core/gui#831: GUIUtil::bringToFront workaround for Wayland --- src/qt/guiutil.cpp | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index e244bed52c96..bc6b06b8a9cb 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -618,19 +618,26 @@ bool isObscured(QWidget *w) void bringToFront(QWidget* w) { -#ifdef Q_OS_MACOS - ForceActivation(); -#endif - if (w) { - // activateWindow() (sometimes) helps with keyboard focus on Windows - if (w->isMinimized()) { - w->showNormal(); - } else { + if (QGuiApplication::platformName() == "wayland") { + auto flags = w->windowFlags(); + w->setWindowFlags(flags|Qt::WindowStaysOnTopHint); + w->show(); + w->setWindowFlags(flags); w->show(); + } else { +#ifdef Q_OS_MACOS + ForceActivation(); +#endif + // activateWindow() (sometimes) helps with keyboard focus on Windows + if (w->isMinimized()) { + w->showNormal(); + } else { + w->show(); + } + w->activateWindow(); + w->raise(); } - w->activateWindow(); - w->raise(); } } From 20763f1101484fa1bbaa46c6aa9b3aa7766c11b2 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Thu, 12 Sep 2024 18:50:43 -0300 Subject: [PATCH 12/12] merge bitcoin-core/gui#835: Fix crash when closing wallet --- src/qt/walletcontroller.cpp | 18 ++++++++++-------- src/qt/walletcontroller.h | 3 +++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/qt/walletcontroller.cpp b/src/qt/walletcontroller.cpp index 1c0db4616369..17205eea09c7 100644 --- a/src/qt/walletcontroller.cpp +++ b/src/qt/walletcontroller.cpp @@ -77,6 +77,14 @@ std::map WalletController::listWalletDir() const return wallets; } +void WalletController::removeWallet(WalletModel* wallet_model) +{ + // Once the wallet is successfully removed from the node, the model will emit the 'WalletModel::unload' signal. + // This signal is already connected and will complete the removal of the view from the GUI. + // Look at 'WalletController::getOrCreateWallet' for the signal connection. + wallet_model->wallet().remove(); +} + void WalletController::closeWallet(WalletModel* wallet_model, QWidget* parent) { QMessageBox box(parent); @@ -87,10 +95,7 @@ void WalletController::closeWallet(WalletModel* wallet_model, QWidget* parent) box.setDefaultButton(QMessageBox::Yes); if (box.exec() != QMessageBox::Yes) return; - // First remove wallet from node. - wallet_model->wallet().remove(); - // Now release the model. - removeAndDeleteWallet(wallet_model); + removeWallet(wallet_model); } void WalletController::closeAllWallets(QWidget* parent) @@ -103,11 +108,8 @@ void WalletController::closeAllWallets(QWidget* parent) QMutexLocker locker(&m_mutex); for (WalletModel* wallet_model : m_wallets) { - wallet_model->wallet().remove(); - Q_EMIT walletRemoved(wallet_model); - delete wallet_model; + removeWallet(wallet_model); } - m_wallets.clear(); } WalletModel* WalletController::getOrCreateWallet(std::unique_ptr wallet) diff --git a/src/qt/walletcontroller.h b/src/qt/walletcontroller.h index f633c4072a88..c72008426bf1 100644 --- a/src/qt/walletcontroller.h +++ b/src/qt/walletcontroller.h @@ -82,6 +82,9 @@ class WalletController : public QObject std::unique_ptr m_handler_load_wallet; friend class WalletControllerActivity; + + //! Starts the wallet closure procedure + void removeWallet(WalletModel* wallet_model); }; class WalletControllerActivity : public QObject