Desktop tray icon and rpc console #746

Manually merged
epicleafies merged 73 commits from desktop-tray-rpc-console into qt6 2026-06-29 15:06:20 +00:00 AGit
epicleafies commented 2026-06-04 03:01:02 +00:00 (Migrated from github.com)

Combines the tray icon PR, the rpc console PR and the settings redesign, closes #538 and closes #540

For the tray icon, fixes #513:
Added window behavior as a new option in settings.
Added window behavior page, allows the user to configure if the tray is visible, behavior on minimization and behavior on closing.
Tray icon color matches the network the app is on.
Tray icon gives option to show or quit when clicked on.
Added unit, qml and functional tests.

For the rpc console, fixes #508:
Created page for rpc command console.
Created option under settings for console.
Preserved parsing logic currently in use along with autocomplete.
Added unit and functional tests.

For the settings redesign, fixes #685, fixes #688, fixes #747:
The settings menu now uses use a desktop sidebar layout instead of drill-down navigation.
Introduced a reusable SettingsHeader component, replacing NavigationBar2 + state machine boilerplate across all settings pages.
Removed redundant Dark Mode toggle from Developer Options, already exists in Display -> Theme.
Rpc console and peers now have their own icons on the main navbar and have been moved out of the settings page.
Added unit, qml and functional tests.
Updated functional tests to support rpc console and peers being out of the settings page.

Fixes from #750:
Fixes send page nav button crash on Qt 6.4.2.
Added qml_test_psbt.py to CI workflow file.

Also cleaned up a few minor style/design issues.

Platform support. The tray-icon window toggle uses an obscured-check (QGuiApplication::topLevelAt()) ported from the Qt Widgets GUI's GUIUtil::isObscured(). On Wayland the compositor forbids querying other windows, so obscured-detection is unavailable, showMinimized() does not report a Minimized visibility, and the window position is not preserved across a tray hide/show because the compositor, not the client, controls placement. The position limitation applies to any Wayland-compositor session, including X11 clients via Xwayland; geometry is restored correctly on native X11 (Xorg), macOS, and Windows. These match the limitations the existing Qt Widgets GUI has on Wayland and meet issue #513's DoD, which does not require obscured-detection parity. Tracking: bitcoin/bitcoin#19950 and #748.

Qt Quick has no system-tray API, so DesktopTrayIconController wraps QSystemTrayIcon (Qt Widgets) in C++, with a native QMenu context menu (Linux SNI/AppIndicator hosts require a menu set via setContextMenu()). This reuses the Qt Widgets dependency the GUI already links.

image image
Combines the tray icon PR, the rpc console PR and the settings redesign, closes #538 and closes #540 For the tray icon, fixes #513: Added window behavior as a new option in settings. Added window behavior page, allows the user to configure if the tray is visible, behavior on minimization and behavior on closing. Tray icon color matches the network the app is on. Tray icon gives option to show or quit when clicked on. Added unit, qml and functional tests. For the rpc console, fixes #508: Created page for rpc command console. Created option under settings for console. Preserved parsing logic currently in use along with autocomplete. Added unit and functional tests. For the settings redesign, fixes #685, fixes #688, fixes #747: The settings menu now uses use a desktop sidebar layout instead of drill-down navigation. Introduced a reusable SettingsHeader component, replacing NavigationBar2 + state machine boilerplate across all settings pages. Removed redundant Dark Mode toggle from Developer Options, already exists in Display -> Theme. Rpc console and peers now have their own icons on the main navbar and have been moved out of the settings page. Added unit, qml and functional tests. Updated functional tests to support rpc console and peers being out of the settings page. Fixes from #750: Fixes send page nav button crash on Qt 6.4.2. Added qml_test_psbt.py to CI workflow file. Also cleaned up a few minor style/design issues. Platform support. The tray-icon window toggle uses an obscured-check (QGuiApplication::topLevelAt()) ported from the Qt Widgets GUI's GUIUtil::isObscured(). On Wayland the compositor forbids querying other windows, so obscured-detection is unavailable, showMinimized() does not report a Minimized visibility, and the window position is not preserved across a tray hide/show because the compositor, not the client, controls placement. The position limitation applies to any Wayland-compositor session, including X11 clients via Xwayland; geometry is restored correctly on native X11 (Xorg), macOS, and Windows. These match the limitations the existing Qt Widgets GUI has on Wayland and meet issue #513's DoD, which does not require obscured-detection parity. Tracking: bitcoin/bitcoin#19950 and #748. Qt Quick has no system-tray API, so DesktopTrayIconController wraps QSystemTrayIcon (Qt Widgets) in C++, with a native QMenu context menu (Linux SNI/AppIndicator hosts require a menu set via setContextMenu()). This reuses the Qt Widgets dependency the GUI already links. <img width="1919" height="1004" alt="image" src="https://git.fish.foo/attachments/f0a25a2a-fa8c-4a53-a812-e5b08c98a41a" /> <img width="640" height="665" alt="image" src="https://git.fish.foo/attachments/d0219601-79c6-4d49-a64c-57a670d4324d" />
epicleafies commented 2026-06-04 23:49:08 +00:00 (Migrated from github.com)

Note main navbar can't fit anymore elements, adding the rpc console and peers icon fill it up at max width

Note main navbar can't fit anymore elements, adding the rpc console and peers icon fill it up at max width
johnny9 (Migrated from github.com) reviewed 2026-06-05 21:31:01 +00:00
johnny9 (Migrated from github.com) commented 2026-06-05 21:30:57 +00:00

I think these headers aren't needed if we have the context already on the left sidebar.

I think these headers aren't needed if we have the context already on the left sidebar.
johnny9 (Migrated from github.com) reviewed 2026-06-05 21:34:28 +00:00
johnny9 (Migrated from github.com) left a comment
FAILED: wait_for_page('gotoAboutSetting') failed: Timed out waiting for page: gotoAboutSetting
Traceback (most recent call last):
  File "/home/runner/work/gui-qml/gui-qml/test/functional/qml_test_blocksonly_settings.py", line 26, in run_tests
    gui.wait_for_page("gotoAboutSetting", timeout_ms=10000)
  File "/home/runner/work/gui-qml/gui-qml/test/functional/qml_driver.py", line 189, in wait_for_page
    raise QmlDriverError(
qml_driver.QmlDriverError: wait_for_page('gotoAboutSetting') failed: Timed out waiting for page: gotoAboutSetting
Starting GUI: /home/runner/work/gui-qml/gui-qml/build/bin/bitcoin-core-app -datadir=/tmp/qml_test_bridge_cbg9940j/node0 -test-automation=/tmp/qml_test_bridge_cbg9940j/test_bridge.sock -test-settings-dir=/tmp/qml_test_bridge_cbg9940j/config -resetguisettings -logtimemicros -debug -debugexclude=libevent -debugexclude=leveldb -nolisten -disablewallet -blocksonly -disablewallet -blocksonly
QmlDriver connected to test bridge.

Node only mode functional tests are failing. -disablewallet cli arg will launch it in that mode.

``` FAILED: wait_for_page('gotoAboutSetting') failed: Timed out waiting for page: gotoAboutSetting Traceback (most recent call last): File "/home/runner/work/gui-qml/gui-qml/test/functional/qml_test_blocksonly_settings.py", line 26, in run_tests gui.wait_for_page("gotoAboutSetting", timeout_ms=10000) File "/home/runner/work/gui-qml/gui-qml/test/functional/qml_driver.py", line 189, in wait_for_page raise QmlDriverError( qml_driver.QmlDriverError: wait_for_page('gotoAboutSetting') failed: Timed out waiting for page: gotoAboutSetting Starting GUI: /home/runner/work/gui-qml/gui-qml/build/bin/bitcoin-core-app -datadir=/tmp/qml_test_bridge_cbg9940j/node0 -test-automation=/tmp/qml_test_bridge_cbg9940j/test_bridge.sock -test-settings-dir=/tmp/qml_test_bridge_cbg9940j/config -resetguisettings -logtimemicros -debug -debugexclude=libevent -debugexclude=leveldb -nolisten -disablewallet -blocksonly -disablewallet -blocksonly QmlDriver connected to test bridge. ``` Node only mode functional tests are failing. `-disablewallet` cli arg will launch it in that mode.
epicleafies (Migrated from github.com) reviewed 2026-06-06 03:41:30 +00:00
epicleafies (Migrated from github.com) commented 2026-06-06 03:41:30 +00:00

I can take them out if you want but without a full page redesign it doesn't look good. If I did do it I'd probably align the page with top of menu.
image

image
I can take them out if you want but without a full page redesign it doesn't look good. If I did do it I'd probably align the page with top of menu. <img width="640" height="665" alt="image" src="https://git.fish.foo/attachments/051ca558-45f6-46c7-a384-ee834c0826d9" /> <img width="640" height="665" alt="image" src="https://git.fish.foo/attachments/bd0ddc35-cfa8-48e4-a22d-bf09668d6282" />
pseudoramdom (Migrated from github.com) reviewed 2026-06-06 18:44:16 +00:00
pseudoramdom (Migrated from github.com) commented 2026-06-06 18:44:16 +00:00

I'd prefer to keep the header title.

I'd prefer to keep the header title.
johnny9 (Migrated from github.com) approved these changes 2026-06-08 03:02:12 +00:00
johnny9 (Migrated from github.com) left a comment

There should be 5 peer/node icons

There should be 5 peer/node icons
johnny9 (Migrated from github.com) commented 2026-06-08 02:56:04 +00:00

The peers icon here is designed to be 5 icons with each one representing an increasing amount of connections to the node.

Image
The peers icon here is designed to be 5 icons with each one representing an increasing amount of connections to the node. <img width="632" height="60" alt="Image" src="https://git.fish.foo/attachments/b240cb05-838a-4ed5-a85d-f04e0965c38a" />
johnny9 (Migrated from github.com) reviewed 2026-06-08 03:02:56 +00:00
johnny9 (Migrated from github.com) commented 2026-06-08 03:02:56 +00:00
The original source of these icon is the bitcoin wallet ui kit https://www.figma.com/design/iaIQLsKeyK6CDRilTPeHie/Bitcoin-Wallet-UI-Kit---Design-System--Community-?node-id=4499-57506&t=Kq8aiiPsn58BlnQ1-4
pseudoramdom (Migrated from github.com) reviewed 2026-06-08 03:05:59 +00:00
pseudoramdom (Migrated from github.com) commented 2026-06-08 03:05:59 +00:00

It's available on https://bitcoinicons.com

It's available on https://bitcoinicons.com
epicleafies (Migrated from github.com) reviewed 2026-06-08 04:19:28 +00:00
epicleafies (Migrated from github.com) commented 2026-06-08 04:19:28 +00:00

Okay. I'll update to use all dynamically.

Okay. I'll update to use all dynamically.
pseudoramdom commented 2026-06-08 18:43:49 +00:00 (Migrated from github.com)

The command hints are super slick and useful! But when I hit return on any of the command, I'd expect the selected command to go through , but instead what ever is in my textfield went.
https://github.com/user-attachments/assets/f24d2c71-65c2-498f-b813-3a8f21a13f6d

The command hints are super slick and useful! But when I hit return on any of the command, I'd expect the selected command to go through , but instead what ever is in my textfield went. https://github.com/user-attachments/assets/f24d2c71-65c2-498f-b813-3a8f21a13f6d
pseudoramdom commented 2026-06-08 19:11:30 +00:00 (Migrated from github.com)

Re: Settings layout, I believe Christoph had a simpler version here
Mainly

  • highlight over selected item instead of the accent
  • Grouping of items
  • left aligned
Re: Settings layout, I believe Christoph had a simpler version [here](https://github.com/BitcoinDesign/Bitcoin-Core-App/issues/163#issuecomment-4368468139) Mainly - highlight over selected item instead of the accent - Grouping of items - left aligned
pseudoramdom commented 2026-06-08 19:13:33 +00:00 (Migrated from github.com)

The icon sizes are off on macOS. Worth fixing it here if it's quick
Screenshot 2026-06-08 at 12 12 31 PM

The icon sizes are off on macOS. Worth fixing it here if it's quick <img width="203" height="73" alt="Screenshot 2026-06-08 at 12 12 31 PM" src="https://git.fish.foo/attachments/b9b2d345-5468-4302-810c-ddb29895f3fc" />
jarolrod (Migrated from github.com) reviewed 2026-06-15 20:03:34 +00:00
jarolrod (Migrated from github.com) commented 2026-06-15 20:03:34 +00:00

Are we intentionally choosing to drop the wallet context here?

The lower-level executor already supports wallet scoping: RpcCommandExecutor::RPCParseCommandLine() accepts wallet_name and builds the /wallet/<percent-encoded-name> URI before calling node.executeRpc().

Are we intentionally choosing to drop the wallet context here? The lower-level executor already supports wallet scoping: `RpcCommandExecutor::RPCParseCommandLine()` accepts `wallet_name` and builds the `/wallet/<percent-encoded-name>` URI before calling `node.executeRpc()`.
jarolrod (Migrated from github.com) reviewed 2026-06-15 21:24:45 +00:00
jarolrod (Migrated from github.com) commented 2026-06-15 21:24:45 +00:00

The button itself is disabled while rpcConsoleModel.executing is true, but submitCommand() itself still accepts commands. That matters because Enter calls the QML submitCommand() helper directly, so keyboard submission can still reach the invokable while another RPC is running.

Qt Widgets handles this in RPCConsole::on_lineEdit_returnPressed() by allowing stop as a special case, then returning early when m_is_executing is true.

The QML worker still executes queued commands serially, so this is not parallel RPC execution, but the executing state can become inaccurate: the first result calls setExecuting(false) even if another command is already queued or running behind it.

The button itself is disabled while `rpcConsoleModel.executing` is true, but `submitCommand()` itself still accepts commands. That matters because Enter calls the QML `submitCommand()` helper directly, so keyboard submission can still reach the invokable while another RPC is running. Qt Widgets handles this in `RPCConsole::on_lineEdit_returnPressed()` by allowing `stop` as a special case, then returning early when `m_is_executing` is true. The QML worker still executes queued commands serially, so this is not parallel RPC execution, but the `executing` state can become inaccurate: the first result calls `setExecuting(false)` even if another command is already queued or running behind it.
jarolrod (Migrated from github.com) reviewed 2026-06-15 21:25:30 +00:00
jarolrod (Migrated from github.com) commented 2026-06-15 21:25:30 +00:00

The suggestion here is to model Qt Widgets with how it prevents calls from all forms, button and keyboard press

The suggestion here is to model Qt Widgets with how it prevents calls from all forms, button and keyboard press
jarolrod (Migrated from github.com) reviewed 2026-06-16 00:01:33 +00:00
jarolrod (Migrated from github.com) commented 2026-06-16 00:01:33 +00:00

Maybe we should mirror the Qt Widgets load time clamp here?

Widgets has treated persisted settings as mutable external input in a few places:

  • malformed proxy QSettings were reset to avoid Options dialog crashes (ce2418fa4c)
  • invalid DisplayBitcoinUnit values are rewritten to BTC (75832fdc37)
  • bad settings.json values get recovery handling (1ee6d0b01a, 5b1aae12ca)
  • coupled settings like listen/listenonion are reconciled during init (70f2c579b9, 3b82608dd1)

The tray setting has the same precedent: since the original hide-tray feature (8b0e497028) and still after the positive “Show tray icon” rename (17174f8328), Widgets loads minimizeToTray as settings.value("fMinimizeToTray").toBool() && m_show_tray_icon.

An invalid state is not reachable through normal user clicks, but the gui is implemented to be defensive against an old/manually altered/stale QSettings value so that it cannot produce runtime showTrayIcon=false && minimizeToTray=true.

Maybe we should mirror the Qt Widgets load time clamp here? Widgets has treated persisted settings as mutable external input in a few places: - malformed proxy QSettings were reset to avoid Options dialog crashes ([ce2418fa4c](https://github.com/bitcoin/bitcoin/pull/11448)) - invalid DisplayBitcoinUnit values are rewritten to BTC ([75832fdc37](https://github.com/bitcoin-core/gui/pull/556)) - bad settings.json values get recovery handling ([1ee6d0b01a](https://github.com/bitcoin-core/gui/pull/379), [5b1aae12ca](https://github.com/bitcoin/bitcoin/pull/24498)) - coupled settings like listen/listenonion are reconciled during init ([70f2c579b9](https://github.com/bitcoin-core/gui/pull/568), [3b82608dd1](https://github.com/bitcoin-core/gui/pull/568)) The tray setting has the same precedent: since the original hide-tray feature ([8b0e497028](https://github.com/bitcoin/bitcoin/pull/8006)) and still after the positive “Show tray icon” rename ([17174f8328](https://github.com/bitcoin-core/gui/pull/115)), Widgets loads minimizeToTray as settings.value("fMinimizeToTray").toBool() && m_show_tray_icon. An invalid state is not reachable through normal user clicks, but the gui is implemented to be defensive against an old/manually altered/stale QSettings value so that it cannot produce runtime `showTrayIcon=false && minimizeToTray=true`.
jarolrod (Migrated from github.com) reviewed 2026-06-16 00:04:07 +00:00
jarolrod (Migrated from github.com) commented 2026-06-16 00:04:07 +00:00

The needed changes would look something like

diff --git a/qml/models/desktopwindowbehaviormodel.cpp b/qml/models/desktopwindowbehaviormodel.cpp
index 5e8d2ed049..b8c74ae04e 100644
--- a/qml/models/desktopwindowbehaviormodel.cpp
+++ b/qml/models/desktopwindowbehaviormodel.cpp
@@ -11,7 +11,11 @@ void DesktopWindowBehaviorModel::loadFromSettings()
     QSettings settings;
     // fHideTrayIcon stores the inverse of showTrayIcon (default: show = true → hide = false)
     m_show_tray_icon = !settings.value(KEY_HIDE_TRAY_ICON, false).toBool();
-    m_minimize_to_tray = settings.value(KEY_MINIMIZE_TO_TRAY, false).toBool();
+    const bool raw_minimize_to_tray = settings.value(KEY_MINIMIZE_TO_TRAY, false).toBool();
+    m_minimize_to_tray = raw_minimize_to_tray && m_show_tray_icon;
+    if (raw_minimize_to_tray && !m_show_tray_icon) {
+        settings.setValue(KEY_MINIMIZE_TO_TRAY, false);
+    }
     m_minimize_on_close = settings.value(KEY_MINIMIZE_ON_CLOSE, false).toBool();
 
     if (!m_desktop_platform) {
diff --git a/test/test_desktopwindowbehaviormodel.cpp b/test/test_desktopwindowbehaviormodel.cpp
index a25a07ad89..664093eac7 100644
--- a/test/test_desktopwindowbehaviormodel.cpp
+++ b/test/test_desktopwindowbehaviormodel.cpp
@@ -33,6 +33,7 @@ private Q_SLOTS:
     void shouldMinimizeWindowOnClose_requiresDesktopAndMinimizeOnClose();
 
     // QSettings persistence
+    void loadSettings_clampsMinimizeToTrayWhenTrayHidden();
     void settings_persistAcrossInstances();
 
 private:
@@ -184,6 +185,23 @@ void DesktopWindowBehaviorModelTests::shouldMinimizeWindowOnClose_requiresDeskto
     }
 }
 
+void DesktopWindowBehaviorModelTests::loadSettings_clampsMinimizeToTrayWhenTrayHidden()
+{
+    QSettings settings;
+    settings.setValue("fHideTrayIcon", true);
+    settings.setValue("fMinimizeToTray", true);
+    settings.sync();
+
+    DesktopWindowBehaviorModel model(/*desktop_platform=*/true);
+
+    QCOMPARE(model.showTrayIcon(), false);
+    QCOMPARE(model.minimizeToTray(), false);
+    QCOMPARE(model.shouldHideToTrayOnMinimize(), false);
+
+    QSettings updated_settings;
+    QCOMPARE(updated_settings.value("fMinimizeToTray", true).toBool(), false);
+}
+
 void DesktopWindowBehaviorModelTests::settings_persistAcrossInstances()
 {
     // minimizeOnClose persists when tray icon stays enabled

Alternatively I'm fine with this being a follow-up, or if this is merged before settings, I can include it in my settings PR.

The needed changes would look something like <details> ```diff diff --git a/qml/models/desktopwindowbehaviormodel.cpp b/qml/models/desktopwindowbehaviormodel.cpp index 5e8d2ed049..b8c74ae04e 100644 --- a/qml/models/desktopwindowbehaviormodel.cpp +++ b/qml/models/desktopwindowbehaviormodel.cpp @@ -11,7 +11,11 @@ void DesktopWindowBehaviorModel::loadFromSettings() QSettings settings; // fHideTrayIcon stores the inverse of showTrayIcon (default: show = true → hide = false) m_show_tray_icon = !settings.value(KEY_HIDE_TRAY_ICON, false).toBool(); - m_minimize_to_tray = settings.value(KEY_MINIMIZE_TO_TRAY, false).toBool(); + const bool raw_minimize_to_tray = settings.value(KEY_MINIMIZE_TO_TRAY, false).toBool(); + m_minimize_to_tray = raw_minimize_to_tray && m_show_tray_icon; + if (raw_minimize_to_tray && !m_show_tray_icon) { + settings.setValue(KEY_MINIMIZE_TO_TRAY, false); + } m_minimize_on_close = settings.value(KEY_MINIMIZE_ON_CLOSE, false).toBool(); if (!m_desktop_platform) { diff --git a/test/test_desktopwindowbehaviormodel.cpp b/test/test_desktopwindowbehaviormodel.cpp index a25a07ad89..664093eac7 100644 --- a/test/test_desktopwindowbehaviormodel.cpp +++ b/test/test_desktopwindowbehaviormodel.cpp @@ -33,6 +33,7 @@ private Q_SLOTS: void shouldMinimizeWindowOnClose_requiresDesktopAndMinimizeOnClose(); // QSettings persistence + void loadSettings_clampsMinimizeToTrayWhenTrayHidden(); void settings_persistAcrossInstances(); private: @@ -184,6 +185,23 @@ void DesktopWindowBehaviorModelTests::shouldMinimizeWindowOnClose_requiresDeskto } } +void DesktopWindowBehaviorModelTests::loadSettings_clampsMinimizeToTrayWhenTrayHidden() +{ + QSettings settings; + settings.setValue("fHideTrayIcon", true); + settings.setValue("fMinimizeToTray", true); + settings.sync(); + + DesktopWindowBehaviorModel model(/*desktop_platform=*/true); + + QCOMPARE(model.showTrayIcon(), false); + QCOMPARE(model.minimizeToTray(), false); + QCOMPARE(model.shouldHideToTrayOnMinimize(), false); + + QSettings updated_settings; + QCOMPARE(updated_settings.value("fMinimizeToTray", true).toBool(), false); +} + void DesktopWindowBehaviorModelTests::settings_persistAcrossInstances() { // minimizeOnClose persists when tray icon stays enabled ``` </details> Alternatively I'm fine with this being a follow-up, or if this is merged before settings, I can include it in my settings PR.
jarolrod (Migrated from github.com) reviewed 2026-06-16 00:10:34 +00:00
jarolrod (Migrated from github.com) commented 2026-06-16 00:10:34 +00:00

a fix for this could look like:

diff --git a/qml/models/rpcconsolemodel.cpp b/qml/models/rpcconsolemodel.cpp
index 6fa98e01a5..48937fdfae 100644
--- a/qml/models/rpcconsolemodel.cpp
+++ b/qml/models/rpcconsolemodel.cpp
@@ -203,7 +203,7 @@ public:
         : QObject(parent), m_node(node) {}
 
 public Q_SLOTS:
-    void execute(const QString& command)
+    void execute(const QString& command, const QString& wallet_name)
     {
         QString time = QDateTime::currentDateTime().toString("hh:mm:ss");
         try {
@@ -232,7 +232,7 @@ public Q_SLOTS:
             }
 
             std::string result;
-            if (!RpcCommandExecutor::RPCExecuteCommandLine(m_node, result, executableCommand)) {
+            if (!RpcCommandExecutor::RPCExecuteCommandLine(m_node, result, executableCommand, nullptr, wallet_name)) {
                 Q_EMIT resultReady(time, RpcConsoleModel::CMD_ERROR,
                                    tr("Parse error: unbalanced ' or \""));
                 return;
@@ -325,7 +325,7 @@ void RpcConsoleModel::appendFormattedRow(const QString& time, int category, cons
                              WrapColor(prefix + body, color));
 }
 
-void RpcConsoleModel::submitCommand(const QString& command)
+void RpcConsoleModel::submitCommand(const QString& command, const QString& wallet_name)
 {
     if (command.trimmed().isEmpty()) return;
 
@@ -359,6 +359,15 @@ void RpcConsoleModel::submitCommand(const QString& command)
     m_history_idx = -1;
     m_pending_text.clear();
 
+    if (m_last_wallet_name != wallet_name) {
+        if (!wallet_name.isEmpty()) {
+            appendFormattedRow(time, CMD_REQUEST, tr("Executing command using \"%1\" wallet").arg(wallet_name));
+        } else {
+            appendFormattedRow(time, CMD_REQUEST, tr("Executing command without any wallet"));
+        }
+        m_last_wallet_name = wallet_name;
+    }
+
     // Append the request line immediately (main thread) so QML sees it before
     // the async reply arrives. Mirrors Qt GUI RPCConsole behaviour.
     appendFormattedRow(time, CMD_REQUEST, filteredCmd);
@@ -367,7 +376,8 @@ void RpcConsoleModel::submitCommand(const QString& command)
 
     // Dispatch to worker thread.
     QMetaObject::invokeMethod(m_worker, "execute", Qt::QueuedConnection,
-                              Q_ARG(QString, command));
+                              Q_ARG(QString, command),
+                              Q_ARG(QString, wallet_name));
 }
 
 QString RpcConsoleModel::browseHistory(int direction, const QString& currentText)
diff --git a/qml/models/rpcconsolemodel.h b/qml/models/rpcconsolemodel.h
index 8ff8a11e53..840042c440 100644
--- a/qml/models/rpcconsolemodel.h
+++ b/qml/models/rpcconsolemodel.h
@@ -73,7 +73,7 @@ private:
  *        emitted rows keep their baked-in colours, which is intentional).
  *
  * Invokable from QML:
- *  - submitCommand(command)
+ *  - submitCommand(command, walletName)
  *  - browseHistory(direction, currentText) → QString
  *  - resetHistoryNavigation()
  *  - clear()
@@ -105,7 +105,7 @@ public:
     QStringList availableCommands() const { return m_available_commands; }
     QAbstractListModel* outputModel() { return &m_output_model; }
 
-    Q_INVOKABLE void submitCommand(const QString& command);
+    Q_INVOKABLE void submitCommand(const QString& command, const QString& wallet_name = {});
 
     /**
      * Navigate command history.
@@ -151,6 +151,7 @@ private:
     QStringList m_history;
     int m_history_idx{-1};
     QString m_pending_text; // text being edited before browsing history
+    QString m_last_wallet_name;
 
     QThread m_worker_thread;
     RpcConsoleWorker* m_worker{nullptr};
diff --git a/qml/pages/node/CommandConsole.qml b/qml/pages/node/CommandConsole.qml
index 0806885676..d99dc353ac 100644
--- a/qml/pages/node/CommandConsole.qml
+++ b/qml/pages/node/CommandConsole.qml
@@ -41,6 +41,8 @@ Page {
     // Exposed for E2E execution-complete detection.
     property bool executing: rpcConsoleModel.executing
 
+    property string walletName: ""
+
     // Guard flag: true while Up/Down navigation is setting inputField.text
     // programmatically, so onTextChanged does not reset the history cursor.
     // Kept in a QtObject to avoid leaking this internal flag into the public API.
@@ -404,7 +406,7 @@ Page {
     function submitCommand() {
         var cmd = inputField.text.trim()
         if (cmd.length === 0) return
-        rpcConsoleModel.submitCommand(cmd)
+        rpcConsoleModel.submitCommand(cmd, root.walletName)
         inputField.text = ""
         filteredCommands = []
     }
diff --git a/qml/pages/wallet/DesktopWallets.qml b/qml/pages/wallet/DesktopWallets.qml
index 7dd931d68e..2c31a731ec 100644
--- a/qml/pages/wallet/DesktopWallets.qml
+++ b/qml/pages/wallet/DesktopWallets.qml
@@ -339,6 +339,9 @@ Page {
         }
         CommandConsole {
             showHeader: false
+            walletName: walletController.isWalletLoaded && walletController.selectedWallet
+                ? walletController.selectedWallet.name
+                : ""
         }
         NodeSettings {
             id: nodeSettings
a fix for this could look like: <details> ```diff diff --git a/qml/models/rpcconsolemodel.cpp b/qml/models/rpcconsolemodel.cpp index 6fa98e01a5..48937fdfae 100644 --- a/qml/models/rpcconsolemodel.cpp +++ b/qml/models/rpcconsolemodel.cpp @@ -203,7 +203,7 @@ public: : QObject(parent), m_node(node) {} public Q_SLOTS: - void execute(const QString& command) + void execute(const QString& command, const QString& wallet_name) { QString time = QDateTime::currentDateTime().toString("hh:mm:ss"); try { @@ -232,7 +232,7 @@ public Q_SLOTS: } std::string result; - if (!RpcCommandExecutor::RPCExecuteCommandLine(m_node, result, executableCommand)) { + if (!RpcCommandExecutor::RPCExecuteCommandLine(m_node, result, executableCommand, nullptr, wallet_name)) { Q_EMIT resultReady(time, RpcConsoleModel::CMD_ERROR, tr("Parse error: unbalanced ' or \"")); return; @@ -325,7 +325,7 @@ void RpcConsoleModel::appendFormattedRow(const QString& time, int category, cons WrapColor(prefix + body, color)); } -void RpcConsoleModel::submitCommand(const QString& command) +void RpcConsoleModel::submitCommand(const QString& command, const QString& wallet_name) { if (command.trimmed().isEmpty()) return; @@ -359,6 +359,15 @@ void RpcConsoleModel::submitCommand(const QString& command) m_history_idx = -1; m_pending_text.clear(); + if (m_last_wallet_name != wallet_name) { + if (!wallet_name.isEmpty()) { + appendFormattedRow(time, CMD_REQUEST, tr("Executing command using \"%1\" wallet").arg(wallet_name)); + } else { + appendFormattedRow(time, CMD_REQUEST, tr("Executing command without any wallet")); + } + m_last_wallet_name = wallet_name; + } + // Append the request line immediately (main thread) so QML sees it before // the async reply arrives. Mirrors Qt GUI RPCConsole behaviour. appendFormattedRow(time, CMD_REQUEST, filteredCmd); @@ -367,7 +376,8 @@ void RpcConsoleModel::submitCommand(const QString& command) // Dispatch to worker thread. QMetaObject::invokeMethod(m_worker, "execute", Qt::QueuedConnection, - Q_ARG(QString, command)); + Q_ARG(QString, command), + Q_ARG(QString, wallet_name)); } QString RpcConsoleModel::browseHistory(int direction, const QString& currentText) diff --git a/qml/models/rpcconsolemodel.h b/qml/models/rpcconsolemodel.h index 8ff8a11e53..840042c440 100644 --- a/qml/models/rpcconsolemodel.h +++ b/qml/models/rpcconsolemodel.h @@ -73,7 +73,7 @@ private: * emitted rows keep their baked-in colours, which is intentional). * * Invokable from QML: - * - submitCommand(command) + * - submitCommand(command, walletName) * - browseHistory(direction, currentText) → QString * - resetHistoryNavigation() * - clear() @@ -105,7 +105,7 @@ public: QStringList availableCommands() const { return m_available_commands; } QAbstractListModel* outputModel() { return &m_output_model; } - Q_INVOKABLE void submitCommand(const QString& command); + Q_INVOKABLE void submitCommand(const QString& command, const QString& wallet_name = {}); /** * Navigate command history. @@ -151,6 +151,7 @@ private: QStringList m_history; int m_history_idx{-1}; QString m_pending_text; // text being edited before browsing history + QString m_last_wallet_name; QThread m_worker_thread; RpcConsoleWorker* m_worker{nullptr}; diff --git a/qml/pages/node/CommandConsole.qml b/qml/pages/node/CommandConsole.qml index 0806885676..d99dc353ac 100644 --- a/qml/pages/node/CommandConsole.qml +++ b/qml/pages/node/CommandConsole.qml @@ -41,6 +41,8 @@ Page { // Exposed for E2E execution-complete detection. property bool executing: rpcConsoleModel.executing + property string walletName: "" + // Guard flag: true while Up/Down navigation is setting inputField.text // programmatically, so onTextChanged does not reset the history cursor. // Kept in a QtObject to avoid leaking this internal flag into the public API. @@ -404,7 +406,7 @@ Page { function submitCommand() { var cmd = inputField.text.trim() if (cmd.length === 0) return - rpcConsoleModel.submitCommand(cmd) + rpcConsoleModel.submitCommand(cmd, root.walletName) inputField.text = "" filteredCommands = [] } diff --git a/qml/pages/wallet/DesktopWallets.qml b/qml/pages/wallet/DesktopWallets.qml index 7dd931d68e..2c31a731ec 100644 --- a/qml/pages/wallet/DesktopWallets.qml +++ b/qml/pages/wallet/DesktopWallets.qml @@ -339,6 +339,9 @@ Page { } CommandConsole { showHeader: false + walletName: walletController.isWalletLoaded && walletController.selectedWallet + ? walletController.selectedWallet.name + : "" } NodeSettings { id: nodeSettings ``` </details>
jarolrod (Migrated from github.com) reviewed 2026-06-16 00:51:48 +00:00
jarolrod (Migrated from github.com) commented 2026-06-16 00:51:48 +00:00

a fix for the above can look like:

diff --git a/qml/models/rpcconsolemodel.cpp b/qml/models/rpcconsolemodel.cpp
index 6fa98e01a5..fcea7627a3 100644
--- a/qml/models/rpcconsolemodel.cpp
+++ b/qml/models/rpcconsolemodel.cpp
@@ -325,9 +325,10 @@ void RpcConsoleModel::appendFormattedRow(const QString& time, int category, cons
                              WrapColor(prefix + body, color));
 }
 
-void RpcConsoleModel::submitCommand(const QString& command)
+bool RpcConsoleModel::submitCommand(const QString& command)
 {
-    if (command.trimmed().isEmpty()) return;
+    const QString trimmed_command = command.trimmed();
+    if (trimmed_command.isEmpty()) return false;
 
     // Compute the filtered version to store in history (passwords redacted).
     // Mirrors Qt5's rpcconsole.cpp:994-1004: the fExecute=false parse call must be
@@ -337,18 +338,27 @@ void RpcConsoleModel::submitCommand(const QString& command)
     std::string dummy;
     QString time = QDateTime::currentDateTime().toString("hh:mm:ss");
     try {
-        if (!RpcCommandExecutor::RPCParseCommandLine(nullptr, dummy, command.toStdString() + "\n",
+        if (!RpcCommandExecutor::RPCParseCommandLine(nullptr, dummy, trimmed_command.toStdString() + "\n",
                                                      false, &filtered)) {
             appendFormattedRow(time, CMD_ERROR, tr("Parse error: unbalanced ' or \""));
-            return;
+            return true;
         }
     } catch (const std::runtime_error& e) {
         appendFormattedRow(time, CMD_ERROR,
                            tr("Error: %1").arg(QString::fromStdString(e.what())));
-        return;
+        return true;
     }
     QString filteredCmd = QString::fromStdString(filtered).trimmed();
 
+    // Match Qt Widgets: allow "stop" even while another command is executing,
+    // but do not enqueue other commands until the current reply has arrived.
+    if (trimmed_command == QLatin1String("stop")) {
+        std::string result;
+        RpcCommandExecutor::RPCExecuteCommandLine(m_node, result, trimmed_command.toStdString());
+        return true;
+    }
+    if (m_executing) return false;
+
     // Add to history (deduplicate consecutive identical entries).
     if (m_history.isEmpty() || m_history.last() != filteredCmd) {
         m_history.append(filteredCmd);
@@ -367,7 +377,8 @@ void RpcConsoleModel::submitCommand(const QString& command)
 
     // Dispatch to worker thread.
     QMetaObject::invokeMethod(m_worker, "execute", Qt::QueuedConnection,
-                              Q_ARG(QString, command));
+                              Q_ARG(QString, trimmed_command));
+    return true;
 }
 
 QString RpcConsoleModel::browseHistory(int direction, const QString& currentText)
diff --git a/qml/models/rpcconsolemodel.h b/qml/models/rpcconsolemodel.h
index 8ff8a11e53..e9787b9056 100644
--- a/qml/models/rpcconsolemodel.h
+++ b/qml/models/rpcconsolemodel.h
@@ -73,7 +73,7 @@ private:
  *        emitted rows keep their baked-in colours, which is intentional).
  *
  * Invokable from QML:
- *  - submitCommand(command)
+ *  - submitCommand(command) -> bool
  *  - browseHistory(direction, currentText) → QString
  *  - resetHistoryNavigation()
  *  - clear()
@@ -105,7 +105,12 @@ public:
     QStringList availableCommands() const { return m_available_commands; }
     QAbstractListModel* outputModel() { return &m_output_model; }
 
-    Q_INVOKABLE void submitCommand(const QString& command);
+    /**
+     * Submit a command for execution.
+     * @return true if the command was accepted, false if it was ignored because
+     *         another command is already executing.
+     */
+    Q_INVOKABLE bool submitCommand(const QString& command);
 
     /**
      * Navigate command history.
diff --git a/qml/pages/node/CommandConsole.qml b/qml/pages/node/CommandConsole.qml
index 0806885676..e9c780d385 100644
--- a/qml/pages/node/CommandConsole.qml
+++ b/qml/pages/node/CommandConsole.qml
@@ -310,7 +310,8 @@ Page {
                 Layout.preferredHeight: 32
                 Layout.alignment: Qt.AlignVCenter
                 hoverEnabled: true
-                enabled: !rpcConsoleModel.executing && inputField.text.trim().length > 0
+                enabled: inputField.text.trim().length > 0 &&
+                         (!rpcConsoleModel.executing || inputField.text.trim() === "stop")
                 onClicked: submitCommand()
 
                 background: Rectangle {
@@ -404,8 +405,9 @@ Page {
     function submitCommand() {
         var cmd = inputField.text.trim()
         if (cmd.length === 0) return
-        rpcConsoleModel.submitCommand(cmd)
-        inputField.text = ""
-        filteredCommands = []
+        if (rpcConsoleModel.submitCommand(cmd)) {
+            inputField.text = ""
+            filteredCommands = []
+        }
     }
 }
a fix for the above can look like: <details> ```diff diff --git a/qml/models/rpcconsolemodel.cpp b/qml/models/rpcconsolemodel.cpp index 6fa98e01a5..fcea7627a3 100644 --- a/qml/models/rpcconsolemodel.cpp +++ b/qml/models/rpcconsolemodel.cpp @@ -325,9 +325,10 @@ void RpcConsoleModel::appendFormattedRow(const QString& time, int category, cons WrapColor(prefix + body, color)); } -void RpcConsoleModel::submitCommand(const QString& command) +bool RpcConsoleModel::submitCommand(const QString& command) { - if (command.trimmed().isEmpty()) return; + const QString trimmed_command = command.trimmed(); + if (trimmed_command.isEmpty()) return false; // Compute the filtered version to store in history (passwords redacted). // Mirrors Qt5's rpcconsole.cpp:994-1004: the fExecute=false parse call must be @@ -337,18 +338,27 @@ void RpcConsoleModel::submitCommand(const QString& command) std::string dummy; QString time = QDateTime::currentDateTime().toString("hh:mm:ss"); try { - if (!RpcCommandExecutor::RPCParseCommandLine(nullptr, dummy, command.toStdString() + "\n", + if (!RpcCommandExecutor::RPCParseCommandLine(nullptr, dummy, trimmed_command.toStdString() + "\n", false, &filtered)) { appendFormattedRow(time, CMD_ERROR, tr("Parse error: unbalanced ' or \"")); - return; + return true; } } catch (const std::runtime_error& e) { appendFormattedRow(time, CMD_ERROR, tr("Error: %1").arg(QString::fromStdString(e.what()))); - return; + return true; } QString filteredCmd = QString::fromStdString(filtered).trimmed(); + // Match Qt Widgets: allow "stop" even while another command is executing, + // but do not enqueue other commands until the current reply has arrived. + if (trimmed_command == QLatin1String("stop")) { + std::string result; + RpcCommandExecutor::RPCExecuteCommandLine(m_node, result, trimmed_command.toStdString()); + return true; + } + if (m_executing) return false; + // Add to history (deduplicate consecutive identical entries). if (m_history.isEmpty() || m_history.last() != filteredCmd) { m_history.append(filteredCmd); @@ -367,7 +377,8 @@ void RpcConsoleModel::submitCommand(const QString& command) // Dispatch to worker thread. QMetaObject::invokeMethod(m_worker, "execute", Qt::QueuedConnection, - Q_ARG(QString, command)); + Q_ARG(QString, trimmed_command)); + return true; } QString RpcConsoleModel::browseHistory(int direction, const QString& currentText) diff --git a/qml/models/rpcconsolemodel.h b/qml/models/rpcconsolemodel.h index 8ff8a11e53..e9787b9056 100644 --- a/qml/models/rpcconsolemodel.h +++ b/qml/models/rpcconsolemodel.h @@ -73,7 +73,7 @@ private: * emitted rows keep their baked-in colours, which is intentional). * * Invokable from QML: - * - submitCommand(command) + * - submitCommand(command) -> bool * - browseHistory(direction, currentText) → QString * - resetHistoryNavigation() * - clear() @@ -105,7 +105,12 @@ public: QStringList availableCommands() const { return m_available_commands; } QAbstractListModel* outputModel() { return &m_output_model; } - Q_INVOKABLE void submitCommand(const QString& command); + /** + * Submit a command for execution. + * @return true if the command was accepted, false if it was ignored because + * another command is already executing. + */ + Q_INVOKABLE bool submitCommand(const QString& command); /** * Navigate command history. diff --git a/qml/pages/node/CommandConsole.qml b/qml/pages/node/CommandConsole.qml index 0806885676..e9c780d385 100644 --- a/qml/pages/node/CommandConsole.qml +++ b/qml/pages/node/CommandConsole.qml @@ -310,7 +310,8 @@ Page { Layout.preferredHeight: 32 Layout.alignment: Qt.AlignVCenter hoverEnabled: true - enabled: !rpcConsoleModel.executing && inputField.text.trim().length > 0 + enabled: inputField.text.trim().length > 0 && + (!rpcConsoleModel.executing || inputField.text.trim() === "stop") onClicked: submitCommand() background: Rectangle { @@ -404,8 +405,9 @@ Page { function submitCommand() { var cmd = inputField.text.trim() if (cmd.length === 0) return - rpcConsoleModel.submitCommand(cmd) - inputField.text = "" - filteredCommands = [] + if (rpcConsoleModel.submitCommand(cmd)) { + inputField.text = "" + filteredCommands = [] + } } } ``` </details>
jarolrod (Migrated from github.com) reviewed 2026-06-16 00:54:47 +00:00
jarolrod (Migrated from github.com) commented 2026-06-16 00:54:47 +00:00

To reproduce manaully, you can enter the following, which is long running command:

waitfornewblock 50000

On the current branch you can enter as many of them as you want and they will execute one after another, and return when they return. With the suggested patch you cannot enter another rcp command until that one returns, which is the Qt Widgets gui behavior.

To reproduce manaully, you can enter the following, which is long running command: ``` waitfornewblock 50000 ``` On the current branch you can enter as many of them as you want and they will execute one after another, and return when they return. With the suggested patch you cannot enter another rcp command until that one returns, which is the Qt Widgets gui behavior.
jarolrod (Migrated from github.com) reviewed 2026-06-22 00:30:08 +00:00
jarolrod (Migrated from github.com) commented 2026-06-22 00:30:08 +00:00

This component is currently functional, and does the right things, so we can merge.

Longer term, though, I think the RPC console would benefit from being split into a few focused pieces.

Right now this one QML file owns page layout, warning/header text, output rendering, command input, keyboard handling, history navigation, autocomplete filtering, popup behavior, focus policy, and wallet context submission.

I think this warrants refactoring the console around a clearer ownership model (placeholder names below, we can figure out naming later):

RpcConsoleModel / RpcConsoleController
  - RPC execution
  - busy state
  - command history
  - wallet scoping
  - command acceptance policy
  - available commands / completions
  - output model

CommandConsole.qml
  - page layout
  - warning/header area
  - places output view and command line

RpcCommandLine.qml
  - TextField + submit button
  - Enter/Tab/Up/Down handling
  - history navigation
  - accepted/refused submit UX

RpcCompletionPopup.qml
  - suggestion list
  - highlighted row behavior
  - click/keyboard completion behavior

ConsoleOutputView.qml / MonospaceOutputView
  - output rendering
  - scroll behavior
  - selection/copy behavior

The important design direction is that command acceptance should remain controller owned.

QML can ask canSubmit(command) or consume a richer SubmitResult, but it shouldn't need to duplicate special cases like "stop is allowed while another command is executing."

That keeps direct invokable calls, keyboard submission, button submission, and tests all going through the same policy.

While also giving us the benefit of a clean architecture split, and easier testability, and finer grain testability of each component independently.

Architecture diagram:

flowchart TD
    Page["CommandConsole.qml<br/>page layout only"]
    Header["Header / warning area"]
    Output["ConsoleOutputView.qml<br/>output rendering + scroll"]
    Line["RpcCommandLine.qml<br/>input, submit button, key handling"]
    Popup["RpcCompletionPopup.qml<br/>suggestions + highlighted item"]

    Controller["RpcConsoleModel / Controller<br/>acceptance policy, history, completions,<br/>wallet scoping, output model"]
    Worker["RpcConsoleWorker<br/>background RPC execution"]
    Node["interfaces::Node<br/>executeRpc / listRpcCommands"]

    Page --> Header
    Page --> Output
    Page --> Line
    Line --> Popup

    Line -->|"canSubmit / submitCommand"| Controller
    Popup -->|"selected completion"| Line
    Output -->|"binds outputModel"| Controller
    Controller --> Worker
    Worker --> Node
    Worker -->|"resultReady"| Controller

This component is currently functional, and does the right things, so we can merge. Longer term, though, I think the RPC console would benefit from being split into a few focused pieces. Right now this one QML file owns page layout, warning/header text, output rendering, command input, keyboard handling, history navigation, autocomplete filtering, popup behavior, focus policy, and wallet context submission. I think this warrants refactoring the console around a clearer ownership model (placeholder names below, we can figure out naming later): ```text RpcConsoleModel / RpcConsoleController - RPC execution - busy state - command history - wallet scoping - command acceptance policy - available commands / completions - output model CommandConsole.qml - page layout - warning/header area - places output view and command line RpcCommandLine.qml - TextField + submit button - Enter/Tab/Up/Down handling - history navigation - accepted/refused submit UX RpcCompletionPopup.qml - suggestion list - highlighted row behavior - click/keyboard completion behavior ConsoleOutputView.qml / MonospaceOutputView - output rendering - scroll behavior - selection/copy behavior ``` The important design direction is that command acceptance should remain controller owned. QML can ask `canSubmit(command)` or consume a richer `SubmitResult`, but it shouldn't need to duplicate special cases like "stop is allowed while another command is executing." That keeps direct invokable calls, keyboard submission, button submission, and tests all going through the same policy. While also giving us the benefit of a clean architecture split, and easier testability, and finer grain testability of each component independently. Architecture diagram: ```mermaid flowchart TD Page["CommandConsole.qml<br/>page layout only"] Header["Header / warning area"] Output["ConsoleOutputView.qml<br/>output rendering + scroll"] Line["RpcCommandLine.qml<br/>input, submit button, key handling"] Popup["RpcCompletionPopup.qml<br/>suggestions + highlighted item"] Controller["RpcConsoleModel / Controller<br/>acceptance policy, history, completions,<br/>wallet scoping, output model"] Worker["RpcConsoleWorker<br/>background RPC execution"] Node["interfaces::Node<br/>executeRpc / listRpcCommands"] Page --> Header Page --> Output Page --> Line Line --> Popup Line -->|"canSubmit / submitCommand"| Controller Popup -->|"selected completion"| Line Output -->|"binds outputModel"| Controller Controller --> Worker Worker --> Node Worker -->|"resultReady"| Controller
jarolrod (Migrated from github.com) reviewed 2026-06-22 00:57:41 +00:00
jarolrod (Migrated from github.com) commented 2026-06-22 00:57:41 +00:00

I think in a follow-up we can make the tray controller use one shared show/hide/restore model.

The tray click path and the native menu path currently make different decisions:

  • toggleWindow() checks the real window state: hidden, minimized, and obscured.
  • The menu action only checks m_window_visible.

This means that a covered but visible window can be treated differently depending on whether the user clicks the tray icon or uses the OS native menu; tray click would try to show/raise it, while the menu can label/action it as “Hide”.

I don't think this needs to block this PR, but the follow up should probably centralize the decision in one helper, for example:

bool DesktopTrayIconController::shouldShowMainWindow() const
{
    if (!m_main_window) return false;
    if (!m_main_window->isVisible()) return true;
    if (m_main_window->windowStates() & Qt::WindowMinimized) return true;
    return isObscured(m_main_window);
}

Then use that same logic for:

  • tray icon activation
  • native menu action
  • native menu label text
I think in a follow-up we can make the tray controller use one shared show/hide/restore model. The tray click path and the native menu path currently make different decisions: - `toggleWindow()` checks the real window state: hidden, minimized, and obscured. - The menu action only checks `m_window_visible`. This means that a covered but visible window can be treated differently depending on whether the user clicks the tray icon or uses the OS native menu; tray click would try to show/raise it, while the menu can label/action it as “Hide”. I don't think this needs to block this PR, but the follow up should probably centralize the decision in one helper, for example: ```cpp bool DesktopTrayIconController::shouldShowMainWindow() const { if (!m_main_window) return false; if (!m_main_window->isVisible()) return true; if (m_main_window->windowStates() & Qt::WindowMinimized) return true; return isObscured(m_main_window); } ``` Then use that same logic for: - tray icon activation - native menu action - native menu label text
jarolrod (Migrated from github.com) reviewed 2026-06-22 14:38:45 +00:00
jarolrod (Migrated from github.com) commented 2026-06-22 14:20:30 +00:00

I noticed here that there is probably a related followup we would want to do:

This hasMoreLines calculation cannot reliably detect older entries. ReadRawLines() returns at most loadLimit rows, and then this path checks filtered.size() > m_load_limit. For a normal large log whose newest loadLimit rows are non-blank, filtered.size() will be exactly m_load_limit, not greater than it, even if the file has many older entries. So hasMoreLines becomes false and the button stays hidden.

I noticed here that there is probably a related followup we would want to do: This `hasMoreLines` calculation cannot reliably detect older entries. `ReadRawLines()` returns at most `loadLimit` rows, and then this path checks `filtered.size() > m_load_limit`. For a normal large log whose newest `loadLimit` rows are non-blank, `filtered.size()` will be exactly `m_load_limit`, not greater than it, even if the file has many older entries. So `hasMoreLines` becomes false and the button stays hidden.
jarolrod (Migrated from github.com) commented 2026-06-22 14:38:40 +00:00

Building on the above, I think the debug log viewer would benefit from a refactor that treats this as a small log viewing subsystem rather than one list model that happens to read a file.

From first principles, the debug log viewer has four separate responsibilities:

  1. read the file correctly and efficiently
  2. track pagination and file identity
  3. expose rows to QML with precise model notifications
  4. render/search/update visible UI

Right now those responsibilities are mixed together. That makes a few correctness issues hard to avoid.

The current model mostly knows “I loaded N rows from the tail,” then tries to infer everything else from that. That makes Load more a limit bump plus reread, append refresh a search for the old top row by message text, and rotation/truncation detection dependent on whether old content can still be found.

I think the cleaner followup is to make this cursor-based: the reader returns rows plus oldestCursor, newestCursor, hasOlderEntries, and file generation. Then initial load, Load more, appends, and reloads become direct operations instead of things that we try to best effort guesstimate.

That also gives cleaner model notifications: insert new rows at the top, insert older rows at the bottom, emit dataChanged for relative-time-only updates, and reserve full resets for true replacement cases like filtering or rotation.

I think a good architecture to move towards is one that implements the following split:

DebugLogReader
  Owns file facts. It should be a pure file-IO worker.
  It can return structured results from:
  - readTail(limit)
  - readOlder(before_cursor, limit)
  - readAppended(after_cursor)
  - readReload(limit)

DebugLogStore
  Owns loaded-window state:
  - loaded rows
  - newest cursor
  - oldest cursor
  - hasOlderEntries
  - file generation

DebugLogModel
  Owns QAbstractListModel behavior:
  - exposes rows and roles to QML
  - emits beginInsertRows for appended/older rows
  - emits dataChanged for role-only updates
  - uses beginResetModel only for full replacement cases

SettingsDebugLog.qml / log view
  Owns presentation:
  - search controls
  - load-more button
  - visible list rendering
  - ideally virtualized row creation
flowchart TD
    QML["SettingsDebugLog.qml<br/>controls + page state"]
    View["Virtualized Log View<br/>renders visible rows only"]
    Model["DebugLogModel<br/>QAbstractListModel adapter"]
    Store["DebugLogStore<br/>loaded rows + cursors + file generation"]
    Reader["DebugLogReader<br/>pure async file IO"]
    Watcher["LogFileWatcher<br/>file/directory events"]
    File["debug.log"]

    QML --> View
    View --> Model
    QML --> Model

    Model --> Store
    Model --> Reader
    Watcher --> Model

    Reader --> File
    Watcher --> File
    Reader --> Store

The important shift here is that the model stops guessing and starts tracking where it actually is in the file. The reader gives the model real cursors and file information.

This would make the behavior easier to reason about and test, while fixing the current pagination ambiguity, stale relative time labels, duplicate content refresh risk, and log lifecycle edge cases.

Building on the above, I think the debug log viewer would benefit from a refactor that treats this as a small log viewing subsystem rather than one list model that happens to read a file. From first principles, the debug log viewer has four separate responsibilities: 1. read the file correctly and efficiently 2. track pagination and file identity 3. expose rows to QML with precise model notifications 4. render/search/update visible UI Right now those responsibilities are mixed together. That makes a few correctness issues hard to avoid. The current model mostly knows “I loaded N rows from the tail,” then tries to infer everything else from that. That makes `Load more` a limit bump plus reread, append refresh a search for the old top row by message text, and rotation/truncation detection dependent on whether old content can still be found. I think the cleaner followup is to make this cursor-based: the reader returns rows plus `oldestCursor`, `newestCursor`, `hasOlderEntries`, and file generation. Then initial load, `Load more`, appends, and reloads become direct operations instead of things that we try to best effort guesstimate. That also gives cleaner model notifications: insert new rows at the top, insert older rows at the bottom, emit `dataChanged` for relative-time-only updates, and reserve full resets for true replacement cases like filtering or rotation. I think a good architecture to move towards is one that implements the following split: ```text DebugLogReader Owns file facts. It should be a pure file-IO worker. It can return structured results from: - readTail(limit) - readOlder(before_cursor, limit) - readAppended(after_cursor) - readReload(limit) DebugLogStore Owns loaded-window state: - loaded rows - newest cursor - oldest cursor - hasOlderEntries - file generation DebugLogModel Owns QAbstractListModel behavior: - exposes rows and roles to QML - emits beginInsertRows for appended/older rows - emits dataChanged for role-only updates - uses beginResetModel only for full replacement cases SettingsDebugLog.qml / log view Owns presentation: - search controls - load-more button - visible list rendering - ideally virtualized row creation ``` ```mermaid flowchart TD QML["SettingsDebugLog.qml<br/>controls + page state"] View["Virtualized Log View<br/>renders visible rows only"] Model["DebugLogModel<br/>QAbstractListModel adapter"] Store["DebugLogStore<br/>loaded rows + cursors + file generation"] Reader["DebugLogReader<br/>pure async file IO"] Watcher["LogFileWatcher<br/>file/directory events"] File["debug.log"] QML --> View View --> Model QML --> Model Model --> Store Model --> Reader Watcher --> Model Reader --> File Watcher --> File Reader --> Store ``` The important shift here is that the model stops guessing and starts tracking where it actually is in the file. The reader gives the model real cursors and file information. This would make the behavior easier to reason about and test, while fixing the current pagination ambiguity, stale relative time labels, duplicate content refresh risk, and log lifecycle edge cases.
jarolrod commented 2026-06-22 14:40:58 +00:00 (Migrated from github.com)

ACK 8f4a8379742ceece1b200292d740ad95d8097fca

These changes are good to merge now. Important follow-ups are documented in review.

ACK 8f4a8379742ceece1b200292d740ad95d8097fca These changes are good to merge now. Important follow-ups are documented in review.
johnny9 (Migrated from github.com) approved these changes 2026-06-24 03:40:41 +00:00
johnny9 (Migrated from github.com) left a comment

ACK 8f4a8379742ceece1b200292d740ad95d8097fca

ACK 8f4a8379742ceece1b200292d740ad95d8097fca
hebasto commented 2026-06-24 11:27:06 +00:00 (Migrated from github.com)

Needs rebase.

Needs rebase.
epicleafies commented 2026-06-24 22:09:12 +00:00 (Migrated from github.com)

@pseudoramdom I fixed the 2 blockers from #750 here (send crash and adding to CI flow). Rest of review issues are less urgent.

@pseudoramdom I fixed the 2 blockers from #750 here (send crash and adding to CI flow). Rest of review issues are less urgent.
pseudoramdom commented 2026-06-24 22:21:08 +00:00 (Migrated from github.com)

nit: Should we give a padding to the left of the menu? Feels like there's no breathing room there compared to the rest of the app.
Screenshot 2026-06-24 at 3 20 16 PM

nit: Should we give a padding to the left of the menu? Feels like there's no breathing room there compared to the rest of the app. <img width="1358" height="809" alt="Screenshot 2026-06-24 at 3 20 16 PM" src="https://git.fish.foo/attachments/8e1e37a3-0a8c-4e03-a34e-867c3c80873e" />
johnny9 (Migrated from github.com) reviewed 2026-06-28 00:15:50 +00:00
johnny9 (Migrated from github.com) left a comment

There are 2 commits in the PR that don't compile. Please resolve this before we ACK/merge.

8ac27bdc15 build: Add Qt6::Widgets and optional DBus support for system tray

48f9f2355b qt: Add DesktopWindowBehaviorModel

Both fail at CMake configure because test/CMakeLists.txt references test_desktoptrayiconcontroller.cpp before that file exists. The fix is straightforward: move the test_desktoptrayiconcontroller.cpp addition to test/CMakeLists.txt into the commit that adds that file, or add the file in the earlier build-system commit.

Everything else looks good enough to ACK/merge. I have added an issue to track a bug that Jarol also mentioned relating to the relativeTime updates.

There are 2 commits in the PR that don't compile. Please resolve this before we ACK/merge. 8ac27bdc15 build: Add Qt6::Widgets and optional DBus support for system tray 48f9f2355b qt: Add DesktopWindowBehaviorModel Both fail at CMake configure because test/CMakeLists.txt references test_desktoptrayiconcontroller.cpp before that file exists. The fix is straightforward: move the test_desktoptrayiconcontroller.cpp addition to test/CMakeLists.txt into the commit that adds that file, or add the file in the earlier build-system commit. Everything else looks good enough to ACK/merge. I have added an issue to track a bug that Jarol also mentioned relating to the relativeTime updates.
johnny9 (Migrated from github.com) reviewed 2026-06-28 20:04:03 +00:00
johnny9 (Migrated from github.com) left a comment

The second commit 8d3d0818fd doesn't link properly

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0a8291af95..97dd827f04 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -105,18 +105,20 @@ target_link_libraries(bitcoinqml
     Qt6::Quick
     Qt6::QuickControls2
     Qt6::Network
     Qt6::Widgets
+  PRIVATE
+    bitcoin_cli
 )
The second commit 8d3d0818fd doesn't link properly ``` diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a8291af95..97dd827f04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,18 +105,20 @@ target_link_libraries(bitcoinqml Qt6::Quick Qt6::QuickControls2 Qt6::Network Qt6::Widgets + PRIVATE + bitcoin_cli ) ```
johnny9 (Migrated from github.com) approved these changes 2026-06-29 03:41:51 +00:00
johnny9 (Migrated from github.com) left a comment

ACK 6ff51b854d

Re-reviewed the latest push and confirmed the commit-order build issue is fixed

Manually tested on Ubuntu and macOS. Remaining non-blocking issues are tracked for follow-up.

ACK 6ff51b854d12e4852ba2216302f43efed15000e8 Re-reviewed the latest push and confirmed the commit-order build issue is fixed Manually tested on Ubuntu and macOS. Remaining non-blocking issues are tracked for follow-up.
Sign in to join this conversation.
No description provided.