From ea7d1a66f4abb70dcbc479ecdd3ce76f124c7cb9 2018-08-16 18:38:33 From: Alexis Jeandet Date: 2018-08-16 18:38:33 Subject: [PATCH] All the codebase is modified to build with new Variable Controller it only builds now there won't be any data update most of the code is broken now ¯\_(ツ)_/¯ Signed-off-by: Alexis Jeandet --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 14d3042..2cfed99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,7 +47,13 @@ ENDIF(IWYU) enable_testing() -add_subdirectory(core) +find_package(core CONFIG QUIET) +if (NOT sciqlopcore_FOUND) + execute_process(COMMAND git submodule init core WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + execute_process(COMMAND git submodule update core WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + add_subdirectory(core) +endif() + add_subdirectory(gui) add_subdirectory(app) add_subdirectory(plugins) diff --git a/app/src/MainWindow.cpp b/app/src/MainWindow.cpp index d3a508d..f603c6a 100644 --- a/app/src/MainWindow.cpp +++ b/app/src/MainWindow.cpp @@ -319,8 +319,8 @@ MainWindow::MainWindow(QWidget *parent) // /////////// // // Controllers / controllers connections - connect(&sqpApp->timeController(), SIGNAL(timeUpdated(DateTimeRange)), &sqpApp->variableController(), - SLOT(onDateTimeOnSelection(DateTimeRange))); +// connect(&sqpApp->timeController(), SIGNAL(timeUpdated(DateTimeRange)), &sqpApp->variableController(), +// SLOT(onDateTimeOnSelection(DateTimeRange))); // Widgets / controllers connections diff --git a/core b/core index 5a50815..5f4f956 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 5a50815a763fb421298a06a6d0380b8f5364e7cd +Subproject commit 5f4f9560990ba00394322fa1d06d4a30feaf7075 diff --git a/gui/include/SqpApplication.h b/gui/include/SqpApplication.h index fad8eb6..4984fa0 100644 --- a/gui/include/SqpApplication.h +++ b/gui/include/SqpApplication.h @@ -19,6 +19,8 @@ class DataSourceController; class NetworkController; class TimeController; class VariableController; +class VariableController2; +class VariableModel2; class VisualizationController; class DragDropGuiController; class ActionsGuiController; @@ -37,14 +39,17 @@ class SqpApplication : public QApplication { Q_OBJECT public: explicit SqpApplication(int &argc, char **argv); - virtual ~SqpApplication(); + ~SqpApplication() override; void initialize(); /// Accessors for the differents sciqlop controllers DataSourceController &dataSourceController() noexcept; NetworkController &networkController() noexcept; TimeController &timeController() noexcept; - VariableController &variableController() noexcept; + VariableController2 &variableController() noexcept; + std::shared_ptr variableControllerOwner() noexcept; + //@TODO there should not be any global model it's just GUI impl detail +// VariableModel2 &variableModel() noexcept; VisualizationController &visualizationController() noexcept; CatalogueController &catalogueController() noexcept; diff --git a/gui/include/Variable/VariableInspectorWidget.h b/gui/include/Variable/VariableInspectorWidget.h index f8e249c..9039107 100644 --- a/gui/include/Variable/VariableInspectorWidget.h +++ b/gui/include/Variable/VariableInspectorWidget.h @@ -7,6 +7,8 @@ #include +#include + Q_DECLARE_LOGGING_CATEGORY(LOG_VariableInspectorWidget) class Variable; @@ -45,6 +47,7 @@ private: Ui::VariableInspectorWidget *ui; QProgressBarItemDelegate *m_ProgressBarItemDelegate; + VariableModel2* m_model; private slots: /// Slot called when right clicking on an variable in the table (displays a menu) diff --git a/gui/include/Visualization/VisualizationGraphWidget.h b/gui/include/Visualization/VisualizationGraphWidget.h index 0c1cbd1..aa21ae9 100644 --- a/gui/include/Visualization/VisualizationGraphWidget.h +++ b/gui/include/Visualization/VisualizationGraphWidget.h @@ -64,7 +64,7 @@ public: void removeVariable(std::shared_ptr variable) noexcept; /// Returns the list of all variables used in the graph - QList > variables() const; + std::vector > variables() const; /// Sets the y-axis range based on the data of a variable void setYRange(std::shared_ptr variable); diff --git a/gui/include/Visualization/VisualizationTabWidget.h b/gui/include/Visualization/VisualizationTabWidget.h index 5299e6e..a9f8db8 100644 --- a/gui/include/Visualization/VisualizationTabWidget.h +++ b/gui/include/Visualization/VisualizationTabWidget.h @@ -53,7 +53,7 @@ public: * @param index The index where the zone should be inserted in the layout * @return the pointer to the created zone */ - VisualizationZoneWidget *createZone(const QList > &variables, + VisualizationZoneWidget *createZone(const std::vector > &variables, int index); /** diff --git a/gui/include/Visualization/VisualizationZoneWidget.h b/gui/include/Visualization/VisualizationZoneWidget.h index 743a20d..7b5216a 100644 --- a/gui/include/Visualization/VisualizationZoneWidget.h +++ b/gui/include/Visualization/VisualizationZoneWidget.h @@ -62,7 +62,7 @@ public: * @param index The index where the graph should be inserted in the layout * @return the pointer to the created graph */ - VisualizationGraphWidget *createGraph(const QList > variables, + VisualizationGraphWidget *createGraph( std::vector > variables, int index); /// Returns the first graph in the zone or nullptr if there is no graph inside diff --git a/gui/src/Catalogue/CatalogueEventsWidget.cpp b/gui/src/Catalogue/CatalogueEventsWidget.cpp index b875af4..e8d770e 100644 --- a/gui/src/Catalogue/CatalogueEventsWidget.cpp +++ b/gui/src/Catalogue/CatalogueEventsWidget.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -240,11 +241,9 @@ struct CatalogueEventsWidget::CatalogueEventsWidgetPrivate { // Closes the previous graph and delete the asociated variables for (auto graph : m_CustomGraphs) { graph->close(); - auto variables = graph->variables().toVector(); - - QMetaObject::invokeMethod(&sqpApp->variableController(), "deleteVariables", - Qt::QueuedConnection, - Q_ARG(QVector >, variables)); + auto variables = graph->variables(); + for(const auto& variable:variables) + sqpApp->variableController().deleteVariable(variable); } m_CustomGraphs.clear(); @@ -276,7 +275,7 @@ struct CatalogueEventsWidget::CatalogueEventsWidgetPrivate { auto context = new QObject{catalogueEventWidget}; QObject::connect( - &sqpApp->variableController(), &VariableController::variableAdded, context, + &sqpApp->variableController(), &VariableController2::variableAdded, context, [this, catalogueEventWidget, zone, context, event, range, productRange, productId](auto variable) { diff --git a/gui/src/DragAndDrop/DragDropGuiController.cpp b/gui/src/DragAndDrop/DragDropGuiController.cpp index 22f058b..87ed9f0 100644 --- a/gui/src/DragAndDrop/DragDropGuiController.cpp +++ b/gui/src/DragAndDrop/DragDropGuiController.cpp @@ -9,7 +9,7 @@ #include "DataSource/DataSourceController.h" #include "Variable/Variable.h" -#include "Variable/VariableController.h" +#include "Variable/VariableController2.h" #include "Common/MimeTypesDef.h" #include "Common/VisualizationDef.h" @@ -244,12 +244,12 @@ bool DragDropGuiController::checkMimeDataForVisualization( auto result = false; if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) { - auto variables = sqpApp->variableController().variablesForMimeData( + auto variables = sqpApp->variableController().variables( mimeData->data(MIME_TYPE_VARIABLE_LIST)); - if (variables.count() == 1) { + if (variables.size() == 1) { - auto variable = variables.first(); + auto variable = variables[0]; if (variable->dataSeries() != nullptr) { // Check that the variable is not already in a graph diff --git a/gui/src/SqpApplication.cpp b/gui/src/SqpApplication.cpp index 419d8a6..38ead16 100644 --- a/gui/src/SqpApplication.cpp +++ b/gui/src/SqpApplication.cpp @@ -10,6 +10,8 @@ #include