From 7071c2fc1c253357e12af8de28ff52cea8b9cd95 Mon Sep 17 00:00:00 2001 From: JC Luna Date: Wed, 1 Apr 2026 17:33:11 -0500 Subject: [PATCH 01/13] Expose Qt6::Widgets link --- CMakeLists.txt | 10 +--------- src/Plotting/Plot2D.hpp | 5 ++--- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd557f4..78ad6fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,18 +25,10 @@ qt_standard_project_setup(REQUIRES 6.10) #target_compile_warn_all(guidev) # #target_link_libraries(guidev PRIVATE ${STD_APP_QT6_DEPS}) -# -## Ideally you would quickly iter on QML designs by using the dev gui app -#qt_add_qml_module(qml.a_circle -# URI qml.a_circle -# OUTPUT_DIRECTORY "qml/a_circle" -# QML_FILES -# "qml/circle.qml" -#) # Plotting Interface add_library(plotting_iface SHARED ${PLOTTING_SOURCES}) -target_link_libraries(plotting_iface PRIVATE Qt6::Core Qt6::Widgets) +target_link_libraries(plotting_iface PUBLIC Qt6::Core Qt6::Widgets) target_include_directories(plotting_iface PUBLIC ${PLOTTING_SRC_DIR}) target_compile_definitions(plotting_iface PRIVATE COMPILING_PLOT_API_DLL) target_compile_warn_all(plotting_iface) diff --git a/src/Plotting/Plot2D.hpp b/src/Plotting/Plot2D.hpp index 6ddf998..f5e5a62 100644 --- a/src/Plotting/Plot2D.hpp +++ b/src/Plotting/Plot2D.hpp @@ -13,9 +13,8 @@ namespace VSCL::Plot { // 2D plotting interface. -// The embeddable plot has at most, one figure inside of it. A figure will have multiple serieses. -// -// TODO: probably look at typical plotting implementations for scientific programming +// The embeddable plot has at most, one figure inside of it. +// A figure will have multiple series. class PLOT_API EmbeddablePlot2D { public: void AddPoint(uint8_t idx, double time, double quantity, bool update = false); From 61d40c9b524a188f60ee65052dd662b536d2f777 Mon Sep 17 00:00:00 2001 From: JC Luna Date: Wed, 1 Apr 2026 17:43:30 -0500 Subject: [PATCH 02/13] Remove container sources --- cmake/cpp.cmake | 3 +-- src/Plotting/Container.cpp | 25 ------------------------- src/Plotting/Container.hpp | 23 ----------------------- src/Plotting/Plot2D.cpp | 2 ++ src/Plotting/Plot2D.hpp | 10 ++++++---- 5 files changed, 9 insertions(+), 54 deletions(-) delete mode 100644 src/Plotting/Container.cpp delete mode 100644 src/Plotting/Container.hpp diff --git a/cmake/cpp.cmake b/cmake/cpp.cmake index 8a3e41b..2fb55c6 100644 --- a/cmake/cpp.cmake +++ b/cmake/cpp.cmake @@ -35,8 +35,7 @@ set(WIDGET_SOURCES ${DISPLAYER_SOURCES}) set(PLOTTING_SOURCES - "${PLOTTING_SRC_DIR}/Plot2D.cpp" - "${PLOTTING_SRC_DIR}/Container.cpp") + "${PLOTTING_SRC_DIR}/Plot2D.cpp") set(GR_BKND_SOURCES "${PLOTTING_SRC_DIR}/Backend/CoreGR.cpp") diff --git a/src/Plotting/Container.cpp b/src/Plotting/Container.cpp deleted file mode 100644 index 6598ca7..0000000 --- a/src/Plotting/Container.cpp +++ /dev/null @@ -1,25 +0,0 @@ - -#include "Container.hpp" - -namespace VSCL::Plot { - -PlotContainer::PlotContainer(QWidget* parent, EmbeddablePlot2D* newPlot) - : QWidget(parent) { - QHBoxLayout* boxlay = new QHBoxLayout(this); - boxlay->setContentsMargins(5, 5, 5, 5); - setLayout(boxlay); - - Plot = newPlot; - Plot->GetWidgetRep()->setParent(this); - - QSizePolicy plotSizePolicy; - plotSizePolicy.setHorizontalPolicy(QSizePolicy::Expanding); - plotSizePolicy.setVerticalPolicy(QSizePolicy::Expanding); - Plot->GetWidgetRep()->setSizePolicy(plotSizePolicy); - - boxlay->addWidget(Plot->GetWidgetRep()); - - Plot->Plot(); -} - -} // namespace VSCL::Plot diff --git a/src/Plotting/Container.hpp b/src/Plotting/Container.hpp deleted file mode 100644 index 45430d5..0000000 --- a/src/Plotting/Container.hpp +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include -#include - -#include "Plot2D.hpp" -#include "PlotAPI.hpp" - -namespace VSCL::Plot { - -// The intent is to put stuff next to the embedded plot -class PLOT_API PlotContainer : public QWidget { - - Q_OBJECT; - -public: - PlotContainer(QWidget* parent, EmbeddablePlot2D* newPlot); - -private: - EmbeddablePlot2D* Plot; - -}; // class AttitudePlotContainer -} // namespace VSCL::Plot diff --git a/src/Plotting/Plot2D.cpp b/src/Plotting/Plot2D.cpp index 6480ed5..a10d0e5 100644 --- a/src/Plotting/Plot2D.cpp +++ b/src/Plotting/Plot2D.cpp @@ -4,6 +4,8 @@ namespace VSCL::Plot { +EmbeddablePlot2D::EmbeddablePlot2D(QWidget* parent) : QWidget(parent) { } + void EmbeddablePlot2D::AddPoint(double time, double quantity, bool update) { AddPoint(0, time, quantity, update); } void EmbeddablePlot2D::AddPoint(uint8_t idx, double time, double quantity, bool update) { std::vector& oldTime = Series[idx].Times; diff --git a/src/Plotting/Plot2D.hpp b/src/Plotting/Plot2D.hpp index f5e5a62..ee58d34 100644 --- a/src/Plotting/Plot2D.hpp +++ b/src/Plotting/Plot2D.hpp @@ -15,8 +15,13 @@ namespace VSCL::Plot { // 2D plotting interface. // The embeddable plot has at most, one figure inside of it. // A figure will have multiple series. -class PLOT_API EmbeddablePlot2D { +class PLOT_API EmbeddablePlot2D : public QWidget { + + Q_OBJECT; + public: + EmbeddablePlot2D(QWidget* parent); + void AddPoint(uint8_t idx, double time, double quantity, bool update = false); void AddPoint(double time, double quantity, bool update = false); void AddPoints(uint8_t idx, const std::vector& times, const std::vector& quantities, bool update = false); @@ -34,9 +39,6 @@ class PLOT_API EmbeddablePlot2D { // Clear data that was being stored. virtual void EraseAllData(); - QWidget* GetWidgetRep() const; - void SetWidgetRep(QWidget* newWidgetRep); - const AxisInfo& GetAxisInfoView(Axis axis) const; /* From baedc70a0d69e10c8d6dc8d3993c6edfd66f24cc Mon Sep 17 00:00:00 2001 From: JC Luna Date: Wed, 1 Apr 2026 18:32:56 -0500 Subject: [PATCH 03/13] Remove refs to PlotContainer --- src/Plotting/Plot2D.cpp | 9 +-------- src/Windowing/WidgetsRecreation.cpp | 6 ++---- src/Windowing/WidgetsRecreation.hpp | 3 +-- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/Plotting/Plot2D.cpp b/src/Plotting/Plot2D.cpp index a10d0e5..ddbf2c7 100644 --- a/src/Plotting/Plot2D.cpp +++ b/src/Plotting/Plot2D.cpp @@ -53,8 +53,7 @@ void EmbeddablePlot2D::SetAxis(const Axis axis, const AxisInfo& info) { void EmbeddablePlot2D::SetTitle(const std::string& title) { Title = title; Plot(); } void EmbeddablePlot2D::Plot() { - if (WidgetRep) - WidgetRep->update(); + update(); } void EmbeddablePlot2D::EraseAllData() { @@ -77,12 +76,6 @@ const AxisInfo& EmbeddablePlot2D::GetAxisInfoView(Axis axis) const { }; } -QWidget* EmbeddablePlot2D::GetWidgetRep() const { return WidgetRep; } -void EmbeddablePlot2D::SetWidgetRep(QWidget* newWidgetRep) { - WidgetRep = newWidgetRep; - WidgetRep->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); -} - // Series {{{ void EmbeddablePlot2D::AddSeries() { Series.push_back(SeriesInfo()); Plot(); } void EmbeddablePlot2D::AddSeries(std::string& name) { diff --git a/src/Windowing/WidgetsRecreation.cpp b/src/Windowing/WidgetsRecreation.cpp index 8061f75..2623c73 100644 --- a/src/Windowing/WidgetsRecreation.cpp +++ b/src/Windowing/WidgetsRecreation.cpp @@ -201,8 +201,7 @@ void Widgets::SetAllButtonTextSize() { void Widgets::SetupTimeHistoryPlotGR() { Plot = new Plot::PlotGR(this); - TimeHistory = new Plot::PlotContainer(MajorContainer, Plot); - MajorLayout->addWidget(TimeHistory, 1, 0); + MajorLayout->addWidget(Plot, 1, 0); Plot::AxisInfo axInfo; axInfo.Range = { 0, 10 }; @@ -231,8 +230,7 @@ void Widgets::SetupTimeHistoryPlotGR() { void Widgets::SetupTimeHistoryPlotQChart() { Plot = new Plot::PlotQChart(this); - TimeHistory = new Plot::PlotContainer(MajorContainer, Plot); - MajorLayout->addWidget(TimeHistory, 1, 0); + MajorLayout->addWidget(Plot, 1, 0); Plot::AxisInfo axInfo; axInfo.Range = { 0, 10 }; diff --git a/src/Windowing/WidgetsRecreation.hpp b/src/Windowing/WidgetsRecreation.hpp index 49d2768..a3c3cf0 100644 --- a/src/Windowing/WidgetsRecreation.hpp +++ b/src/Windowing/WidgetsRecreation.hpp @@ -6,7 +6,7 @@ #include "Widgets/Dial/Composite.hpp" #include "Widgets/Displays/QuantitiesRatesDisplay.hpp" #include "Widgets/Displays/QuantitiesRatesRow.hpp" -#include "Plotting/Container.hpp" +#include "Plotting/Plot2D.hpp" #include "Util/Sizing.hpp" namespace VSCL::FromPpt { @@ -42,7 +42,6 @@ class Widgets : public QMainWindow { void SetupAttitudeDials(); Plot::EmbeddablePlot2D* Plot; - Plot::PlotContainer* TimeHistory; void SetupTimeHistoryPlotGR(); void SetupTimeHistoryPlotQChart(); From c89c441938dfc051937b542f7b8e1a1f90609e27 Mon Sep 17 00:00:00 2001 From: JC Luna Date: Wed, 1 Apr 2026 18:51:21 -0500 Subject: [PATCH 04/13] Solve multiple inheritance in plots --- src/Plotting/Backend/CoreGR.cpp | 14 ++++++++------ src/Plotting/Backend/CoreGR.hpp | 8 ++------ src/Plotting/Backend/CoreQChart.cpp | 7 ++++--- src/Plotting/Backend/CoreQChart.hpp | 2 +- src/Plotting/Plot2D.hpp | 8 +++----- 5 files changed, 18 insertions(+), 21 deletions(-) diff --git a/src/Plotting/Backend/CoreGR.cpp b/src/Plotting/Backend/CoreGR.cpp index 705d4c7..0965ba9 100644 --- a/src/Plotting/Backend/CoreGR.cpp +++ b/src/Plotting/Backend/CoreGR.cpp @@ -7,9 +7,9 @@ namespace VSCL::Plot { -PlotGR::PlotGR(QWidget* parent) : GRWidget(parent) { - SetWidgetRep(this); -}; +PlotGR::PlotGR(QWidget* parent) + : EmbeddablePlot2D(parent) + , GRWidget(parent) { }; void PlotGR::SetAxis(const Axis axis, const AxisInfo& info) { EmbeddablePlot2D::SetAxis(axis, info); draw(); } void PlotGR::SetTitle(const std::string& title) { EmbeddablePlot2D::SetTitle(title); draw(); } @@ -144,13 +144,15 @@ void PlotGR::draw() { const AxisInfo& taxe = GetAxisInfoView(Axis::Time); const AxisInfo& qaxe = GetAxisInfoView(Axis::Quantity); - double wxh = (double)width() / (double)height(); - double hxw = (double)height() / (double)width(); + double wide = EmbeddablePlot2D::width(); + double high = EmbeddablePlot2D::height(); + double wxh = (double)wide / (double)high; + double hxw = 1 / wxh; double inset[4] = { 0.1, 0.97, 0.16, 0.9 }; // this is magic numbers double wwsdims[4] = { 0, 1, 0, 1 }; double vpdims[4]; - if (width() > height()) { + if (wide > high) { wwsdims[3] = hxw; double dims[4] = { inset[0], inset[1], inset[2]*hxw, inset[3]*hxw }; memcpy(vpdims, dims, 4*sizeof(double)); diff --git a/src/Plotting/Backend/CoreGR.hpp b/src/Plotting/Backend/CoreGR.hpp index c4aa975..8b8f29a 100644 --- a/src/Plotting/Backend/CoreGR.hpp +++ b/src/Plotting/Backend/CoreGR.hpp @@ -9,11 +9,7 @@ namespace VSCL::Plot { -class PlotContainer; - -class GR_BACKEND PlotGR : public EmbeddablePlot2D, public GRWidget { - - friend class PlotContainer; +class GR_BACKEND PlotGR : public GRWidget, virtual public EmbeddablePlot2D { public: PlotGR(QWidget* parent); @@ -34,6 +30,6 @@ class GR_BACKEND PlotGR : public EmbeddablePlot2D, public GRWidget { double* output, const size_t arrSize); public: - static constexpr uint16_t ColorIndex(ColorGR color) { return static_cast(color); } + static uint16_t ColorIndex(ColorGR color) { return static_cast(color); } }; // class PlotGR } // namespace VSCL::Plot diff --git a/src/Plotting/Backend/CoreQChart.cpp b/src/Plotting/Backend/CoreQChart.cpp index 6b7dbef..d4d9d04 100644 --- a/src/Plotting/Backend/CoreQChart.cpp +++ b/src/Plotting/Backend/CoreQChart.cpp @@ -3,10 +3,11 @@ namespace VSCL::Plot { -PlotQChart::PlotQChart(QWidget* parent) : QChartView(parent) { - SetWidgetRep(this); +PlotQChart::PlotQChart(QWidget* parent) + : EmbeddablePlot2D(parent) + , QChartView(parent) { - // These heap allocs are parented when they get added to each other + // These heap allocs are parented and handled when they get added to each other PlotChart = new QChart; LogTimeAxisQt = new QLogValueAxis; diff --git a/src/Plotting/Backend/CoreQChart.hpp b/src/Plotting/Backend/CoreQChart.hpp index 653d92a..7383593 100644 --- a/src/Plotting/Backend/CoreQChart.hpp +++ b/src/Plotting/Backend/CoreQChart.hpp @@ -9,7 +9,7 @@ namespace VSCL::Plot { class PlotContainer; -class QCHART_BACKEND PlotQChart : public EmbeddablePlot2D, public QChartView { +class QCHART_BACKEND PlotQChart : public QChartView, virtual public EmbeddablePlot2D { friend class PlotContainer; diff --git a/src/Plotting/Plot2D.hpp b/src/Plotting/Plot2D.hpp index ee58d34..6f1ef5e 100644 --- a/src/Plotting/Plot2D.hpp +++ b/src/Plotting/Plot2D.hpp @@ -15,9 +15,7 @@ namespace VSCL::Plot { // 2D plotting interface. // The embeddable plot has at most, one figure inside of it. // A figure will have multiple series. -class PLOT_API EmbeddablePlot2D : public QWidget { - - Q_OBJECT; +class PLOT_API EmbeddablePlot2D : virtual public QWidget { public: EmbeddablePlot2D(QWidget* parent); @@ -78,8 +76,8 @@ class PLOT_API EmbeddablePlot2D : public QWidget { virtual void SetColor(uint8_t idx, ColorRGB& color); virtual void SetColor(ColorRGB& color); - constexpr bool GetDrawGridState() { return DrawGrid; }; - constexpr void SetDrawGridState(bool newState) { DrawGrid = newState; }; + bool GetDrawGridState() { return DrawGrid; }; + void SetDrawGridState(bool newState) { DrawGrid = newState; }; private: std::string Title; From 59826892a3217d0aa0c06b7a89fa8db0a41c886b Mon Sep 17 00:00:00 2001 From: JC Luna Date: Wed, 1 Apr 2026 19:24:29 -0500 Subject: [PATCH 05/13] Some more cleanup post-merge --- src/Widgets/Displays/MultiPlotContainer.cpp | 20 ++++++++------------ src/Widgets/Displays/MultiPlotContainer.hpp | 14 ++++++-------- src/Windowing/WidgetsRecreation.cpp | 12 +++++------- src/Windowing/WidgetsRecreation.hpp | 5 ----- 4 files changed, 19 insertions(+), 32 deletions(-) diff --git a/src/Widgets/Displays/MultiPlotContainer.cpp b/src/Widgets/Displays/MultiPlotContainer.cpp index 81913c1..e2aaa58 100644 --- a/src/Widgets/Displays/MultiPlotContainer.cpp +++ b/src/Widgets/Displays/MultiPlotContainer.cpp @@ -1,8 +1,6 @@ #include -#include #include "MultiPlotContainer.hpp" -#include "Plotting/Backend/CoreGR.hpp" #include "Plotting/Backend/CoreQChart.hpp" namespace VSCL { @@ -16,27 +14,25 @@ MultiPlotContainer::MultiPlotContainer(QWidget* parent, int n) : MultiPlotContai for (int i = 0; i < n; i++) { Plot::PlotQChart *plot = new Plot::PlotQChart(this); plot->AddSeries(); - Plot::PlotContainer *container = new Plot::PlotContainer(this, plot); - Plots.append(container); - layout()->addWidget(container); + Plots.append(plot); + layout()->addWidget(static_cast(plot)); // plot->GetWidgetRep()->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); } - numberOfPlots = n; + NumberOfPlots = n; } void MultiPlotContainer::resizeEvent(QResizeEvent* event) { } -QList MultiPlotContainer::GetPlotContainers() const { +QList MultiPlotContainer::GetPlots() const { return Plots; } -const QList& MultiPlotContainer::GetPlotContainersView() const { +const QList& MultiPlotContainer::GetPlotsView() const { return Plots; } void MultiPlotContainer::AddPoints(int n) { - if (n < 0 || n >= numberOfPlots || Plots.isEmpty()) return; - Plot::PlotContainer* plotContainer = Plots.last(); - Plot::EmbeddablePlot2D* plot = plotContainer->GetPlot(); + if (n < 0 || n >= NumberOfPlots || Plots.isEmpty()) return; + Plot::EmbeddablePlot2D* plot = Plots.last(); plot->AddPoint(0, -1, 0.5); plot->AddPoint(5, 90); plot->AddPoint(11, 90); plot->Plot(); } -} +} // namespace VSCL diff --git a/src/Widgets/Displays/MultiPlotContainer.hpp b/src/Widgets/Displays/MultiPlotContainer.hpp index a1f0ef3..0dbf241 100644 --- a/src/Widgets/Displays/MultiPlotContainer.hpp +++ b/src/Widgets/Displays/MultiPlotContainer.hpp @@ -1,11 +1,9 @@ #pragma once #include -#include "Plotting/Container.hpp" -#include "Util/Sizing.hpp" +#include "Plotting/Plot2D.hpp" namespace VSCL { - class MultiPlotContainer : public QWidget { Q_OBJECT; @@ -15,13 +13,13 @@ class MultiPlotContainer : public QWidget { MultiPlotContainer(QWidget* parent, int n); virtual void resizeEvent(QResizeEvent *event) override; - QList GetPlotContainers() const; - const QList& GetPlotContainersView() const; + QList GetPlots() const; + const QList& GetPlotsView() const; void AddPoints(int n); private: - QList Plots; - int numberOfPlots; + QList Plots; + int NumberOfPlots; }; // class MultiPlotContainer -} // namespace VSCL \ No newline at end of file +} // namespace VSCL diff --git a/src/Windowing/WidgetsRecreation.cpp b/src/Windowing/WidgetsRecreation.cpp index 4f9b546..74afd3e 100644 --- a/src/Windowing/WidgetsRecreation.cpp +++ b/src/Windowing/WidgetsRecreation.cpp @@ -203,7 +203,7 @@ void Widgets::SetAllButtonTextSize() { void Widgets::SetupMultiPlot() { Plots = new MultiPlotContainer(this, 3); MajorLayout->addWidget(Plots, 1, 0); - QList allPlots = Plots->GetPlotContainers(); + QList allPlots = Plots->GetPlots(); Plot::AxisInfo axInfo; axInfo.Range = { 0, 10 }; @@ -217,20 +217,18 @@ void Widgets::SetupMultiPlot() { auto angle = RPY.begin(); auto color = Plot::StandardColor.begin(); - for (Plot::PlotContainer* p : allPlots) { - Plot::EmbeddablePlot2D* uhh = p->GetPlot(); - + for (Plot::EmbeddablePlot2D* p : allPlots) { std::string name = *angle; Plot::ColorRGB rgb = color->second; Plot::SeriesInfo info; info.Name = name; info.Color = rgb; - uhh->AddSeries(info); + p->AddSeries(info); justWtv.Title = name; - uhh->SetAxis(Plot::Axis::Quantity, justWtv); - uhh->SetAxis(Plot::Axis::Time, axInfo); + p->SetAxis(Plot::Axis::Quantity, justWtv); + p->SetAxis(Plot::Axis::Time, axInfo); angle++; color++; diff --git a/src/Windowing/WidgetsRecreation.hpp b/src/Windowing/WidgetsRecreation.hpp index 3a2f741..5d0fb20 100644 --- a/src/Windowing/WidgetsRecreation.hpp +++ b/src/Windowing/WidgetsRecreation.hpp @@ -43,14 +43,9 @@ class Widgets : public QMainWindow { void SetupAttitudeDials(); Plot::EmbeddablePlot2D* Plot; -<<<<<<< HEAD -======= - Plot::PlotContainer* TimeHistory; - MultiPlotContainer* Plots; void SetupMultiPlot(); ->>>>>>> fb76cf8c5a055ea4682904a0ec9fe69b440e70e3 void SetupTimeHistoryPlotGR(); void SetupTimeHistoryPlotQChart(); From dc1a3c5462c88166ab8b8cf254f72b0a7ccb1bc0 Mon Sep 17 00:00:00 2001 From: JC Luna Date: Wed, 1 Apr 2026 19:28:44 -0500 Subject: [PATCH 06/13] Remove GR dependency and target --- .gitmodules | 3 --- CMakeLists.txt | 18 +----------------- cmake/cpp.cmake | 5 +---- lib/gr | 1 - 4 files changed, 2 insertions(+), 25 deletions(-) delete mode 160000 lib/gr diff --git a/.gitmodules b/.gitmodules index 73f6bd0..ae4b1a4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ [submodule "lib/vcpkg"] path = lib/vcpkg url = https://github.com/microsoft/vcpkg.git -[submodule "lib/gr"] - path = lib/gr - url = https://github.com/sciapp/gr.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 78ad6fa..b497684 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,22 +33,6 @@ target_include_directories(plotting_iface PUBLIC ${PLOTTING_SRC_DIR}) target_compile_definitions(plotting_iface PRIVATE COMPILING_PLOT_API_DLL) target_compile_warn_all(plotting_iface) -find_package(PNG REQUIRED) -add_library(Libpng::Libpng ALIAS PNG::PNG) # Why does the vcpkg version not do this/why does GR do this -add_subdirectory_silence_warnings("${CMAKE_SOURCE_DIR}/lib/gr") - -# GR Backend Compilation -add_library(gr_backend SHARED ${GR_BKND_SOURCES}) -get_target_property(QT6GR_INCLUDES GR::GR INTERFACE_INCLUDE_DIRECTORIES) -target_include_directories(gr_backend PUBLIC - ${QT6GR_INCLUDES} "${CMAKE_SOURCE_DIR}/src") - -target_link_libraries(gr_backend PUBLIC plotting_iface) -target_link_libraries(gr_backend PUBLIC Qt6::Core Qt6::Widgets) -target_link_libraries(gr_backend PUBLIC GR::qt6gr qt6plugin) -target_compile_definitions(gr_backend PRIVATE COMPILING_GR_BACKEND_DLL) -target_compile_warn_all(gr_backend) - # QChart Backend Compilation add_library(qchart_backend SHARED ${QCHART_BKND_SOURCES}) target_include_directories(qchart_backend PUBLIC "${CMAKE_SOURCE_DIR}/src") @@ -68,4 +52,4 @@ target_include_directories(widgets_recreation PRIVATE ${STD_APP_INCLUDES}) target_compile_warn_all(widgets_recreation) target_link_libraries(widgets_recreation PRIVATE ${STD_APP_QT6_DEPS}) -target_link_libraries(widgets_recreation PRIVATE gr_backend qchart_backend) +target_link_libraries(widgets_recreation PRIVATE qchart_backend) diff --git a/cmake/cpp.cmake b/cmake/cpp.cmake index 5c716dd..5797a34 100644 --- a/cmake/cpp.cmake +++ b/cmake/cpp.cmake @@ -38,9 +38,6 @@ set(WIDGET_SOURCES set(PLOTTING_SOURCES "${PLOTTING_SRC_DIR}/Plot2D.cpp") -set(GR_BKND_SOURCES - "${PLOTTING_SRC_DIR}/Backend/CoreGR.cpp") - set(QCHART_BKND_SOURCES "${PLOTTING_SRC_DIR}/Backend/CoreQChart.cpp") @@ -75,4 +72,4 @@ function(add_subdirectory_silence_warnings IN_DIRECTORY) add_subdirectory("${IN_DIRECTORY}" EXCLUDE_FROM_ALL) set_directory_properties(PROPERTIES COMPILE_OPTIONS "${oldCompileOpts}") -endfunction(set_directory_compile_silence_warnings) +endfunction(add_subdirectory_silence_warnings IN_DIRECTORY) diff --git a/lib/gr b/lib/gr deleted file mode 160000 index 53ed71e..0000000 --- a/lib/gr +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 53ed71e0f464868e1e1cba668895bb4b2d4e2228 From 8478dd9f262daa9ba08b0a6c0284ed42b30a85de Mon Sep 17 00:00:00 2001 From: JC Luna Date: Wed, 1 Apr 2026 19:31:46 -0500 Subject: [PATCH 07/13] Remove GR integration Sources --- src/Plotting/Backend/APIGR.hpp | 13 --- src/Plotting/Backend/ColorGR.hpp | 92 --------------- src/Plotting/Backend/CoreGR.cpp | 174 ---------------------------- src/Plotting/Backend/CoreGR.hpp | 35 ------ src/Plotting/Plot2D.hpp | 3 +- src/Windowing/WidgetsRecreation.cpp | 30 ----- src/Windowing/WidgetsRecreation.hpp | 1 - 7 files changed, 1 insertion(+), 347 deletions(-) delete mode 100644 src/Plotting/Backend/APIGR.hpp delete mode 100644 src/Plotting/Backend/ColorGR.hpp delete mode 100644 src/Plotting/Backend/CoreGR.cpp delete mode 100644 src/Plotting/Backend/CoreGR.hpp diff --git a/src/Plotting/Backend/APIGR.hpp b/src/Plotting/Backend/APIGR.hpp deleted file mode 100644 index 09d67c2..0000000 --- a/src/Plotting/Backend/APIGR.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#ifndef GR_BACKEND -#if defined(_WIN32) && !defined(__GNUC__) -#ifdef COMPILING_GR_BACKEND_DLL -#define GR_BACKEND __declspec(dllexport) -#else -#define GR_BACKEND __declspec(dllimport) -#endif // COMPILING_GR_BACKEND_DLL -#else -#define GR_BACKEND -#endif // _WIN32 && !__GNUC__ -#endif // GR_BACKEND diff --git a/src/Plotting/Backend/ColorGR.hpp b/src/Plotting/Backend/ColorGR.hpp deleted file mode 100644 index 03c9600..0000000 --- a/src/Plotting/Backend/ColorGR.hpp +++ /dev/null @@ -1,92 +0,0 @@ -#pragma once - -#include -#include -#include - -#include "Plotting/Appearance.hpp" - -namespace VSCL::Plot { - -// Reference gr.h 104-123 -// The polyline coloring function takes an int < 1024 -enum class ColorGR : uint16_t { - White = 0, - Black = 1, - Red = 236, - Green = 237, - Yellow = 238, - Blue = 239, - Orange = 240, - Purple = 241, - Cyan = 242, - Magenta = 243, - Lime = 244, - Pink = 245, - Teal = 246, - Lavender = 247, - Brown = 248, - Beige = 249, - Maroon = 250, - Mint = 251, - Olive = 252, - Apricot = 253, - Navy = 254, - Grey = 255 -}; // enum class ColorGR - -// Reference gks/util.c 213-463 -static const std::map ColorGRAsRGB = { - { ColorGR::White, ColorRGB{1.000000, 1.000000, 1.000000} }, - { ColorGR::Black, ColorRGB{0.0, 0.0, 0.0} }, - { ColorGR::Red, ColorRGB{0.901960, 0.098040, 0.294120} }, - { ColorGR::Green, ColorRGB{0.235290, 0.705880, 0.294120} }, - { ColorGR::Yellow, ColorRGB{1.000000, 0.882350, 0.098040} }, - { ColorGR::Blue, ColorRGB{0.000000, 0.509800, 0.784310} }, - { ColorGR::Orange, ColorRGB{0.960780, 0.509800, 0.188240} }, - { ColorGR::Purple, ColorRGB{0.568630, 0.117650, 0.705880} }, - { ColorGR::Cyan, ColorRGB{0.274510, 0.941180, 0.941180} }, - { ColorGR::Magenta, ColorRGB{0.941180, 0.196080, 0.901960} }, - { ColorGR::Lime, ColorRGB{0.823530, 0.960780, 0.235290} }, - { ColorGR::Pink, ColorRGB{0.980390, 0.745100, 0.831370} }, - { ColorGR::Teal, ColorRGB{0.000000, 0.501960, 0.501960} }, - { ColorGR::Lavender, ColorRGB{0.862750, 0.745100, 1.000000} }, - { ColorGR::Brown, ColorRGB{0.666670, 0.431370, 0.156860} }, - { ColorGR::Beige, ColorRGB{1.000000, 0.980390, 0.784310} }, - { ColorGR::Maroon, ColorRGB{0.501960, 0.000000, 0.000000} }, - { ColorGR::Mint, ColorRGB{0.666670, 1.000000, 0.764710} }, - { ColorGR::Olive, ColorRGB{0.501960, 0.501960, 0.000000} }, - { ColorGR::Apricot, ColorRGB{1.000000, 0.843140, 0.705880} }, - { ColorGR::Navy, ColorRGB{0.000000, 0.000000, 0.501960} }, - { ColorGR::Grey, ColorRGB{0.501960, 0.501960, 0.501960} } -}; // ColorGRAsRGB - -/* - * Find the RGB-spaced color from the input GR color name. - */ -static const ColorRGB RGBFromColorGR(ColorGR color) { - return ColorGRAsRGB.at(color); -}; - -/* - * Find a color that's close enough to or matching the input color. - * - * Defaults to RED: ColorRGB{0.901960, 0.098040, 0.294120} - * - */ -static const ColorGR ColorGRFromRGB(ColorRGB color, double tol = 1e-1) { - - for (std::pair colorpair : ColorGRAsRGB) { - const ColorRGB& rgb = colorpair.second; - - if (std::abs(rgb[0] - color[0]) > tol) { continue; } - if (std::abs(rgb[1] - color[1]) > tol) { continue; } - if (std::abs(rgb[2] - color[2]) > tol) { continue; } - - return colorpair.first; - } - - // default - return ColorGR::Red; -}; -} // VSCL::Plot diff --git a/src/Plotting/Backend/CoreGR.cpp b/src/Plotting/Backend/CoreGR.cpp deleted file mode 100644 index 0965ba9..0000000 --- a/src/Plotting/Backend/CoreGR.cpp +++ /dev/null @@ -1,174 +0,0 @@ -#include - -#include "gr.h" - -#include "./CoreGR.hpp" -#include "./ColorGR.hpp" - -namespace VSCL::Plot { - -PlotGR::PlotGR(QWidget* parent) - : EmbeddablePlot2D(parent) - , GRWidget(parent) { }; - -void PlotGR::SetAxis(const Axis axis, const AxisInfo& info) { EmbeddablePlot2D::SetAxis(axis, info); draw(); } -void PlotGR::SetTitle(const std::string& title) { EmbeddablePlot2D::SetTitle(title); draw(); } - -void PlotGR::Plot() { - EmbeddablePlot2D::Plot(); - draw(); -} - -void PlotGR::EraseAllData() { - EmbeddablePlot2D::EraseAllData(); - draw(); -} - -int PlotGR::DoubleVectorToArray(const std::vector& original, - double* output, const size_t arrSize) { - - const size_t vecSize = original.size(); - const bool oversized = vecSize > arrSize; - - int stepSize = 1; - int endDelta = (oversized) ? -1 : 0; - // End delta will change so that it's inclusive of the last point - - // Must take samplings if it's too big to fit - if (oversized) - stepSize = static_cast(std::floor(vecSize / arrSize)); - - for (unsigned int i = 0; i < arrSize + endDelta; i += stepSize) { - output[i] = original[i]; - } - - if (oversized) - output[arrSize - 1] = original[arrSize - 1]; - - return 0; -} - -void PlotGR::UpdateAxes() { - // Horizontal Axis {{{ - const AxisInfo& taxe = GetAxisInfoView(Axis::Time); - double ttick = gr_tick(taxe.Range[0], taxe.Range[1]); - AxisScaling tscal = taxe.Scaling; - - switch (tscal) { - case AxisScaling::Log10: - gr_setscale(GR_OPTION_X_LOG); - break; - case AxisScaling::Ln: - gr_setscale(GR_OPTION_X_LN); - break; - case AxisScaling::Inverted: - gr_setscale(GR_OPTION_FLIP_X); - break; - case AxisScaling::Linear: - default: - gr_setscale(0); - break; - } - // }}} - // Vertical Axis {{{ - const AxisInfo& qaxe = GetAxisInfoView(Axis::Quantity); - double qtick = gr_tick(qaxe.Range[0], qaxe.Range[1]); - AxisScaling qscal = qaxe.Scaling; - - switch (qscal) { - case AxisScaling::Log10: - gr_setscale(GR_OPTION_Y_LOG); - break; - case AxisScaling::Ln: - gr_setscale(GR_OPTION_Y_LN); - break; - case AxisScaling::Inverted: - gr_setscale(GR_OPTION_FLIP_Y); - break; - case AxisScaling::Linear: - default: - gr_setscale(0); - break; - } - // }}} - - if (GetDrawGridState()) { - gr_setlinecolorind(ColorIndex(ColorGR::Grey)); - gr_setlinetype(1); - gr_grid(ttick, qtick, 0, 0, taxe.MajorSpacing, qaxe.MajorSpacing); - } - - gr_setlinecolorind(ColorIndex(ColorGR::Black)); - gr_setlinetype(1); - gr_axes(ttick, qtick, 0, 0, taxe.MajorSpacing, qaxe.MajorSpacing, -0.01); -} // void PlotGR::UpdateAxes(); - -void PlotGR::UpdateSeries() { - const std::vector serieses = GetSeriesInfosView(); - for (const SeriesInfo& series : serieses) { - const std::vector times = series.Times; - const std::vector quantities = series.Quantities; - if (times.size() < 2 || quantities.size() < 2) { continue; } - - // Magic number 512 (arbitrary power of 2) - const size_t vecSize = times.size(); - const size_t n = (vecSize < 512) ? vecSize : 512; - - double timeArr[512] = { 0.0 }; - double quantityArr[512] = { 0.0 }; - - DoubleVectorToArray(times, timeArr, n); - DoubleVectorToArray(quantities, quantityArr, n); - - // Appearance and drawing - switch (series.Style) { - case LineStyle::Dashed: - gr_setlinetype(2); // LINETYPE_DASHED - break; - case LineStyle::Dotted: - gr_setlinetype(3); // LINETYPE_DOTTED - break; - case LineStyle::Solid: - default: - gr_setlinetype(1); // LINETYPE_SOLID - break; - } - - ColorGR color = ColorGRFromRGB(series.Color); - gr_setlinecolorind(ColorIndex(color)); - gr_polyline((int)n, timeArr, quantityArr); - } -} // void PlotGR::UpdateSeries() - -void PlotGR::draw() { - const AxisInfo& taxe = GetAxisInfoView(Axis::Time); - const AxisInfo& qaxe = GetAxisInfoView(Axis::Quantity); - - double wide = EmbeddablePlot2D::width(); - double high = EmbeddablePlot2D::height(); - double wxh = (double)wide / (double)high; - double hxw = 1 / wxh; - double inset[4] = { 0.1, 0.97, 0.16, 0.9 }; // this is magic numbers - double wwsdims[4] = { 0, 1, 0, 1 }; - double vpdims[4]; - - if (wide > high) { - wwsdims[3] = hxw; - double dims[4] = { inset[0], inset[1], inset[2]*hxw, inset[3]*hxw }; - memcpy(vpdims, dims, 4*sizeof(double)); - } - else { - wwsdims[1] = wxh; - double dims[4] = { inset[0]*wxh, inset[1]*wxh, inset[2], inset[3] }; - memcpy(vpdims, dims, 4*sizeof(double)); - } - - gr_setwswindow(wwsdims[0], wwsdims[1], wwsdims[2], wwsdims[3]); - gr_setviewport(vpdims[0], vpdims[1], vpdims[2], vpdims[3]); - gr_setwindow(taxe.Range[0], taxe.Range[1], qaxe.Range[0], qaxe.Range[1]); - - UpdateSeries(); - UpdateAxes(); -} -} // namespace VSCL::Plot -// vim: foldmethod=marker diff --git a/src/Plotting/Backend/CoreGR.hpp b/src/Plotting/Backend/CoreGR.hpp deleted file mode 100644 index 8b8f29a..0000000 --- a/src/Plotting/Backend/CoreGR.hpp +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include -#include "qtgr/grwidget.h" - -#include "APIGR.hpp" -#include "Plotting/Plot2D.hpp" -#include "ColorGR.hpp" - -namespace VSCL::Plot { - -class GR_BACKEND PlotGR : public GRWidget, virtual public EmbeddablePlot2D { - -public: - PlotGR(QWidget* parent); - - virtual void SetAxis(const Axis axis, const AxisInfo& info) override; - virtual void SetTitle(const std::string& title) override; - virtual void Plot() override; - virtual void EraseAllData() override; - -protected: - void UpdateAxes(); - void UpdateSeries(); - - virtual void draw() override; - - // Mostly here for interaction with GR C API - int DoubleVectorToArray(const std::vector& original, - double* output, const size_t arrSize); - -public: - static uint16_t ColorIndex(ColorGR color) { return static_cast(color); } -}; // class PlotGR -} // namespace VSCL::Plot diff --git a/src/Plotting/Plot2D.hpp b/src/Plotting/Plot2D.hpp index a63bb61..c3f831b 100644 --- a/src/Plotting/Plot2D.hpp +++ b/src/Plotting/Plot2D.hpp @@ -14,9 +14,8 @@ namespace VSCL::Plot { // 2D plotting interface. // The embeddable plot has at most, one figure inside of it. -// A figure will have multiple series. +// A figure can have multiple series. class PLOT_API EmbeddablePlot2D : virtual public QWidget { - public: EmbeddablePlot2D(QWidget* parent); diff --git a/src/Windowing/WidgetsRecreation.cpp b/src/Windowing/WidgetsRecreation.cpp index 74afd3e..c686270 100644 --- a/src/Windowing/WidgetsRecreation.cpp +++ b/src/Windowing/WidgetsRecreation.cpp @@ -3,7 +3,6 @@ #include #include "WidgetsRecreation.hpp" -#include "Plotting/Backend/CoreGR.hpp" #include "Plotting/Backend/CoreQChart.hpp" // stupid temp thing {{{ @@ -235,35 +234,6 @@ void Widgets::SetupMultiPlot() { } } -void Widgets::SetupTimeHistoryPlotGR() { - Plot = new Plot::PlotGR(this); - MajorLayout->addWidget(Plot, 1, 0); - - Plot::AxisInfo axInfo; - axInfo.Range = { 0, 10 }; - axInfo.MajorSpacing = 10; - axInfo.MinorSpacing = 0.25; - Plot->SetAxis(Plot::Axis::Time, axInfo); - - Plot::SeriesInfo rollInfo; - rollInfo.Name = "Roll"; - rollInfo.Color = Plot::RGBFromColorGR(Plot::ColorGR::Red); - - Plot::SeriesInfo pitchInfo; - pitchInfo.Name = "Pitch"; - pitchInfo.Color = Plot::RGBFromColorGR(Plot::ColorGR::Blue); - - Plot::SeriesInfo yawInfo; - yawInfo.Name = "Yaw"; - yawInfo.Color = Plot::RGBFromColorGR(Plot::ColorGR::Green); - - Plot->SetSeries(0, rollInfo); - Plot->AddSeries(pitchInfo); - Plot->AddSeries(yawInfo); - - stupid_make_data(Plot); -} // void Widgets::SetupTimeHistoryPlotGR() - void Widgets::SetupTimeHistoryPlotQChart() { Plot = new Plot::PlotQChart(this); MajorLayout->addWidget(Plot, 1, 0); diff --git a/src/Windowing/WidgetsRecreation.hpp b/src/Windowing/WidgetsRecreation.hpp index 5d0fb20..3ef06f3 100644 --- a/src/Windowing/WidgetsRecreation.hpp +++ b/src/Windowing/WidgetsRecreation.hpp @@ -46,7 +46,6 @@ class Widgets : public QMainWindow { MultiPlotContainer* Plots; void SetupMultiPlot(); - void SetupTimeHistoryPlotGR(); void SetupTimeHistoryPlotQChart(); QtyRateDisplay* AttQtysRates; From 524c8e360fee9ee3c05b53a6ad6e8e879a4852b3 Mon Sep 17 00:00:00 2001 From: JC Luna Date: Wed, 1 Apr 2026 21:45:07 -0500 Subject: [PATCH 08/13] Fix accidentally removed Status Column initter --- src/Plotting/Backend/CoreQChart.cpp | 3 +-- src/Plotting/Plot2D.cpp | 2 -- src/Plotting/Plot2D.hpp | 3 ++- src/Widgets/Displays/QuantitiesRatesRow.cpp | 2 +- src/Windowing/WidgetsRecreation.cpp | 2 +- src/Windowing/WidgetsRecreation.hpp | 2 +- 6 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Plotting/Backend/CoreQChart.cpp b/src/Plotting/Backend/CoreQChart.cpp index 8817ea9..d1e6765 100644 --- a/src/Plotting/Backend/CoreQChart.cpp +++ b/src/Plotting/Backend/CoreQChart.cpp @@ -4,8 +4,7 @@ namespace VSCL::Plot { PlotQChart::PlotQChart(QWidget* parent) - : EmbeddablePlot2D(parent) - , QChartView(parent) { + : QChartView(parent) { // These heap allocs are parented and handled when they get added to each other PlotChart = new QChart; diff --git a/src/Plotting/Plot2D.cpp b/src/Plotting/Plot2D.cpp index 37d9c28..7364a3b 100644 --- a/src/Plotting/Plot2D.cpp +++ b/src/Plotting/Plot2D.cpp @@ -4,8 +4,6 @@ namespace VSCL::Plot { -EmbeddablePlot2D::EmbeddablePlot2D(QWidget* parent) : QWidget(parent) { } - void EmbeddablePlot2D::AddPoint(double time, double quantity, bool update) { AddPoint(0, time, quantity, update); } void EmbeddablePlot2D::AddPoint(uint8_t idx, double time, double quantity, bool update) { std::vector& oldTime = Series[idx].Times; diff --git a/src/Plotting/Plot2D.hpp b/src/Plotting/Plot2D.hpp index c3f831b..feb626d 100644 --- a/src/Plotting/Plot2D.hpp +++ b/src/Plotting/Plot2D.hpp @@ -17,7 +17,8 @@ namespace VSCL::Plot { // A figure can have multiple series. class PLOT_API EmbeddablePlot2D : virtual public QWidget { public: - EmbeddablePlot2D(QWidget* parent); + EmbeddablePlot2D() : QWidget(nullptr) { } + EmbeddablePlot2D(QWidget* parent) : QWidget(parent) { } void AddPoint(uint8_t idx, double time, double quantity, bool update = false); void AddPoint(double time, double quantity, bool update = false); diff --git a/src/Widgets/Displays/QuantitiesRatesRow.cpp b/src/Widgets/Displays/QuantitiesRatesRow.cpp index 19df44c..564f99f 100644 --- a/src/Widgets/Displays/QuantitiesRatesRow.cpp +++ b/src/Widgets/Displays/QuantitiesRatesRow.cpp @@ -28,7 +28,7 @@ void QtyRateRow::resizeEvent(QResizeEvent* event) { } void QtyRateRow::AdjustFontSize() { - unsigned int tpt = static_cast(TitleFontAdjustment.AdjustPxSize(window())); + uint32_t tpt = static_cast(TitleFontAdjustment.AdjustPxSize(window())); if (tpt <= TitleFontAdjustment.PxSizeAtMinimum) { setTitle(tr("")); TitleFont.setPixelSize(1); diff --git a/src/Windowing/WidgetsRecreation.cpp b/src/Windowing/WidgetsRecreation.cpp index c686270..e456821 100644 --- a/src/Windowing/WidgetsRecreation.cpp +++ b/src/Windowing/WidgetsRecreation.cpp @@ -47,10 +47,10 @@ Widgets::Widgets() { SetupMultiPlot(); // <-new multiplot SetupAttQtysRatesDisplay(); SetupButtons(); + SetupStatusColumn(); SetGridColumnsMinimums(); SetGridRowsMinimums(); - ButtonFont = QFont(); SetAllButtonTextSize(); SetRoll(-32); diff --git a/src/Windowing/WidgetsRecreation.hpp b/src/Windowing/WidgetsRecreation.hpp index 3ef06f3..e8fcd35 100644 --- a/src/Windowing/WidgetsRecreation.hpp +++ b/src/Windowing/WidgetsRecreation.hpp @@ -25,7 +25,7 @@ class Widgets : public QMainWindow { void SetYawRate(double yaw); private: - QFont ButtonFont; + QFont ButtonFont{ }; QWidget* MajorContainer; QGridLayout* MajorLayout; From de5856b9ce56cfbb758663e14a3fb4d743fe8ffd Mon Sep 17 00:00:00 2001 From: JC Luna Date: Wed, 1 Apr 2026 22:04:02 -0500 Subject: [PATCH 09/13] Ensure properly scaling by enforcing a hierarchy in derived plot backends --- src/Plotting/Backend/CoreQChart.cpp | 20 +++++++++++--------- src/Plotting/Backend/CoreQChart.hpp | 3 ++- src/Plotting/Plot2D.hpp | 5 +++-- src/Widgets/Displays/MultiPlotContainer.cpp | 16 +++++++++++----- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/Plotting/Backend/CoreQChart.cpp b/src/Plotting/Backend/CoreQChart.cpp index d1e6765..f18cf42 100644 --- a/src/Plotting/Backend/CoreQChart.cpp +++ b/src/Plotting/Backend/CoreQChart.cpp @@ -4,15 +4,15 @@ namespace VSCL::Plot { PlotQChart::PlotQChart(QWidget* parent) - : QChartView(parent) { + : EmbeddablePlot2D(parent) + , PlotChart(new QChart) + , PlotChartView(new QChartView(PlotChart, this)) { // These heap allocs are parented and handled when they get added to each other - PlotChart = new QChart; - - LogTimeAxisQt = new QLogValueAxis; - LogQuantityAxisQt = new QLogValueAxis; - TimeAxisQt = new QValueAxis; - QuantityAxisQt = new QValueAxis; + LogTimeAxisQt = new QLogValueAxis(PlotChart); + LogQuantityAxisQt = new QLogValueAxis(PlotChart); + TimeAxisQt = new QValueAxis(PlotChart); + QuantityAxisQt = new QValueAxis(PlotChart); PlotChart->addAxis(TimeAxisQt, Qt::AlignBottom); TimeAxisQt->setLinePenColor(QColorConstants::Black); @@ -36,8 +36,10 @@ PlotQChart::PlotQChart(QWidget* parent) PlotChart->legend()->setVisible(false); PlotChart->setTheme(QChart::ChartThemeLight); - setChart(PlotChart); - setRenderHint(QPainter::RenderHint::Antialiasing); + PlotChartView->setChart(PlotChart); + PlotChartView->setRenderHint(QPainter::RenderHint::Antialiasing); + + layout()->addWidget(PlotChartView); } PlotQChart::~PlotQChart() { diff --git a/src/Plotting/Backend/CoreQChart.hpp b/src/Plotting/Backend/CoreQChart.hpp index 43a487c..9ee46c1 100644 --- a/src/Plotting/Backend/CoreQChart.hpp +++ b/src/Plotting/Backend/CoreQChart.hpp @@ -9,7 +9,7 @@ namespace VSCL::Plot { class PlotContainer; -class QCHART_BACKEND PlotQChart : public QChartView, virtual public EmbeddablePlot2D { +class QCHART_BACKEND PlotQChart : virtual public EmbeddablePlot2D { friend class PlotContainer; @@ -27,6 +27,7 @@ class QCHART_BACKEND PlotQChart : public QChartView, virtual public EmbeddablePl private: QChart* PlotChart; + QChartView* PlotChartView; QLogValueAxis* LogTimeAxisQt; QLogValueAxis* LogQuantityAxisQt; diff --git a/src/Plotting/Plot2D.hpp b/src/Plotting/Plot2D.hpp index feb626d..1a69cf0 100644 --- a/src/Plotting/Plot2D.hpp +++ b/src/Plotting/Plot2D.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include @@ -17,8 +18,8 @@ namespace VSCL::Plot { // A figure can have multiple series. class PLOT_API EmbeddablePlot2D : virtual public QWidget { public: - EmbeddablePlot2D() : QWidget(nullptr) { } - EmbeddablePlot2D(QWidget* parent) : QWidget(parent) { } + EmbeddablePlot2D() : EmbeddablePlot2D(nullptr) { } + EmbeddablePlot2D(QWidget* parent) : QWidget(parent) { setLayout(new QHBoxLayout(this)); } void AddPoint(uint8_t idx, double time, double quantity, bool update = false); void AddPoint(double time, double quantity, bool update = false); diff --git a/src/Widgets/Displays/MultiPlotContainer.cpp b/src/Widgets/Displays/MultiPlotContainer.cpp index e2aaa58..1c68554 100644 --- a/src/Widgets/Displays/MultiPlotContainer.cpp +++ b/src/Widgets/Displays/MultiPlotContainer.cpp @@ -6,27 +6,33 @@ namespace VSCL { MultiPlotContainer::MultiPlotContainer(QWidget* parent) : QWidget(parent) { QVBoxLayout* Organizers = new QVBoxLayout(this); - Organizers->setContentsMargins(0, 0, 0, 0); - Organizers->setSpacing(0); + Organizers->setContentsMargins(5, 5, 5, 5); + //Organizers->setSpacing(0); setLayout(Organizers); } + MultiPlotContainer::MultiPlotContainer(QWidget* parent, int n) : MultiPlotContainer(parent) { for (int i = 0; i < n; i++) { - Plot::PlotQChart *plot = new Plot::PlotQChart(this); + Plot::EmbeddablePlot2D* plot = static_cast(new Plot::PlotQChart(this)); plot->AddSeries(); + Plots.append(plot); - layout()->addWidget(static_cast(plot)); + layout()->addWidget(plot); + plot->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); // plot->GetWidgetRep()->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); } NumberOfPlots = n; } + void MultiPlotContainer::resizeEvent(QResizeEvent* event) { } QList MultiPlotContainer::GetPlots() const { return Plots; } + const QList& MultiPlotContainer::GetPlotsView() const { return Plots; } + void MultiPlotContainer::AddPoints(int n) { if (n < 0 || n >= NumberOfPlots || Plots.isEmpty()) return; Plot::EmbeddablePlot2D* plot = Plots.last(); @@ -35,4 +41,4 @@ void MultiPlotContainer::AddPoints(int n) { plot->AddPoint(11, 90); plot->Plot(); } -} // namespace VSCL +} // namespace VSCL \ No newline at end of file From 1fa485a2c766087cb9f14b339e0e01bcc1a4fbcf Mon Sep 17 00:00:00 2001 From: JC Luna Date: Wed, 1 Apr 2026 22:05:18 -0500 Subject: [PATCH 10/13] Get rid of vcpkg dependencies for GR --- vcpkg.json | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/vcpkg.json b/vcpkg.json index fcda80c..025669a 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,12 +1,5 @@ { "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "testrig-gui", - "dependencies": [ - "zlib", - "libjpeg-turbo", - "libpng", - "qhull", - "cairo", - "opengl" - ] -} + "dependencies": [ ] +} \ No newline at end of file From a3ed356f2313113137e736f64c6b9111b9d84dbb Mon Sep 17 00:00:00 2001 From: JC Luna Date: Wed, 1 Apr 2026 22:16:18 -0500 Subject: [PATCH 11/13] Might as well init all private members in the initializer list --- src/Plotting/Backend/CoreQChart.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/Plotting/Backend/CoreQChart.cpp b/src/Plotting/Backend/CoreQChart.cpp index f18cf42..736fac8 100644 --- a/src/Plotting/Backend/CoreQChart.cpp +++ b/src/Plotting/Backend/CoreQChart.cpp @@ -6,31 +6,29 @@ namespace VSCL::Plot { PlotQChart::PlotQChart(QWidget* parent) : EmbeddablePlot2D(parent) , PlotChart(new QChart) - , PlotChartView(new QChartView(PlotChart, this)) { - - // These heap allocs are parented and handled when they get added to each other - LogTimeAxisQt = new QLogValueAxis(PlotChart); - LogQuantityAxisQt = new QLogValueAxis(PlotChart); - TimeAxisQt = new QValueAxis(PlotChart); - QuantityAxisQt = new QValueAxis(PlotChart); + , PlotChartView(new QChartView(PlotChart, this)) + , LogTimeAxisQt(new QLogValueAxis(PlotChart)) + , LogQuantityAxisQt(new QLogValueAxis(PlotChart)) + , TimeAxisQt(new QValueAxis(PlotChart)) + , QuantityAxisQt(new QValueAxis(PlotChart)) { PlotChart->addAxis(TimeAxisQt, Qt::AlignBottom); TimeAxisQt->setLinePenColor(QColorConstants::Black); - // TimeAxisQt->setLabelFormat("%i"); + TimeAxisQt->setLabelFormat("%i"); PlotChart->addAxis(LogTimeAxisQt, Qt::AlignBottom); LogTimeAxisQt->setLinePenColor(QColorConstants::Black); - // LogTimeAxisQt->setLabelFormat("%g"); + LogTimeAxisQt->setLabelFormat("%g"); LogTimeAxisQt->setGridLineVisible(false); SetAxis(Axis::Time, GetAxisInfoView(Axis::Time)); PlotChart->addAxis(QuantityAxisQt, Qt::AlignLeft); QuantityAxisQt->setLinePenColor(QColorConstants::Black); - // QuantityAxisQt->setLabelFormat("%i"); + QuantityAxisQt->setLabelFormat("%i"); PlotChart->addAxis(LogQuantityAxisQt, Qt::AlignLeft); LogQuantityAxisQt->setLinePenColor(QColorConstants::Black); - // LogQuantityAxisQt->setLabelFormat("%g"); + LogQuantityAxisQt->setLabelFormat("%g"); LogQuantityAxisQt->setGridLineVisible(false); SetAxis(Axis::Quantity, GetAxisInfoView(Axis::Quantity)); From a52a475d6abf25ae42c94c60a0b65d3ccfecc059 Mon Sep 17 00:00:00 2001 From: JC Luna Date: Wed, 1 Apr 2026 22:21:52 -0500 Subject: [PATCH 12/13] Remove vcpkg --- .github/workflows/build.yml | 35 ----------------------------------- CMakeLists.txt | 2 -- vcpkg.json | 5 ----- 3 files changed, 42 deletions(-) delete mode 100644 vcpkg.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5baf5f6..e13cb04 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,24 +42,6 @@ jobs: sudo apt install cmake -y echo Installing automake... sudo apt install autoconf autoconf-archive automake libtool - echo Installing mono... - sudo apt install mono-complete - - uses: lukka/run-vcpkg@v11 - with: - vcpkgDirectory: "${{ github.workspace }}/lib/vcpkg" - vcpkgJsonGlob: "**/vcpkg.json" - - name: "Setup NuGet Credentials" - run: | - mono `vcpkg fetch nuget | tail -n 1` \ - sources add \ - -source "https://nuget.pkg.github.com/team-gets/index.json" \ - -storepasswordincleartext \ - -name "GitHub" \ - -username "team-gets" \ - -password "${{ secrets.GITHUB_TOKEN }}" - mono `vcpkg fetch nuget | tail -n 1` \ - setapikey "${{ secrets.GITHUB_TOKEN }}" \ - -source "https://nuget.pkg.github.com/team-gets/index.json" - name: Prepare CMake run: | cmake -S . -B build --preset=linux-gcc @@ -81,23 +63,6 @@ jobs: target: "desktop" arch: "win64_msvc2022_64" modules: "qtcharts" - - uses: lukka/run-vcpkg@v11 - with: - vcpkgDirectory: "${{ github.workspace }}/lib/vcpkg" - vcpkgJsonGlob: "**/vcpkg.json" - - name: "Setup NuGet Credentials" - shell: "bash" - run: | - `./lib/vcpkg/vcpkg fetch nuget | tail -n 1` \ - sources add \ - -source "https://nuget.pkg.github.com/team-gets/index.json" \ - -storepasswordincleartext \ - -name "GitHub" \ - -username "team-gets" \ - -password "${{ secrets.GITHUB_TOKEN }}" - `./lib/vcpkg/vcpkg fetch nuget | tail -n 1` \ - setapikey "${{ secrets.GITHUB_TOKEN }}" \ - -source "https://nuget.pkg.github.com/team-gets/index.json" - uses: ilammy/msvc-dev-cmd@v1.13.0 - name: Prepare CMake run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index b497684..6bfdbdb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,4 @@ cmake_minimum_required(VERSION 3.30...4.0) -set(CMAKE_TOOLCHAIN_FILE "${CMAKE_SOURCE_DIR}/lib/vcpkg/scripts/buildsystems/vcpkg.cmake" - CACHE STRING "Vcpkg toolchain file" FORCE) project(rig_gui LANGUAGES CXX C diff --git a/vcpkg.json b/vcpkg.json deleted file mode 100644 index 025669a..0000000 --- a/vcpkg.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", - "name": "testrig-gui", - "dependencies": [ ] -} \ No newline at end of file From 2fd4cc7e10698505ac84ac1c01cce5f4b72f8f01 Mon Sep 17 00:00:00 2001 From: JC Luna Date: Wed, 1 Apr 2026 22:32:51 -0500 Subject: [PATCH 13/13] Remove vcpkg submodule --- .gitmodules | 3 --- lib/vcpkg | 1 - 2 files changed, 4 deletions(-) delete mode 100644 .gitmodules delete mode 160000 lib/vcpkg diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index ae4b1a4..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "lib/vcpkg"] - path = lib/vcpkg - url = https://github.com/microsoft/vcpkg.git diff --git a/lib/vcpkg b/lib/vcpkg deleted file mode 160000 index 4bc3a47..0000000 --- a/lib/vcpkg +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4bc3a47c7a63506e215e04e1473368adbaea6c27