From 1d5e880630343197a6f6488c386ce20935050780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20I=C3=B1igo=20Blasco?= Date: Tue, 14 Apr 2026 08:58:27 +0200 Subject: [PATCH 1/2] feat(proto-app): add Tools menu with dynamic toolbox plugin discovery Add a Tools menu to MainWindow that dynamically discovers and lists all loaded Toolbox plugins. Each plugin appears as a menu action that opens its dialog via ToolboxSession::runDialog(). After the dialog closes, the chart and series tree are refreshed. This is the minimum wiring needed to open toolbox plugins (FFT, Quaternion, ColorMap, etc.) from the application UI. --- pj_proto_app/src/main_window.cpp | 34 ++++++++++++++++++++++++++++++++ pj_proto_app/src/main_window.hpp | 7 +++++++ 2 files changed, 41 insertions(+) diff --git a/pj_proto_app/src/main_window.cpp b/pj_proto_app/src/main_window.cpp index 7433ea73..a7930d23 100644 --- a/pj_proto_app/src/main_window.cpp +++ b/pj_proto_app/src/main_window.cpp @@ -187,6 +187,10 @@ MainWindow::MainWindow(const std::string& plugin_dir, QWidget* parent) }); connect(&refresh_timer_, &QTimer::timeout, this, &MainWindow::onRefreshTimer); + // --- Tools menu --- + auto* tools_menu = menuBar()->addMenu("&Tools"); + setupToolboxPanels(tools_menu); + setWindowTitle("PlotJuggler Proto"); } @@ -692,4 +696,34 @@ void MainWindow::onOpenMarketplace() { } } +void MainWindow::setupToolboxPanels(QMenu* tools_menu) { + for (const auto& tb : registry_.allToolboxes()) { + auto session = + std::make_unique(engine_, const_cast(tb.library), tb.name, this); + if (!session->init()) { + continue; + } + + connect(session.get(), &ToolboxSession::dataChanged, this, [this]() { + auto [begin, end] = computeVisibleRange(); + chart_panel_->updateData(begin, end); + tree_model_.rebuildIfChanged(); + }); + + ToolboxSession* raw_session = session.get(); + + tools_menu->addAction(QString::fromStdString(tb.name), this, [this, raw_session]() { + if (raw_session->hasDialog()) { + if (raw_session->runDialog(this)) { + auto [begin, end] = computeVisibleRange(); + chart_panel_->updateData(begin, end); + tree_model_.rebuildIfChanged(); + } + } + }); + + toolbox_sessions_.push_back(std::move(session)); + } +} + } // namespace proto diff --git a/pj_proto_app/src/main_window.hpp b/pj_proto_app/src/main_window.hpp index f26a1b94..3aa978ea 100644 --- a/pj_proto_app/src/main_window.hpp +++ b/pj_proto_app/src/main_window.hpp @@ -1,6 +1,8 @@ #pragma once #include +#include +#include #include #include #include @@ -13,6 +15,7 @@ #include "pj_datastore/engine.hpp" #include "plugin_registry.hpp" #include "series_tree_model.hpp" +#include "toolbox_session.hpp" #include "pj_marketplace/extension_manager.hpp" @@ -43,6 +46,8 @@ class MainWindow : public QMainWindow { void onTreeContextMenu(const QPoint& pos); private: + void setupToolboxPanels(QMenu* tools_menu); + /// Compute the current visible time range based on data and streaming state. std::pair computeVisibleRange() const; @@ -66,6 +71,8 @@ class MainWindow : public QMainWindow { QTimer refresh_timer_; int refresh_tick_ = 0; bool streaming_active_ = false; + + std::vector> toolbox_sessions_; }; } // namespace proto From d3c6505454a34f0fa0ddae66a1cd449e834cc670 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20I=C3=B1igo=20Blasco?= Date: Tue, 14 Apr 2026 09:05:24 +0200 Subject: [PATCH 2/2] fix(build): add toolbox_session.cpp to pj_proto_app sources toolbox_session.cpp was added by PR #44 but not listed in the CMakeLists.txt sources, causing undefined reference errors at link time. --- pj_proto_app/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/pj_proto_app/CMakeLists.txt b/pj_proto_app/CMakeLists.txt index 7dc27197..fc64a1bd 100644 --- a/pj_proto_app/CMakeLists.txt +++ b/pj_proto_app/CMakeLists.txt @@ -8,6 +8,7 @@ add_executable(pj_proto_app src/main_window.cpp src/plugin_registry.cpp src/data_source_session.cpp + src/toolbox_session.cpp src/series_tree_model.cpp src/chart_panel.cpp src/time_range_slider.cpp