@@ -0,0 +1,1 | |||||
|
1 | Subproject commit 5a50815a763fb421298a06a6d0380b8f5364e7cd |
@@ -1,9 +1,6 | |||||
1 | [submodule "external/CatalogueAPI"] |
|
|||
2 | path = external/CatalogueAPI |
|
|||
3 | url = https://hephaistos.lpp.polytechnique.fr/rhodecode/HG_REPOSITORIES/LPP/INSTRUMENTATION/USERS/JEANDET/CatalogueAPI |
|
|||
4 | [submodule "external/libcatalogs"] |
|
|||
5 | path = external/libcatalogs |
|
|||
6 | url = https://hephaistos.lpp.polytechnique.fr/rhodecode/HG_REPOSITORIES/LPP/SciQLOP_Repos/libcatalogs |
|
|||
7 | [submodule "external/pybind11"] |
|
1 | [submodule "external/pybind11"] | |
8 | path = external/pybind11 |
|
2 | path = external/pybind11 | |
9 | url = https://github.com/pybind/pybind11 |
|
3 | url = https://github.com/pybind/pybind11 | |
|
4 | [submodule "core"] | |||
|
5 | path = core | |||
|
6 | url = https://hephaistos.lpp.polytechnique.fr/rhodecode/HG_REPOSITORIES/LPP/INSTRUMENTATION/USERS/JEANDET/SciQLOPCore |
@@ -1,69 +1,54 | |||||
1 | cmake_minimum_required(VERSION 3.6) |
|
1 | cmake_minimum_required(VERSION 3.6) | |
2 | project(SciQLOP CXX) |
|
2 | project(SciQLOP CXX) | |
3 |
|
3 | |||
4 | include(GNUInstallDirs) |
|
4 | include(GNUInstallDirs) | |
5 |
|
5 | |||
6 | SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake") |
|
6 | SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake") | |
7 |
|
7 | |||
8 | OPTION (CPPCHECK "Analyzes the source code with cppcheck" OFF) |
|
8 | OPTION (CPPCHECK "Analyzes the source code with cppcheck" OFF) | |
9 | OPTION (CLANG_TIDY "Analyzes the source code with Clang Tidy" OFF) |
|
9 | OPTION (CLANG_TIDY "Analyzes the source code with Clang Tidy" OFF) | |
10 | OPTION (IWYU "Analyzes the source code with Include What You Use" OFF) |
|
10 | OPTION (IWYU "Analyzes the source code with Include What You Use" OFF) | |
11 |
|
11 | |||
12 |
set(CMAKE_CXX_STANDARD 1 |
|
12 | set(CMAKE_CXX_STANDARD 17) | |
13 |
|
13 | |||
14 | set(CMAKE_AUTOMOC ON) |
|
14 | set(CMAKE_AUTOMOC ON) | |
15 | #https://gitlab.kitware.com/cmake/cmake/issues/15227 |
|
15 | #https://gitlab.kitware.com/cmake/cmake/issues/15227 | |
16 | #set(CMAKE_AUTOUIC ON) |
|
16 | #set(CMAKE_AUTOUIC ON) | |
17 | if(POLICY CMP0071) |
|
17 | if(POLICY CMP0071) | |
18 | cmake_policy(SET CMP0071 OLD) |
|
18 | cmake_policy(SET CMP0071 OLD) | |
19 | endif() |
|
19 | endif() | |
20 | set(CMAKE_AUTORCC ON) |
|
20 | set(CMAKE_AUTORCC ON) | |
21 | set(CMAKE_INCLUDE_CURRENT_DIR ON) |
|
21 | set(CMAKE_INCLUDE_CURRENT_DIR ON) | |
22 |
|
22 | |||
23 | if(NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_PATH) |
|
23 | if(NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_PATH) | |
24 | set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) |
|
24 | set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | |
25 | endif() |
|
25 | endif() | |
26 | if(NOT DEFINED CMAKE_MACOSX_RPATH) |
|
26 | if(NOT DEFINED CMAKE_MACOSX_RPATH) | |
27 | set(CMAKE_MACOSX_RPATH TRUE) |
|
27 | set(CMAKE_MACOSX_RPATH TRUE) | |
28 | endif() |
|
28 | endif() | |
29 |
|
29 | |||
30 | if(NOT CMAKE_BUILD_TYPE) |
|
30 | if(NOT CMAKE_BUILD_TYPE) | |
31 | set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE) |
|
31 | set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE) | |
32 | endif() |
|
32 | endif() | |
33 |
|
33 | |||
34 | find_package(Qt5 COMPONENTS Core Widgets Network PrintSupport Svg Test REQUIRED) |
|
34 | find_package(Qt5 COMPONENTS Core Widgets Network PrintSupport Svg Test REQUIRED) | |
35 |
|
35 | |||
36 | IF(CPPCHECK) |
|
36 | IF(CPPCHECK) | |
37 | set(CMAKE_CXX_CPPCHECK "cppcheck;--enable=warning,style") |
|
37 | set(CMAKE_CXX_CPPCHECK "cppcheck;--enable=warning,style") | |
38 | ENDIF(CPPCHECK) |
|
38 | ENDIF(CPPCHECK) | |
39 |
|
39 | |||
40 | IF(CLANG_TIDY) |
|
40 | IF(CLANG_TIDY) | |
41 | set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-style=file;-checks=*") |
|
41 | set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-style=file;-checks=*") | |
42 | ENDIF(CLANG_TIDY) |
|
42 | ENDIF(CLANG_TIDY) | |
43 |
|
43 | |||
44 | IF(IWYU) |
|
44 | IF(IWYU) | |
45 | set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "include-what-you-use") |
|
45 | set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "include-what-you-use") | |
46 | ENDIF(IWYU) |
|
46 | ENDIF(IWYU) | |
47 |
|
47 | |||
48 | enable_testing() |
|
48 | enable_testing() | |
49 |
|
49 | |||
50 |
|
||||
51 | find_package(catalogs CONFIG QUIET) |
|
|||
52 | if (NOT CatalogueAPI_FOUND) |
|
|||
53 | execute_process(COMMAND git submodule init external/libcatalogs WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) |
|
|||
54 | execute_process(COMMAND git submodule update external/libcatalogs WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) |
|
|||
55 | add_subdirectory(external/libcatalogs) |
|
|||
56 | endif() |
|
|||
57 |
|
||||
58 | find_package(pybind11 CONFIG QUIET) |
|
|||
59 | if (NOT pybind11_FOUND) |
|
|||
60 | execute_process(COMMAND git submodule init external/pybind11 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) |
|
|||
61 | execute_process(COMMAND git submodule update external/pybind11 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) |
|
|||
62 | add_subdirectory(external/pybind11) |
|
|||
63 | endif() |
|
|||
64 |
|
||||
65 | add_subdirectory(core) |
|
50 | add_subdirectory(core) | |
66 | add_subdirectory(gui) |
|
51 | add_subdirectory(gui) | |
67 | add_subdirectory(app) |
|
52 | add_subdirectory(app) | |
68 | add_subdirectory(plugins) |
|
53 | add_subdirectory(plugins) | |
69 | add_subdirectory(docs) |
|
54 | add_subdirectory(docs) |
@@ -1,47 +1,47 | |||||
1 | #ifndef SCIQLOP_TIMEWIDGET_H |
|
1 | #ifndef SCIQLOP_TIMEWIDGET_H | |
2 | #define SCIQLOP_TIMEWIDGET_H |
|
2 | #define SCIQLOP_TIMEWIDGET_H | |
3 |
|
3 | |||
4 | #include <QWidget> |
|
4 | #include <QWidget> | |
5 |
|
5 | |||
6 |
#include <Data/ |
|
6 | #include <Data/DateTimeRange.h> | |
7 |
|
7 | |||
8 | #include <Common/spimpl.h> |
|
8 | #include <Common/spimpl.h> | |
9 |
|
9 | |||
10 | namespace Ui { |
|
10 | namespace Ui { | |
11 | class TimeWidget; |
|
11 | class TimeWidget; | |
12 | } // Ui |
|
12 | } // Ui | |
13 |
|
13 | |||
14 | class TimeWidget : public QWidget { |
|
14 | class TimeWidget : public QWidget { | |
15 | Q_OBJECT |
|
15 | Q_OBJECT | |
16 |
|
16 | |||
17 | public: |
|
17 | public: | |
18 | explicit TimeWidget(QWidget *parent = 0); |
|
18 | explicit TimeWidget(QWidget *parent = 0); | |
19 | virtual ~TimeWidget(); |
|
19 | virtual ~TimeWidget(); | |
20 |
|
20 | |||
21 | void setTimeRange(DateTimeRange time); |
|
21 | void setTimeRange(DateTimeRange time); | |
22 | DateTimeRange timeRange() const; |
|
22 | DateTimeRange timeRange() const; | |
23 |
|
23 | |||
24 | signals: |
|
24 | signals: | |
25 | /// Signal emitted when the time parameters has beed updated |
|
25 | /// Signal emitted when the time parameters has beed updated | |
26 | void timeUpdated(DateTimeRange time); |
|
26 | void timeUpdated(DateTimeRange time); | |
27 |
|
27 | |||
28 | public slots: |
|
28 | public slots: | |
29 | /// slot called when time parameters update has ben requested |
|
29 | /// slot called when time parameters update has ben requested | |
30 | void onTimeUpdateRequested(); |
|
30 | void onTimeUpdateRequested(); | |
31 |
|
31 | |||
32 | protected: |
|
32 | protected: | |
33 | void dragEnterEvent(QDragEnterEvent *event) override; |
|
33 | void dragEnterEvent(QDragEnterEvent *event) override; | |
34 | void dragLeaveEvent(QDragLeaveEvent *event) override; |
|
34 | void dragLeaveEvent(QDragLeaveEvent *event) override; | |
35 | void dropEvent(QDropEvent *event) override; |
|
35 | void dropEvent(QDropEvent *event) override; | |
36 |
|
36 | |||
37 | void mousePressEvent(QMouseEvent *event) override; |
|
37 | void mousePressEvent(QMouseEvent *event) override; | |
38 | void mouseMoveEvent(QMouseEvent *event) override; |
|
38 | void mouseMoveEvent(QMouseEvent *event) override; | |
39 |
|
39 | |||
40 | private: |
|
40 | private: | |
41 | Ui::TimeWidget *ui; |
|
41 | Ui::TimeWidget *ui; | |
42 |
|
42 | |||
43 | class TimeWidgetPrivate; |
|
43 | class TimeWidgetPrivate; | |
44 | spimpl::unique_impl_ptr<TimeWidgetPrivate> impl; |
|
44 | spimpl::unique_impl_ptr<TimeWidgetPrivate> impl; | |
45 | }; |
|
45 | }; | |
46 |
|
46 | |||
47 | #endif // SCIQLOP_ SQPSIDEPANE_H |
|
47 | #endif // SCIQLOP_ SQPSIDEPANE_H |
@@ -1,41 +1,41 | |||||
1 | #ifndef SCIQLOP_VISUALIZATIONGRAPHHELPER_H |
|
1 | #ifndef SCIQLOP_VISUALIZATIONGRAPHHELPER_H | |
2 | #define SCIQLOP_VISUALIZATIONGRAPHHELPER_H |
|
2 | #define SCIQLOP_VISUALIZATIONGRAPHHELPER_H | |
3 |
|
3 | |||
4 | #include "Visualization/VisualizationDefs.h" |
|
4 | #include "Visualization/VisualizationDefs.h" | |
5 |
|
5 | |||
6 |
#include <Data/ |
|
6 | #include <Data/DateTimeRange.h> | |
7 |
|
7 | |||
8 | #include <QLoggingCategory> |
|
8 | #include <QLoggingCategory> | |
9 | #include <QVector> |
|
9 | #include <QVector> | |
10 |
|
10 | |||
11 | #include <memory> |
|
11 | #include <memory> | |
12 |
|
12 | |||
13 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationGraphHelper) |
|
13 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationGraphHelper) | |
14 |
|
14 | |||
15 | class IDataSeries; |
|
15 | class IDataSeries; | |
16 | class QCPAbstractPlottable; |
|
16 | class QCPAbstractPlottable; | |
17 | class QCustomPlot; |
|
17 | class QCustomPlot; | |
18 | class Variable; |
|
18 | class Variable; | |
19 |
|
19 | |||
20 | /** |
|
20 | /** | |
21 | * @brief The VisualizationGraphHelper class aims to create the QCustomPlot components relative to a |
|
21 | * @brief The VisualizationGraphHelper class aims to create the QCustomPlot components relative to a | |
22 | * variable, depending on the data series of this variable |
|
22 | * variable, depending on the data series of this variable | |
23 | */ |
|
23 | */ | |
24 | struct VisualizationGraphHelper { |
|
24 | struct VisualizationGraphHelper { | |
25 | /** |
|
25 | /** | |
26 | * Creates (if possible) the QCustomPlot components relative to the variable passed in |
|
26 | * Creates (if possible) the QCustomPlot components relative to the variable passed in | |
27 | * parameter, and adds these to the plot passed in parameter. |
|
27 | * parameter, and adds these to the plot passed in parameter. | |
28 | * @param variable the variable for which to create the components |
|
28 | * @param variable the variable for which to create the components | |
29 | * @param plot the plot in which to add the created components. It takes ownership of these |
|
29 | * @param plot the plot in which to add the created components. It takes ownership of these | |
30 | * components. |
|
30 | * components. | |
31 | * @return the list of the components created |
|
31 | * @return the list of the components created | |
32 | */ |
|
32 | */ | |
33 | static PlottablesMap create(std::shared_ptr<Variable> variable, QCustomPlot &plot) noexcept; |
|
33 | static PlottablesMap create(std::shared_ptr<Variable> variable, QCustomPlot &plot) noexcept; | |
34 |
|
34 | |||
35 | static void updateData(PlottablesMap &plottables, std::shared_ptr<Variable> variable, |
|
35 | static void updateData(PlottablesMap &plottables, std::shared_ptr<Variable> variable, | |
36 | const DateTimeRange &dateTime); |
|
36 | const DateTimeRange &dateTime); | |
37 |
|
37 | |||
38 | static void setYAxisRange(std::shared_ptr<Variable> variable, QCustomPlot &plot) noexcept; |
|
38 | static void setYAxisRange(std::shared_ptr<Variable> variable, QCustomPlot &plot) noexcept; | |
39 | }; |
|
39 | }; | |
40 |
|
40 | |||
41 | #endif // SCIQLOP_VISUALIZATIONGRAPHHELPER_H |
|
41 | #endif // SCIQLOP_VISUALIZATIONGRAPHHELPER_H |
@@ -1,73 +1,73 | |||||
1 | #ifndef SCIQLOP_VISUALIZATIONSELECTIONZONEITEM_H |
|
1 | #ifndef SCIQLOP_VISUALIZATIONSELECTIONZONEITEM_H | |
2 | #define SCIQLOP_VISUALIZATIONSELECTIONZONEITEM_H |
|
2 | #define SCIQLOP_VISUALIZATIONSELECTIONZONEITEM_H | |
3 |
|
3 | |||
4 | #include <Common/spimpl.h> |
|
4 | #include <Common/spimpl.h> | |
5 |
#include <Data/ |
|
5 | #include <Data/DateTimeRange.h> | |
6 | #include <Visualization/qcustomplot.h> |
|
6 | #include <Visualization/qcustomplot.h> | |
7 |
|
7 | |||
8 | class VisualizationGraphWidget; |
|
8 | class VisualizationGraphWidget; | |
9 |
|
9 | |||
10 | class VisualizationSelectionZoneItem : public QCPItemRect { |
|
10 | class VisualizationSelectionZoneItem : public QCPItemRect { | |
11 | Q_OBJECT |
|
11 | Q_OBJECT | |
12 |
|
12 | |||
13 | signals: |
|
13 | signals: | |
14 | /// Signal emitted when the zone range is edited manually |
|
14 | /// Signal emitted when the zone range is edited manually | |
15 | void rangeEdited(const DateTimeRange &range); |
|
15 | void rangeEdited(const DateTimeRange &range); | |
16 |
|
16 | |||
17 | public: |
|
17 | public: | |
18 | VisualizationSelectionZoneItem(QCustomPlot *plot); |
|
18 | VisualizationSelectionZoneItem(QCustomPlot *plot); | |
19 | virtual ~VisualizationSelectionZoneItem(); |
|
19 | virtual ~VisualizationSelectionZoneItem(); | |
20 |
|
20 | |||
21 | VisualizationGraphWidget *parentGraphWidget() const noexcept; |
|
21 | VisualizationGraphWidget *parentGraphWidget() const noexcept; | |
22 |
|
22 | |||
23 | void setName(const QString &name); |
|
23 | void setName(const QString &name); | |
24 | QString name() const; |
|
24 | QString name() const; | |
25 |
|
25 | |||
26 | DateTimeRange range() const; |
|
26 | DateTimeRange range() const; | |
27 | void setRange(double tstart, double tend); |
|
27 | void setRange(double tstart, double tend); | |
28 | void setStart(double tstart); |
|
28 | void setStart(double tstart); | |
29 | void setEnd(double tend); |
|
29 | void setEnd(double tend); | |
30 |
|
30 | |||
31 | void setColor(const QColor &color); |
|
31 | void setColor(const QColor &color); | |
32 |
|
32 | |||
33 | void setEditionEnabled(bool value); |
|
33 | void setEditionEnabled(bool value); | |
34 | bool isEditionEnabled() const; |
|
34 | bool isEditionEnabled() const; | |
35 |
|
35 | |||
36 | /// Moves the item at the top of its QCPLayer. It will then receive the mouse events if multiple |
|
36 | /// Moves the item at the top of its QCPLayer. It will then receive the mouse events if multiple | |
37 | /// items are stacked on top of each others. |
|
37 | /// items are stacked on top of each others. | |
38 | void moveToTop(); |
|
38 | void moveToTop(); | |
39 |
|
39 | |||
40 | Qt::CursorShape curshorShapeForPosition(const QPoint &position) const; |
|
40 | Qt::CursorShape curshorShapeForPosition(const QPoint &position) const; | |
41 | void setHovered(bool value); |
|
41 | void setHovered(bool value); | |
42 |
|
42 | |||
43 | /// Sets the zones which should be moved or reisized together with this zone |
|
43 | /// Sets the zones which should be moved or reisized together with this zone | |
44 | void setAssociatedEditedZones(const QVector<VisualizationSelectionZoneItem *> &associatedZones); |
|
44 | void setAssociatedEditedZones(const QVector<VisualizationSelectionZoneItem *> &associatedZones); | |
45 |
|
45 | |||
46 | /// Align the specified zones with this one, vertically with the left border |
|
46 | /// Align the specified zones with this one, vertically with the left border | |
47 | bool alignZonesVerticallyOnLeft(const QVector<VisualizationSelectionZoneItem *> &zonesToAlign, |
|
47 | bool alignZonesVerticallyOnLeft(const QVector<VisualizationSelectionZoneItem *> &zonesToAlign, | |
48 | bool allowResize); |
|
48 | bool allowResize); | |
49 | /// Align the specified zones with this one, vertically with the right border |
|
49 | /// Align the specified zones with this one, vertically with the right border | |
50 | bool alignZonesVerticallyOnRight(const QVector<VisualizationSelectionZoneItem *> &zonesToAlign, |
|
50 | bool alignZonesVerticallyOnRight(const QVector<VisualizationSelectionZoneItem *> &zonesToAlign, | |
51 | bool allowResize); |
|
51 | bool allowResize); | |
52 | /// Align the specified zones with this one, temporally with the left border |
|
52 | /// Align the specified zones with this one, temporally with the left border | |
53 | bool alignZonesTemporallyOnLeft(const QVector<VisualizationSelectionZoneItem *> &zonesToAlign, |
|
53 | bool alignZonesTemporallyOnLeft(const QVector<VisualizationSelectionZoneItem *> &zonesToAlign, | |
54 | bool allowResize); |
|
54 | bool allowResize); | |
55 | /// Align the specified zones with this one, temporally with the right border |
|
55 | /// Align the specified zones with this one, temporally with the right border | |
56 | bool alignZonesTemporallyOnRight(const QVector<VisualizationSelectionZoneItem *> &zonesToAlign, |
|
56 | bool alignZonesTemporallyOnRight(const QVector<VisualizationSelectionZoneItem *> &zonesToAlign, | |
57 | bool allowResize); |
|
57 | bool allowResize); | |
58 |
|
58 | |||
59 | protected: |
|
59 | protected: | |
60 | void mousePressEvent(QMouseEvent *event, const QVariant &details) override; |
|
60 | void mousePressEvent(QMouseEvent *event, const QVariant &details) override; | |
61 | void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) override; |
|
61 | void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) override; | |
62 | void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) override; |
|
62 | void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) override; | |
63 |
|
63 | |||
64 | void resizeLeft(double pixelDiff); |
|
64 | void resizeLeft(double pixelDiff); | |
65 | void resizeRight(double pixelDiff); |
|
65 | void resizeRight(double pixelDiff); | |
66 | void move(double pixelDiff); |
|
66 | void move(double pixelDiff); | |
67 |
|
67 | |||
68 | private: |
|
68 | private: | |
69 | class VisualizationSelectionZoneItemPrivate; |
|
69 | class VisualizationSelectionZoneItemPrivate; | |
70 | spimpl::unique_impl_ptr<VisualizationSelectionZoneItemPrivate> impl; |
|
70 | spimpl::unique_impl_ptr<VisualizationSelectionZoneItemPrivate> impl; | |
71 | }; |
|
71 | }; | |
72 |
|
72 | |||
73 | #endif // SCIQLOP_VISUALIZATIONSELECTIONZONEITEM_H |
|
73 | #endif // SCIQLOP_VISUALIZATIONSELECTIONZONEITEM_H |
@@ -1,65 +1,65 | |||||
1 | #ifndef SCIQLOP_VISUALIZATIONWIDGET_H |
|
1 | #ifndef SCIQLOP_VISUALIZATIONWIDGET_H | |
2 | #define SCIQLOP_VISUALIZATIONWIDGET_H |
|
2 | #define SCIQLOP_VISUALIZATIONWIDGET_H | |
3 |
|
3 | |||
4 | #include "Visualization/IVisualizationWidget.h" |
|
4 | #include "Visualization/IVisualizationWidget.h" | |
5 |
#include <Data/ |
|
5 | #include <Data/DateTimeRange.h> | |
6 |
|
6 | |||
7 | #include <QLoggingCategory> |
|
7 | #include <QLoggingCategory> | |
8 | #include <QWidget> |
|
8 | #include <QWidget> | |
9 |
|
9 | |||
10 | #include <Common/spimpl.h> |
|
10 | #include <Common/spimpl.h> | |
11 |
|
11 | |||
12 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationWidget) |
|
12 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationWidget) | |
13 |
|
13 | |||
14 | class QMenu; |
|
14 | class QMenu; | |
15 | class Variable; |
|
15 | class Variable; | |
16 | class VisualizationTabWidget; |
|
16 | class VisualizationTabWidget; | |
17 | class VisualizationSelectionZoneManager; |
|
17 | class VisualizationSelectionZoneManager; | |
18 |
|
18 | |||
19 | namespace Ui { |
|
19 | namespace Ui { | |
20 | class VisualizationWidget; |
|
20 | class VisualizationWidget; | |
21 | } // namespace Ui |
|
21 | } // namespace Ui | |
22 |
|
22 | |||
23 | class VisualizationWidget : public QWidget, public IVisualizationWidget { |
|
23 | class VisualizationWidget : public QWidget, public IVisualizationWidget { | |
24 | Q_OBJECT |
|
24 | Q_OBJECT | |
25 |
|
25 | |||
26 | public: |
|
26 | public: | |
27 | explicit VisualizationWidget(QWidget *parent = 0); |
|
27 | explicit VisualizationWidget(QWidget *parent = 0); | |
28 | virtual ~VisualizationWidget(); |
|
28 | virtual ~VisualizationWidget(); | |
29 |
|
29 | |||
30 | /// Returns the class which manage the selection of selection zone across the visualization |
|
30 | /// Returns the class which manage the selection of selection zone across the visualization | |
31 | VisualizationSelectionZoneManager &selectionZoneManager() const; |
|
31 | VisualizationSelectionZoneManager &selectionZoneManager() const; | |
32 |
|
32 | |||
33 | VisualizationTabWidget *currentTabWidget() const; |
|
33 | VisualizationTabWidget *currentTabWidget() const; | |
34 |
|
34 | |||
35 | // IVisualizationWidget interface |
|
35 | // IVisualizationWidget interface | |
36 | void accept(IVisualizationWidgetVisitor *visitor) override; |
|
36 | void accept(IVisualizationWidgetVisitor *visitor) override; | |
37 | bool canDrop(const Variable &variable) const override; |
|
37 | bool canDrop(const Variable &variable) const override; | |
38 | bool contains(const Variable &variable) const override; |
|
38 | bool contains(const Variable &variable) const override; | |
39 | QString name() const override; |
|
39 | QString name() const override; | |
40 |
|
40 | |||
41 | public slots: |
|
41 | public slots: | |
42 | /** |
|
42 | /** | |
43 | * Attaches to a menu the menu relative to the visualization of variables |
|
43 | * Attaches to a menu the menu relative to the visualization of variables | |
44 | * @param menu the parent menu of the generated menu |
|
44 | * @param menu the parent menu of the generated menu | |
45 | * @param variables the variables for which to generate the menu |
|
45 | * @param variables the variables for which to generate the menu | |
46 | */ |
|
46 | */ | |
47 | void attachVariableMenu(QMenu *menu, |
|
47 | void attachVariableMenu(QMenu *menu, | |
48 | const QVector<std::shared_ptr<Variable> > &variables) noexcept; |
|
48 | const QVector<std::shared_ptr<Variable> > &variables) noexcept; | |
49 |
|
49 | |||
50 | /// Slot called when a variable is about to be deleted from SciQlop |
|
50 | /// Slot called when a variable is about to be deleted from SciQlop | |
51 | void onVariableAboutToBeDeleted(std::shared_ptr<Variable> variable) noexcept; |
|
51 | void onVariableAboutToBeDeleted(std::shared_ptr<Variable> variable) noexcept; | |
52 |
|
52 | |||
53 | void onRangeChanged(std::shared_ptr<Variable> variable, const DateTimeRange &range) noexcept; |
|
53 | void onRangeChanged(std::shared_ptr<Variable> variable, const DateTimeRange &range) noexcept; | |
54 |
|
54 | |||
55 | protected: |
|
55 | protected: | |
56 | void closeEvent(QCloseEvent *event) override; |
|
56 | void closeEvent(QCloseEvent *event) override; | |
57 |
|
57 | |||
58 | private: |
|
58 | private: | |
59 | Ui::VisualizationWidget *ui; |
|
59 | Ui::VisualizationWidget *ui; | |
60 |
|
60 | |||
61 | class VisualizationWidgetPrivate; |
|
61 | class VisualizationWidgetPrivate; | |
62 | spimpl::unique_impl_ptr<VisualizationWidgetPrivate> impl; |
|
62 | spimpl::unique_impl_ptr<VisualizationWidgetPrivate> impl; | |
63 | }; |
|
63 | }; | |
64 |
|
64 | |||
65 | #endif // VISUALIZATIONWIDGET_H |
|
65 | #endif // VISUALIZATIONWIDGET_H |
@@ -1,106 +1,106 | |||||
1 | #ifndef SCIQLOP_VISUALIZATIONZONEWIDGET_H |
|
1 | #ifndef SCIQLOP_VISUALIZATIONZONEWIDGET_H | |
2 | #define SCIQLOP_VISUALIZATIONZONEWIDGET_H |
|
2 | #define SCIQLOP_VISUALIZATIONZONEWIDGET_H | |
3 |
|
3 | |||
4 |
#include "Data/ |
|
4 | #include "Data/DateTimeRange.h" | |
5 | #include "Visualization/IVisualizationWidget.h" |
|
5 | #include "Visualization/IVisualizationWidget.h" | |
6 | #include "Visualization/VisualizationDragWidget.h" |
|
6 | #include "Visualization/VisualizationDragWidget.h" | |
7 |
|
7 | |||
8 | #include <QLoggingCategory> |
|
8 | #include <QLoggingCategory> | |
9 | #include <QWidget> |
|
9 | #include <QWidget> | |
10 |
|
10 | |||
11 | #include <memory> |
|
11 | #include <memory> | |
12 |
|
12 | |||
13 | #include <Common/spimpl.h> |
|
13 | #include <Common/spimpl.h> | |
14 |
|
14 | |||
15 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationZoneWidget) |
|
15 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationZoneWidget) | |
16 |
|
16 | |||
17 | namespace Ui { |
|
17 | namespace Ui { | |
18 | class VisualizationZoneWidget; |
|
18 | class VisualizationZoneWidget; | |
19 | } // namespace Ui |
|
19 | } // namespace Ui | |
20 |
|
20 | |||
21 | class Variable; |
|
21 | class Variable; | |
22 | class VisualizationGraphWidget; |
|
22 | class VisualizationGraphWidget; | |
23 |
|
23 | |||
24 | class VisualizationZoneWidget : public VisualizationDragWidget, public IVisualizationWidget { |
|
24 | class VisualizationZoneWidget : public VisualizationDragWidget, public IVisualizationWidget { | |
25 | Q_OBJECT |
|
25 | Q_OBJECT | |
26 |
|
26 | |||
27 | public: |
|
27 | public: | |
28 | explicit VisualizationZoneWidget(const QString &name = {}, QWidget *parent = 0); |
|
28 | explicit VisualizationZoneWidget(const QString &name = {}, QWidget *parent = 0); | |
29 | virtual ~VisualizationZoneWidget(); |
|
29 | virtual ~VisualizationZoneWidget(); | |
30 |
|
30 | |||
31 | /// Sets the range of the zone, only works if there is at least one graph in the zone |
|
31 | /// Sets the range of the zone, only works if there is at least one graph in the zone | |
32 | /// Note: calibrations between graphs are lost. |
|
32 | /// Note: calibrations between graphs are lost. | |
33 | void setZoneRange(const DateTimeRange &range); |
|
33 | void setZoneRange(const DateTimeRange &range); | |
34 |
|
34 | |||
35 | /// Adds a graph widget |
|
35 | /// Adds a graph widget | |
36 | void addGraph(VisualizationGraphWidget *graphWidget); |
|
36 | void addGraph(VisualizationGraphWidget *graphWidget); | |
37 |
|
37 | |||
38 | /// Inserts a graph widget |
|
38 | /// Inserts a graph widget | |
39 | void insertGraph(int index, VisualizationGraphWidget *graphWidget); |
|
39 | void insertGraph(int index, VisualizationGraphWidget *graphWidget); | |
40 |
|
40 | |||
41 | /** |
|
41 | /** | |
42 | * Creates a graph using a variable. The variable will be displayed in the new graph. |
|
42 | * Creates a graph using a variable. The variable will be displayed in the new graph. | |
43 | * The graph is added at the end. |
|
43 | * The graph is added at the end. | |
44 | * @param variable the variable for which to create the graph |
|
44 | * @param variable the variable for which to create the graph | |
45 | * @return the pointer to the created graph |
|
45 | * @return the pointer to the created graph | |
46 | */ |
|
46 | */ | |
47 | VisualizationGraphWidget *createGraph(std::shared_ptr<Variable> variable); |
|
47 | VisualizationGraphWidget *createGraph(std::shared_ptr<Variable> variable); | |
48 |
|
48 | |||
49 | /** |
|
49 | /** | |
50 | * Creates a graph using a variable. The variable will be displayed in the new graph. |
|
50 | * Creates a graph using a variable. The variable will be displayed in the new graph. | |
51 | * The graph is inserted at the specified index. |
|
51 | * The graph is inserted at the specified index. | |
52 | * @param variable the variable for which to create the graph |
|
52 | * @param variable the variable for which to create the graph | |
53 | * @param index The index where the graph should be inserted in the layout |
|
53 | * @param index The index where the graph should be inserted in the layout | |
54 | * @return the pointer to the created graph |
|
54 | * @return the pointer to the created graph | |
55 | */ |
|
55 | */ | |
56 | VisualizationGraphWidget *createGraph(std::shared_ptr<Variable> variable, int index); |
|
56 | VisualizationGraphWidget *createGraph(std::shared_ptr<Variable> variable, int index); | |
57 |
|
57 | |||
58 | /** |
|
58 | /** | |
59 | * Creates a graph using a list of variables. The variables will be displayed in the new graph. |
|
59 | * Creates a graph using a list of variables. The variables will be displayed in the new graph. | |
60 | * The graph is inserted at the specified index. |
|
60 | * The graph is inserted at the specified index. | |
61 | * @param variables List of variables to be added to the graph |
|
61 | * @param variables List of variables to be added to the graph | |
62 | * @param index The index where the graph should be inserted in the layout |
|
62 | * @param index The index where the graph should be inserted in the layout | |
63 | * @return the pointer to the created graph |
|
63 | * @return the pointer to the created graph | |
64 | */ |
|
64 | */ | |
65 | VisualizationGraphWidget *createGraph(const QList<std::shared_ptr<Variable> > variables, |
|
65 | VisualizationGraphWidget *createGraph(const QList<std::shared_ptr<Variable> > variables, | |
66 | int index); |
|
66 | int index); | |
67 |
|
67 | |||
68 | /// Returns the first graph in the zone or nullptr if there is no graph inside |
|
68 | /// Returns the first graph in the zone or nullptr if there is no graph inside | |
69 | VisualizationGraphWidget *firstGraph() const; |
|
69 | VisualizationGraphWidget *firstGraph() const; | |
70 |
|
70 | |||
71 | /// Closes all graphes inside the zone |
|
71 | /// Closes all graphes inside the zone | |
72 | void closeAllGraphs(); |
|
72 | void closeAllGraphs(); | |
73 |
|
73 | |||
74 | // IVisualizationWidget interface |
|
74 | // IVisualizationWidget interface | |
75 | void accept(IVisualizationWidgetVisitor *visitor) override; |
|
75 | void accept(IVisualizationWidgetVisitor *visitor) override; | |
76 | bool canDrop(const Variable &variable) const override; |
|
76 | bool canDrop(const Variable &variable) const override; | |
77 | bool contains(const Variable &variable) const override; |
|
77 | bool contains(const Variable &variable) const override; | |
78 | QString name() const override; |
|
78 | QString name() const override; | |
79 |
|
79 | |||
80 | // VisualisationDragWidget |
|
80 | // VisualisationDragWidget | |
81 | QMimeData *mimeData(const QPoint &position) const override; |
|
81 | QMimeData *mimeData(const QPoint &position) const override; | |
82 | bool isDragAllowed() const override; |
|
82 | bool isDragAllowed() const override; | |
83 |
|
83 | |||
84 | void notifyMouseMoveInGraph(const QPointF &graphPosition, const QPointF &plotPosition, |
|
84 | void notifyMouseMoveInGraph(const QPointF &graphPosition, const QPointF &plotPosition, | |
85 | VisualizationGraphWidget *graphWidget); |
|
85 | VisualizationGraphWidget *graphWidget); | |
86 | void notifyMouseLeaveGraph(VisualizationGraphWidget *graphWidget); |
|
86 | void notifyMouseLeaveGraph(VisualizationGraphWidget *graphWidget); | |
87 |
|
87 | |||
88 | protected: |
|
88 | protected: | |
89 | void closeEvent(QCloseEvent *event) override; |
|
89 | void closeEvent(QCloseEvent *event) override; | |
90 |
|
90 | |||
91 | private: |
|
91 | private: | |
92 | Ui::VisualizationZoneWidget *ui; |
|
92 | Ui::VisualizationZoneWidget *ui; | |
93 |
|
93 | |||
94 | class VisualizationZoneWidgetPrivate; |
|
94 | class VisualizationZoneWidgetPrivate; | |
95 | spimpl::unique_impl_ptr<VisualizationZoneWidgetPrivate> impl; |
|
95 | spimpl::unique_impl_ptr<VisualizationZoneWidgetPrivate> impl; | |
96 |
|
96 | |||
97 | private slots: |
|
97 | private slots: | |
98 | void onVariableAdded(std::shared_ptr<Variable> variable); |
|
98 | void onVariableAdded(std::shared_ptr<Variable> variable); | |
99 | /// Slot called when a variable is about to be removed from a graph contained in the zone |
|
99 | /// Slot called when a variable is about to be removed from a graph contained in the zone | |
100 | void onVariableAboutToBeRemoved(std::shared_ptr<Variable> variable); |
|
100 | void onVariableAboutToBeRemoved(std::shared_ptr<Variable> variable); | |
101 |
|
101 | |||
102 | void dropMimeData(int index, const QMimeData *mimeData); |
|
102 | void dropMimeData(int index, const QMimeData *mimeData); | |
103 | void dropMimeDataOnGraph(VisualizationDragWidget *dragWidget, const QMimeData *mimeData); |
|
103 | void dropMimeDataOnGraph(VisualizationDragWidget *dragWidget, const QMimeData *mimeData); | |
104 | }; |
|
104 | }; | |
105 |
|
105 | |||
106 | #endif // SCIQLOP_VISUALIZATIONZONEWIDGET_H |
|
106 | #endif // SCIQLOP_VISUALIZATIONZONEWIDGET_H |
@@ -1,42 +1,42 | |||||
1 | #ifndef SCIQLOP_RESCALEAXEOPERATION_H |
|
1 | #ifndef SCIQLOP_RESCALEAXEOPERATION_H | |
2 | #define SCIQLOP_RESCALEAXEOPERATION_H |
|
2 | #define SCIQLOP_RESCALEAXEOPERATION_H | |
3 |
|
3 | |||
4 | #include "Visualization/IVisualizationWidgetVisitor.h" |
|
4 | #include "Visualization/IVisualizationWidgetVisitor.h" | |
5 |
#include <Data/ |
|
5 | #include <Data/DateTimeRange.h> | |
6 |
|
6 | |||
7 | #include <Common/spimpl.h> |
|
7 | #include <Common/spimpl.h> | |
8 |
|
8 | |||
9 | #include <QLoggingCategory> |
|
9 | #include <QLoggingCategory> | |
10 |
|
10 | |||
11 | #include <memory> |
|
11 | #include <memory> | |
12 |
|
12 | |||
13 | class Variable; |
|
13 | class Variable; | |
14 |
|
14 | |||
15 | Q_DECLARE_LOGGING_CATEGORY(LOG_RescaleAxeOperation) |
|
15 | Q_DECLARE_LOGGING_CATEGORY(LOG_RescaleAxeOperation) | |
16 |
|
16 | |||
17 | /** |
|
17 | /** | |
18 | * @brief The RescaleAxeOperation class defines an operation that traverses all of visualization |
|
18 | * @brief The RescaleAxeOperation class defines an operation that traverses all of visualization | |
19 | * widgets to remove a variable if they contain it |
|
19 | * widgets to remove a variable if they contain it | |
20 | */ |
|
20 | */ | |
21 | class RescaleAxeOperation : public IVisualizationWidgetVisitor { |
|
21 | class RescaleAxeOperation : public IVisualizationWidgetVisitor { | |
22 | public: |
|
22 | public: | |
23 | /** |
|
23 | /** | |
24 | * Ctor |
|
24 | * Ctor | |
25 | * @param variable the variable to remove from widgets |
|
25 | * @param variable the variable to remove from widgets | |
26 | */ |
|
26 | */ | |
27 | explicit RescaleAxeOperation(std::shared_ptr<Variable> variable, const DateTimeRange &range); |
|
27 | explicit RescaleAxeOperation(std::shared_ptr<Variable> variable, const DateTimeRange &range); | |
28 |
|
28 | |||
29 | void visitEnter(VisualizationWidget *widget) override final; |
|
29 | void visitEnter(VisualizationWidget *widget) override final; | |
30 | void visitLeave(VisualizationWidget *widget) override final; |
|
30 | void visitLeave(VisualizationWidget *widget) override final; | |
31 | void visitEnter(VisualizationTabWidget *tabWidget) override final; |
|
31 | void visitEnter(VisualizationTabWidget *tabWidget) override final; | |
32 | void visitLeave(VisualizationTabWidget *tabWidget) override final; |
|
32 | void visitLeave(VisualizationTabWidget *tabWidget) override final; | |
33 | void visitEnter(VisualizationZoneWidget *zoneWidget) override final; |
|
33 | void visitEnter(VisualizationZoneWidget *zoneWidget) override final; | |
34 | void visitLeave(VisualizationZoneWidget *zoneWidget) override final; |
|
34 | void visitLeave(VisualizationZoneWidget *zoneWidget) override final; | |
35 | void visit(VisualizationGraphWidget *graphWidget) override final; |
|
35 | void visit(VisualizationGraphWidget *graphWidget) override final; | |
36 |
|
36 | |||
37 | private: |
|
37 | private: | |
38 | class RescaleAxeOperationPrivate; |
|
38 | class RescaleAxeOperationPrivate; | |
39 | spimpl::unique_impl_ptr<RescaleAxeOperationPrivate> impl; |
|
39 | spimpl::unique_impl_ptr<RescaleAxeOperationPrivate> impl; | |
40 | }; |
|
40 | }; | |
41 |
|
41 | |||
42 | #endif // SCIQLOP_RESCALEAXEOPERATION_H |
|
42 | #endif // SCIQLOP_RESCALEAXEOPERATION_H |
@@ -1,484 +1,484 | |||||
1 | #include "Catalogue/CatalogueEventsModel.h" |
|
1 | #include "Catalogue/CatalogueEventsModel.h" | |
2 |
|
2 | |||
3 | #include <Catalogue/CatalogueController.h> |
|
3 | #include <Catalogue/CatalogueController.h> | |
4 | #include <Common/DateUtils.h> |
|
4 | #include <Common/DateUtils.h> | |
5 | #include <Common/MimeTypesDef.h> |
|
5 | #include <Common/MimeTypesDef.h> | |
6 | #include <DBEvent.h> |
|
6 | #include <DBEvent.h> | |
7 | #include <DBEventProduct.h> |
|
7 | #include <DBEventProduct.h> | |
8 | #include <DBTag.h> |
|
8 | #include <DBTag.h> | |
9 |
#include <Data/ |
|
9 | #include <Data/DateTimeRange.h> | |
10 | #include <SqpApplication.h> |
|
10 | #include <SqpApplication.h> | |
11 | #include <Time/TimeController.h> |
|
11 | #include <Time/TimeController.h> | |
12 |
|
12 | |||
13 | #include <list> |
|
13 | #include <list> | |
14 | #include <unordered_map> |
|
14 | #include <unordered_map> | |
15 |
|
15 | |||
16 | #include <QHash> |
|
16 | #include <QHash> | |
17 | #include <QMimeData> |
|
17 | #include <QMimeData> | |
18 |
|
18 | |||
19 | Q_LOGGING_CATEGORY(LOG_CatalogueEventsModel, "CatalogueEventsModel") |
|
19 | Q_LOGGING_CATEGORY(LOG_CatalogueEventsModel, "CatalogueEventsModel") | |
20 |
|
20 | |||
21 | const auto EVENT_ITEM_TYPE = 1; |
|
21 | const auto EVENT_ITEM_TYPE = 1; | |
22 | const auto EVENT_PRODUCT_ITEM_TYPE = 2; |
|
22 | const auto EVENT_PRODUCT_ITEM_TYPE = 2; | |
23 |
|
23 | |||
24 | struct CatalogueEventsModel::CatalogueEventsModelPrivate { |
|
24 | struct CatalogueEventsModel::CatalogueEventsModelPrivate { | |
25 | QVector<std::shared_ptr<DBEvent> > m_Events; |
|
25 | QVector<std::shared_ptr<DBEvent> > m_Events; | |
26 | std::unordered_map<DBEvent *, QVector<std::shared_ptr<DBEventProduct> > > m_EventProducts; |
|
26 | std::unordered_map<DBEvent *, QVector<std::shared_ptr<DBEventProduct> > > m_EventProducts; | |
27 | QVector<std::shared_ptr<DBCatalogue> > m_SourceCatalogue; |
|
27 | QVector<std::shared_ptr<DBCatalogue> > m_SourceCatalogue; | |
28 |
|
28 | |||
29 | QStringList columnNames() |
|
29 | QStringList columnNames() | |
30 | { |
|
30 | { | |
31 | return QStringList{tr("Event"), tr("TStart"), tr("TEnd"), |
|
31 | return QStringList{tr("Event"), tr("TStart"), tr("TEnd"), | |
32 | tr("Tags"), tr("Product"), tr("")}; |
|
32 | tr("Tags"), tr("Product"), tr("")}; | |
33 | } |
|
33 | } | |
34 |
|
34 | |||
35 | QVariant sortData(int col, const std::shared_ptr<DBEvent> &event) const |
|
35 | QVariant sortData(int col, const std::shared_ptr<DBEvent> &event) const | |
36 | { |
|
36 | { | |
37 | if (col == (int)CatalogueEventsModel::Column::Validation) { |
|
37 | if (col == (int)CatalogueEventsModel::Column::Validation) { | |
38 | auto hasChanges = sqpApp->catalogueController().eventHasChanges(event); |
|
38 | auto hasChanges = sqpApp->catalogueController().eventHasChanges(event); | |
39 | return hasChanges ? true : QVariant(); |
|
39 | return hasChanges ? true : QVariant(); | |
40 | } |
|
40 | } | |
41 |
|
41 | |||
42 | return eventData(col, event); |
|
42 | return eventData(col, event); | |
43 | } |
|
43 | } | |
44 |
|
44 | |||
45 | QVariant eventData(int col, const std::shared_ptr<DBEvent> &event) const |
|
45 | QVariant eventData(int col, const std::shared_ptr<DBEvent> &event) const | |
46 | { |
|
46 | { | |
47 | switch (static_cast<Column>(col)) { |
|
47 | switch (static_cast<Column>(col)) { | |
48 | case CatalogueEventsModel::Column::Name: |
|
48 | case CatalogueEventsModel::Column::Name: | |
49 | return event->getName(); |
|
49 | return event->getName(); | |
50 | case CatalogueEventsModel::Column::TStart: |
|
50 | case CatalogueEventsModel::Column::TStart: | |
51 | return nbEventProducts(event) > 0 |
|
51 | return nbEventProducts(event) > 0 | |
52 | ? DateUtils::dateTime(event->getTStart()) |
|
52 | ? DateUtils::dateTime(event->getTStart()) | |
53 | .toString(DATETIME_FORMAT_ONE_LINE) |
|
53 | .toString(DATETIME_FORMAT_ONE_LINE) | |
54 | : QVariant{}; |
|
54 | : QVariant{}; | |
55 | case CatalogueEventsModel::Column::TEnd: |
|
55 | case CatalogueEventsModel::Column::TEnd: | |
56 | return nbEventProducts(event) > 0 |
|
56 | return nbEventProducts(event) > 0 | |
57 | ? DateUtils::dateTime(event->getTEnd()) |
|
57 | ? DateUtils::dateTime(event->getTEnd()) | |
58 | .toString(DATETIME_FORMAT_ONE_LINE) |
|
58 | .toString(DATETIME_FORMAT_ONE_LINE) | |
59 | : QVariant{}; |
|
59 | : QVariant{}; | |
60 | case CatalogueEventsModel::Column::Product: { |
|
60 | case CatalogueEventsModel::Column::Product: { | |
61 | auto eventProducts = event->getEventProducts(); |
|
61 | auto eventProducts = event->getEventProducts(); | |
62 | QStringList eventProductList; |
|
62 | QStringList eventProductList; | |
63 | for (auto evtProduct : eventProducts) { |
|
63 | for (auto evtProduct : eventProducts) { | |
64 | eventProductList << evtProduct.getProductId(); |
|
64 | eventProductList << evtProduct.getProductId(); | |
65 | } |
|
65 | } | |
66 | return eventProductList.join(";"); |
|
66 | return eventProductList.join(";"); | |
67 | } |
|
67 | } | |
68 | case CatalogueEventsModel::Column::Tags: { |
|
68 | case CatalogueEventsModel::Column::Tags: { | |
69 | QString tagList; |
|
69 | QString tagList; | |
70 | auto tags = event->getTags(); |
|
70 | auto tags = event->getTags(); | |
71 | for (auto tag : tags) { |
|
71 | for (auto tag : tags) { | |
72 | tagList += tag.getName(); |
|
72 | tagList += tag.getName(); | |
73 | tagList += ' '; |
|
73 | tagList += ' '; | |
74 | } |
|
74 | } | |
75 |
|
75 | |||
76 | return tagList; |
|
76 | return tagList; | |
77 | } |
|
77 | } | |
78 | case CatalogueEventsModel::Column::Validation: |
|
78 | case CatalogueEventsModel::Column::Validation: | |
79 | return QVariant(); |
|
79 | return QVariant(); | |
80 | default: |
|
80 | default: | |
81 | break; |
|
81 | break; | |
82 | } |
|
82 | } | |
83 |
|
83 | |||
84 | Q_ASSERT(false); |
|
84 | Q_ASSERT(false); | |
85 | return QStringLiteral("Unknown Data"); |
|
85 | return QStringLiteral("Unknown Data"); | |
86 | } |
|
86 | } | |
87 |
|
87 | |||
88 | void parseEventProduct(const std::shared_ptr<DBEvent> &event) |
|
88 | void parseEventProduct(const std::shared_ptr<DBEvent> &event) | |
89 | { |
|
89 | { | |
90 | for (auto product : event->getEventProducts()) { |
|
90 | for (auto product : event->getEventProducts()) { | |
91 | m_EventProducts[event.get()].append(std::make_shared<DBEventProduct>(product)); |
|
91 | m_EventProducts[event.get()].append(std::make_shared<DBEventProduct>(product)); | |
92 | } |
|
92 | } | |
93 | } |
|
93 | } | |
94 |
|
94 | |||
95 | int nbEventProducts(const std::shared_ptr<DBEvent> &event) const |
|
95 | int nbEventProducts(const std::shared_ptr<DBEvent> &event) const | |
96 | { |
|
96 | { | |
97 | auto eventProductsIt = m_EventProducts.find(event.get()); |
|
97 | auto eventProductsIt = m_EventProducts.find(event.get()); | |
98 | if (eventProductsIt != m_EventProducts.cend()) { |
|
98 | if (eventProductsIt != m_EventProducts.cend()) { | |
99 | return m_EventProducts.at(event.get()).count(); |
|
99 | return m_EventProducts.at(event.get()).count(); | |
100 | } |
|
100 | } | |
101 | else { |
|
101 | else { | |
102 | return 0; |
|
102 | return 0; | |
103 | } |
|
103 | } | |
104 | } |
|
104 | } | |
105 |
|
105 | |||
106 | QVariant eventProductData(int col, const std::shared_ptr<DBEventProduct> &eventProduct) const |
|
106 | QVariant eventProductData(int col, const std::shared_ptr<DBEventProduct> &eventProduct) const | |
107 | { |
|
107 | { | |
108 | switch (static_cast<Column>(col)) { |
|
108 | switch (static_cast<Column>(col)) { | |
109 | case CatalogueEventsModel::Column::Name: |
|
109 | case CatalogueEventsModel::Column::Name: | |
110 | return eventProduct->getProductId(); |
|
110 | return eventProduct->getProductId(); | |
111 | case CatalogueEventsModel::Column::TStart: |
|
111 | case CatalogueEventsModel::Column::TStart: | |
112 | return DateUtils::dateTime(eventProduct->getTStart()) |
|
112 | return DateUtils::dateTime(eventProduct->getTStart()) | |
113 | .toString(DATETIME_FORMAT_ONE_LINE); |
|
113 | .toString(DATETIME_FORMAT_ONE_LINE); | |
114 | case CatalogueEventsModel::Column::TEnd: |
|
114 | case CatalogueEventsModel::Column::TEnd: | |
115 | return DateUtils::dateTime(eventProduct->getTEnd()) |
|
115 | return DateUtils::dateTime(eventProduct->getTEnd()) | |
116 | .toString(DATETIME_FORMAT_ONE_LINE); |
|
116 | .toString(DATETIME_FORMAT_ONE_LINE); | |
117 | case CatalogueEventsModel::Column::Product: |
|
117 | case CatalogueEventsModel::Column::Product: | |
118 | return eventProduct->getProductId(); |
|
118 | return eventProduct->getProductId(); | |
119 | case CatalogueEventsModel::Column::Tags: |
|
119 | case CatalogueEventsModel::Column::Tags: | |
120 | return QString(); |
|
120 | return QString(); | |
121 | case CatalogueEventsModel::Column::Validation: |
|
121 | case CatalogueEventsModel::Column::Validation: | |
122 | return QVariant(); |
|
122 | return QVariant(); | |
123 | default: |
|
123 | default: | |
124 | break; |
|
124 | break; | |
125 | } |
|
125 | } | |
126 |
|
126 | |||
127 | Q_ASSERT(false); |
|
127 | Q_ASSERT(false); | |
128 | return QStringLiteral("Unknown Data"); |
|
128 | return QStringLiteral("Unknown Data"); | |
129 | } |
|
129 | } | |
130 |
|
130 | |||
131 | void refreshChildrenOfIndex(CatalogueEventsModel *model, const QModelIndex &index) const |
|
131 | void refreshChildrenOfIndex(CatalogueEventsModel *model, const QModelIndex &index) const | |
132 | { |
|
132 | { | |
133 | auto childCount = model->rowCount(index); |
|
133 | auto childCount = model->rowCount(index); | |
134 | auto colCount = model->columnCount(); |
|
134 | auto colCount = model->columnCount(); | |
135 | emit model->dataChanged(model->index(0, 0, index), |
|
135 | emit model->dataChanged(model->index(0, 0, index), | |
136 | model->index(childCount, colCount, index)); |
|
136 | model->index(childCount, colCount, index)); | |
137 | } |
|
137 | } | |
138 | }; |
|
138 | }; | |
139 |
|
139 | |||
140 | CatalogueEventsModel::CatalogueEventsModel(QObject *parent) |
|
140 | CatalogueEventsModel::CatalogueEventsModel(QObject *parent) | |
141 | : QAbstractItemModel(parent), impl{spimpl::make_unique_impl<CatalogueEventsModelPrivate>()} |
|
141 | : QAbstractItemModel(parent), impl{spimpl::make_unique_impl<CatalogueEventsModelPrivate>()} | |
142 | { |
|
142 | { | |
143 | } |
|
143 | } | |
144 |
|
144 | |||
145 | void CatalogueEventsModel::setSourceCatalogues( |
|
145 | void CatalogueEventsModel::setSourceCatalogues( | |
146 | const QVector<std::shared_ptr<DBCatalogue> > &catalogues) |
|
146 | const QVector<std::shared_ptr<DBCatalogue> > &catalogues) | |
147 | { |
|
147 | { | |
148 | impl->m_SourceCatalogue = catalogues; |
|
148 | impl->m_SourceCatalogue = catalogues; | |
149 | } |
|
149 | } | |
150 |
|
150 | |||
151 | void CatalogueEventsModel::setEvents(const QVector<std::shared_ptr<DBEvent> > &events) |
|
151 | void CatalogueEventsModel::setEvents(const QVector<std::shared_ptr<DBEvent> > &events) | |
152 | { |
|
152 | { | |
153 | beginResetModel(); |
|
153 | beginResetModel(); | |
154 |
|
154 | |||
155 | impl->m_Events = events; |
|
155 | impl->m_Events = events; | |
156 | impl->m_EventProducts.clear(); |
|
156 | impl->m_EventProducts.clear(); | |
157 | for (auto event : events) { |
|
157 | for (auto event : events) { | |
158 | impl->parseEventProduct(event); |
|
158 | impl->parseEventProduct(event); | |
159 | } |
|
159 | } | |
160 |
|
160 | |||
161 | endResetModel(); |
|
161 | endResetModel(); | |
162 | } |
|
162 | } | |
163 |
|
163 | |||
164 | std::shared_ptr<DBEvent> CatalogueEventsModel::getEvent(const QModelIndex &index) const |
|
164 | std::shared_ptr<DBEvent> CatalogueEventsModel::getEvent(const QModelIndex &index) const | |
165 | { |
|
165 | { | |
166 | if (itemTypeOf(index) == CatalogueEventsModel::ItemType::Event) { |
|
166 | if (itemTypeOf(index) == CatalogueEventsModel::ItemType::Event) { | |
167 | return impl->m_Events.value(index.row()); |
|
167 | return impl->m_Events.value(index.row()); | |
168 | } |
|
168 | } | |
169 | else { |
|
169 | else { | |
170 | return nullptr; |
|
170 | return nullptr; | |
171 | } |
|
171 | } | |
172 | } |
|
172 | } | |
173 |
|
173 | |||
174 | std::shared_ptr<DBEvent> CatalogueEventsModel::getParentEvent(const QModelIndex &index) const |
|
174 | std::shared_ptr<DBEvent> CatalogueEventsModel::getParentEvent(const QModelIndex &index) const | |
175 | { |
|
175 | { | |
176 | if (itemTypeOf(index) == CatalogueEventsModel::ItemType::EventProduct) { |
|
176 | if (itemTypeOf(index) == CatalogueEventsModel::ItemType::EventProduct) { | |
177 | return getEvent(index.parent()); |
|
177 | return getEvent(index.parent()); | |
178 | } |
|
178 | } | |
179 | else { |
|
179 | else { | |
180 | return nullptr; |
|
180 | return nullptr; | |
181 | } |
|
181 | } | |
182 | } |
|
182 | } | |
183 |
|
183 | |||
184 | std::shared_ptr<DBEventProduct> |
|
184 | std::shared_ptr<DBEventProduct> | |
185 | CatalogueEventsModel::getEventProduct(const QModelIndex &index) const |
|
185 | CatalogueEventsModel::getEventProduct(const QModelIndex &index) const | |
186 | { |
|
186 | { | |
187 | if (itemTypeOf(index) == CatalogueEventsModel::ItemType::EventProduct) { |
|
187 | if (itemTypeOf(index) == CatalogueEventsModel::ItemType::EventProduct) { | |
188 | auto event = static_cast<DBEvent *>(index.internalPointer()); |
|
188 | auto event = static_cast<DBEvent *>(index.internalPointer()); | |
189 | return impl->m_EventProducts.at(event).value(index.row()); |
|
189 | return impl->m_EventProducts.at(event).value(index.row()); | |
190 | } |
|
190 | } | |
191 | else { |
|
191 | else { | |
192 | return nullptr; |
|
192 | return nullptr; | |
193 | } |
|
193 | } | |
194 | } |
|
194 | } | |
195 |
|
195 | |||
196 | void CatalogueEventsModel::addEvent(const std::shared_ptr<DBEvent> &event) |
|
196 | void CatalogueEventsModel::addEvent(const std::shared_ptr<DBEvent> &event) | |
197 | { |
|
197 | { | |
198 | beginInsertRows(QModelIndex(), impl->m_Events.count(), impl->m_Events.count()); |
|
198 | beginInsertRows(QModelIndex(), impl->m_Events.count(), impl->m_Events.count()); | |
199 | impl->m_Events.append(event); |
|
199 | impl->m_Events.append(event); | |
200 | impl->parseEventProduct(event); |
|
200 | impl->parseEventProduct(event); | |
201 | endInsertRows(); |
|
201 | endInsertRows(); | |
202 |
|
202 | |||
203 | // Also refreshes its children event products |
|
203 | // Also refreshes its children event products | |
204 | auto eventIndex = index(impl->m_Events.count(), 0); |
|
204 | auto eventIndex = index(impl->m_Events.count(), 0); | |
205 | impl->refreshChildrenOfIndex(this, eventIndex); |
|
205 | impl->refreshChildrenOfIndex(this, eventIndex); | |
206 | } |
|
206 | } | |
207 |
|
207 | |||
208 | void CatalogueEventsModel::removeEvent(const std::shared_ptr<DBEvent> &event) |
|
208 | void CatalogueEventsModel::removeEvent(const std::shared_ptr<DBEvent> &event) | |
209 | { |
|
209 | { | |
210 | auto index = impl->m_Events.indexOf(event); |
|
210 | auto index = impl->m_Events.indexOf(event); | |
211 | if (index >= 0) { |
|
211 | if (index >= 0) { | |
212 | beginRemoveRows(QModelIndex(), index, index); |
|
212 | beginRemoveRows(QModelIndex(), index, index); | |
213 | impl->m_Events.removeAt(index); |
|
213 | impl->m_Events.removeAt(index); | |
214 | impl->m_EventProducts.erase(event.get()); |
|
214 | impl->m_EventProducts.erase(event.get()); | |
215 | endRemoveRows(); |
|
215 | endRemoveRows(); | |
216 | } |
|
216 | } | |
217 | } |
|
217 | } | |
218 |
|
218 | |||
219 | QVector<std::shared_ptr<DBEvent> > CatalogueEventsModel::events() const |
|
219 | QVector<std::shared_ptr<DBEvent> > CatalogueEventsModel::events() const | |
220 | { |
|
220 | { | |
221 | return impl->m_Events; |
|
221 | return impl->m_Events; | |
222 | } |
|
222 | } | |
223 |
|
223 | |||
224 | void CatalogueEventsModel::refreshEvent(const std::shared_ptr<DBEvent> &event, |
|
224 | void CatalogueEventsModel::refreshEvent(const std::shared_ptr<DBEvent> &event, | |
225 | bool refreshEventProducts) |
|
225 | bool refreshEventProducts) | |
226 | { |
|
226 | { | |
227 | auto eventIndex = indexOf(event); |
|
227 | auto eventIndex = indexOf(event); | |
228 | if (eventIndex.isValid()) { |
|
228 | if (eventIndex.isValid()) { | |
229 |
|
229 | |||
230 | if (refreshEventProducts) { |
|
230 | if (refreshEventProducts) { | |
231 | // Reparse the associated event products |
|
231 | // Reparse the associated event products | |
232 |
|
232 | |||
233 | auto nbEventProducts = impl->nbEventProducts(event); |
|
233 | auto nbEventProducts = impl->nbEventProducts(event); | |
234 | auto newNbOfEventProducts = event->getEventProducts().size(); |
|
234 | auto newNbOfEventProducts = event->getEventProducts().size(); | |
235 | if (newNbOfEventProducts < nbEventProducts) { |
|
235 | if (newNbOfEventProducts < nbEventProducts) { | |
236 | beginRemoveRows(eventIndex, newNbOfEventProducts, nbEventProducts - 1); |
|
236 | beginRemoveRows(eventIndex, newNbOfEventProducts, nbEventProducts - 1); | |
237 | impl->m_EventProducts.erase(event.get()); |
|
237 | impl->m_EventProducts.erase(event.get()); | |
238 | impl->parseEventProduct(event); |
|
238 | impl->parseEventProduct(event); | |
239 | endRemoveRows(); |
|
239 | endRemoveRows(); | |
240 | } |
|
240 | } | |
241 | else if (newNbOfEventProducts > nbEventProducts) { |
|
241 | else if (newNbOfEventProducts > nbEventProducts) { | |
242 | beginInsertRows(eventIndex, nbEventProducts, newNbOfEventProducts - 1); |
|
242 | beginInsertRows(eventIndex, nbEventProducts, newNbOfEventProducts - 1); | |
243 | impl->m_EventProducts.erase(event.get()); |
|
243 | impl->m_EventProducts.erase(event.get()); | |
244 | impl->parseEventProduct(event); |
|
244 | impl->parseEventProduct(event); | |
245 | endInsertRows(); |
|
245 | endInsertRows(); | |
246 | } |
|
246 | } | |
247 | else { // newNbOfEventProducts == nbEventProducts |
|
247 | else { // newNbOfEventProducts == nbEventProducts | |
248 | impl->m_EventProducts.erase(event.get()); |
|
248 | impl->m_EventProducts.erase(event.get()); | |
249 | impl->parseEventProduct(event); |
|
249 | impl->parseEventProduct(event); | |
250 | } |
|
250 | } | |
251 | } |
|
251 | } | |
252 |
|
252 | |||
253 | // Refreshes the event line |
|
253 | // Refreshes the event line | |
254 | auto colCount = columnCount(); |
|
254 | auto colCount = columnCount(); | |
255 | emit dataChanged(eventIndex, index(eventIndex.row(), colCount)); |
|
255 | emit dataChanged(eventIndex, index(eventIndex.row(), colCount)); | |
256 |
|
256 | |||
257 | // Also refreshes its children event products |
|
257 | // Also refreshes its children event products | |
258 | impl->refreshChildrenOfIndex(this, eventIndex); |
|
258 | impl->refreshChildrenOfIndex(this, eventIndex); | |
259 | } |
|
259 | } | |
260 | else { |
|
260 | else { | |
261 | qCWarning(LOG_CatalogueEventsModel()) << "refreshEvent: event not found."; |
|
261 | qCWarning(LOG_CatalogueEventsModel()) << "refreshEvent: event not found."; | |
262 | } |
|
262 | } | |
263 | } |
|
263 | } | |
264 |
|
264 | |||
265 | QModelIndex CatalogueEventsModel::indexOf(const std::shared_ptr<DBEvent> &event) const |
|
265 | QModelIndex CatalogueEventsModel::indexOf(const std::shared_ptr<DBEvent> &event) const | |
266 | { |
|
266 | { | |
267 | auto row = impl->m_Events.indexOf(event); |
|
267 | auto row = impl->m_Events.indexOf(event); | |
268 | if (row >= 0) { |
|
268 | if (row >= 0) { | |
269 | return index(row, 0); |
|
269 | return index(row, 0); | |
270 | } |
|
270 | } | |
271 |
|
271 | |||
272 | return QModelIndex(); |
|
272 | return QModelIndex(); | |
273 | } |
|
273 | } | |
274 |
|
274 | |||
275 | QModelIndex CatalogueEventsModel::index(int row, int column, const QModelIndex &parent) const |
|
275 | QModelIndex CatalogueEventsModel::index(int row, int column, const QModelIndex &parent) const | |
276 | { |
|
276 | { | |
277 | if (!hasIndex(row, column, parent)) { |
|
277 | if (!hasIndex(row, column, parent)) { | |
278 | return QModelIndex(); |
|
278 | return QModelIndex(); | |
279 | } |
|
279 | } | |
280 |
|
280 | |||
281 | switch (itemTypeOf(parent)) { |
|
281 | switch (itemTypeOf(parent)) { | |
282 | case CatalogueEventsModel::ItemType::Root: |
|
282 | case CatalogueEventsModel::ItemType::Root: | |
283 | return createIndex(row, column); |
|
283 | return createIndex(row, column); | |
284 | case CatalogueEventsModel::ItemType::Event: { |
|
284 | case CatalogueEventsModel::ItemType::Event: { | |
285 | auto event = getEvent(parent); |
|
285 | auto event = getEvent(parent); | |
286 | return createIndex(row, column, event.get()); |
|
286 | return createIndex(row, column, event.get()); | |
287 | } |
|
287 | } | |
288 | case CatalogueEventsModel::ItemType::EventProduct: |
|
288 | case CatalogueEventsModel::ItemType::EventProduct: | |
289 | break; |
|
289 | break; | |
290 | default: |
|
290 | default: | |
291 | break; |
|
291 | break; | |
292 | } |
|
292 | } | |
293 |
|
293 | |||
294 | return QModelIndex(); |
|
294 | return QModelIndex(); | |
295 | } |
|
295 | } | |
296 |
|
296 | |||
297 | QModelIndex CatalogueEventsModel::parent(const QModelIndex &index) const |
|
297 | QModelIndex CatalogueEventsModel::parent(const QModelIndex &index) const | |
298 | { |
|
298 | { | |
299 | switch (itemTypeOf(index)) { |
|
299 | switch (itemTypeOf(index)) { | |
300 | case CatalogueEventsModel::ItemType::EventProduct: { |
|
300 | case CatalogueEventsModel::ItemType::EventProduct: { | |
301 | auto parentEvent = static_cast<DBEvent *>(index.internalPointer()); |
|
301 | auto parentEvent = static_cast<DBEvent *>(index.internalPointer()); | |
302 | auto it |
|
302 | auto it | |
303 | = std::find_if(impl->m_Events.cbegin(), impl->m_Events.cend(), |
|
303 | = std::find_if(impl->m_Events.cbegin(), impl->m_Events.cend(), | |
304 | [parentEvent](auto event) { return event.get() == parentEvent; }); |
|
304 | [parentEvent](auto event) { return event.get() == parentEvent; }); | |
305 |
|
305 | |||
306 | if (it != impl->m_Events.cend()) { |
|
306 | if (it != impl->m_Events.cend()) { | |
307 | return createIndex(it - impl->m_Events.cbegin(), 0); |
|
307 | return createIndex(it - impl->m_Events.cbegin(), 0); | |
308 | } |
|
308 | } | |
309 | else { |
|
309 | else { | |
310 | return QModelIndex(); |
|
310 | return QModelIndex(); | |
311 | } |
|
311 | } | |
312 | } |
|
312 | } | |
313 | case CatalogueEventsModel::ItemType::Root: |
|
313 | case CatalogueEventsModel::ItemType::Root: | |
314 | break; |
|
314 | break; | |
315 | case CatalogueEventsModel::ItemType::Event: |
|
315 | case CatalogueEventsModel::ItemType::Event: | |
316 | break; |
|
316 | break; | |
317 | default: |
|
317 | default: | |
318 | break; |
|
318 | break; | |
319 | } |
|
319 | } | |
320 |
|
320 | |||
321 | return QModelIndex(); |
|
321 | return QModelIndex(); | |
322 | } |
|
322 | } | |
323 |
|
323 | |||
324 | int CatalogueEventsModel::rowCount(const QModelIndex &parent) const |
|
324 | int CatalogueEventsModel::rowCount(const QModelIndex &parent) const | |
325 | { |
|
325 | { | |
326 | if (parent.column() > 0) { |
|
326 | if (parent.column() > 0) { | |
327 | return 0; |
|
327 | return 0; | |
328 | } |
|
328 | } | |
329 |
|
329 | |||
330 | switch (itemTypeOf(parent)) { |
|
330 | switch (itemTypeOf(parent)) { | |
331 | case CatalogueEventsModel::ItemType::Root: |
|
331 | case CatalogueEventsModel::ItemType::Root: | |
332 | return impl->m_Events.count(); |
|
332 | return impl->m_Events.count(); | |
333 | case CatalogueEventsModel::ItemType::Event: { |
|
333 | case CatalogueEventsModel::ItemType::Event: { | |
334 | auto event = getEvent(parent); |
|
334 | auto event = getEvent(parent); | |
335 | return impl->m_EventProducts[event.get()].count(); |
|
335 | return impl->m_EventProducts[event.get()].count(); | |
336 | } |
|
336 | } | |
337 | case CatalogueEventsModel::ItemType::EventProduct: |
|
337 | case CatalogueEventsModel::ItemType::EventProduct: | |
338 | break; |
|
338 | break; | |
339 | default: |
|
339 | default: | |
340 | break; |
|
340 | break; | |
341 | } |
|
341 | } | |
342 |
|
342 | |||
343 | return 0; |
|
343 | return 0; | |
344 | } |
|
344 | } | |
345 |
|
345 | |||
346 | int CatalogueEventsModel::columnCount(const QModelIndex &parent) const |
|
346 | int CatalogueEventsModel::columnCount(const QModelIndex &parent) const | |
347 | { |
|
347 | { | |
348 | return static_cast<int>(CatalogueEventsModel::Column::NbColumn); |
|
348 | return static_cast<int>(CatalogueEventsModel::Column::NbColumn); | |
349 | } |
|
349 | } | |
350 |
|
350 | |||
351 | Qt::ItemFlags CatalogueEventsModel::flags(const QModelIndex &index) const |
|
351 | Qt::ItemFlags CatalogueEventsModel::flags(const QModelIndex &index) const | |
352 | { |
|
352 | { | |
353 | return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled; |
|
353 | return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled; | |
354 | } |
|
354 | } | |
355 |
|
355 | |||
356 | QVariant CatalogueEventsModel::data(const QModelIndex &index, int role) const |
|
356 | QVariant CatalogueEventsModel::data(const QModelIndex &index, int role) const | |
357 | { |
|
357 | { | |
358 | if (index.isValid()) { |
|
358 | if (index.isValid()) { | |
359 |
|
359 | |||
360 | auto type = itemTypeOf(index); |
|
360 | auto type = itemTypeOf(index); | |
361 | if (type == CatalogueEventsModel::ItemType::Event) { |
|
361 | if (type == CatalogueEventsModel::ItemType::Event) { | |
362 | auto event = getEvent(index); |
|
362 | auto event = getEvent(index); | |
363 | switch (role) { |
|
363 | switch (role) { | |
364 | case Qt::DisplayRole: |
|
364 | case Qt::DisplayRole: | |
365 | return impl->eventData(index.column(), event); |
|
365 | return impl->eventData(index.column(), event); | |
366 | break; |
|
366 | break; | |
367 | } |
|
367 | } | |
368 | } |
|
368 | } | |
369 | else if (type == CatalogueEventsModel::ItemType::EventProduct) { |
|
369 | else if (type == CatalogueEventsModel::ItemType::EventProduct) { | |
370 | auto product = getEventProduct(index); |
|
370 | auto product = getEventProduct(index); | |
371 | switch (role) { |
|
371 | switch (role) { | |
372 | case Qt::DisplayRole: |
|
372 | case Qt::DisplayRole: | |
373 | return impl->eventProductData(index.column(), product); |
|
373 | return impl->eventProductData(index.column(), product); | |
374 | break; |
|
374 | break; | |
375 | } |
|
375 | } | |
376 | } |
|
376 | } | |
377 | } |
|
377 | } | |
378 |
|
378 | |||
379 | return QVariant{}; |
|
379 | return QVariant{}; | |
380 | } |
|
380 | } | |
381 |
|
381 | |||
382 | QVariant CatalogueEventsModel::headerData(int section, Qt::Orientation orientation, int role) const |
|
382 | QVariant CatalogueEventsModel::headerData(int section, Qt::Orientation orientation, int role) const | |
383 | { |
|
383 | { | |
384 | if (orientation == Qt::Horizontal && role == Qt::DisplayRole) { |
|
384 | if (orientation == Qt::Horizontal && role == Qt::DisplayRole) { | |
385 | return impl->columnNames().value(section); |
|
385 | return impl->columnNames().value(section); | |
386 | } |
|
386 | } | |
387 |
|
387 | |||
388 | return QVariant(); |
|
388 | return QVariant(); | |
389 | } |
|
389 | } | |
390 |
|
390 | |||
391 | void CatalogueEventsModel::sort(int column, Qt::SortOrder order) |
|
391 | void CatalogueEventsModel::sort(int column, Qt::SortOrder order) | |
392 | { |
|
392 | { | |
393 | beginResetModel(); |
|
393 | beginResetModel(); | |
394 | std::sort(impl->m_Events.begin(), impl->m_Events.end(), |
|
394 | std::sort(impl->m_Events.begin(), impl->m_Events.end(), | |
395 | [this, column, order](auto e1, auto e2) { |
|
395 | [this, column, order](auto e1, auto e2) { | |
396 | auto data1 = impl->sortData(column, e1); |
|
396 | auto data1 = impl->sortData(column, e1); | |
397 | auto data2 = impl->sortData(column, e2); |
|
397 | auto data2 = impl->sortData(column, e2); | |
398 |
|
398 | |||
399 | auto result = data1.toString() < data2.toString(); |
|
399 | auto result = data1.toString() < data2.toString(); | |
400 |
|
400 | |||
401 | return order == Qt::AscendingOrder ? result : !result; |
|
401 | return order == Qt::AscendingOrder ? result : !result; | |
402 | }); |
|
402 | }); | |
403 |
|
403 | |||
404 | endResetModel(); |
|
404 | endResetModel(); | |
405 | emit modelSorted(); |
|
405 | emit modelSorted(); | |
406 | } |
|
406 | } | |
407 |
|
407 | |||
408 | Qt::DropActions CatalogueEventsModel::supportedDragActions() const |
|
408 | Qt::DropActions CatalogueEventsModel::supportedDragActions() const | |
409 | { |
|
409 | { | |
410 | return Qt::CopyAction | Qt::MoveAction; |
|
410 | return Qt::CopyAction | Qt::MoveAction; | |
411 | } |
|
411 | } | |
412 |
|
412 | |||
413 | QStringList CatalogueEventsModel::mimeTypes() const |
|
413 | QStringList CatalogueEventsModel::mimeTypes() const | |
414 | { |
|
414 | { | |
415 | return {MIME_TYPE_EVENT_LIST, MIME_TYPE_SOURCE_CATALOGUE_LIST, MIME_TYPE_TIME_RANGE}; |
|
415 | return {MIME_TYPE_EVENT_LIST, MIME_TYPE_SOURCE_CATALOGUE_LIST, MIME_TYPE_TIME_RANGE}; | |
416 | } |
|
416 | } | |
417 |
|
417 | |||
418 | QMimeData *CatalogueEventsModel::mimeData(const QModelIndexList &indexes) const |
|
418 | QMimeData *CatalogueEventsModel::mimeData(const QModelIndexList &indexes) const | |
419 | { |
|
419 | { | |
420 | auto mimeData = new QMimeData; |
|
420 | auto mimeData = new QMimeData; | |
421 |
|
421 | |||
422 | bool isFirst = true; |
|
422 | bool isFirst = true; | |
423 |
|
423 | |||
424 | QVector<std::shared_ptr<DBEvent> > eventList; |
|
424 | QVector<std::shared_ptr<DBEvent> > eventList; | |
425 | QVector<std::shared_ptr<DBEventProduct> > eventProductList; |
|
425 | QVector<std::shared_ptr<DBEventProduct> > eventProductList; | |
426 |
|
426 | |||
427 | DateTimeRange firstTimeRange; |
|
427 | DateTimeRange firstTimeRange; | |
428 | for (const auto &index : indexes) { |
|
428 | for (const auto &index : indexes) { | |
429 | if (index.column() == 0) { // only the first column |
|
429 | if (index.column() == 0) { // only the first column | |
430 |
|
430 | |||
431 | auto type = itemTypeOf(index); |
|
431 | auto type = itemTypeOf(index); | |
432 | if (type == ItemType::Event) { |
|
432 | if (type == ItemType::Event) { | |
433 | auto event = getEvent(index); |
|
433 | auto event = getEvent(index); | |
434 | eventList << event; |
|
434 | eventList << event; | |
435 |
|
435 | |||
436 | if (isFirst) { |
|
436 | if (isFirst) { | |
437 | isFirst = false; |
|
437 | isFirst = false; | |
438 | firstTimeRange.m_TStart = event->getTStart(); |
|
438 | firstTimeRange.m_TStart = event->getTStart(); | |
439 | firstTimeRange.m_TEnd = event->getTEnd(); |
|
439 | firstTimeRange.m_TEnd = event->getTEnd(); | |
440 | } |
|
440 | } | |
441 | } |
|
441 | } | |
442 | else if (type == ItemType::EventProduct) { |
|
442 | else if (type == ItemType::EventProduct) { | |
443 | auto product = getEventProduct(index); |
|
443 | auto product = getEventProduct(index); | |
444 | eventProductList << product; |
|
444 | eventProductList << product; | |
445 |
|
445 | |||
446 | if (isFirst) { |
|
446 | if (isFirst) { | |
447 | isFirst = false; |
|
447 | isFirst = false; | |
448 | firstTimeRange.m_TStart = product->getTStart(); |
|
448 | firstTimeRange.m_TStart = product->getTStart(); | |
449 | firstTimeRange.m_TEnd = product->getTEnd(); |
|
449 | firstTimeRange.m_TEnd = product->getTEnd(); | |
450 | } |
|
450 | } | |
451 | } |
|
451 | } | |
452 | } |
|
452 | } | |
453 | } |
|
453 | } | |
454 |
|
454 | |||
455 | if (!eventList.isEmpty() && eventProductList.isEmpty()) { |
|
455 | if (!eventList.isEmpty() && eventProductList.isEmpty()) { | |
456 | auto eventsEncodedData = sqpApp->catalogueController().mimeDataForEvents(eventList); |
|
456 | auto eventsEncodedData = sqpApp->catalogueController().mimeDataForEvents(eventList); | |
457 | mimeData->setData(MIME_TYPE_EVENT_LIST, eventsEncodedData); |
|
457 | mimeData->setData(MIME_TYPE_EVENT_LIST, eventsEncodedData); | |
458 |
|
458 | |||
459 | auto sourceCataloguesEncodedData |
|
459 | auto sourceCataloguesEncodedData | |
460 | = sqpApp->catalogueController().mimeDataForCatalogues(impl->m_SourceCatalogue); |
|
460 | = sqpApp->catalogueController().mimeDataForCatalogues(impl->m_SourceCatalogue); | |
461 | mimeData->setData(MIME_TYPE_SOURCE_CATALOGUE_LIST, sourceCataloguesEncodedData); |
|
461 | mimeData->setData(MIME_TYPE_SOURCE_CATALOGUE_LIST, sourceCataloguesEncodedData); | |
462 | } |
|
462 | } | |
463 |
|
463 | |||
464 | if (eventList.count() + eventProductList.count() == 1) { |
|
464 | if (eventList.count() + eventProductList.count() == 1) { | |
465 | // No time range MIME data if multiple events are dragged |
|
465 | // No time range MIME data if multiple events are dragged | |
466 | auto timeEncodedData = TimeController::mimeDataForTimeRange(firstTimeRange); |
|
466 | auto timeEncodedData = TimeController::mimeDataForTimeRange(firstTimeRange); | |
467 | mimeData->setData(MIME_TYPE_TIME_RANGE, timeEncodedData); |
|
467 | mimeData->setData(MIME_TYPE_TIME_RANGE, timeEncodedData); | |
468 | } |
|
468 | } | |
469 |
|
469 | |||
470 | return mimeData; |
|
470 | return mimeData; | |
471 | } |
|
471 | } | |
472 |
|
472 | |||
473 | CatalogueEventsModel::ItemType CatalogueEventsModel::itemTypeOf(const QModelIndex &index) const |
|
473 | CatalogueEventsModel::ItemType CatalogueEventsModel::itemTypeOf(const QModelIndex &index) const | |
474 | { |
|
474 | { | |
475 | if (!index.isValid()) { |
|
475 | if (!index.isValid()) { | |
476 | return ItemType::Root; |
|
476 | return ItemType::Root; | |
477 | } |
|
477 | } | |
478 | else if (index.internalPointer() == nullptr) { |
|
478 | else if (index.internalPointer() == nullptr) { | |
479 | return ItemType::Event; |
|
479 | return ItemType::Event; | |
480 | } |
|
480 | } | |
481 | else { |
|
481 | else { | |
482 | return ItemType::EventProduct; |
|
482 | return ItemType::EventProduct; | |
483 | } |
|
483 | } | |
484 | } |
|
484 | } |
@@ -1,154 +1,155 | |||||
1 | #include "TimeWidget/TimeWidget.h" |
|
1 | #include "TimeWidget/TimeWidget.h" | |
2 | #include "ui_TimeWidget.h" |
|
2 | #include "ui_TimeWidget.h" | |
3 |
|
3 | |||
4 | #include <Common/DateUtils.h> |
|
4 | #include <Common/DateUtils.h> | |
5 | #include <Common/MimeTypesDef.h> |
|
5 | #include <Common/MimeTypesDef.h> | |
6 |
|
6 | |||
7 | #include <DragAndDrop/DragDropGuiController.h> |
|
7 | #include <DragAndDrop/DragDropGuiController.h> | |
8 | #include <SqpApplication.h> |
|
8 | #include <SqpApplication.h> | |
9 | #include <Time/TimeController.h> |
|
9 | #include <Time/TimeController.h> | |
10 |
|
10 | |||
11 | #include <QDrag> |
|
11 | #include <QDrag> | |
12 | #include <QDragEnterEvent> |
|
12 | #include <QDragEnterEvent> | |
13 | #include <QDropEvent> |
|
13 | #include <QDropEvent> | |
14 | #include <QMimeData> |
|
14 | #include <QMimeData> | |
|
15 | #include <QStyle> | |||
15 |
|
16 | |||
16 |
|
17 | |||
17 | struct TimeWidget::TimeWidgetPrivate { |
|
18 | struct TimeWidget::TimeWidgetPrivate { | |
18 |
|
19 | |||
19 | explicit TimeWidgetPrivate() {} |
|
20 | explicit TimeWidgetPrivate() {} | |
20 |
|
21 | |||
21 | QPoint m_DragStartPosition; |
|
22 | QPoint m_DragStartPosition; | |
22 | }; |
|
23 | }; | |
23 |
|
24 | |||
24 | TimeWidget::TimeWidget(QWidget *parent) |
|
25 | TimeWidget::TimeWidget(QWidget *parent) | |
25 | : QWidget{parent}, |
|
26 | : QWidget{parent}, | |
26 | ui{new Ui::TimeWidget}, |
|
27 | ui{new Ui::TimeWidget}, | |
27 | impl{spimpl::make_unique_impl<TimeWidgetPrivate>()} |
|
28 | impl{spimpl::make_unique_impl<TimeWidgetPrivate>()} | |
28 | { |
|
29 | { | |
29 | ui->setupUi(this); |
|
30 | ui->setupUi(this); | |
30 |
|
31 | |||
31 | ui->applyToolButton->setIcon(sqpApp->style()->standardIcon(QStyle::SP_DialogApplyButton)); |
|
32 | ui->applyToolButton->setIcon(sqpApp->style()->standardIcon(QStyle::SP_DialogApplyButton)); | |
32 |
|
33 | |||
33 | // Connection |
|
34 | // Connection | |
34 | connect(ui->startDateTimeEdit, &QDateTimeEdit::dateTimeChanged, this, |
|
35 | connect(ui->startDateTimeEdit, &QDateTimeEdit::dateTimeChanged, this, | |
35 | &TimeWidget::onTimeUpdateRequested); |
|
36 | &TimeWidget::onTimeUpdateRequested); | |
36 |
|
37 | |||
37 | connect(ui->endDateTimeEdit, &QDateTimeEdit::dateTimeChanged, this, |
|
38 | connect(ui->endDateTimeEdit, &QDateTimeEdit::dateTimeChanged, this, | |
38 | &TimeWidget::onTimeUpdateRequested); |
|
39 | &TimeWidget::onTimeUpdateRequested); | |
39 |
|
40 | |||
40 |
|
41 | |||
41 | connect(ui->applyToolButton, &QToolButton::clicked, &sqpApp->timeController(), |
|
42 | connect(ui->applyToolButton, &QToolButton::clicked, &sqpApp->timeController(), | |
42 | &TimeController::onTimeNotify); |
|
43 | &TimeController::onTimeNotify); | |
43 |
|
44 | |||
44 | // Initialisation |
|
45 | // Initialisation | |
45 | auto endDateTime = QDateTime::currentDateTimeUtc(); |
|
46 | auto endDateTime = QDateTime::currentDateTimeUtc(); | |
46 | auto startDateTime = endDateTime.addSecs(-3600); // one hour before |
|
47 | auto startDateTime = endDateTime.addSecs(-3600); // one hour before | |
47 |
|
48 | |||
48 | ui->startDateTimeEdit->setDateTime(startDateTime); |
|
49 | ui->startDateTimeEdit->setDateTime(startDateTime); | |
49 | ui->endDateTimeEdit->setDateTime(endDateTime); |
|
50 | ui->endDateTimeEdit->setDateTime(endDateTime); | |
50 |
|
51 | |||
51 | auto dateTime = DateTimeRange{DateUtils::secondsSinceEpoch(startDateTime), |
|
52 | auto dateTime = DateTimeRange{DateUtils::secondsSinceEpoch(startDateTime), | |
52 | DateUtils::secondsSinceEpoch(endDateTime)}; |
|
53 | DateUtils::secondsSinceEpoch(endDateTime)}; | |
53 |
|
54 | |||
54 | sqpApp->timeController().setDateTimeRange(dateTime); |
|
55 | sqpApp->timeController().setDateTimeRange(dateTime); | |
55 | } |
|
56 | } | |
56 |
|
57 | |||
57 |
|
58 | |||
58 | TimeWidget::~TimeWidget() |
|
59 | TimeWidget::~TimeWidget() | |
59 | { |
|
60 | { | |
60 | delete ui; |
|
61 | delete ui; | |
61 | } |
|
62 | } | |
62 |
|
63 | |||
63 | void TimeWidget::setTimeRange(DateTimeRange time) |
|
64 | void TimeWidget::setTimeRange(DateTimeRange time) | |
64 | { |
|
65 | { | |
65 | auto startDateTime = DateUtils::dateTime(time.m_TStart); |
|
66 | auto startDateTime = DateUtils::dateTime(time.m_TStart); | |
66 | auto endDateTime = DateUtils::dateTime(time.m_TEnd); |
|
67 | auto endDateTime = DateUtils::dateTime(time.m_TEnd); | |
67 |
|
68 | |||
68 | ui->startDateTimeEdit->setDateTime(startDateTime); |
|
69 | ui->startDateTimeEdit->setDateTime(startDateTime); | |
69 | ui->endDateTimeEdit->setDateTime(endDateTime); |
|
70 | ui->endDateTimeEdit->setDateTime(endDateTime); | |
70 | } |
|
71 | } | |
71 |
|
72 | |||
72 | DateTimeRange TimeWidget::timeRange() const |
|
73 | DateTimeRange TimeWidget::timeRange() const | |
73 | { |
|
74 | { | |
74 | return DateTimeRange{DateUtils::secondsSinceEpoch(ui->startDateTimeEdit->dateTime()), |
|
75 | return DateTimeRange{DateUtils::secondsSinceEpoch(ui->startDateTimeEdit->dateTime()), | |
75 | DateUtils::secondsSinceEpoch(ui->endDateTimeEdit->dateTime())}; |
|
76 | DateUtils::secondsSinceEpoch(ui->endDateTimeEdit->dateTime())}; | |
76 | } |
|
77 | } | |
77 |
|
78 | |||
78 | void TimeWidget::onTimeUpdateRequested() |
|
79 | void TimeWidget::onTimeUpdateRequested() | |
79 | { |
|
80 | { | |
80 | auto dateTime = timeRange(); |
|
81 | auto dateTime = timeRange(); | |
81 | emit timeUpdated(std::move(dateTime)); |
|
82 | emit timeUpdated(std::move(dateTime)); | |
82 | } |
|
83 | } | |
83 |
|
84 | |||
84 | void TimeWidget::dragEnterEvent(QDragEnterEvent *event) |
|
85 | void TimeWidget::dragEnterEvent(QDragEnterEvent *event) | |
85 | { |
|
86 | { | |
86 | if (event->mimeData()->hasFormat(MIME_TYPE_TIME_RANGE)) { |
|
87 | if (event->mimeData()->hasFormat(MIME_TYPE_TIME_RANGE)) { | |
87 | event->acceptProposedAction(); |
|
88 | event->acceptProposedAction(); | |
88 | setStyleSheet("QDateTimeEdit{background-color: #BBD5EE; border:2px solid #2A7FD4}"); |
|
89 | setStyleSheet("QDateTimeEdit{background-color: #BBD5EE; border:2px solid #2A7FD4}"); | |
89 | } |
|
90 | } | |
90 | else { |
|
91 | else { | |
91 | event->ignore(); |
|
92 | event->ignore(); | |
92 | } |
|
93 | } | |
93 | } |
|
94 | } | |
94 |
|
95 | |||
95 | void TimeWidget::dragLeaveEvent(QDragLeaveEvent *event) |
|
96 | void TimeWidget::dragLeaveEvent(QDragLeaveEvent *event) | |
96 | { |
|
97 | { | |
97 | setStyleSheet(QString{}); |
|
98 | setStyleSheet(QString{}); | |
98 | } |
|
99 | } | |
99 |
|
100 | |||
100 | void TimeWidget::dropEvent(QDropEvent *event) |
|
101 | void TimeWidget::dropEvent(QDropEvent *event) | |
101 | { |
|
102 | { | |
102 | if (event->mimeData()->hasFormat(MIME_TYPE_TIME_RANGE)) { |
|
103 | if (event->mimeData()->hasFormat(MIME_TYPE_TIME_RANGE)) { | |
103 | auto mimeData = event->mimeData()->data(MIME_TYPE_TIME_RANGE); |
|
104 | auto mimeData = event->mimeData()->data(MIME_TYPE_TIME_RANGE); | |
104 | auto timeRange = TimeController::timeRangeForMimeData(mimeData); |
|
105 | auto timeRange = TimeController::timeRangeForMimeData(mimeData); | |
105 |
|
106 | |||
106 | setTimeRange(timeRange); |
|
107 | setTimeRange(timeRange); | |
107 | } |
|
108 | } | |
108 | else { |
|
109 | else { | |
109 | event->ignore(); |
|
110 | event->ignore(); | |
110 | } |
|
111 | } | |
111 |
|
112 | |||
112 | setStyleSheet(QString{}); |
|
113 | setStyleSheet(QString{}); | |
113 | } |
|
114 | } | |
114 |
|
115 | |||
115 |
|
116 | |||
116 | void TimeWidget::mousePressEvent(QMouseEvent *event) |
|
117 | void TimeWidget::mousePressEvent(QMouseEvent *event) | |
117 | { |
|
118 | { | |
118 | if (event->button() == Qt::LeftButton) { |
|
119 | if (event->button() == Qt::LeftButton) { | |
119 | impl->m_DragStartPosition = event->pos(); |
|
120 | impl->m_DragStartPosition = event->pos(); | |
120 | } |
|
121 | } | |
121 |
|
122 | |||
122 | QWidget::mousePressEvent(event); |
|
123 | QWidget::mousePressEvent(event); | |
123 | } |
|
124 | } | |
124 |
|
125 | |||
125 | void TimeWidget::mouseMoveEvent(QMouseEvent *event) |
|
126 | void TimeWidget::mouseMoveEvent(QMouseEvent *event) | |
126 | { |
|
127 | { | |
127 | if (!(event->buttons() & Qt::LeftButton)) { |
|
128 | if (!(event->buttons() & Qt::LeftButton)) { | |
128 | return; |
|
129 | return; | |
129 | } |
|
130 | } | |
130 |
|
131 | |||
131 | if ((event->pos() - impl->m_DragStartPosition).manhattanLength() |
|
132 | if ((event->pos() - impl->m_DragStartPosition).manhattanLength() | |
132 | < QApplication::startDragDistance()) { |
|
133 | < QApplication::startDragDistance()) { | |
133 | return; |
|
134 | return; | |
134 | } |
|
135 | } | |
135 |
|
136 | |||
136 | // Note: The management of the drag object is done by Qt |
|
137 | // Note: The management of the drag object is done by Qt | |
137 | auto drag = new QDrag{this}; |
|
138 | auto drag = new QDrag{this}; | |
138 |
|
139 | |||
139 | auto mimeData = new QMimeData; |
|
140 | auto mimeData = new QMimeData; | |
140 | auto timeData = TimeController::mimeDataForTimeRange(timeRange()); |
|
141 | auto timeData = TimeController::mimeDataForTimeRange(timeRange()); | |
141 | mimeData->setData(MIME_TYPE_TIME_RANGE, timeData); |
|
142 | mimeData->setData(MIME_TYPE_TIME_RANGE, timeData); | |
142 |
|
143 | |||
143 | drag->setMimeData(mimeData); |
|
144 | drag->setMimeData(mimeData); | |
144 |
|
145 | |||
145 | auto pixmap = QPixmap{":/icones/time.png"}; |
|
146 | auto pixmap = QPixmap{":/icones/time.png"}; | |
146 | drag->setPixmap(pixmap.scaledToWidth(22)); |
|
147 | drag->setPixmap(pixmap.scaledToWidth(22)); | |
147 |
|
148 | |||
148 | sqpApp->dragDropGuiController().resetDragAndDrop(); |
|
149 | sqpApp->dragDropGuiController().resetDragAndDrop(); | |
149 |
|
150 | |||
150 | // Note: The exec() is blocking on windows but not on linux and macOS |
|
151 | // Note: The exec() is blocking on windows but not on linux and macOS | |
151 | drag->exec(Qt::MoveAction | Qt::CopyAction); |
|
152 | drag->exec(Qt::MoveAction | Qt::CopyAction); | |
152 |
|
153 | |||
153 | QWidget::mouseMoveEvent(event); |
|
154 | QWidget::mouseMoveEvent(event); | |
154 | } |
|
155 | } |
@@ -1,658 +1,659 | |||||
1 | #include "Visualization/VisualizationZoneWidget.h" |
|
1 | #include "Visualization/VisualizationZoneWidget.h" | |
2 |
|
2 | |||
3 | #include "Visualization/IVisualizationWidgetVisitor.h" |
|
3 | #include "Visualization/IVisualizationWidgetVisitor.h" | |
4 | #include "Visualization/QCustomPlotSynchronizer.h" |
|
4 | #include "Visualization/QCustomPlotSynchronizer.h" | |
5 | #include "Visualization/VisualizationGraphWidget.h" |
|
5 | #include "Visualization/VisualizationGraphWidget.h" | |
6 | #include "Visualization/VisualizationWidget.h" |
|
6 | #include "Visualization/VisualizationWidget.h" | |
7 | #include "ui_VisualizationZoneWidget.h" |
|
7 | #include "ui_VisualizationZoneWidget.h" | |
8 |
|
8 | |||
9 | #include "Common/MimeTypesDef.h" |
|
9 | #include "Common/MimeTypesDef.h" | |
10 | #include "Common/VisualizationDef.h" |
|
10 | #include "Common/VisualizationDef.h" | |
11 |
|
11 | |||
12 |
#include <Data/ |
|
12 | #include <Data/DateTimeRange.h> | |
13 | #include <DataSource/DataSourceController.h> |
|
13 | #include <DataSource/DataSourceController.h> | |
14 | #include <Time/TimeController.h> |
|
14 | #include <Time/TimeController.h> | |
15 | #include <Variable/Variable.h> |
|
15 | #include <Variable/Variable.h> | |
16 | #include <Variable/VariableController.h> |
|
16 | #include <Variable/VariableController.h> | |
17 |
|
17 | |||
18 | #include <Visualization/operations/FindVariableOperation.h> |
|
18 | #include <Visualization/operations/FindVariableOperation.h> | |
19 |
|
19 | |||
20 | #include <DragAndDrop/DragDropGuiController.h> |
|
20 | #include <DragAndDrop/DragDropGuiController.h> | |
21 | #include <QUuid> |
|
21 | #include <QUuid> | |
22 | #include <SqpApplication.h> |
|
22 | #include <SqpApplication.h> | |
23 | #include <cmath> |
|
23 | #include <cmath> | |
24 |
|
24 | |||
25 | #include <QLayout> |
|
25 | #include <QLayout> | |
|
26 | #include <QStyle> | |||
26 |
|
27 | |||
27 | Q_LOGGING_CATEGORY(LOG_VisualizationZoneWidget, "VisualizationZoneWidget") |
|
28 | Q_LOGGING_CATEGORY(LOG_VisualizationZoneWidget, "VisualizationZoneWidget") | |
28 |
|
29 | |||
29 | namespace { |
|
30 | namespace { | |
30 |
|
31 | |||
31 | /** |
|
32 | /** | |
32 | * Applies a function to all graphs of the zone represented by its layout |
|
33 | * Applies a function to all graphs of the zone represented by its layout | |
33 | * @param layout the layout that contains graphs |
|
34 | * @param layout the layout that contains graphs | |
34 | * @param fun the function to apply to each graph |
|
35 | * @param fun the function to apply to each graph | |
35 | */ |
|
36 | */ | |
36 | template <typename Fun> |
|
37 | template <typename Fun> | |
37 | void processGraphs(QLayout &layout, Fun fun) |
|
38 | void processGraphs(QLayout &layout, Fun fun) | |
38 | { |
|
39 | { | |
39 | for (auto i = 0; i < layout.count(); ++i) { |
|
40 | for (auto i = 0; i < layout.count(); ++i) { | |
40 | if (auto item = layout.itemAt(i)) { |
|
41 | if (auto item = layout.itemAt(i)) { | |
41 | if (auto visualizationGraphWidget |
|
42 | if (auto visualizationGraphWidget | |
42 | = qobject_cast<VisualizationGraphWidget *>(item->widget())) { |
|
43 | = qobject_cast<VisualizationGraphWidget *>(item->widget())) { | |
43 | fun(*visualizationGraphWidget); |
|
44 | fun(*visualizationGraphWidget); | |
44 | } |
|
45 | } | |
45 | } |
|
46 | } | |
46 | } |
|
47 | } | |
47 | } |
|
48 | } | |
48 |
|
49 | |||
49 | /// Generates a default name for a new graph, according to the number of graphs already displayed in |
|
50 | /// Generates a default name for a new graph, according to the number of graphs already displayed in | |
50 | /// the zone |
|
51 | /// the zone | |
51 | QString defaultGraphName(QLayout &layout) |
|
52 | QString defaultGraphName(QLayout &layout) | |
52 | { |
|
53 | { | |
53 | QSet<QString> existingNames; |
|
54 | QSet<QString> existingNames; | |
54 | processGraphs( |
|
55 | processGraphs( | |
55 | layout, [&existingNames](auto &graphWidget) { existingNames.insert(graphWidget.name()); }); |
|
56 | layout, [&existingNames](auto &graphWidget) { existingNames.insert(graphWidget.name()); }); | |
56 |
|
57 | |||
57 | int zoneNum = 1; |
|
58 | int zoneNum = 1; | |
58 | QString name; |
|
59 | QString name; | |
59 | do { |
|
60 | do { | |
60 | name = QObject::tr("Graph ").append(QString::number(zoneNum)); |
|
61 | name = QObject::tr("Graph ").append(QString::number(zoneNum)); | |
61 | ++zoneNum; |
|
62 | ++zoneNum; | |
62 | } while (existingNames.contains(name)); |
|
63 | } while (existingNames.contains(name)); | |
63 |
|
64 | |||
64 | return name; |
|
65 | return name; | |
65 | } |
|
66 | } | |
66 |
|
67 | |||
67 | } // namespace |
|
68 | } // namespace | |
68 |
|
69 | |||
69 | struct VisualizationZoneWidget::VisualizationZoneWidgetPrivate { |
|
70 | struct VisualizationZoneWidget::VisualizationZoneWidgetPrivate { | |
70 |
|
71 | |||
71 | explicit VisualizationZoneWidgetPrivate() |
|
72 | explicit VisualizationZoneWidgetPrivate() | |
72 | : m_SynchronisationGroupId{QUuid::createUuid()}, |
|
73 | : m_SynchronisationGroupId{QUuid::createUuid()}, | |
73 | m_Synchronizer{std::make_unique<QCustomPlotSynchronizer>()} |
|
74 | m_Synchronizer{std::make_unique<QCustomPlotSynchronizer>()} | |
74 | { |
|
75 | { | |
75 | } |
|
76 | } | |
76 | QUuid m_SynchronisationGroupId; |
|
77 | QUuid m_SynchronisationGroupId; | |
77 | std::unique_ptr<IGraphSynchronizer> m_Synchronizer; |
|
78 | std::unique_ptr<IGraphSynchronizer> m_Synchronizer; | |
78 |
|
79 | |||
79 | void dropGraph(int index, VisualizationZoneWidget *zoneWidget); |
|
80 | void dropGraph(int index, VisualizationZoneWidget *zoneWidget); | |
80 | void dropVariables(const QList<std::shared_ptr<Variable> > &variables, int index, |
|
81 | void dropVariables(const QList<std::shared_ptr<Variable> > &variables, int index, | |
81 | VisualizationZoneWidget *zoneWidget); |
|
82 | VisualizationZoneWidget *zoneWidget); | |
82 | void dropProducts(const QVariantList &productsData, int index, |
|
83 | void dropProducts(const QVariantList &productsData, int index, | |
83 | VisualizationZoneWidget *zoneWidget); |
|
84 | VisualizationZoneWidget *zoneWidget); | |
84 | }; |
|
85 | }; | |
85 |
|
86 | |||
86 | VisualizationZoneWidget::VisualizationZoneWidget(const QString &name, QWidget *parent) |
|
87 | VisualizationZoneWidget::VisualizationZoneWidget(const QString &name, QWidget *parent) | |
87 | : VisualizationDragWidget{parent}, |
|
88 | : VisualizationDragWidget{parent}, | |
88 | ui{new Ui::VisualizationZoneWidget}, |
|
89 | ui{new Ui::VisualizationZoneWidget}, | |
89 | impl{spimpl::make_unique_impl<VisualizationZoneWidgetPrivate>()} |
|
90 | impl{spimpl::make_unique_impl<VisualizationZoneWidgetPrivate>()} | |
90 | { |
|
91 | { | |
91 | ui->setupUi(this); |
|
92 | ui->setupUi(this); | |
92 |
|
93 | |||
93 | ui->zoneNameLabel->setText(name); |
|
94 | ui->zoneNameLabel->setText(name); | |
94 |
|
95 | |||
95 | ui->dragDropContainer->setPlaceHolderType(DragDropGuiController::PlaceHolderType::Graph); |
|
96 | ui->dragDropContainer->setPlaceHolderType(DragDropGuiController::PlaceHolderType::Graph); | |
96 | ui->dragDropContainer->setMimeType(MIME_TYPE_GRAPH, |
|
97 | ui->dragDropContainer->setMimeType(MIME_TYPE_GRAPH, | |
97 | VisualizationDragDropContainer::DropBehavior::Inserted); |
|
98 | VisualizationDragDropContainer::DropBehavior::Inserted); | |
98 | ui->dragDropContainer->setMimeType( |
|
99 | ui->dragDropContainer->setMimeType( | |
99 | MIME_TYPE_VARIABLE_LIST, VisualizationDragDropContainer::DropBehavior::InsertedAndMerged); |
|
100 | MIME_TYPE_VARIABLE_LIST, VisualizationDragDropContainer::DropBehavior::InsertedAndMerged); | |
100 | ui->dragDropContainer->setMimeType( |
|
101 | ui->dragDropContainer->setMimeType( | |
101 | MIME_TYPE_PRODUCT_LIST, VisualizationDragDropContainer::DropBehavior::InsertedAndMerged); |
|
102 | MIME_TYPE_PRODUCT_LIST, VisualizationDragDropContainer::DropBehavior::InsertedAndMerged); | |
102 | ui->dragDropContainer->setMimeType(MIME_TYPE_TIME_RANGE, |
|
103 | ui->dragDropContainer->setMimeType(MIME_TYPE_TIME_RANGE, | |
103 | VisualizationDragDropContainer::DropBehavior::Merged); |
|
104 | VisualizationDragDropContainer::DropBehavior::Merged); | |
104 | ui->dragDropContainer->setMimeType(MIME_TYPE_ZONE, |
|
105 | ui->dragDropContainer->setMimeType(MIME_TYPE_ZONE, | |
105 | VisualizationDragDropContainer::DropBehavior::Forbidden); |
|
106 | VisualizationDragDropContainer::DropBehavior::Forbidden); | |
106 | ui->dragDropContainer->setMimeType(MIME_TYPE_SELECTION_ZONE, |
|
107 | ui->dragDropContainer->setMimeType(MIME_TYPE_SELECTION_ZONE, | |
107 | VisualizationDragDropContainer::DropBehavior::Forbidden); |
|
108 | VisualizationDragDropContainer::DropBehavior::Forbidden); | |
108 | ui->dragDropContainer->setAcceptMimeDataFunction([this](auto mimeData) { |
|
109 | ui->dragDropContainer->setAcceptMimeDataFunction([this](auto mimeData) { | |
109 | return sqpApp->dragDropGuiController().checkMimeDataForVisualization(mimeData, |
|
110 | return sqpApp->dragDropGuiController().checkMimeDataForVisualization(mimeData, | |
110 | ui->dragDropContainer); |
|
111 | ui->dragDropContainer); | |
111 | }); |
|
112 | }); | |
112 |
|
113 | |||
113 | auto acceptDragWidgetFun = [](auto dragWidget, auto mimeData) { |
|
114 | auto acceptDragWidgetFun = [](auto dragWidget, auto mimeData) { | |
114 | if (!mimeData) { |
|
115 | if (!mimeData) { | |
115 | return false; |
|
116 | return false; | |
116 | } |
|
117 | } | |
117 |
|
118 | |||
118 | if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) { |
|
119 | if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) { | |
119 | auto variables = sqpApp->variableController().variablesForMimeData( |
|
120 | auto variables = sqpApp->variableController().variablesForMimeData( | |
120 | mimeData->data(MIME_TYPE_VARIABLE_LIST)); |
|
121 | mimeData->data(MIME_TYPE_VARIABLE_LIST)); | |
121 |
|
122 | |||
122 | if (variables.count() != 1) { |
|
123 | if (variables.count() != 1) { | |
123 | return false; |
|
124 | return false; | |
124 | } |
|
125 | } | |
125 | auto variable = variables.first(); |
|
126 | auto variable = variables.first(); | |
126 |
|
127 | |||
127 | if (auto graphWidget = dynamic_cast<const VisualizationGraphWidget *>(dragWidget)) { |
|
128 | if (auto graphWidget = dynamic_cast<const VisualizationGraphWidget *>(dragWidget)) { | |
128 | return graphWidget->canDrop(*variable); |
|
129 | return graphWidget->canDrop(*variable); | |
129 | } |
|
130 | } | |
130 | } |
|
131 | } | |
131 |
|
132 | |||
132 | return true; |
|
133 | return true; | |
133 | }; |
|
134 | }; | |
134 | ui->dragDropContainer->setAcceptDragWidgetFunction(acceptDragWidgetFun); |
|
135 | ui->dragDropContainer->setAcceptDragWidgetFunction(acceptDragWidgetFun); | |
135 |
|
136 | |||
136 | connect(ui->dragDropContainer, &VisualizationDragDropContainer::dropOccuredInContainer, this, |
|
137 | connect(ui->dragDropContainer, &VisualizationDragDropContainer::dropOccuredInContainer, this, | |
137 | &VisualizationZoneWidget::dropMimeData); |
|
138 | &VisualizationZoneWidget::dropMimeData); | |
138 | connect(ui->dragDropContainer, &VisualizationDragDropContainer::dropOccuredOnWidget, this, |
|
139 | connect(ui->dragDropContainer, &VisualizationDragDropContainer::dropOccuredOnWidget, this, | |
139 | &VisualizationZoneWidget::dropMimeDataOnGraph); |
|
140 | &VisualizationZoneWidget::dropMimeDataOnGraph); | |
140 |
|
141 | |||
141 | // 'Close' options : widget is deleted when closed |
|
142 | // 'Close' options : widget is deleted when closed | |
142 | setAttribute(Qt::WA_DeleteOnClose); |
|
143 | setAttribute(Qt::WA_DeleteOnClose); | |
143 | connect(ui->closeButton, &QToolButton::clicked, this, &VisualizationZoneWidget::close); |
|
144 | connect(ui->closeButton, &QToolButton::clicked, this, &VisualizationZoneWidget::close); | |
144 | ui->closeButton->setIcon(sqpApp->style()->standardIcon(QStyle::SP_TitleBarCloseButton)); |
|
145 | ui->closeButton->setIcon(sqpApp->style()->standardIcon(QStyle::SP_TitleBarCloseButton)); | |
145 |
|
146 | |||
146 | // Synchronisation id |
|
147 | // Synchronisation id | |
147 | QMetaObject::invokeMethod(&sqpApp->variableController(), "onAddSynchronizationGroupId", |
|
148 | QMetaObject::invokeMethod(&sqpApp->variableController(), "onAddSynchronizationGroupId", | |
148 | Qt::QueuedConnection, Q_ARG(QUuid, impl->m_SynchronisationGroupId)); |
|
149 | Qt::QueuedConnection, Q_ARG(QUuid, impl->m_SynchronisationGroupId)); | |
149 | } |
|
150 | } | |
150 |
|
151 | |||
151 | VisualizationZoneWidget::~VisualizationZoneWidget() |
|
152 | VisualizationZoneWidget::~VisualizationZoneWidget() | |
152 | { |
|
153 | { | |
153 | delete ui; |
|
154 | delete ui; | |
154 | } |
|
155 | } | |
155 |
|
156 | |||
156 | void VisualizationZoneWidget::setZoneRange(const DateTimeRange &range) |
|
157 | void VisualizationZoneWidget::setZoneRange(const DateTimeRange &range) | |
157 | { |
|
158 | { | |
158 | if (auto graph = firstGraph()) { |
|
159 | if (auto graph = firstGraph()) { | |
159 | graph->setGraphRange(range); |
|
160 | graph->setGraphRange(range); | |
160 | } |
|
161 | } | |
161 | else { |
|
162 | else { | |
162 | qCWarning(LOG_VisualizationZoneWidget()) |
|
163 | qCWarning(LOG_VisualizationZoneWidget()) | |
163 | << tr("setZoneRange:Cannot set the range of an empty zone."); |
|
164 | << tr("setZoneRange:Cannot set the range of an empty zone."); | |
164 | } |
|
165 | } | |
165 | } |
|
166 | } | |
166 |
|
167 | |||
167 | void VisualizationZoneWidget::addGraph(VisualizationGraphWidget *graphWidget) |
|
168 | void VisualizationZoneWidget::addGraph(VisualizationGraphWidget *graphWidget) | |
168 | { |
|
169 | { | |
169 | // Synchronize new graph with others in the zone |
|
170 | // Synchronize new graph with others in the zone | |
170 | impl->m_Synchronizer->addGraph(*graphWidget); |
|
171 | impl->m_Synchronizer->addGraph(*graphWidget); | |
171 |
|
172 | |||
172 | ui->dragDropContainer->addDragWidget(graphWidget); |
|
173 | ui->dragDropContainer->addDragWidget(graphWidget); | |
173 | } |
|
174 | } | |
174 |
|
175 | |||
175 | void VisualizationZoneWidget::insertGraph(int index, VisualizationGraphWidget *graphWidget) |
|
176 | void VisualizationZoneWidget::insertGraph(int index, VisualizationGraphWidget *graphWidget) | |
176 | { |
|
177 | { | |
177 | // Synchronize new graph with others in the zone |
|
178 | // Synchronize new graph with others in the zone | |
178 | impl->m_Synchronizer->addGraph(*graphWidget); |
|
179 | impl->m_Synchronizer->addGraph(*graphWidget); | |
179 |
|
180 | |||
180 | ui->dragDropContainer->insertDragWidget(index, graphWidget); |
|
181 | ui->dragDropContainer->insertDragWidget(index, graphWidget); | |
181 | } |
|
182 | } | |
182 |
|
183 | |||
183 | VisualizationGraphWidget *VisualizationZoneWidget::createGraph(std::shared_ptr<Variable> variable) |
|
184 | VisualizationGraphWidget *VisualizationZoneWidget::createGraph(std::shared_ptr<Variable> variable) | |
184 | { |
|
185 | { | |
185 | return createGraph(variable, -1); |
|
186 | return createGraph(variable, -1); | |
186 | } |
|
187 | } | |
187 |
|
188 | |||
188 | VisualizationGraphWidget *VisualizationZoneWidget::createGraph(std::shared_ptr<Variable> variable, |
|
189 | VisualizationGraphWidget *VisualizationZoneWidget::createGraph(std::shared_ptr<Variable> variable, | |
189 | int index) |
|
190 | int index) | |
190 | { |
|
191 | { | |
191 | auto graphWidget |
|
192 | auto graphWidget | |
192 | = new VisualizationGraphWidget{defaultGraphName(*ui->dragDropContainer->layout()), this}; |
|
193 | = new VisualizationGraphWidget{defaultGraphName(*ui->dragDropContainer->layout()), this}; | |
193 |
|
194 | |||
194 |
|
195 | |||
195 | // Set graph properties |
|
196 | // Set graph properties | |
196 | graphWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); |
|
197 | graphWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); | |
197 | graphWidget->setMinimumHeight(GRAPH_MINIMUM_HEIGHT); |
|
198 | graphWidget->setMinimumHeight(GRAPH_MINIMUM_HEIGHT); | |
198 |
|
199 | |||
199 |
|
200 | |||
200 | // Lambda to synchronize zone widget |
|
201 | // Lambda to synchronize zone widget | |
201 | auto synchronizeZoneWidget = [this, graphWidget](const DateTimeRange &graphRange, |
|
202 | auto synchronizeZoneWidget = [this, graphWidget](const DateTimeRange &graphRange, | |
202 | const DateTimeRange &oldGraphRange) { |
|
203 | const DateTimeRange &oldGraphRange) { | |
203 |
|
204 | |||
204 | auto zoomType = VariableController::getZoomType(graphRange, oldGraphRange); |
|
205 | auto zoomType = VariableController::getZoomType(graphRange, oldGraphRange); | |
205 | auto frameLayout = ui->dragDropContainer->layout(); |
|
206 | auto frameLayout = ui->dragDropContainer->layout(); | |
206 | for (auto i = 0; i < frameLayout->count(); ++i) { |
|
207 | for (auto i = 0; i < frameLayout->count(); ++i) { | |
207 | auto graphChild |
|
208 | auto graphChild | |
208 | = dynamic_cast<VisualizationGraphWidget *>(frameLayout->itemAt(i)->widget()); |
|
209 | = dynamic_cast<VisualizationGraphWidget *>(frameLayout->itemAt(i)->widget()); | |
209 | if (graphChild && (graphChild != graphWidget)) { |
|
210 | if (graphChild && (graphChild != graphWidget)) { | |
210 |
|
211 | |||
211 | auto graphChildRange = graphChild->graphRange(); |
|
212 | auto graphChildRange = graphChild->graphRange(); | |
212 | switch (zoomType) { |
|
213 | switch (zoomType) { | |
213 | case AcquisitionZoomType::ZoomIn: { |
|
214 | case AcquisitionZoomType::ZoomIn: { | |
214 | auto deltaLeft = graphRange.m_TStart - oldGraphRange.m_TStart; |
|
215 | auto deltaLeft = graphRange.m_TStart - oldGraphRange.m_TStart; | |
215 | auto deltaRight = oldGraphRange.m_TEnd - graphRange.m_TEnd; |
|
216 | auto deltaRight = oldGraphRange.m_TEnd - graphRange.m_TEnd; | |
216 | graphChildRange.m_TStart += deltaLeft; |
|
217 | graphChildRange.m_TStart += deltaLeft; | |
217 | graphChildRange.m_TEnd -= deltaRight; |
|
218 | graphChildRange.m_TEnd -= deltaRight; | |
218 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: ZoomIn"); |
|
219 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: ZoomIn"); | |
219 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: deltaLeft") |
|
220 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: deltaLeft") | |
220 | << deltaLeft; |
|
221 | << deltaLeft; | |
221 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: deltaRight") |
|
222 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: deltaRight") | |
222 | << deltaRight; |
|
223 | << deltaRight; | |
223 | qCDebug(LOG_VisualizationZoneWidget()) |
|
224 | qCDebug(LOG_VisualizationZoneWidget()) | |
224 | << tr("TORM: dt") << graphRange.m_TEnd - graphRange.m_TStart; |
|
225 | << tr("TORM: dt") << graphRange.m_TEnd - graphRange.m_TStart; | |
225 |
|
226 | |||
226 | break; |
|
227 | break; | |
227 | } |
|
228 | } | |
228 |
|
229 | |||
229 | case AcquisitionZoomType::ZoomOut: { |
|
230 | case AcquisitionZoomType::ZoomOut: { | |
230 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: ZoomOut"); |
|
231 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: ZoomOut"); | |
231 | auto deltaLeft = oldGraphRange.m_TStart - graphRange.m_TStart; |
|
232 | auto deltaLeft = oldGraphRange.m_TStart - graphRange.m_TStart; | |
232 | auto deltaRight = graphRange.m_TEnd - oldGraphRange.m_TEnd; |
|
233 | auto deltaRight = graphRange.m_TEnd - oldGraphRange.m_TEnd; | |
233 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: deltaLeft") |
|
234 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: deltaLeft") | |
234 | << deltaLeft; |
|
235 | << deltaLeft; | |
235 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: deltaRight") |
|
236 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: deltaRight") | |
236 | << deltaRight; |
|
237 | << deltaRight; | |
237 | qCDebug(LOG_VisualizationZoneWidget()) |
|
238 | qCDebug(LOG_VisualizationZoneWidget()) | |
238 | << tr("TORM: dt") << graphRange.m_TEnd - graphRange.m_TStart; |
|
239 | << tr("TORM: dt") << graphRange.m_TEnd - graphRange.m_TStart; | |
239 | graphChildRange.m_TStart -= deltaLeft; |
|
240 | graphChildRange.m_TStart -= deltaLeft; | |
240 | graphChildRange.m_TEnd += deltaRight; |
|
241 | graphChildRange.m_TEnd += deltaRight; | |
241 | break; |
|
242 | break; | |
242 | } |
|
243 | } | |
243 | case AcquisitionZoomType::PanRight: { |
|
244 | case AcquisitionZoomType::PanRight: { | |
244 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: PanRight"); |
|
245 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: PanRight"); | |
245 | auto deltaLeft = graphRange.m_TStart - oldGraphRange.m_TStart; |
|
246 | auto deltaLeft = graphRange.m_TStart - oldGraphRange.m_TStart; | |
246 | auto deltaRight = graphRange.m_TEnd - oldGraphRange.m_TEnd; |
|
247 | auto deltaRight = graphRange.m_TEnd - oldGraphRange.m_TEnd; | |
247 | graphChildRange.m_TStart += deltaLeft; |
|
248 | graphChildRange.m_TStart += deltaLeft; | |
248 | graphChildRange.m_TEnd += deltaRight; |
|
249 | graphChildRange.m_TEnd += deltaRight; | |
249 | qCDebug(LOG_VisualizationZoneWidget()) |
|
250 | qCDebug(LOG_VisualizationZoneWidget()) | |
250 | << tr("TORM: dt") << graphRange.m_TEnd - graphRange.m_TStart; |
|
251 | << tr("TORM: dt") << graphRange.m_TEnd - graphRange.m_TStart; | |
251 | break; |
|
252 | break; | |
252 | } |
|
253 | } | |
253 | case AcquisitionZoomType::PanLeft: { |
|
254 | case AcquisitionZoomType::PanLeft: { | |
254 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: PanLeft"); |
|
255 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: PanLeft"); | |
255 | auto deltaLeft = oldGraphRange.m_TStart - graphRange.m_TStart; |
|
256 | auto deltaLeft = oldGraphRange.m_TStart - graphRange.m_TStart; | |
256 | auto deltaRight = oldGraphRange.m_TEnd - graphRange.m_TEnd; |
|
257 | auto deltaRight = oldGraphRange.m_TEnd - graphRange.m_TEnd; | |
257 | graphChildRange.m_TStart -= deltaLeft; |
|
258 | graphChildRange.m_TStart -= deltaLeft; | |
258 | graphChildRange.m_TEnd -= deltaRight; |
|
259 | graphChildRange.m_TEnd -= deltaRight; | |
259 | break; |
|
260 | break; | |
260 | } |
|
261 | } | |
261 | case AcquisitionZoomType::Unknown: { |
|
262 | case AcquisitionZoomType::Unknown: { | |
262 | qCDebug(LOG_VisualizationZoneWidget()) |
|
263 | qCDebug(LOG_VisualizationZoneWidget()) | |
263 | << tr("Impossible to synchronize: zoom type unknown"); |
|
264 | << tr("Impossible to synchronize: zoom type unknown"); | |
264 | break; |
|
265 | break; | |
265 | } |
|
266 | } | |
266 | default: |
|
267 | default: | |
267 | qCCritical(LOG_VisualizationZoneWidget()) |
|
268 | qCCritical(LOG_VisualizationZoneWidget()) | |
268 | << tr("Impossible to synchronize: zoom type not take into account"); |
|
269 | << tr("Impossible to synchronize: zoom type not take into account"); | |
269 | // No action |
|
270 | // No action | |
270 | break; |
|
271 | break; | |
271 | } |
|
272 | } | |
272 | graphChild->setFlags(GraphFlag::DisableAll); |
|
273 | graphChild->setFlags(GraphFlag::DisableAll); | |
273 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: Range before: ") |
|
274 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: Range before: ") | |
274 | << graphChild->graphRange(); |
|
275 | << graphChild->graphRange(); | |
275 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: Range after : ") |
|
276 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: Range after : ") | |
276 | << graphChildRange; |
|
277 | << graphChildRange; | |
277 | qCDebug(LOG_VisualizationZoneWidget()) |
|
278 | qCDebug(LOG_VisualizationZoneWidget()) | |
278 | << tr("TORM: child dt") << graphChildRange.m_TEnd - graphChildRange.m_TStart; |
|
279 | << tr("TORM: child dt") << graphChildRange.m_TEnd - graphChildRange.m_TStart; | |
279 | graphChild->setGraphRange(graphChildRange); |
|
280 | graphChild->setGraphRange(graphChildRange); | |
280 | graphChild->setFlags(GraphFlag::EnableAll); |
|
281 | graphChild->setFlags(GraphFlag::EnableAll); | |
281 | } |
|
282 | } | |
282 | } |
|
283 | } | |
283 | }; |
|
284 | }; | |
284 |
|
285 | |||
285 | // connection for synchronization |
|
286 | // connection for synchronization | |
286 | connect(graphWidget, &VisualizationGraphWidget::synchronize, synchronizeZoneWidget); |
|
287 | connect(graphWidget, &VisualizationGraphWidget::synchronize, synchronizeZoneWidget); | |
287 | connect(graphWidget, &VisualizationGraphWidget::variableAdded, this, |
|
288 | connect(graphWidget, &VisualizationGraphWidget::variableAdded, this, | |
288 | &VisualizationZoneWidget::onVariableAdded); |
|
289 | &VisualizationZoneWidget::onVariableAdded); | |
289 | connect(graphWidget, &VisualizationGraphWidget::variableAboutToBeRemoved, this, |
|
290 | connect(graphWidget, &VisualizationGraphWidget::variableAboutToBeRemoved, this, | |
290 | &VisualizationZoneWidget::onVariableAboutToBeRemoved); |
|
291 | &VisualizationZoneWidget::onVariableAboutToBeRemoved); | |
291 |
|
292 | |||
292 | auto range = DateTimeRange{}; |
|
293 | auto range = DateTimeRange{}; | |
293 | if (auto firstGraph = this->firstGraph()) { |
|
294 | if (auto firstGraph = this->firstGraph()) { | |
294 | // Case of a new graph in a existant zone |
|
295 | // Case of a new graph in a existant zone | |
295 | range = firstGraph->graphRange(); |
|
296 | range = firstGraph->graphRange(); | |
296 | } |
|
297 | } | |
297 | else { |
|
298 | else { | |
298 | // Case of a new graph as the first of the zone |
|
299 | // Case of a new graph as the first of the zone | |
299 | range = variable->range(); |
|
300 | range = variable->range(); | |
300 | } |
|
301 | } | |
301 |
|
302 | |||
302 | this->insertGraph(index, graphWidget); |
|
303 | this->insertGraph(index, graphWidget); | |
303 |
|
304 | |||
304 | graphWidget->addVariable(variable, range); |
|
305 | graphWidget->addVariable(variable, range); | |
305 | graphWidget->setYRange(variable); |
|
306 | graphWidget->setYRange(variable); | |
306 |
|
307 | |||
307 | return graphWidget; |
|
308 | return graphWidget; | |
308 | } |
|
309 | } | |
309 |
|
310 | |||
310 | VisualizationGraphWidget * |
|
311 | VisualizationGraphWidget * | |
311 | VisualizationZoneWidget::createGraph(const QList<std::shared_ptr<Variable> > variables, int index) |
|
312 | VisualizationZoneWidget::createGraph(const QList<std::shared_ptr<Variable> > variables, int index) | |
312 | { |
|
313 | { | |
313 | if (variables.isEmpty()) { |
|
314 | if (variables.isEmpty()) { | |
314 | return nullptr; |
|
315 | return nullptr; | |
315 | } |
|
316 | } | |
316 |
|
317 | |||
317 | auto graphWidget = createGraph(variables.first(), index); |
|
318 | auto graphWidget = createGraph(variables.first(), index); | |
318 | for (auto variableIt = variables.cbegin() + 1; variableIt != variables.cend(); ++variableIt) { |
|
319 | for (auto variableIt = variables.cbegin() + 1; variableIt != variables.cend(); ++variableIt) { | |
319 | graphWidget->addVariable(*variableIt, graphWidget->graphRange()); |
|
320 | graphWidget->addVariable(*variableIt, graphWidget->graphRange()); | |
320 | } |
|
321 | } | |
321 |
|
322 | |||
322 | return graphWidget; |
|
323 | return graphWidget; | |
323 | } |
|
324 | } | |
324 |
|
325 | |||
325 | VisualizationGraphWidget *VisualizationZoneWidget::firstGraph() const |
|
326 | VisualizationGraphWidget *VisualizationZoneWidget::firstGraph() const | |
326 | { |
|
327 | { | |
327 | VisualizationGraphWidget *firstGraph = nullptr; |
|
328 | VisualizationGraphWidget *firstGraph = nullptr; | |
328 | auto layout = ui->dragDropContainer->layout(); |
|
329 | auto layout = ui->dragDropContainer->layout(); | |
329 | if (layout->count() > 0) { |
|
330 | if (layout->count() > 0) { | |
330 | if (auto visualizationGraphWidget |
|
331 | if (auto visualizationGraphWidget | |
331 | = qobject_cast<VisualizationGraphWidget *>(layout->itemAt(0)->widget())) { |
|
332 | = qobject_cast<VisualizationGraphWidget *>(layout->itemAt(0)->widget())) { | |
332 | firstGraph = visualizationGraphWidget; |
|
333 | firstGraph = visualizationGraphWidget; | |
333 | } |
|
334 | } | |
334 | } |
|
335 | } | |
335 |
|
336 | |||
336 | return firstGraph; |
|
337 | return firstGraph; | |
337 | } |
|
338 | } | |
338 |
|
339 | |||
339 | void VisualizationZoneWidget::closeAllGraphs() |
|
340 | void VisualizationZoneWidget::closeAllGraphs() | |
340 | { |
|
341 | { | |
341 | processGraphs(*ui->dragDropContainer->layout(), |
|
342 | processGraphs(*ui->dragDropContainer->layout(), | |
342 | [](VisualizationGraphWidget &graphWidget) { graphWidget.close(); }); |
|
343 | [](VisualizationGraphWidget &graphWidget) { graphWidget.close(); }); | |
343 | } |
|
344 | } | |
344 |
|
345 | |||
345 | void VisualizationZoneWidget::accept(IVisualizationWidgetVisitor *visitor) |
|
346 | void VisualizationZoneWidget::accept(IVisualizationWidgetVisitor *visitor) | |
346 | { |
|
347 | { | |
347 | if (visitor) { |
|
348 | if (visitor) { | |
348 | visitor->visitEnter(this); |
|
349 | visitor->visitEnter(this); | |
349 |
|
350 | |||
350 | // Apply visitor to graph children: widgets different from graphs are not visited (no |
|
351 | // Apply visitor to graph children: widgets different from graphs are not visited (no | |
351 | // action) |
|
352 | // action) | |
352 | processGraphs( |
|
353 | processGraphs( | |
353 | *ui->dragDropContainer->layout(), |
|
354 | *ui->dragDropContainer->layout(), | |
354 | [visitor](VisualizationGraphWidget &graphWidget) { graphWidget.accept(visitor); }); |
|
355 | [visitor](VisualizationGraphWidget &graphWidget) { graphWidget.accept(visitor); }); | |
355 |
|
356 | |||
356 | visitor->visitLeave(this); |
|
357 | visitor->visitLeave(this); | |
357 | } |
|
358 | } | |
358 | else { |
|
359 | else { | |
359 | qCCritical(LOG_VisualizationZoneWidget()) << tr("Can't visit widget : the visitor is null"); |
|
360 | qCCritical(LOG_VisualizationZoneWidget()) << tr("Can't visit widget : the visitor is null"); | |
360 | } |
|
361 | } | |
361 | } |
|
362 | } | |
362 |
|
363 | |||
363 | bool VisualizationZoneWidget::canDrop(const Variable &variable) const |
|
364 | bool VisualizationZoneWidget::canDrop(const Variable &variable) const | |
364 | { |
|
365 | { | |
365 | // A tab can always accomodate a variable |
|
366 | // A tab can always accomodate a variable | |
366 | Q_UNUSED(variable); |
|
367 | Q_UNUSED(variable); | |
367 | return true; |
|
368 | return true; | |
368 | } |
|
369 | } | |
369 |
|
370 | |||
370 | bool VisualizationZoneWidget::contains(const Variable &variable) const |
|
371 | bool VisualizationZoneWidget::contains(const Variable &variable) const | |
371 | { |
|
372 | { | |
372 | Q_UNUSED(variable); |
|
373 | Q_UNUSED(variable); | |
373 | return false; |
|
374 | return false; | |
374 | } |
|
375 | } | |
375 |
|
376 | |||
376 | QString VisualizationZoneWidget::name() const |
|
377 | QString VisualizationZoneWidget::name() const | |
377 | { |
|
378 | { | |
378 | return ui->zoneNameLabel->text(); |
|
379 | return ui->zoneNameLabel->text(); | |
379 | } |
|
380 | } | |
380 |
|
381 | |||
381 | QMimeData *VisualizationZoneWidget::mimeData(const QPoint &position) const |
|
382 | QMimeData *VisualizationZoneWidget::mimeData(const QPoint &position) const | |
382 | { |
|
383 | { | |
383 | Q_UNUSED(position); |
|
384 | Q_UNUSED(position); | |
384 |
|
385 | |||
385 | auto mimeData = new QMimeData; |
|
386 | auto mimeData = new QMimeData; | |
386 | mimeData->setData(MIME_TYPE_ZONE, QByteArray{}); |
|
387 | mimeData->setData(MIME_TYPE_ZONE, QByteArray{}); | |
387 |
|
388 | |||
388 | if (auto firstGraph = this->firstGraph()) { |
|
389 | if (auto firstGraph = this->firstGraph()) { | |
389 | auto timeRangeData = TimeController::mimeDataForTimeRange(firstGraph->graphRange()); |
|
390 | auto timeRangeData = TimeController::mimeDataForTimeRange(firstGraph->graphRange()); | |
390 | mimeData->setData(MIME_TYPE_TIME_RANGE, timeRangeData); |
|
391 | mimeData->setData(MIME_TYPE_TIME_RANGE, timeRangeData); | |
391 | } |
|
392 | } | |
392 |
|
393 | |||
393 | return mimeData; |
|
394 | return mimeData; | |
394 | } |
|
395 | } | |
395 |
|
396 | |||
396 | bool VisualizationZoneWidget::isDragAllowed() const |
|
397 | bool VisualizationZoneWidget::isDragAllowed() const | |
397 | { |
|
398 | { | |
398 | return true; |
|
399 | return true; | |
399 | } |
|
400 | } | |
400 |
|
401 | |||
401 | void VisualizationZoneWidget::notifyMouseMoveInGraph(const QPointF &graphPosition, |
|
402 | void VisualizationZoneWidget::notifyMouseMoveInGraph(const QPointF &graphPosition, | |
402 | const QPointF &plotPosition, |
|
403 | const QPointF &plotPosition, | |
403 | VisualizationGraphWidget *graphWidget) |
|
404 | VisualizationGraphWidget *graphWidget) | |
404 | { |
|
405 | { | |
405 | processGraphs(*ui->dragDropContainer->layout(), [&graphPosition, &plotPosition, &graphWidget]( |
|
406 | processGraphs(*ui->dragDropContainer->layout(), [&graphPosition, &plotPosition, &graphWidget]( | |
406 | VisualizationGraphWidget &processedGraph) { |
|
407 | VisualizationGraphWidget &processedGraph) { | |
407 |
|
408 | |||
408 | switch (sqpApp->plotsCursorMode()) { |
|
409 | switch (sqpApp->plotsCursorMode()) { | |
409 | case SqpApplication::PlotsCursorMode::Vertical: |
|
410 | case SqpApplication::PlotsCursorMode::Vertical: | |
410 | processedGraph.removeHorizontalCursor(); |
|
411 | processedGraph.removeHorizontalCursor(); | |
411 | processedGraph.addVerticalCursorAtViewportPosition(graphPosition.x()); |
|
412 | processedGraph.addVerticalCursorAtViewportPosition(graphPosition.x()); | |
412 | break; |
|
413 | break; | |
413 | case SqpApplication::PlotsCursorMode::Temporal: |
|
414 | case SqpApplication::PlotsCursorMode::Temporal: | |
414 | processedGraph.addVerticalCursor(plotPosition.x()); |
|
415 | processedGraph.addVerticalCursor(plotPosition.x()); | |
415 | processedGraph.removeHorizontalCursor(); |
|
416 | processedGraph.removeHorizontalCursor(); | |
416 | break; |
|
417 | break; | |
417 | case SqpApplication::PlotsCursorMode::Horizontal: |
|
418 | case SqpApplication::PlotsCursorMode::Horizontal: | |
418 | processedGraph.removeVerticalCursor(); |
|
419 | processedGraph.removeVerticalCursor(); | |
419 | if (&processedGraph == graphWidget) { |
|
420 | if (&processedGraph == graphWidget) { | |
420 | processedGraph.addHorizontalCursorAtViewportPosition(graphPosition.y()); |
|
421 | processedGraph.addHorizontalCursorAtViewportPosition(graphPosition.y()); | |
421 | } |
|
422 | } | |
422 | else { |
|
423 | else { | |
423 | processedGraph.removeHorizontalCursor(); |
|
424 | processedGraph.removeHorizontalCursor(); | |
424 | } |
|
425 | } | |
425 | break; |
|
426 | break; | |
426 | case SqpApplication::PlotsCursorMode::Cross: |
|
427 | case SqpApplication::PlotsCursorMode::Cross: | |
427 | if (&processedGraph == graphWidget) { |
|
428 | if (&processedGraph == graphWidget) { | |
428 | processedGraph.addVerticalCursorAtViewportPosition(graphPosition.x()); |
|
429 | processedGraph.addVerticalCursorAtViewportPosition(graphPosition.x()); | |
429 | processedGraph.addHorizontalCursorAtViewportPosition(graphPosition.y()); |
|
430 | processedGraph.addHorizontalCursorAtViewportPosition(graphPosition.y()); | |
430 | } |
|
431 | } | |
431 | else { |
|
432 | else { | |
432 | processedGraph.removeHorizontalCursor(); |
|
433 | processedGraph.removeHorizontalCursor(); | |
433 | processedGraph.removeVerticalCursor(); |
|
434 | processedGraph.removeVerticalCursor(); | |
434 | } |
|
435 | } | |
435 | break; |
|
436 | break; | |
436 | case SqpApplication::PlotsCursorMode::NoCursor: |
|
437 | case SqpApplication::PlotsCursorMode::NoCursor: | |
437 | processedGraph.removeHorizontalCursor(); |
|
438 | processedGraph.removeHorizontalCursor(); | |
438 | processedGraph.removeVerticalCursor(); |
|
439 | processedGraph.removeVerticalCursor(); | |
439 | break; |
|
440 | break; | |
440 | } |
|
441 | } | |
441 |
|
442 | |||
442 |
|
443 | |||
443 | }); |
|
444 | }); | |
444 | } |
|
445 | } | |
445 |
|
446 | |||
446 | void VisualizationZoneWidget::notifyMouseLeaveGraph(VisualizationGraphWidget *graphWidget) |
|
447 | void VisualizationZoneWidget::notifyMouseLeaveGraph(VisualizationGraphWidget *graphWidget) | |
447 | { |
|
448 | { | |
448 | processGraphs(*ui->dragDropContainer->layout(), [](VisualizationGraphWidget &processedGraph) { |
|
449 | processGraphs(*ui->dragDropContainer->layout(), [](VisualizationGraphWidget &processedGraph) { | |
449 | processedGraph.removeHorizontalCursor(); |
|
450 | processedGraph.removeHorizontalCursor(); | |
450 | processedGraph.removeVerticalCursor(); |
|
451 | processedGraph.removeVerticalCursor(); | |
451 | }); |
|
452 | }); | |
452 | } |
|
453 | } | |
453 |
|
454 | |||
454 | void VisualizationZoneWidget::closeEvent(QCloseEvent *event) |
|
455 | void VisualizationZoneWidget::closeEvent(QCloseEvent *event) | |
455 | { |
|
456 | { | |
456 | // Closes graphs in the zone |
|
457 | // Closes graphs in the zone | |
457 | processGraphs(*ui->dragDropContainer->layout(), |
|
458 | processGraphs(*ui->dragDropContainer->layout(), | |
458 | [](VisualizationGraphWidget &graphWidget) { graphWidget.close(); }); |
|
459 | [](VisualizationGraphWidget &graphWidget) { graphWidget.close(); }); | |
459 |
|
460 | |||
460 | // Delete synchronization group from variable controller |
|
461 | // Delete synchronization group from variable controller | |
461 | QMetaObject::invokeMethod(&sqpApp->variableController(), "onRemoveSynchronizationGroupId", |
|
462 | QMetaObject::invokeMethod(&sqpApp->variableController(), "onRemoveSynchronizationGroupId", | |
462 | Qt::QueuedConnection, Q_ARG(QUuid, impl->m_SynchronisationGroupId)); |
|
463 | Qt::QueuedConnection, Q_ARG(QUuid, impl->m_SynchronisationGroupId)); | |
463 |
|
464 | |||
464 | QWidget::closeEvent(event); |
|
465 | QWidget::closeEvent(event); | |
465 | } |
|
466 | } | |
466 |
|
467 | |||
467 | void VisualizationZoneWidget::onVariableAdded(std::shared_ptr<Variable> variable) |
|
468 | void VisualizationZoneWidget::onVariableAdded(std::shared_ptr<Variable> variable) | |
468 | { |
|
469 | { | |
469 | QMetaObject::invokeMethod(&sqpApp->variableController(), "onAddSynchronized", |
|
470 | QMetaObject::invokeMethod(&sqpApp->variableController(), "onAddSynchronized", | |
470 | Qt::QueuedConnection, Q_ARG(std::shared_ptr<Variable>, variable), |
|
471 | Qt::QueuedConnection, Q_ARG(std::shared_ptr<Variable>, variable), | |
471 | Q_ARG(QUuid, impl->m_SynchronisationGroupId)); |
|
472 | Q_ARG(QUuid, impl->m_SynchronisationGroupId)); | |
472 | } |
|
473 | } | |
473 |
|
474 | |||
474 | void VisualizationZoneWidget::onVariableAboutToBeRemoved(std::shared_ptr<Variable> variable) |
|
475 | void VisualizationZoneWidget::onVariableAboutToBeRemoved(std::shared_ptr<Variable> variable) | |
475 | { |
|
476 | { | |
476 | QMetaObject::invokeMethod(&sqpApp->variableController(), "desynchronize", Qt::QueuedConnection, |
|
477 | QMetaObject::invokeMethod(&sqpApp->variableController(), "desynchronize", Qt::QueuedConnection, | |
477 | Q_ARG(std::shared_ptr<Variable>, variable), |
|
478 | Q_ARG(std::shared_ptr<Variable>, variable), | |
478 | Q_ARG(QUuid, impl->m_SynchronisationGroupId)); |
|
479 | Q_ARG(QUuid, impl->m_SynchronisationGroupId)); | |
479 | } |
|
480 | } | |
480 |
|
481 | |||
481 | void VisualizationZoneWidget::dropMimeData(int index, const QMimeData *mimeData) |
|
482 | void VisualizationZoneWidget::dropMimeData(int index, const QMimeData *mimeData) | |
482 | { |
|
483 | { | |
483 | if (mimeData->hasFormat(MIME_TYPE_GRAPH)) { |
|
484 | if (mimeData->hasFormat(MIME_TYPE_GRAPH)) { | |
484 | impl->dropGraph(index, this); |
|
485 | impl->dropGraph(index, this); | |
485 | } |
|
486 | } | |
486 | else if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) { |
|
487 | else if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) { | |
487 | auto variables = sqpApp->variableController().variablesForMimeData( |
|
488 | auto variables = sqpApp->variableController().variablesForMimeData( | |
488 | mimeData->data(MIME_TYPE_VARIABLE_LIST)); |
|
489 | mimeData->data(MIME_TYPE_VARIABLE_LIST)); | |
489 | impl->dropVariables(variables, index, this); |
|
490 | impl->dropVariables(variables, index, this); | |
490 | } |
|
491 | } | |
491 | else if (mimeData->hasFormat(MIME_TYPE_PRODUCT_LIST)) { |
|
492 | else if (mimeData->hasFormat(MIME_TYPE_PRODUCT_LIST)) { | |
492 | auto products = sqpApp->dataSourceController().productsDataForMimeData( |
|
493 | auto products = sqpApp->dataSourceController().productsDataForMimeData( | |
493 | mimeData->data(MIME_TYPE_PRODUCT_LIST)); |
|
494 | mimeData->data(MIME_TYPE_PRODUCT_LIST)); | |
494 | impl->dropProducts(products, index, this); |
|
495 | impl->dropProducts(products, index, this); | |
495 | } |
|
496 | } | |
496 | else { |
|
497 | else { | |
497 | qCWarning(LOG_VisualizationZoneWidget()) |
|
498 | qCWarning(LOG_VisualizationZoneWidget()) | |
498 | << tr("VisualizationZoneWidget::dropMimeData, unknown MIME data received."); |
|
499 | << tr("VisualizationZoneWidget::dropMimeData, unknown MIME data received."); | |
499 | } |
|
500 | } | |
500 | } |
|
501 | } | |
501 |
|
502 | |||
502 | void VisualizationZoneWidget::dropMimeDataOnGraph(VisualizationDragWidget *dragWidget, |
|
503 | void VisualizationZoneWidget::dropMimeDataOnGraph(VisualizationDragWidget *dragWidget, | |
503 | const QMimeData *mimeData) |
|
504 | const QMimeData *mimeData) | |
504 | { |
|
505 | { | |
505 | auto graphWidget = qobject_cast<VisualizationGraphWidget *>(dragWidget); |
|
506 | auto graphWidget = qobject_cast<VisualizationGraphWidget *>(dragWidget); | |
506 | if (!graphWidget) { |
|
507 | if (!graphWidget) { | |
507 | qCWarning(LOG_VisualizationZoneWidget()) |
|
508 | qCWarning(LOG_VisualizationZoneWidget()) | |
508 | << tr("VisualizationZoneWidget::dropMimeDataOnGraph, dropping in an unknown widget, " |
|
509 | << tr("VisualizationZoneWidget::dropMimeDataOnGraph, dropping in an unknown widget, " | |
509 | "drop aborted"); |
|
510 | "drop aborted"); | |
510 | Q_ASSERT(false); |
|
511 | Q_ASSERT(false); | |
511 | return; |
|
512 | return; | |
512 | } |
|
513 | } | |
513 |
|
514 | |||
514 | if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) { |
|
515 | if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) { | |
515 | auto variables = sqpApp->variableController().variablesForMimeData( |
|
516 | auto variables = sqpApp->variableController().variablesForMimeData( | |
516 | mimeData->data(MIME_TYPE_VARIABLE_LIST)); |
|
517 | mimeData->data(MIME_TYPE_VARIABLE_LIST)); | |
517 | for (const auto &var : variables) { |
|
518 | for (const auto &var : variables) { | |
518 | graphWidget->addVariable(var, graphWidget->graphRange()); |
|
519 | graphWidget->addVariable(var, graphWidget->graphRange()); | |
519 | } |
|
520 | } | |
520 | } |
|
521 | } | |
521 | else if (mimeData->hasFormat(MIME_TYPE_PRODUCT_LIST)) { |
|
522 | else if (mimeData->hasFormat(MIME_TYPE_PRODUCT_LIST)) { | |
522 | auto products = sqpApp->dataSourceController().productsDataForMimeData( |
|
523 | auto products = sqpApp->dataSourceController().productsDataForMimeData( | |
523 | mimeData->data(MIME_TYPE_PRODUCT_LIST)); |
|
524 | mimeData->data(MIME_TYPE_PRODUCT_LIST)); | |
524 |
|
525 | |||
525 | auto context = new QObject{this}; |
|
526 | auto context = new QObject{this}; | |
526 | connect(&sqpApp->variableController(), &VariableController::variableAdded, context, |
|
527 | connect(&sqpApp->variableController(), &VariableController::variableAdded, context, | |
527 | [this, graphWidget, context](auto variable) { |
|
528 | [this, graphWidget, context](auto variable) { | |
528 | graphWidget->addVariable(variable, graphWidget->graphRange()); |
|
529 | graphWidget->addVariable(variable, graphWidget->graphRange()); | |
529 | delete context; // removes the connection |
|
530 | delete context; // removes the connection | |
530 | }, |
|
531 | }, | |
531 | Qt::QueuedConnection); |
|
532 | Qt::QueuedConnection); | |
532 |
|
533 | |||
533 | auto productData = products.first().toHash(); |
|
534 | auto productData = products.first().toHash(); | |
534 | QMetaObject::invokeMethod(&sqpApp->dataSourceController(), "requestVariable", |
|
535 | QMetaObject::invokeMethod(&sqpApp->dataSourceController(), "requestVariable", | |
535 | Qt::QueuedConnection, Q_ARG(QVariantHash, productData)); |
|
536 | Qt::QueuedConnection, Q_ARG(QVariantHash, productData)); | |
536 | } |
|
537 | } | |
537 | else if (mimeData->hasFormat(MIME_TYPE_TIME_RANGE)) { |
|
538 | else if (mimeData->hasFormat(MIME_TYPE_TIME_RANGE)) { | |
538 | auto range = TimeController::timeRangeForMimeData(mimeData->data(MIME_TYPE_TIME_RANGE)); |
|
539 | auto range = TimeController::timeRangeForMimeData(mimeData->data(MIME_TYPE_TIME_RANGE)); | |
539 | graphWidget->setGraphRange(range); |
|
540 | graphWidget->setGraphRange(range); | |
540 | } |
|
541 | } | |
541 | else { |
|
542 | else { | |
542 | qCWarning(LOG_VisualizationZoneWidget()) |
|
543 | qCWarning(LOG_VisualizationZoneWidget()) | |
543 | << tr("VisualizationZoneWidget::dropMimeDataOnGraph, unknown MIME data received."); |
|
544 | << tr("VisualizationZoneWidget::dropMimeDataOnGraph, unknown MIME data received."); | |
544 | } |
|
545 | } | |
545 | } |
|
546 | } | |
546 |
|
547 | |||
547 | void VisualizationZoneWidget::VisualizationZoneWidgetPrivate::dropGraph( |
|
548 | void VisualizationZoneWidget::VisualizationZoneWidgetPrivate::dropGraph( | |
548 | int index, VisualizationZoneWidget *zoneWidget) |
|
549 | int index, VisualizationZoneWidget *zoneWidget) | |
549 | { |
|
550 | { | |
550 | auto &helper = sqpApp->dragDropGuiController(); |
|
551 | auto &helper = sqpApp->dragDropGuiController(); | |
551 |
|
552 | |||
552 | auto graphWidget = qobject_cast<VisualizationGraphWidget *>(helper.getCurrentDragWidget()); |
|
553 | auto graphWidget = qobject_cast<VisualizationGraphWidget *>(helper.getCurrentDragWidget()); | |
553 | if (!graphWidget) { |
|
554 | if (!graphWidget) { | |
554 | qCWarning(LOG_VisualizationZoneWidget()) |
|
555 | qCWarning(LOG_VisualizationZoneWidget()) | |
555 | << tr("VisualizationZoneWidget::dropGraph, drop aborted, the dropped graph is not " |
|
556 | << tr("VisualizationZoneWidget::dropGraph, drop aborted, the dropped graph is not " | |
556 | "found or invalid."); |
|
557 | "found or invalid."); | |
557 | Q_ASSERT(false); |
|
558 | Q_ASSERT(false); | |
558 | return; |
|
559 | return; | |
559 | } |
|
560 | } | |
560 |
|
561 | |||
561 | auto parentDragDropContainer |
|
562 | auto parentDragDropContainer | |
562 | = qobject_cast<VisualizationDragDropContainer *>(graphWidget->parentWidget()); |
|
563 | = qobject_cast<VisualizationDragDropContainer *>(graphWidget->parentWidget()); | |
563 | if (!parentDragDropContainer) { |
|
564 | if (!parentDragDropContainer) { | |
564 | qCWarning(LOG_VisualizationZoneWidget()) |
|
565 | qCWarning(LOG_VisualizationZoneWidget()) | |
565 | << tr("VisualizationZoneWidget::dropGraph, drop aborted, the parent container of " |
|
566 | << tr("VisualizationZoneWidget::dropGraph, drop aborted, the parent container of " | |
566 | "the dropped graph is not found."); |
|
567 | "the dropped graph is not found."); | |
567 | Q_ASSERT(false); |
|
568 | Q_ASSERT(false); | |
568 | return; |
|
569 | return; | |
569 | } |
|
570 | } | |
570 |
|
571 | |||
571 | const auto &variables = graphWidget->variables(); |
|
572 | const auto &variables = graphWidget->variables(); | |
572 |
|
573 | |||
573 | if (parentDragDropContainer != zoneWidget->ui->dragDropContainer && !variables.isEmpty()) { |
|
574 | if (parentDragDropContainer != zoneWidget->ui->dragDropContainer && !variables.isEmpty()) { | |
574 | // The drop didn't occur in the same zone |
|
575 | // The drop didn't occur in the same zone | |
575 |
|
576 | |||
576 | // Abort the requests for the variables (if any) |
|
577 | // Abort the requests for the variables (if any) | |
577 | // Commented, because it's not sure if it's needed or not |
|
578 | // Commented, because it's not sure if it's needed or not | |
578 | // for (const auto& var : variables) |
|
579 | // for (const auto& var : variables) | |
579 | //{ |
|
580 | //{ | |
580 | // sqpApp->variableController().onAbortProgressRequested(var); |
|
581 | // sqpApp->variableController().onAbortProgressRequested(var); | |
581 | //} |
|
582 | //} | |
582 |
|
583 | |||
583 | auto previousParentZoneWidget = graphWidget->parentZoneWidget(); |
|
584 | auto previousParentZoneWidget = graphWidget->parentZoneWidget(); | |
584 | auto nbGraph = parentDragDropContainer->countDragWidget(); |
|
585 | auto nbGraph = parentDragDropContainer->countDragWidget(); | |
585 | if (nbGraph == 1) { |
|
586 | if (nbGraph == 1) { | |
586 | // This is the only graph in the previous zone, close the zone |
|
587 | // This is the only graph in the previous zone, close the zone | |
587 | helper.delayedCloseWidget(previousParentZoneWidget); |
|
588 | helper.delayedCloseWidget(previousParentZoneWidget); | |
588 | } |
|
589 | } | |
589 | else { |
|
590 | else { | |
590 | // Close the graph |
|
591 | // Close the graph | |
591 | helper.delayedCloseWidget(graphWidget); |
|
592 | helper.delayedCloseWidget(graphWidget); | |
592 | } |
|
593 | } | |
593 |
|
594 | |||
594 | // Creates the new graph in the zone |
|
595 | // Creates the new graph in the zone | |
595 | auto newGraphWidget = zoneWidget->createGraph(variables, index); |
|
596 | auto newGraphWidget = zoneWidget->createGraph(variables, index); | |
596 | newGraphWidget->addSelectionZones(graphWidget->selectionZoneRanges()); |
|
597 | newGraphWidget->addSelectionZones(graphWidget->selectionZoneRanges()); | |
597 | } |
|
598 | } | |
598 | else { |
|
599 | else { | |
599 | // The drop occurred in the same zone or the graph is empty |
|
600 | // The drop occurred in the same zone or the graph is empty | |
600 | // Simple move of the graph, no variable operation associated |
|
601 | // Simple move of the graph, no variable operation associated | |
601 | parentDragDropContainer->layout()->removeWidget(graphWidget); |
|
602 | parentDragDropContainer->layout()->removeWidget(graphWidget); | |
602 |
|
603 | |||
603 | if (variables.isEmpty() && parentDragDropContainer != zoneWidget->ui->dragDropContainer) { |
|
604 | if (variables.isEmpty() && parentDragDropContainer != zoneWidget->ui->dragDropContainer) { | |
604 | // The graph is empty and dropped in a different zone. |
|
605 | // The graph is empty and dropped in a different zone. | |
605 | // Take the range of the first graph in the zone (if existing). |
|
606 | // Take the range of the first graph in the zone (if existing). | |
606 | auto layout = zoneWidget->ui->dragDropContainer->layout(); |
|
607 | auto layout = zoneWidget->ui->dragDropContainer->layout(); | |
607 | if (layout->count() > 0) { |
|
608 | if (layout->count() > 0) { | |
608 | if (auto visualizationGraphWidget |
|
609 | if (auto visualizationGraphWidget | |
609 | = qobject_cast<VisualizationGraphWidget *>(layout->itemAt(0)->widget())) { |
|
610 | = qobject_cast<VisualizationGraphWidget *>(layout->itemAt(0)->widget())) { | |
610 | graphWidget->setGraphRange(visualizationGraphWidget->graphRange()); |
|
611 | graphWidget->setGraphRange(visualizationGraphWidget->graphRange()); | |
611 | } |
|
612 | } | |
612 | } |
|
613 | } | |
613 | } |
|
614 | } | |
614 |
|
615 | |||
615 | zoneWidget->ui->dragDropContainer->insertDragWidget(index, graphWidget); |
|
616 | zoneWidget->ui->dragDropContainer->insertDragWidget(index, graphWidget); | |
616 | } |
|
617 | } | |
617 | } |
|
618 | } | |
618 |
|
619 | |||
619 | void VisualizationZoneWidget::VisualizationZoneWidgetPrivate::dropVariables( |
|
620 | void VisualizationZoneWidget::VisualizationZoneWidgetPrivate::dropVariables( | |
620 | const QList<std::shared_ptr<Variable> > &variables, int index, |
|
621 | const QList<std::shared_ptr<Variable> > &variables, int index, | |
621 | VisualizationZoneWidget *zoneWidget) |
|
622 | VisualizationZoneWidget *zoneWidget) | |
622 | { |
|
623 | { | |
623 | // Note: the AcceptMimeDataFunction (set on the drop container) ensure there is a single and |
|
624 | // Note: the AcceptMimeDataFunction (set on the drop container) ensure there is a single and | |
624 | // compatible variable here |
|
625 | // compatible variable here | |
625 | if (variables.count() > 1) { |
|
626 | if (variables.count() > 1) { | |
626 | qCWarning(LOG_VisualizationZoneWidget()) |
|
627 | qCWarning(LOG_VisualizationZoneWidget()) | |
627 | << tr("VisualizationZoneWidget::dropVariables, dropping multiple variables, operation " |
|
628 | << tr("VisualizationZoneWidget::dropVariables, dropping multiple variables, operation " | |
628 | "aborted."); |
|
629 | "aborted."); | |
629 | return; |
|
630 | return; | |
630 | } |
|
631 | } | |
631 |
|
632 | |||
632 | zoneWidget->createGraph(variables, index); |
|
633 | zoneWidget->createGraph(variables, index); | |
633 | } |
|
634 | } | |
634 |
|
635 | |||
635 | void VisualizationZoneWidget::VisualizationZoneWidgetPrivate::dropProducts( |
|
636 | void VisualizationZoneWidget::VisualizationZoneWidgetPrivate::dropProducts( | |
636 | const QVariantList &productsData, int index, VisualizationZoneWidget *zoneWidget) |
|
637 | const QVariantList &productsData, int index, VisualizationZoneWidget *zoneWidget) | |
637 | { |
|
638 | { | |
638 | // Note: the AcceptMimeDataFunction (set on the drop container) ensure there is a single and |
|
639 | // Note: the AcceptMimeDataFunction (set on the drop container) ensure there is a single and | |
639 | // compatible variable here |
|
640 | // compatible variable here | |
640 | if (productsData.count() != 1) { |
|
641 | if (productsData.count() != 1) { | |
641 | qCWarning(LOG_VisualizationZoneWidget()) |
|
642 | qCWarning(LOG_VisualizationZoneWidget()) | |
642 | << tr("VisualizationTabWidget::dropProducts, dropping multiple products, operation " |
|
643 | << tr("VisualizationTabWidget::dropProducts, dropping multiple products, operation " | |
643 | "aborted."); |
|
644 | "aborted."); | |
644 | return; |
|
645 | return; | |
645 | } |
|
646 | } | |
646 |
|
647 | |||
647 | auto context = new QObject{zoneWidget}; |
|
648 | auto context = new QObject{zoneWidget}; | |
648 | connect(&sqpApp->variableController(), &VariableController::variableAdded, context, |
|
649 | connect(&sqpApp->variableController(), &VariableController::variableAdded, context, | |
649 | [this, index, zoneWidget, context](auto variable) { |
|
650 | [this, index, zoneWidget, context](auto variable) { | |
650 | zoneWidget->createGraph(variable, index); |
|
651 | zoneWidget->createGraph(variable, index); | |
651 | delete context; // removes the connection |
|
652 | delete context; // removes the connection | |
652 | }, |
|
653 | }, | |
653 | Qt::QueuedConnection); |
|
654 | Qt::QueuedConnection); | |
654 |
|
655 | |||
655 | auto productData = productsData.first().toHash(); |
|
656 | auto productData = productsData.first().toHash(); | |
656 | QMetaObject::invokeMethod(&sqpApp->dataSourceController(), "requestVariable", |
|
657 | QMetaObject::invokeMethod(&sqpApp->dataSourceController(), "requestVariable", | |
657 | Qt::QueuedConnection, Q_ARG(QVariantHash, productData)); |
|
658 | Qt::QueuedConnection, Q_ARG(QVariantHash, productData)); | |
658 | } |
|
659 | } |
@@ -1,128 +1,128 | |||||
1 | #ifndef SCIQLOP_FUZZINGDEFS_H |
|
1 | #ifndef SCIQLOP_FUZZINGDEFS_H | |
2 | #define SCIQLOP_FUZZINGDEFS_H |
|
2 | #define SCIQLOP_FUZZINGDEFS_H | |
3 |
|
3 | |||
4 |
#include <Data/ |
|
4 | #include <Data/DateTimeRange.h> | |
5 |
|
5 | |||
6 | #include <QString> |
|
6 | #include <QString> | |
7 | #include <QUuid> |
|
7 | #include <QUuid> | |
8 | #include <QVariantHash> |
|
8 | #include <QVariantHash> | |
9 |
|
9 | |||
10 | #include <memory> |
|
10 | #include <memory> | |
11 | #include <set> |
|
11 | #include <set> | |
12 |
|
12 | |||
13 | // /////// // |
|
13 | // /////// // | |
14 | // Aliases // |
|
14 | // Aliases // | |
15 | // /////// // |
|
15 | // /////// // | |
16 |
|
16 | |||
17 | using MetadataPool = std::vector<QVariantHash>; |
|
17 | using MetadataPool = std::vector<QVariantHash>; | |
18 | Q_DECLARE_METATYPE(MetadataPool) |
|
18 | Q_DECLARE_METATYPE(MetadataPool) | |
19 |
|
19 | |||
20 | using Properties = QVariantHash; |
|
20 | using Properties = QVariantHash; | |
21 |
|
21 | |||
22 | // ///////// // |
|
22 | // ///////// // | |
23 | // Constants // |
|
23 | // Constants // | |
24 | // ///////// // |
|
24 | // ///////// // | |
25 |
|
25 | |||
26 | /// Timeout set for data acquisition for an operation (in ms) |
|
26 | /// Timeout set for data acquisition for an operation (in ms) | |
27 | extern const QString ACQUISITION_TIMEOUT_PROPERTY; |
|
27 | extern const QString ACQUISITION_TIMEOUT_PROPERTY; | |
28 |
|
28 | |||
29 | /// Max number of operations to generate |
|
29 | /// Max number of operations to generate | |
30 | extern const QString NB_MAX_OPERATIONS_PROPERTY; |
|
30 | extern const QString NB_MAX_OPERATIONS_PROPERTY; | |
31 |
|
31 | |||
32 | /// Max number of sync groups to create through operations |
|
32 | /// Max number of sync groups to create through operations | |
33 | extern const QString NB_MAX_SYNC_GROUPS_PROPERTY; |
|
33 | extern const QString NB_MAX_SYNC_GROUPS_PROPERTY; | |
34 |
|
34 | |||
35 | /// Max number of variables to manipulate through operations |
|
35 | /// Max number of variables to manipulate through operations | |
36 | extern const QString NB_MAX_VARIABLES_PROPERTY; |
|
36 | extern const QString NB_MAX_VARIABLES_PROPERTY; | |
37 |
|
37 | |||
38 | /// Set of operations available for the test |
|
38 | /// Set of operations available for the test | |
39 | extern const QString AVAILABLE_OPERATIONS_PROPERTY; |
|
39 | extern const QString AVAILABLE_OPERATIONS_PROPERTY; | |
40 |
|
40 | |||
41 | /// Tolerance used for variable's cache (in ratio) |
|
41 | /// Tolerance used for variable's cache (in ratio) | |
42 | extern const QString CACHE_TOLERANCE_PROPERTY; |
|
42 | extern const QString CACHE_TOLERANCE_PROPERTY; | |
43 |
|
43 | |||
44 | /// Range with which the timecontroller is initialized |
|
44 | /// Range with which the timecontroller is initialized | |
45 | extern const QString INITIAL_RANGE_PROPERTY; |
|
45 | extern const QString INITIAL_RANGE_PROPERTY; | |
46 |
|
46 | |||
47 | /// Max range that an operation can reach |
|
47 | /// Max range that an operation can reach | |
48 | extern const QString MAX_RANGE_PROPERTY; |
|
48 | extern const QString MAX_RANGE_PROPERTY; | |
49 |
|
49 | |||
50 | /// Set of metadata that can be associated to a variable |
|
50 | /// Set of metadata that can be associated to a variable | |
51 | extern const QString METADATA_POOL_PROPERTY; |
|
51 | extern const QString METADATA_POOL_PROPERTY; | |
52 |
|
52 | |||
53 | /// Provider used to retrieve data |
|
53 | /// Provider used to retrieve data | |
54 | extern const QString PROVIDER_PROPERTY; |
|
54 | extern const QString PROVIDER_PROPERTY; | |
55 |
|
55 | |||
56 | /// Min/max times left for an operation to execute |
|
56 | /// Min/max times left for an operation to execute | |
57 | extern const QString OPERATION_DELAY_BOUNDS_PROPERTY; |
|
57 | extern const QString OPERATION_DELAY_BOUNDS_PROPERTY; | |
58 |
|
58 | |||
59 | /// Validators used to validate an operation |
|
59 | /// Validators used to validate an operation | |
60 | extern const QString VALIDATORS_PROPERTY; |
|
60 | extern const QString VALIDATORS_PROPERTY; | |
61 |
|
61 | |||
62 | /// Min/max number of operations to execute before calling validation of the current test's state |
|
62 | /// Min/max number of operations to execute before calling validation of the current test's state | |
63 | extern const QString VALIDATION_FREQUENCY_BOUNDS_PROPERTY; |
|
63 | extern const QString VALIDATION_FREQUENCY_BOUNDS_PROPERTY; | |
64 |
|
64 | |||
65 | // /////// // |
|
65 | // /////// // | |
66 | // Structs // |
|
66 | // Structs // | |
67 | // /////// // |
|
67 | // /////// // | |
68 |
|
68 | |||
69 | class Variable; |
|
69 | class Variable; | |
70 | struct VariableState { |
|
70 | struct VariableState { | |
71 | std::shared_ptr<Variable> m_Variable{nullptr}; |
|
71 | std::shared_ptr<Variable> m_Variable{nullptr}; | |
72 | DateTimeRange m_Range{INVALID_RANGE}; |
|
72 | DateTimeRange m_Range{INVALID_RANGE}; | |
73 | }; |
|
73 | }; | |
74 |
|
74 | |||
75 | using VariableId = int; |
|
75 | using VariableId = int; | |
76 | using VariablesPool = std::map<VariableId, VariableState>; |
|
76 | using VariablesPool = std::map<VariableId, VariableState>; | |
77 |
|
77 | |||
78 | /** |
|
78 | /** | |
79 | * Defines a synchronization group for a fuzzing state. A group reports the variables synchronized |
|
79 | * Defines a synchronization group for a fuzzing state. A group reports the variables synchronized | |
80 | * with each other, and the current range of the group (i.e. range of the last synchronized variable |
|
80 | * with each other, and the current range of the group (i.e. range of the last synchronized variable | |
81 | * that has been moved) |
|
81 | * that has been moved) | |
82 | */ |
|
82 | */ | |
83 | struct SyncGroup { |
|
83 | struct SyncGroup { | |
84 | std::set<VariableId> m_Variables{}; |
|
84 | std::set<VariableId> m_Variables{}; | |
85 | DateTimeRange m_Range{INVALID_RANGE}; |
|
85 | DateTimeRange m_Range{INVALID_RANGE}; | |
86 | }; |
|
86 | }; | |
87 |
|
87 | |||
88 | using SyncGroupId = QUuid; |
|
88 | using SyncGroupId = QUuid; | |
89 | using SyncGroupsPool = std::map<SyncGroupId, SyncGroup>; |
|
89 | using SyncGroupsPool = std::map<SyncGroupId, SyncGroup>; | |
90 |
|
90 | |||
91 | /** |
|
91 | /** | |
92 | * Defines a current state during a fuzzing state. It contains all the variables manipulated during |
|
92 | * Defines a current state during a fuzzing state. It contains all the variables manipulated during | |
93 | * the test, as well as the synchronization status of these variables. |
|
93 | * the test, as well as the synchronization status of these variables. | |
94 | */ |
|
94 | */ | |
95 | struct FuzzingState { |
|
95 | struct FuzzingState { | |
96 | const SyncGroup &syncGroup(SyncGroupId id) const; |
|
96 | const SyncGroup &syncGroup(SyncGroupId id) const; | |
97 | SyncGroup &syncGroup(SyncGroupId id); |
|
97 | SyncGroup &syncGroup(SyncGroupId id); | |
98 |
|
98 | |||
99 | const VariableState &variableState(VariableId id) const; |
|
99 | const VariableState &variableState(VariableId id) const; | |
100 | VariableState &variableState(VariableId id); |
|
100 | VariableState &variableState(VariableId id); | |
101 |
|
101 | |||
102 | /// @return the identifier of the synchronization group in which the variable passed in |
|
102 | /// @return the identifier of the synchronization group in which the variable passed in | |
103 | /// parameter is located. If the variable is not in any group, returns an invalid identifier |
|
103 | /// parameter is located. If the variable is not in any group, returns an invalid identifier | |
104 | SyncGroupId syncGroupId(VariableId variableId) const; |
|
104 | SyncGroupId syncGroupId(VariableId variableId) const; | |
105 |
|
105 | |||
106 | /// @return the set of synchronization group identifiers |
|
106 | /// @return the set of synchronization group identifiers | |
107 | std::vector<SyncGroupId> syncGroupsIds() const; |
|
107 | std::vector<SyncGroupId> syncGroupsIds() const; | |
108 |
|
108 | |||
109 | /// Updates fuzzing state according to a variable synchronization |
|
109 | /// Updates fuzzing state according to a variable synchronization | |
110 | /// @param variableId the variable that is synchronized |
|
110 | /// @param variableId the variable that is synchronized | |
111 | /// @param syncGroupId the synchronization group |
|
111 | /// @param syncGroupId the synchronization group | |
112 | void synchronizeVariable(VariableId variableId, SyncGroupId syncGroupId); |
|
112 | void synchronizeVariable(VariableId variableId, SyncGroupId syncGroupId); | |
113 |
|
113 | |||
114 | /// Updates fuzzing state according to a variable desynchronization |
|
114 | /// Updates fuzzing state according to a variable desynchronization | |
115 | /// @param variableId the variable that is desynchronized |
|
115 | /// @param variableId the variable that is desynchronized | |
116 | /// @param syncGroupId the synchronization group from which to remove the variable |
|
116 | /// @param syncGroupId the synchronization group from which to remove the variable | |
117 | void desynchronizeVariable(VariableId variableId, SyncGroupId syncGroupId); |
|
117 | void desynchronizeVariable(VariableId variableId, SyncGroupId syncGroupId); | |
118 |
|
118 | |||
119 | /// Updates the range of a variable and all variables to which it is synchronized |
|
119 | /// Updates the range of a variable and all variables to which it is synchronized | |
120 | /// @param the variable for which to affect the range |
|
120 | /// @param the variable for which to affect the range | |
121 | /// @param the range to affect |
|
121 | /// @param the range to affect | |
122 | void updateRanges(VariableId variableId, const DateTimeRange &newRange); |
|
122 | void updateRanges(VariableId variableId, const DateTimeRange &newRange); | |
123 |
|
123 | |||
124 | VariablesPool m_VariablesPool; |
|
124 | VariablesPool m_VariablesPool; | |
125 | SyncGroupsPool m_SyncGroupsPool; |
|
125 | SyncGroupsPool m_SyncGroupsPool; | |
126 | }; |
|
126 | }; | |
127 |
|
127 | |||
128 | #endif // SCIQLOP_FUZZINGDEFS_H |
|
128 | #endif // SCIQLOP_FUZZINGDEFS_H |
@@ -1,126 +1,126 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SciQLOP Software |
|
2 | -- This file is a part of the SciQLOP Software | |
3 | -- Copyright (C) 2018, Plasma Physics Laboratory - CNRS |
|
3 | -- Copyright (C) 2018, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
6 | -- it under the terms of the GNU General Public License as published by |
|
6 | -- it under the terms of the GNU General Public License as published by | |
7 | -- the Free Software Foundation; either version 2 of the License, or |
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
15 | -- You should have received a copy of the GNU General Public License | |
16 | -- along with this program; if not, write to the Free Software |
|
16 | -- along with this program; if not, write to the Free Software | |
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include <string> |
|
22 | #include <string> | |
23 | #include <sstream> |
|
23 | #include <sstream> | |
24 | #include <memory> |
|
24 | #include <memory> | |
25 |
|
25 | |||
26 | #include <pybind11/pybind11.h> |
|
26 | #include <pybind11/pybind11.h> | |
27 | #include <pybind11/operators.h> |
|
27 | #include <pybind11/operators.h> | |
28 | #include <pybind11/embed.h> |
|
28 | #include <pybind11/embed.h> | |
29 | #include <pybind11/numpy.h> |
|
29 | #include <pybind11/numpy.h> | |
30 | #include <pybind11/chrono.h> |
|
30 | #include <pybind11/chrono.h> | |
31 |
|
31 | |||
32 | #include <SqpApplication.h> |
|
32 | #include <SqpApplication.h> | |
33 | #include <Variable/VariableController.h> |
|
33 | #include <Variable/VariableController.h> | |
34 | #include <Time/TimeController.h> |
|
34 | #include <Time/TimeController.h> | |
35 |
#include <Data/ |
|
35 | #include <Data/DateTimeRange.h> | |
36 | #include <Data/DataSeriesType.h> |
|
36 | #include <Data/DataSeriesType.h> | |
37 | #include <Common/DateUtils.h> |
|
37 | #include <Common/DateUtils.h> | |
38 | #include <Variable/Variable.h> |
|
38 | #include <Variable/Variable.h> | |
39 | #include <Data/ScalarSeries.h> |
|
39 | #include <Data/ScalarSeries.h> | |
40 | #include <Data/VectorSeries.h> |
|
40 | #include <Data/VectorSeries.h> | |
41 |
|
41 | |||
42 | #include <AmdaProvider.h> |
|
42 | #include <AmdaProvider.h> | |
43 | #include <AmdaResultParser.h> |
|
43 | #include <AmdaResultParser.h> | |
44 |
|
44 | |||
45 | //#include <QDate> |
|
45 | //#include <QDate> | |
46 | //#include <QTime> |
|
46 | //#include <QTime> | |
47 | //#include <QUuid> |
|
47 | //#include <QUuid> | |
48 | //#include <QString> |
|
48 | //#include <QString> | |
49 | #include <QFile> |
|
49 | #include <QFile> | |
50 |
|
50 | |||
51 | #include <pywrappers_common.h> |
|
51 | #include <pywrappers_common.h> | |
52 | #include <CoreWrappers.h> |
|
52 | #include <CoreWrappers.h> | |
53 |
|
53 | |||
54 | #include "PyTestAmdaWrapper.h" |
|
54 | #include "PyTestAmdaWrapper.h" | |
55 |
|
55 | |||
56 |
|
56 | |||
57 | using namespace std::chrono; |
|
57 | using namespace std::chrono; | |
58 |
|
58 | |||
59 |
|
59 | |||
60 |
|
60 | |||
61 |
|
61 | |||
62 | PYBIND11_MODULE(pytestamda, m){ |
|
62 | PYBIND11_MODULE(pytestamda, m){ | |
63 |
|
63 | |||
64 | int argc = 0; |
|
64 | int argc = 0; | |
65 | char ** argv=nullptr; |
|
65 | char ** argv=nullptr; | |
66 | SqpApplication::setOrganizationName("LPP"); |
|
66 | SqpApplication::setOrganizationName("LPP"); | |
67 | SqpApplication::setOrganizationDomain("lpp.fr"); |
|
67 | SqpApplication::setOrganizationDomain("lpp.fr"); | |
68 | SqpApplication::setApplicationName("SciQLop"); |
|
68 | SqpApplication::setApplicationName("SciQLop"); | |
69 | static SqpApplication app(argc, argv); |
|
69 | static SqpApplication app(argc, argv); | |
70 |
|
70 | |||
71 | auto qtmod = py::module::import("sciqlopqt"); |
|
71 | auto qtmod = py::module::import("sciqlopqt"); | |
72 | auto sciqlopmod = py::module::import("pysciqlopcore"); |
|
72 | auto sciqlopmod = py::module::import("pysciqlopcore"); | |
73 |
|
73 | |||
74 | m.doc() = "hello"; |
|
74 | m.doc() = "hello"; | |
75 |
|
75 | |||
76 | py::class_<VariableController>(m, "VariableController") |
|
76 | py::class_<VariableController>(m, "VariableController") | |
77 | .def_static("createVariable",[](const QString &name, |
|
77 | .def_static("createVariable",[](const QString &name, | |
78 | std::shared_ptr<IDataProvider> provider, const DateTimeRange& range){ |
|
78 | std::shared_ptr<IDataProvider> provider, const DateTimeRange& range){ | |
79 | return sqpApp->variableController().createVariable(name, {{"dataType", "vector"}, {"xml:id", "c1_b"}}, provider, range); |
|
79 | return sqpApp->variableController().createVariable(name, {{"dataType", "vector"}, {"xml:id", "c1_b"}}, provider, range); | |
80 | }) |
|
80 | }) | |
81 | .def_static("hasPendingDownloads", |
|
81 | .def_static("hasPendingDownloads", | |
82 | [](){return sqpApp->variableController().hasPendingDownloads();} |
|
82 | [](){return sqpApp->variableController().hasPendingDownloads();} | |
83 | ) |
|
83 | ) | |
84 | .def_static("addSynchronizationGroup", |
|
84 | .def_static("addSynchronizationGroup", | |
85 | [](QUuid uuid){sqpApp->variableController().onAddSynchronizationGroupId(uuid);} |
|
85 | [](QUuid uuid){sqpApp->variableController().onAddSynchronizationGroupId(uuid);} | |
86 | ) |
|
86 | ) | |
87 | .def_static("removeSynchronizationGroup", |
|
87 | .def_static("removeSynchronizationGroup", | |
88 | [](QUuid uuid){sqpApp->variableController().onRemoveSynchronizationGroupId(uuid);} |
|
88 | [](QUuid uuid){sqpApp->variableController().onRemoveSynchronizationGroupId(uuid);} | |
89 | ) |
|
89 | ) | |
90 | .def_static("synchronizeVar", |
|
90 | .def_static("synchronizeVar", | |
91 | [](std::shared_ptr<Variable> variable, QUuid uuid){sqpApp->variableController().onAddSynchronized(variable, uuid);} |
|
91 | [](std::shared_ptr<Variable> variable, QUuid uuid){sqpApp->variableController().onAddSynchronized(variable, uuid);} | |
92 | ) |
|
92 | ) | |
93 | .def_static("deSynchronizeVar", |
|
93 | .def_static("deSynchronizeVar", | |
94 | [](std::shared_ptr<Variable> variable, QUuid uuid){sqpApp->variableController().desynchronize(variable, uuid);} |
|
94 | [](std::shared_ptr<Variable> variable, QUuid uuid){sqpApp->variableController().desynchronize(variable, uuid);} | |
95 | ) |
|
95 | ) | |
96 | .def_static("deleteVariable", |
|
96 | .def_static("deleteVariable", | |
97 | [](std::shared_ptr<Variable> variable){ |
|
97 | [](std::shared_ptr<Variable> variable){ | |
98 | sqpApp->variableController().deleteVariable(variable);} |
|
98 | sqpApp->variableController().deleteVariable(variable);} | |
99 | ) |
|
99 | ) | |
100 | .def_static("update_range",[](std::shared_ptr<Variable> variable, const DateTimeRange &range, bool synchronise){ |
|
100 | .def_static("update_range",[](std::shared_ptr<Variable> variable, const DateTimeRange &range, bool synchronise){ | |
101 | sqpApp->variableController().onRequestDataLoading({variable}, range, synchronise); |
|
101 | sqpApp->variableController().onRequestDataLoading({variable}, range, synchronise); | |
102 | }) |
|
102 | }) | |
103 | .def_static("wait_for_downloads",[](){ |
|
103 | .def_static("wait_for_downloads",[](){ | |
104 | while (sqpApp->variableController().hasPendingDownloads()) { |
|
104 | while (sqpApp->variableController().hasPendingDownloads()) { | |
105 | usleep(100); |
|
105 | usleep(100); | |
106 | } |
|
106 | } | |
107 | }); |
|
107 | }); | |
108 |
|
108 | |||
109 | py::class_<TimeController>(m,"TimeController") |
|
109 | py::class_<TimeController>(m,"TimeController") | |
110 | .def_static("setTime", [](DateTimeRange range){sqpApp->timeController().setDateTimeRange(range);}); |
|
110 | .def_static("setTime", [](DateTimeRange range){sqpApp->timeController().setDateTimeRange(range);}); | |
111 |
|
111 | |||
112 |
|
112 | |||
113 | auto amda_provider = std::make_shared<AmdaProvider>(); |
|
113 | auto amda_provider = std::make_shared<AmdaProvider>(); | |
114 | m.def("amda_provider",[amda_provider](){return amda_provider;}, py::return_value_policy::copy); |
|
114 | m.def("amda_provider",[amda_provider](){return amda_provider;}, py::return_value_policy::copy); | |
115 |
|
115 | |||
116 | py::class_<AmdaProvider, std::shared_ptr<AmdaProvider>, IDataProvider>(m, "AmdaProvider"); |
|
116 | py::class_<AmdaProvider, std::shared_ptr<AmdaProvider>, IDataProvider>(m, "AmdaProvider"); | |
117 |
|
117 | |||
118 | py::class_<AmdaResultParser>(m, "AmdaResultParser") |
|
118 | py::class_<AmdaResultParser>(m, "AmdaResultParser") | |
119 | .def_static("readTxt", AmdaResultParser::readTxt) |
|
119 | .def_static("readTxt", AmdaResultParser::readTxt) | |
120 | .def("readScalarTxt", [](const QString& path){ |
|
120 | .def("readScalarTxt", [](const QString& path){ | |
121 | return std::dynamic_pointer_cast<ScalarSeries>(AmdaResultParser::readTxt(path, DataSeriesType::SCALAR)); |
|
121 | return std::dynamic_pointer_cast<ScalarSeries>(AmdaResultParser::readTxt(path, DataSeriesType::SCALAR)); | |
122 | }, py::return_value_policy::copy); |
|
122 | }, py::return_value_policy::copy); | |
123 |
|
123 | |||
124 |
|
124 | |||
125 | } |
|
125 | } | |
126 |
|
126 |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed | ||
This diff has been collapsed as it changes many lines, (507 lines changed) Show them Hide them |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed | ||
This diff has been collapsed as it changes many lines, (574 lines changed) Show them Hide them |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed | ||
This diff has been collapsed as it changes many lines, (1103 lines changed) Show them Hide them |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed | ||
This diff has been collapsed as it changes many lines, (600 lines changed) Show them Hide them |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed | ||
This diff has been collapsed as it changes many lines, (508 lines changed) Show them Hide them |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now