From fb8f470a1906fe0b8e5a817fa9d86927f30d8789 2018-09-03 10:48:39 From: Alexis Jeandet Date: 2018-09-03 10:48:39 Subject: [PATCH] [WIP] new generic WS plugin and few other fixes Signed-off-by: Alexis Jeandet --- diff --git a/.gitignore b/.gitignore index 8211dab..7e2e3d9 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,6 @@ core/include/Version.h subprojects/CatalogueAPI/ subprojects/QxOrm/ documentation/* -.idea/* +**/.idea/* **/__pycache__/* +*.srctrl* diff --git a/CMakeLists.txt b/CMakeLists.txt index 2cfed99..517ac18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,10 +47,13 @@ ENDIF(IWYU) enable_testing() -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}) +find_package(SciQLOPCore CONFIG QUIET) +if (NOT SciQLOPCore_FOUND) + if(NOT IS_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/core) + message("Init submodule Core") + 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}) + endif() add_subdirectory(core) endif() diff --git a/core b/core index a05b0ab..6b6270b 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit a05b0ab234936e28b6ba79535ccaee297d83a1e8 +Subproject commit 6b6270b07547ddc94a57ecd2cdb54784412c1081 diff --git a/gui/include/Visualization/VisualizationGraphWidget.h b/gui/include/Visualization/VisualizationGraphWidget.h index 749d8e0..54a04f1 100644 --- a/gui/include/Visualization/VisualizationGraphWidget.h +++ b/gui/include/Visualization/VisualizationGraphWidget.h @@ -6,6 +6,7 @@ #include #include +#include #include @@ -152,6 +153,8 @@ private slots: void onDataCacheVariableUpdated(); void onUpdateVarDisplaying(std::shared_ptr variable, const DateTimeRange &range); + + void variableUpdated(QUuid id); }; #endif // SCIQLOP_VISUALIZATIONGRAPHWIDGET_H diff --git a/gui/src/Variable/VariableInspectorWidget.cpp b/gui/src/Variable/VariableInspectorWidget.cpp index 7188f4c..925f56e 100644 --- a/gui/src/Variable/VariableInspectorWidget.cpp +++ b/gui/src/Variable/VariableInspectorWidget.cpp @@ -172,12 +172,9 @@ VariableInspectorWidget::~VariableInspectorWidget() void VariableInspectorWidget::onTableMenuRequested(const QPoint &pos) noexcept { auto selectedRows = ui->tableView->selectionModel()->selectedRows(); - - // Gets the model to retrieve the underlying selected variables - auto& vc = sqpApp->variableController(); auto selectedVariables = QVector >{}; for (const auto &selectedRow : qAsConst(selectedRows)) { - if (auto selectedVariable = vc[selectedRow.row()]) { + if (auto selectedVariable = this->m_model->variables()[selectedRow.row()]) { selectedVariables.push_back(selectedVariable); } } diff --git a/gui/src/Visualization/VisualizationGraphWidget.cpp b/gui/src/Visualization/VisualizationGraphWidget.cpp index 061bd5d..8900e75 100644 --- a/gui/src/Visualization/VisualizationGraphWidget.cpp +++ b/gui/src/Visualization/VisualizationGraphWidget.cpp @@ -312,11 +312,9 @@ void VisualizationGraphWidget::addVariable(std::shared_ptr variable, D setGraphRange(range); this->setFlags(GraphFlag::EnableAll); } - connect(variable.get(),&Variable::updated, - [variable=variable,this]() - { - QMetaObject::invokeMethod(this,[variable=variable,this](){this->onUpdateVarDisplaying(variable,this->graphRange());}); - }); + //@TODO this is bad! when variable is moved to another graph it still fires + // even if this has been deleted + connect(variable.get(),&Variable::updated,this, &VisualizationGraphWidget::variableUpdated); this->onUpdateVarDisplaying(variable,range);//My bullshit emit variableAdded(variable); } @@ -1040,3 +1038,14 @@ void VisualizationGraphWidget::onUpdateVarDisplaying(std::shared_ptr v impl->updateData(it->second, variable, range); } } + +void VisualizationGraphWidget::variableUpdated(QUuid id) +{ + for(auto& [var,plotables]:impl->m_VariableToPlotMultiMap) + { + if(var->ID()==id) + { + impl->updateData(plotables,var,this->graphRange()); + } + } +} diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index f65856d..9716678 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -1,2 +1,3 @@ add_subdirectory(mockplugin) add_subdirectory(amda) +add_subdirectory(generic_ws) diff --git a/plugins/amda/src/AmdaProvider.cpp b/plugins/amda/src/AmdaProvider.cpp index ab38dc0..11a525c 100644 --- a/plugins/amda/src/AmdaProvider.cpp +++ b/plugins/amda/src/AmdaProvider.cpp @@ -67,7 +67,7 @@ std::shared_ptr AmdaProvider::clone() const IDataSeries* AmdaProvider::getData(const DataProviderParameters ¶meters) { - auto range = parameters.m_Times.front(); + auto range = parameters.m_Range; auto metaData = parameters.m_Data; auto productId = metaData.value(AMDA_XML_ID_KEY).toString(); auto productValueType diff --git a/plugins/amda/src/AmdaServer.cpp b/plugins/amda/src/AmdaServer.cpp index 66c11cf..064b789 100644 --- a/plugins/amda/src/AmdaServer.cpp +++ b/plugins/amda/src/AmdaServer.cpp @@ -10,7 +10,7 @@ namespace { const auto AMDA_DEFAULT_SERVER_URL = QStringLiteral("amda.irap.omp.eu"); /// URL of the AMDA test server -const auto AMDA_TEST_SERVER_URL = QStringLiteral("amdatest.irap.omp.eu"); +const auto AMDA_TEST_SERVER_URL = QStringLiteral("amdadev.irap.omp.eu/"); /// Port used for local server const auto AMDA_LOCAL_SERVER_PORT = 6543; diff --git a/plugins/generic_ws/CMakeLists.txt b/plugins/generic_ws/CMakeLists.txt new file mode 100644 index 0000000..75cc735 --- /dev/null +++ b/plugins/generic_ws/CMakeLists.txt @@ -0,0 +1,25 @@ +include_directories(include) +FILE (GLOB_RECURSE genericWS_SRCS + include/*.h + src/*.cpp + resources/*.qrc + ) + +add_definitions(-DQT_PLUGIN) +add_definitions(-DSCIQLOP_PLUGIN_JSON_FILE_PATH="${CMAKE_CURRENT_SOURCE_DIR}/resources/genericWS.json") +if(NOT BUILD_SHARED_LIBS) + add_definitions(-DQT_STATICPLUGIN) +endif() + +add_library(generic_ws ${genericWS_SRCS}) +SET_TARGET_PROPERTIES(generic_ws PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) + +target_link_libraries(generic_ws PUBLIC sciqlopgui) + +install(TARGETS generic_ws + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/SciQlop + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/SciQlop + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + +include(sciqlop_tests) + diff --git a/plugins/generic_ws/include/GenericWSEngine.h b/plugins/generic_ws/include/GenericWSEngine.h new file mode 100644 index 0000000..1a6f8a8 --- /dev/null +++ b/plugins/generic_ws/include/GenericWSEngine.h @@ -0,0 +1,26 @@ +#ifndef GENERICWSENGINE_H +#define GENERICWSENGINE_H +#include +#include + +class GenericWSEngine: public IDataProvider +{ +public: + virtual std::shared_ptr clone() const override + { + return std::make_shared(); + } + + virtual IDataSeries* getData(const DataProviderParameters ¶meters) override + { + auto range = parameters.m_Range; + auto metadata = parameters.m_Data; + auto WS = metadata["WS"].toString(); + auto parameter = metadata["WS"].toString(); + return nullptr; + } + + +}; + +#endif diff --git a/plugins/generic_ws/include/GenericWSPlugin.h b/plugins/generic_ws/include/GenericWSPlugin.h new file mode 100644 index 0000000..0a9ca3a --- /dev/null +++ b/plugins/generic_ws/include/GenericWSPlugin.h @@ -0,0 +1,24 @@ +#ifndef GENERICWSPLUGIN_H +#define GENERICWSPLUGIN_H + +#include + + +#include + +#ifndef SCIQLOP_PLUGIN_JSON_FILE_PATH +#define SCIQLOP_PLUGIN_JSON_FILE_PATH "genericWS.json" +#endif + +class DataSourceItem; + +class GenericWS : public QObject, public IPlugin { + Q_OBJECT + Q_INTERFACES(IPlugin) + Q_PLUGIN_METADATA(IID "sciqlop.plugin.IPlugin" FILE SCIQLOP_PLUGIN_JSON_FILE_PATH) +public: + /// @sa IPlugin::initialize() + void initialize() override; +}; + +#endif // GENERICWSPLUGIN_H diff --git a/plugins/generic_ws/resources/genericWS.json b/plugins/generic_ws/resources/genericWS.json new file mode 100644 index 0000000..3b55fa0 --- /dev/null +++ b/plugins/generic_ws/resources/genericWS.json @@ -0,0 +1,3 @@ +{ + "name" : "GenericWS" +} diff --git a/plugins/generic_ws/src/GenericWSEngine.cpp b/plugins/generic_ws/src/GenericWSEngine.cpp new file mode 100644 index 0000000..760ce30 --- /dev/null +++ b/plugins/generic_ws/src/GenericWSEngine.cpp @@ -0,0 +1 @@ +#include "GenericWSEngine.h" diff --git a/plugins/generic_ws/src/GenericWSPlugin.cpp b/plugins/generic_ws/src/GenericWSPlugin.cpp new file mode 100644 index 0000000..760ce30 --- /dev/null +++ b/plugins/generic_ws/src/GenericWSPlugin.cpp @@ -0,0 +1 @@ +#include "GenericWSEngine.h" diff --git a/plugins/mockplugin/src/CosinusProvider.cpp b/plugins/mockplugin/src/CosinusProvider.cpp index 51dc75d..cbe36c8 100644 --- a/plugins/mockplugin/src/CosinusProvider.cpp +++ b/plugins/mockplugin/src/CosinusProvider.cpp @@ -194,6 +194,6 @@ IDataSeries *CosinusProvider::_generate(const DateTimeRange &range, const QVaria IDataSeries* CosinusProvider::getData(const DataProviderParameters ¶meters) { - return _generate(parameters.m_Times.front(),parameters.m_Data); + return _generate(parameters.m_Range, parameters.m_Data); } diff --git a/subprojects/libcatalogs b/subprojects/libcatalogs new file mode 160000 index 0000000..f2fa281 --- /dev/null +++ b/subprojects/libcatalogs @@ -0,0 +1 @@ +Subproject commit f2fa281306099e7136a288dd70fd97d0e33afa15