From 39c69f3871430545dbc9de2588e702e5e637de5f Mon Sep 17 00:00:00 2001 From: sami Date: Fri, 11 Sep 2026 17:17:23 +0400 Subject: [PATCH] gui: rpc plumbing for settings.changed and grabber.progress MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Protocol.hpp gains method-name constants for every RPC the next batch of dialogs needs (settings.*, limiter.*, schedule.*, queue.*, download.addBatch, grabber.*) and RpcClient re-broadcasts the two events nothing consumed yet: event.settings.changed and event.grabber.progress. No behaviour change on its own — OptionsDialog, SchedulerDialog and GrabberWizard are what actually call these, landing next. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01NSCdCWFXBTSBBK3MzWtJiC --- gui/src/rpc/Protocol.hpp | 20 ++++++++++++++++++++ gui/src/rpc/RpcClient.cpp | 4 ++++ gui/src/rpc/RpcClient.hpp | 6 ++++++ 3 files changed, 30 insertions(+) diff --git a/gui/src/rpc/Protocol.hpp b/gui/src/rpc/Protocol.hpp index 5695395..1258899 100644 --- a/gui/src/rpc/Protocol.hpp +++ b/gui/src/rpc/Protocol.hpp @@ -69,6 +69,24 @@ inline constexpr auto kDownloadPause = "download.pause"; inline constexpr auto kDownloadResume = "download.resume"; inline constexpr auto kDownloadCancel = "download.cancel"; inline constexpr auto kDownloadRemove = "download.remove"; +inline constexpr auto kDownloadProbe = "download.probe"; +inline constexpr auto kDownloadAdd = "download.add"; +inline constexpr auto kDownloadAddBatch = "download.addBatch"; +inline constexpr auto kCategoryList = "category.list"; +inline constexpr auto kQueueList = "queue.list"; +inline constexpr auto kQueueUpsert = "queue.upsert"; +inline constexpr auto kQueueReorder = "queue.reorder"; +inline constexpr auto kQueueStart = "queue.start"; +inline constexpr auto kQueueStop = "queue.stop"; +inline constexpr auto kScheduleGet = "schedule.get"; +inline constexpr auto kScheduleSet = "schedule.set"; +inline constexpr auto kSettingsGet = "settings.get"; +inline constexpr auto kSettingsSet = "settings.set"; +inline constexpr auto kLimiterGet = "limiter.get"; +inline constexpr auto kLimiterSet = "limiter.set"; +inline constexpr auto kGrabberStart = "grabber.start"; +inline constexpr auto kGrabberStatus = "grabber.status"; +inline constexpr auto kGrabberHarvest = "grabber.harvest"; } // namespace method // --- event names --------------------------------------------------------------------- @@ -79,6 +97,8 @@ inline constexpr auto kTaskState = "event.task.state"; inline constexpr auto kTaskProgress = "event.task.progress"; inline constexpr auto kSpeedGlobal = "event.speed.global"; inline constexpr auto kNotify = "event.notify"; +inline constexpr auto kSettingsChanged = "event.settings.changed"; +inline constexpr auto kGrabberProgress = "event.grabber.progress"; } // namespace event } // namespace velox::gui::rpc diff --git a/gui/src/rpc/RpcClient.cpp b/gui/src/rpc/RpcClient.cpp index 55f9b1a..529950c 100644 --- a/gui/src/rpc/RpcClient.cpp +++ b/gui/src/rpc/RpcClient.cpp @@ -106,6 +106,10 @@ void RpcClient::onNotification(const QString &methodName, const QJsonObject &par emit speedGlobal(params); } else if (methodName == QLatin1String(event::kNotify)) { emit notify(params); + } else if (methodName == QLatin1String(event::kSettingsChanged)) { + emit settingsChanged(params); + } else if (methodName == QLatin1String(event::kGrabberProgress)) { + emit grabberProgress(params); } } diff --git a/gui/src/rpc/RpcClient.hpp b/gui/src/rpc/RpcClient.hpp index e337f75..80dec01 100644 --- a/gui/src/rpc/RpcClient.hpp +++ b/gui/src/rpc/RpcClient.hpp @@ -53,6 +53,12 @@ class RpcClient : public QObject { void taskRemoved(const QString &taskId); void speedGlobal(const QJsonObject ¶ms); void notify(const QJsonObject ¶ms); + /// event.settings.changed: carries only the key names that changed; a client re-reads + /// whatever it cares about (OptionsDialog re-fetches if it is open and idle). + void settingsChanged(const QJsonObject ¶ms); + /// event.grabber.progress: crawl progress for whichever GrabberWizard is watching + /// jobId; done true means grabber.status's file list is final. + void grabberProgress(const QJsonObject ¶ms); private slots: void onConnectionState(int state);