@@ -0,0 +1,22 | |||||
|
1 | #ifndef SCIQLOP_ACTIONSGUICONTROLLER_H | |||
|
2 | #define SCIQLOP_ACTIONSGUICONTROLLER_H | |||
|
3 | ||||
|
4 | #include <Actions/SelectionZoneAction.h> | |||
|
5 | #include <Common/spimpl.h> | |||
|
6 | ||||
|
7 | #include <memory> | |||
|
8 | ||||
|
9 | class ActionsGuiController { | |||
|
10 | public: | |||
|
11 | ActionsGuiController(); | |||
|
12 | ||||
|
13 | std::shared_ptr<SelectionZoneAction> | |||
|
14 | addSectionZoneAction(const QString &name, SelectionZoneAction::ExecuteFunction function); | |||
|
15 | QVector<std::shared_ptr<SelectionZoneAction> > selectionZoneActions() const; | |||
|
16 | ||||
|
17 | private: | |||
|
18 | class ActionsGuiControllerPrivate; | |||
|
19 | spimpl::unique_impl_ptr<ActionsGuiControllerPrivate> impl; | |||
|
20 | }; | |||
|
21 | ||||
|
22 | #endif // SCIQLOP_ACTIONSGUICONTROLLER_H |
@@ -0,0 +1,49 | |||||
|
1 | #ifndef SCIQLOP_SELECTIONZONEACTION_H | |||
|
2 | #define SCIQLOP_SELECTIONZONEACTION_H | |||
|
3 | ||||
|
4 | #include <Common/spimpl.h> | |||
|
5 | ||||
|
6 | #include <QLoggingCategory> | |||
|
7 | #include <QObject> | |||
|
8 | ||||
|
9 | #include <functional> | |||
|
10 | ||||
|
11 | class VisualizationSelectionZoneItem; | |||
|
12 | ||||
|
13 | Q_DECLARE_LOGGING_CATEGORY(LOG_SelectionZoneAction) | |||
|
14 | ||||
|
15 | /** | |||
|
16 | * @brief The SelectionZoneAction class represents an action on a selection zone in the | |||
|
17 | * visualization. | |||
|
18 | * | |||
|
19 | * The action is a function that will be executed when the slot execute() is called. | |||
|
20 | */ | |||
|
21 | class SelectionZoneAction : public QObject { | |||
|
22 | ||||
|
23 | Q_OBJECT | |||
|
24 | ||||
|
25 | public: | |||
|
26 | /// Signature of the function associated to the action | |||
|
27 | using ExecuteFunction | |||
|
28 | = std::function<void(const QVector<VisualizationSelectionZoneItem *> &item)>; | |||
|
29 | ||||
|
30 | /** | |||
|
31 | * @param name the name of the action, displayed to the user | |||
|
32 | * @param fun the function that will be called when the action is executed | |||
|
33 | * @sa execute() | |||
|
34 | */ | |||
|
35 | explicit SelectionZoneAction(const QString &name, ExecuteFunction fun); | |||
|
36 | ||||
|
37 | /// The name of the action | |||
|
38 | QString name() const noexcept; | |||
|
39 | ||||
|
40 | public slots: | |||
|
41 | /// Executes the action | |||
|
42 | void execute(const QVector<VisualizationSelectionZoneItem *> &item); | |||
|
43 | ||||
|
44 | private: | |||
|
45 | class SelectionZoneActionPrivate; | |||
|
46 | spimpl::unique_impl_ptr<SelectionZoneActionPrivate> impl; | |||
|
47 | }; | |||
|
48 | ||||
|
49 | #endif // SCIQLOP_SELECTIONZONEACTION_H |
@@ -0,0 +1,26 | |||||
|
1 | #include "Actions/ActionsGuiController.h" | |||
|
2 | ||||
|
3 | struct ActionsGuiController::ActionsGuiControllerPrivate { | |||
|
4 | ||||
|
5 | QVector<std::shared_ptr<SelectionZoneAction> > m_SelectionZoneActions; | |||
|
6 | }; | |||
|
7 | ||||
|
8 | ActionsGuiController::ActionsGuiController() | |||
|
9 | : impl{spimpl::make_unique_impl<ActionsGuiControllerPrivate>()} | |||
|
10 | { | |||
|
11 | } | |||
|
12 | ||||
|
13 | std::shared_ptr<SelectionZoneAction> | |||
|
14 | ActionsGuiController::addSectionZoneAction(const QString &name, | |||
|
15 | SelectionZoneAction::ExecuteFunction function) | |||
|
16 | { | |||
|
17 | auto action = std::make_shared<SelectionZoneAction>(name, function); | |||
|
18 | impl->m_SelectionZoneActions.push_back(action); | |||
|
19 | ||||
|
20 | return action; | |||
|
21 | } | |||
|
22 | ||||
|
23 | QVector<std::shared_ptr<SelectionZoneAction> > ActionsGuiController::selectionZoneActions() const | |||
|
24 | { | |||
|
25 | return impl->m_SelectionZoneActions; | |||
|
26 | } |
@@ -0,0 +1,30 | |||||
|
1 | #include <Actions/SelectionZoneAction.h> | |||
|
2 | #include <Visualization/VisualizationSelectionZoneItem.h> | |||
|
3 | ||||
|
4 | Q_LOGGING_CATEGORY(LOG_SelectionZoneAction, "SelectionZoneAction") | |||
|
5 | ||||
|
6 | struct SelectionZoneAction::SelectionZoneActionPrivate { | |||
|
7 | explicit SelectionZoneActionPrivate(const QString &name, | |||
|
8 | SelectionZoneAction::ExecuteFunction fun) | |||
|
9 | : m_Name{name}, m_Fun{std::move(fun)} | |||
|
10 | { | |||
|
11 | } | |||
|
12 | ||||
|
13 | QString m_Name; | |||
|
14 | SelectionZoneAction::ExecuteFunction m_Fun; | |||
|
15 | }; | |||
|
16 | ||||
|
17 | SelectionZoneAction::SelectionZoneAction(const QString &name, ExecuteFunction fun) | |||
|
18 | : impl{spimpl::make_unique_impl<SelectionZoneActionPrivate>(name, std::move(fun))} | |||
|
19 | { | |||
|
20 | } | |||
|
21 | ||||
|
22 | QString SelectionZoneAction::name() const noexcept | |||
|
23 | { | |||
|
24 | return impl->m_Name; | |||
|
25 | } | |||
|
26 | ||||
|
27 | void SelectionZoneAction::execute(const QVector<VisualizationSelectionZoneItem *> &item) | |||
|
28 | { | |||
|
29 | impl->m_Fun(item); | |||
|
30 | } |
@@ -1,67 +1,69 | |||||
1 | #ifndef SCIQLOP_SQPAPPLICATION_H |
|
1 | #ifndef SCIQLOP_SQPAPPLICATION_H | |
2 | #define SCIQLOP_SQPAPPLICATION_H |
|
2 | #define SCIQLOP_SQPAPPLICATION_H | |
3 |
|
3 | |||
4 | #include "SqpApplication.h" |
|
4 | #include "SqpApplication.h" | |
5 |
|
5 | |||
6 | #include <QApplication> |
|
6 | #include <QApplication> | |
7 | #include <QLoggingCategory> |
|
7 | #include <QLoggingCategory> | |
8 |
|
8 | |||
9 | #include <Common/spimpl.h> |
|
9 | #include <Common/spimpl.h> | |
10 |
|
10 | |||
11 | Q_DECLARE_LOGGING_CATEGORY(LOG_SqpApplication) |
|
11 | Q_DECLARE_LOGGING_CATEGORY(LOG_SqpApplication) | |
12 |
|
12 | |||
13 | #if defined(sqpApp) |
|
13 | #if defined(sqpApp) | |
14 | #undef sqpApp |
|
14 | #undef sqpApp | |
15 | #endif |
|
15 | #endif | |
16 | #define sqpApp (static_cast<SqpApplication *>(QCoreApplication::instance())) |
|
16 | #define sqpApp (static_cast<SqpApplication *>(QCoreApplication::instance())) | |
17 |
|
17 | |||
18 | class DataSourceController; |
|
18 | class DataSourceController; | |
19 | class NetworkController; |
|
19 | class NetworkController; | |
20 | class TimeController; |
|
20 | class TimeController; | |
21 | class VariableController; |
|
21 | class VariableController; | |
22 | class VisualizationController; |
|
22 | class VisualizationController; | |
23 | class DragDropGuiController; |
|
23 | class DragDropGuiController; | |
|
24 | class ActionsGuiController; | |||
24 |
|
25 | |||
25 | /** |
|
26 | /** | |
26 | * @brief The SqpApplication class aims to make the link between SciQlop |
|
27 | * @brief The SqpApplication class aims to make the link between SciQlop | |
27 | * and its plugins. This is the intermediate class that SciQlop has to use |
|
28 | * and its plugins. This is the intermediate class that SciQlop has to use | |
28 | * in the way to connect a data source. Please first use load method to initialize |
|
29 | * in the way to connect a data source. Please first use load method to initialize | |
29 | * a plugin specified by its metadata name (JSON plugin source) then others specifics |
|
30 | * a plugin specified by its metadata name (JSON plugin source) then others specifics | |
30 | * method will be able to access it. |
|
31 | * method will be able to access it. | |
31 | * You can load a data source driver plugin then create a data source. |
|
32 | * You can load a data source driver plugin then create a data source. | |
32 | */ |
|
33 | */ | |
33 |
|
34 | |||
34 | class SqpApplication : public QApplication { |
|
35 | class SqpApplication : public QApplication { | |
35 | Q_OBJECT |
|
36 | Q_OBJECT | |
36 | public: |
|
37 | public: | |
37 | explicit SqpApplication(int &argc, char **argv); |
|
38 | explicit SqpApplication(int &argc, char **argv); | |
38 | virtual ~SqpApplication(); |
|
39 | virtual ~SqpApplication(); | |
39 | void initialize(); |
|
40 | void initialize(); | |
40 |
|
41 | |||
41 | /// Accessors for the differents sciqlop controllers |
|
42 | /// Accessors for the differents sciqlop controllers | |
42 | DataSourceController &dataSourceController() noexcept; |
|
43 | DataSourceController &dataSourceController() noexcept; | |
43 | NetworkController &networkController() noexcept; |
|
44 | NetworkController &networkController() noexcept; | |
44 | TimeController &timeController() noexcept; |
|
45 | TimeController &timeController() noexcept; | |
45 | VariableController &variableController() noexcept; |
|
46 | VariableController &variableController() noexcept; | |
46 | VisualizationController &visualizationController() noexcept; |
|
47 | VisualizationController &visualizationController() noexcept; | |
47 |
|
48 | |||
48 | /// Accessors for the differents sciqlop helpers, these helpers classes are like controllers but |
|
49 | /// Accessors for the differents sciqlop helpers, these helpers classes are like controllers but | |
49 | /// doesn't live in a thread and access gui |
|
50 | /// doesn't live in a thread and access gui | |
50 | DragDropGuiController &dragDropGuiController() noexcept; |
|
51 | DragDropGuiController &dragDropGuiController() noexcept; | |
|
52 | ActionsGuiController &actionsGuiController() noexcept; | |||
51 |
|
53 | |||
52 | enum class PlotsInteractionMode { None, ZoomBox, DragAndDrop, SelectionZones }; |
|
54 | enum class PlotsInteractionMode { None, ZoomBox, DragAndDrop, SelectionZones }; | |
53 |
|
55 | |||
54 | enum class PlotsCursorMode { NoCursor, Vertical, Temporal, Horizontal, Cross }; |
|
56 | enum class PlotsCursorMode { NoCursor, Vertical, Temporal, Horizontal, Cross }; | |
55 |
|
57 | |||
56 | PlotsInteractionMode plotsInteractionMode() const; |
|
58 | PlotsInteractionMode plotsInteractionMode() const; | |
57 | void setPlotsInteractionMode(PlotsInteractionMode mode); |
|
59 | void setPlotsInteractionMode(PlotsInteractionMode mode); | |
58 |
|
60 | |||
59 | PlotsCursorMode plotsCursorMode() const; |
|
61 | PlotsCursorMode plotsCursorMode() const; | |
60 | void setPlotsCursorMode(PlotsCursorMode mode); |
|
62 | void setPlotsCursorMode(PlotsCursorMode mode); | |
61 |
|
63 | |||
62 | private: |
|
64 | private: | |
63 | class SqpApplicationPrivate; |
|
65 | class SqpApplicationPrivate; | |
64 | spimpl::unique_impl_ptr<SqpApplicationPrivate> impl; |
|
66 | spimpl::unique_impl_ptr<SqpApplicationPrivate> impl; | |
65 | }; |
|
67 | }; | |
66 |
|
68 | |||
67 | #endif // SCIQLOP_SQPAPPLICATION_H |
|
69 | #endif // SCIQLOP_SQPAPPLICATION_H |
@@ -1,103 +1,106 | |||||
1 |
|
1 | |||
2 | gui_moc_headers = [ |
|
2 | gui_moc_headers = [ | |
3 | 'include/DataSource/DataSourceWidget.h', |
|
3 | 'include/DataSource/DataSourceWidget.h', | |
4 | 'include/Settings/SqpSettingsDialog.h', |
|
4 | 'include/Settings/SqpSettingsDialog.h', | |
5 | 'include/Settings/SqpSettingsGeneralWidget.h', |
|
5 | 'include/Settings/SqpSettingsGeneralWidget.h', | |
6 | 'include/SidePane/SqpSidePane.h', |
|
6 | 'include/SidePane/SqpSidePane.h', | |
7 | 'include/SqpApplication.h', |
|
7 | 'include/SqpApplication.h', | |
8 | 'include/DragAndDrop/DragDropScroller.h', |
|
8 | 'include/DragAndDrop/DragDropScroller.h', | |
9 | 'include/DragAndDrop/DragDropTabSwitcher.h', |
|
9 | 'include/DragAndDrop/DragDropTabSwitcher.h', | |
10 | 'include/TimeWidget/TimeWidget.h', |
|
10 | 'include/TimeWidget/TimeWidget.h', | |
11 | 'include/Variable/VariableInspectorWidget.h', |
|
11 | 'include/Variable/VariableInspectorWidget.h', | |
12 | 'include/Variable/RenameVariableDialog.h', |
|
12 | 'include/Variable/RenameVariableDialog.h', | |
13 | 'include/Visualization/qcustomplot.h', |
|
13 | 'include/Visualization/qcustomplot.h', | |
14 | 'include/Visualization/VisualizationGraphWidget.h', |
|
14 | 'include/Visualization/VisualizationGraphWidget.h', | |
15 | 'include/Visualization/VisualizationTabWidget.h', |
|
15 | 'include/Visualization/VisualizationTabWidget.h', | |
16 | 'include/Visualization/VisualizationWidget.h', |
|
16 | 'include/Visualization/VisualizationWidget.h', | |
17 | 'include/Visualization/VisualizationZoneWidget.h', |
|
17 | 'include/Visualization/VisualizationZoneWidget.h', | |
18 | 'include/Visualization/VisualizationDragDropContainer.h', |
|
18 | 'include/Visualization/VisualizationDragDropContainer.h', | |
19 | 'include/Visualization/VisualizationDragWidget.h', |
|
19 | 'include/Visualization/VisualizationDragWidget.h', | |
20 | 'include/Visualization/ColorScaleEditor.h' |
|
20 | 'include/Visualization/ColorScaleEditor.h', | |
|
21 | 'include/Visualization/SelectionZoneAction.h' | |||
21 | ] |
|
22 | ] | |
22 |
|
23 | |||
23 | gui_ui_files = [ |
|
24 | gui_ui_files = [ | |
24 | 'ui/DataSource/DataSourceWidget.ui', |
|
25 | 'ui/DataSource/DataSourceWidget.ui', | |
25 | 'ui/Settings/SqpSettingsDialog.ui', |
|
26 | 'ui/Settings/SqpSettingsDialog.ui', | |
26 | 'ui/Settings/SqpSettingsGeneralWidget.ui', |
|
27 | 'ui/Settings/SqpSettingsGeneralWidget.ui', | |
27 | 'ui/SidePane/SqpSidePane.ui', |
|
28 | 'ui/SidePane/SqpSidePane.ui', | |
28 | 'ui/TimeWidget/TimeWidget.ui', |
|
29 | 'ui/TimeWidget/TimeWidget.ui', | |
29 | 'ui/Variable/VariableInspectorWidget.ui', |
|
30 | 'ui/Variable/VariableInspectorWidget.ui', | |
30 | 'ui/Variable/RenameVariableDialog.ui', |
|
31 | 'ui/Variable/RenameVariableDialog.ui', | |
31 | 'ui/Variable/VariableMenuHeaderWidget.ui', |
|
32 | 'ui/Variable/VariableMenuHeaderWidget.ui', | |
32 | 'ui/Visualization/VisualizationGraphWidget.ui', |
|
33 | 'ui/Visualization/VisualizationGraphWidget.ui', | |
33 | 'ui/Visualization/VisualizationTabWidget.ui', |
|
34 | 'ui/Visualization/VisualizationTabWidget.ui', | |
34 | 'ui/Visualization/VisualizationWidget.ui', |
|
35 | 'ui/Visualization/VisualizationWidget.ui', | |
35 | 'ui/Visualization/VisualizationZoneWidget.ui', |
|
36 | 'ui/Visualization/VisualizationZoneWidget.ui', | |
36 | 'ui/Visualization/ColorScaleEditor.ui' |
|
37 | 'ui/Visualization/ColorScaleEditor.ui' | |
37 | ] |
|
38 | ] | |
38 |
|
39 | |||
39 | gui_qresources = ['resources/sqpguiresources.qrc'] |
|
40 | gui_qresources = ['resources/sqpguiresources.qrc'] | |
40 |
|
41 | |||
41 | gui_moc_files = qt5.preprocess(moc_headers : gui_moc_headers, |
|
42 | gui_moc_files = qt5.preprocess(moc_headers : gui_moc_headers, | |
42 | ui_files : gui_ui_files, |
|
43 | ui_files : gui_ui_files, | |
43 | qresources : gui_qresources) |
|
44 | qresources : gui_qresources) | |
44 |
|
45 | |||
45 | gui_sources = [ |
|
46 | gui_sources = [ | |
46 | 'src/SqpApplication.cpp', |
|
47 | 'src/SqpApplication.cpp', | |
47 | 'src/DragAndDrop/DragDropHelper.cpp', |
|
48 | 'src/DragAndDrop/DragDropHelper.cpp', | |
48 | 'src/DragAndDrop/DragDropScroller.cpp', |
|
49 | 'src/DragAndDrop/DragDropScroller.cpp', | |
49 | 'src/DragAndDrop/DragDropTabSwitcher.cpp', |
|
50 | 'src/DragAndDrop/DragDropTabSwitcher.cpp', | |
50 | 'src/Common/ColorUtils.cpp', |
|
51 | 'src/Common/ColorUtils.cpp', | |
51 | 'src/Common/VisualizationDef.cpp', |
|
52 | 'src/Common/VisualizationDef.cpp', | |
52 | 'src/DataSource/DataSourceTreeWidgetItem.cpp', |
|
53 | 'src/DataSource/DataSourceTreeWidgetItem.cpp', | |
53 | 'src/DataSource/DataSourceTreeWidgetHelper.cpp', |
|
54 | 'src/DataSource/DataSourceTreeWidgetHelper.cpp', | |
54 | 'src/DataSource/DataSourceWidget.cpp', |
|
55 | 'src/DataSource/DataSourceWidget.cpp', | |
55 | 'src/DataSource/DataSourceTreeWidget.cpp', |
|
56 | 'src/DataSource/DataSourceTreeWidget.cpp', | |
56 | 'src/Settings/SqpSettingsDialog.cpp', |
|
57 | 'src/Settings/SqpSettingsDialog.cpp', | |
57 | 'src/Settings/SqpSettingsGeneralWidget.cpp', |
|
58 | 'src/Settings/SqpSettingsGeneralWidget.cpp', | |
58 | 'src/SidePane/SqpSidePane.cpp', |
|
59 | 'src/SidePane/SqpSidePane.cpp', | |
59 | 'src/TimeWidget/TimeWidget.cpp', |
|
60 | 'src/TimeWidget/TimeWidget.cpp', | |
60 | 'src/Variable/VariableInspectorWidget.cpp', |
|
61 | 'src/Variable/VariableInspectorWidget.cpp', | |
61 | 'src/Variable/VariableInspectorTableView.cpp', |
|
62 | 'src/Variable/VariableInspectorTableView.cpp', | |
62 | 'src/Variable/VariableMenuHeaderWidget.cpp', |
|
63 | 'src/Variable/VariableMenuHeaderWidget.cpp', | |
63 | 'src/Variable/RenameVariableDialog.cpp', |
|
64 | 'src/Variable/RenameVariableDialog.cpp', | |
64 | 'src/Visualization/VisualizationGraphHelper.cpp', |
|
65 | 'src/Visualization/VisualizationGraphHelper.cpp', | |
65 | 'src/Visualization/VisualizationGraphRenderingDelegate.cpp', |
|
66 | 'src/Visualization/VisualizationGraphRenderingDelegate.cpp', | |
66 | 'src/Visualization/VisualizationGraphWidget.cpp', |
|
67 | 'src/Visualization/VisualizationGraphWidget.cpp', | |
67 | 'src/Visualization/VisualizationTabWidget.cpp', |
|
68 | 'src/Visualization/VisualizationTabWidget.cpp', | |
68 | 'src/Visualization/VisualizationWidget.cpp', |
|
69 | 'src/Visualization/VisualizationWidget.cpp', | |
69 | 'src/Visualization/VisualizationZoneWidget.cpp', |
|
70 | 'src/Visualization/VisualizationZoneWidget.cpp', | |
70 | 'src/Visualization/qcustomplot.cpp', |
|
71 | 'src/Visualization/qcustomplot.cpp', | |
71 | 'src/Visualization/QCustomPlotSynchronizer.cpp', |
|
72 | 'src/Visualization/QCustomPlotSynchronizer.cpp', | |
72 | 'src/Visualization/operations/FindVariableOperation.cpp', |
|
73 | 'src/Visualization/operations/FindVariableOperation.cpp', | |
73 | 'src/Visualization/operations/GenerateVariableMenuOperation.cpp', |
|
74 | 'src/Visualization/operations/GenerateVariableMenuOperation.cpp', | |
74 | 'src/Visualization/operations/MenuBuilder.cpp', |
|
75 | 'src/Visualization/operations/MenuBuilder.cpp', | |
75 | 'src/Visualization/operations/RemoveVariableOperation.cpp', |
|
76 | 'src/Visualization/operations/RemoveVariableOperation.cpp', | |
76 | 'src/Visualization/operations/RescaleAxeOperation.cpp', |
|
77 | 'src/Visualization/operations/RescaleAxeOperation.cpp', | |
77 | 'src/Visualization/VisualizationDragDropContainer.cpp', |
|
78 | 'src/Visualization/VisualizationDragDropContainer.cpp', | |
78 | 'src/Visualization/VisualizationDragWidget.cpp', |
|
79 | 'src/Visualization/VisualizationDragWidget.cpp', | |
79 | 'src/Visualization/AxisRenderingUtils.cpp', |
|
80 | 'src/Visualization/AxisRenderingUtils.cpp', | |
80 | 'src/Visualization/PlottablesRenderingUtils.cpp', |
|
81 | 'src/Visualization/PlottablesRenderingUtils.cpp', | |
81 | 'src/Visualization/MacScrollBarStyle.cpp', |
|
82 | 'src/Visualization/MacScrollBarStyle.cpp', | |
82 | 'src/Visualization/VisualizationCursorItem.cpp', |
|
83 | 'src/Visualization/VisualizationCursorItem.cpp', | |
83 | 'src/Visualization/ColorScaleEditor.cpp', |
|
84 | 'src/Visualization/ColorScaleEditor.cpp', | |
84 | 'src/Visualization/SqpColorScale.cpp', |
|
85 | 'src/Visualization/SqpColorScale.cpp', | |
85 | 'src/Visualization/QCPColorMapIterator.cpp', |
|
86 | 'src/Visualization/QCPColorMapIterator.cpp', | |
86 | 'src/Visualization/VisualizationSelectionZoneItem.cpp', |
|
87 | 'src/Visualization/VisualizationSelectionZoneItem.cpp', | |
87 | 'src/Visualization/VisualizationSelectionZoneManager.cpp' |
|
88 | 'src/Visualization/VisualizationSelectionZoneManager.cpp', | |
|
89 | 'src/Visualization/SelectionZoneAction.cpp', | |||
|
90 | 'src/Visualization/ActionsGuiController.cpp' | |||
88 | ] |
|
91 | ] | |
89 |
|
92 | |||
90 | gui_inc = include_directories(['include']) |
|
93 | gui_inc = include_directories(['include']) | |
91 |
|
94 | |||
92 | sciqlop_gui_lib = library('sciqlopgui', |
|
95 | sciqlop_gui_lib = library('sciqlopgui', | |
93 | gui_sources, |
|
96 | gui_sources, | |
94 | gui_moc_files, |
|
97 | gui_moc_files, | |
95 | include_directories : [gui_inc], |
|
98 | include_directories : [gui_inc], | |
96 | dependencies : [ qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core], |
|
99 | dependencies : [ qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core], | |
97 | install : true |
|
100 | install : true | |
98 | ) |
|
101 | ) | |
99 |
|
102 | |||
100 | sciqlop_gui = declare_dependency(link_with : sciqlop_gui_lib, |
|
103 | sciqlop_gui = declare_dependency(link_with : sciqlop_gui_lib, | |
101 | include_directories : gui_inc, |
|
104 | include_directories : gui_inc, | |
102 | dependencies : [qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core]) |
|
105 | dependencies : [qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core]) | |
103 |
|
106 |
@@ -1,203 +1,198 | |||||
1 | #include "SqpApplication.h" |
|
1 | #include "SqpApplication.h" | |
2 |
|
2 | |||
3 |
#include < |
|
3 | #include <Actions/ActionsGuiController.h> | |
4 | #include <Data/IDataProvider.h> |
|
4 | #include <Data/IDataProvider.h> | |
5 | #include <DataSource/DataSourceController.h> |
|
5 | #include <DataSource/DataSourceController.h> | |
6 | #include <DragAndDrop/DragDropGuiController.h> |
|
6 | #include <DragAndDrop/DragDropGuiController.h> | |
7 | #include <Network/NetworkController.h> |
|
7 | #include <Network/NetworkController.h> | |
8 | #include <QThread> |
|
8 | #include <QThread> | |
9 | #include <Time/TimeController.h> |
|
9 | #include <Time/TimeController.h> | |
10 | #include <Variable/Variable.h> |
|
10 | #include <Variable/Variable.h> | |
11 | #include <Variable/VariableController.h> |
|
11 | #include <Variable/VariableController.h> | |
12 | #include <Variable/VariableModel.h> |
|
12 | #include <Variable/VariableModel.h> | |
13 | #include <Visualization/VisualizationController.h> |
|
13 | #include <Visualization/VisualizationController.h> | |
14 |
|
14 | |||
15 | Q_LOGGING_CATEGORY(LOG_SqpApplication, "SqpApplication") |
|
15 | Q_LOGGING_CATEGORY(LOG_SqpApplication, "SqpApplication") | |
16 |
|
16 | |||
17 | class SqpApplication::SqpApplicationPrivate { |
|
17 | class SqpApplication::SqpApplicationPrivate { | |
18 | public: |
|
18 | public: | |
19 | SqpApplicationPrivate() |
|
19 | SqpApplicationPrivate() | |
20 | : m_DataSourceController{std::make_unique<DataSourceController>()}, |
|
20 | : m_DataSourceController{std::make_unique<DataSourceController>()}, | |
21 | m_VariableController{std::make_unique<VariableController>()}, |
|
21 | m_VariableController{std::make_unique<VariableController>()}, | |
22 | m_TimeController{std::make_unique<TimeController>()}, |
|
22 | m_TimeController{std::make_unique<TimeController>()}, | |
23 | m_NetworkController{std::make_unique<NetworkController>()}, |
|
23 | m_NetworkController{std::make_unique<NetworkController>()}, | |
24 | m_VisualizationController{std::make_unique<VisualizationController>()}, |
|
24 | m_VisualizationController{std::make_unique<VisualizationController>()}, | |
25 | m_DragDropGuiController{std::make_unique<DragDropGuiController>()}, |
|
25 | m_DragDropGuiController{std::make_unique<DragDropGuiController>()}, | |
26 | m_CatalogueController{std::make_unique<CatalogueController>()}, |
|
26 | m_CatalogueController{std::make_unique<CatalogueController>()}, | |
|
27 | m_ActionsGuiController{std::make_unique<ActionsGuiController>()}, | |||
27 | m_PlotInterractionMode(SqpApplication::PlotsInteractionMode::None), |
|
28 | m_PlotInterractionMode(SqpApplication::PlotsInteractionMode::None), | |
28 | m_PlotCursorMode(SqpApplication::PlotsCursorMode::NoCursor) |
|
29 | m_PlotCursorMode(SqpApplication::PlotsCursorMode::NoCursor) | |
29 | { |
|
30 | { | |
30 | // /////////////////////////////// // |
|
31 | // /////////////////////////////// // | |
31 | // Connections between controllers // |
|
32 | // Connections between controllers // | |
32 | // /////////////////////////////// // |
|
33 | // /////////////////////////////// // | |
33 |
|
34 | |||
34 | // VariableController <-> DataSourceController |
|
35 | // VariableController <-> DataSourceController | |
35 | connect(m_DataSourceController.get(), |
|
36 | connect(m_DataSourceController.get(), | |
36 | SIGNAL(variableCreationRequested(const QString &, const QVariantHash &, |
|
37 | SIGNAL(variableCreationRequested(const QString &, const QVariantHash &, | |
37 | std::shared_ptr<IDataProvider>)), |
|
38 | std::shared_ptr<IDataProvider>)), | |
38 | m_VariableController.get(), |
|
39 | m_VariableController.get(), | |
39 | SLOT(createVariable(const QString &, const QVariantHash &, |
|
40 | SLOT(createVariable(const QString &, const QVariantHash &, | |
40 | std::shared_ptr<IDataProvider>))); |
|
41 | std::shared_ptr<IDataProvider>))); | |
41 |
|
42 | |||
42 | connect(m_VariableController->variableModel(), &VariableModel::requestVariable, |
|
43 | connect(m_VariableController->variableModel(), &VariableModel::requestVariable, | |
43 | m_DataSourceController.get(), &DataSourceController::requestVariable); |
|
44 | m_DataSourceController.get(), &DataSourceController::requestVariable); | |
44 |
|
45 | |||
45 | // VariableController <-> VisualizationController |
|
46 | // VariableController <-> VisualizationController | |
46 | connect(m_VariableController.get(), |
|
47 | connect(m_VariableController.get(), | |
47 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), |
|
48 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), | |
48 | m_VisualizationController.get(), |
|
49 | m_VisualizationController.get(), | |
49 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), Qt::DirectConnection); |
|
50 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), Qt::DirectConnection); | |
50 |
|
51 | |||
51 | connect(m_VariableController.get(), |
|
52 | connect(m_VariableController.get(), | |
52 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &)), |
|
53 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &)), | |
53 | m_VisualizationController.get(), |
|
54 | m_VisualizationController.get(), | |
54 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &))); |
|
55 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &))); | |
55 |
|
56 | |||
56 |
|
57 | |||
57 | m_DataSourceController->moveToThread(&m_DataSourceControllerThread); |
|
58 | m_DataSourceController->moveToThread(&m_DataSourceControllerThread); | |
58 | m_DataSourceControllerThread.setObjectName("DataSourceControllerThread"); |
|
59 | m_DataSourceControllerThread.setObjectName("DataSourceControllerThread"); | |
59 | m_NetworkController->moveToThread(&m_NetworkControllerThread); |
|
60 | m_NetworkController->moveToThread(&m_NetworkControllerThread); | |
60 | m_NetworkControllerThread.setObjectName("NetworkControllerThread"); |
|
61 | m_NetworkControllerThread.setObjectName("NetworkControllerThread"); | |
61 | m_VariableController->moveToThread(&m_VariableControllerThread); |
|
62 | m_VariableController->moveToThread(&m_VariableControllerThread); | |
62 | m_VariableControllerThread.setObjectName("VariableControllerThread"); |
|
63 | m_VariableControllerThread.setObjectName("VariableControllerThread"); | |
63 | m_VisualizationController->moveToThread(&m_VisualizationControllerThread); |
|
64 | m_VisualizationController->moveToThread(&m_VisualizationControllerThread); | |
64 | m_VisualizationControllerThread.setObjectName("VsualizationControllerThread"); |
|
65 | m_VisualizationControllerThread.setObjectName("VsualizationControllerThread"); | |
65 | m_CatalogueController->moveToThread(&m_CatalogueControllerThread); |
|
|||
66 | m_CatalogueControllerThread.setObjectName("CatalogueControllerThread"); |
|
|||
67 |
|
66 | |||
68 |
|
67 | |||
69 | // Additionnal init |
|
68 | // Additionnal init | |
70 | m_VariableController->setTimeController(m_TimeController.get()); |
|
69 | m_VariableController->setTimeController(m_TimeController.get()); | |
71 | } |
|
70 | } | |
72 |
|
71 | |||
73 | virtual ~SqpApplicationPrivate() |
|
72 | virtual ~SqpApplicationPrivate() | |
74 | { |
|
73 | { | |
75 | m_DataSourceControllerThread.quit(); |
|
74 | m_DataSourceControllerThread.quit(); | |
76 | m_DataSourceControllerThread.wait(); |
|
75 | m_DataSourceControllerThread.wait(); | |
77 |
|
76 | |||
78 | m_NetworkControllerThread.quit(); |
|
77 | m_NetworkControllerThread.quit(); | |
79 | m_NetworkControllerThread.wait(); |
|
78 | m_NetworkControllerThread.wait(); | |
80 |
|
79 | |||
81 | m_VariableControllerThread.quit(); |
|
80 | m_VariableControllerThread.quit(); | |
82 | m_VariableControllerThread.wait(); |
|
81 | m_VariableControllerThread.wait(); | |
83 |
|
82 | |||
84 | m_VisualizationControllerThread.quit(); |
|
83 | m_VisualizationControllerThread.quit(); | |
85 | m_VisualizationControllerThread.wait(); |
|
84 | m_VisualizationControllerThread.wait(); | |
86 |
|
||||
87 | m_CatalogueControllerThread.quit(); |
|
|||
88 | m_CatalogueControllerThread.wait(); |
|
|||
89 | } |
|
85 | } | |
90 |
|
86 | |||
91 | std::unique_ptr<DataSourceController> m_DataSourceController; |
|
87 | std::unique_ptr<DataSourceController> m_DataSourceController; | |
92 | std::unique_ptr<VariableController> m_VariableController; |
|
88 | std::unique_ptr<VariableController> m_VariableController; | |
93 | std::unique_ptr<TimeController> m_TimeController; |
|
89 | std::unique_ptr<TimeController> m_TimeController; | |
94 | std::unique_ptr<NetworkController> m_NetworkController; |
|
90 | std::unique_ptr<NetworkController> m_NetworkController; | |
95 | std::unique_ptr<VisualizationController> m_VisualizationController; |
|
91 | std::unique_ptr<VisualizationController> m_VisualizationController; | |
96 | std::unique_ptr<CatalogueController> m_CatalogueController; |
|
92 | ||
97 | QThread m_DataSourceControllerThread; |
|
93 | QThread m_DataSourceControllerThread; | |
98 | QThread m_NetworkControllerThread; |
|
94 | QThread m_NetworkControllerThread; | |
99 | QThread m_VariableControllerThread; |
|
95 | QThread m_VariableControllerThread; | |
100 | QThread m_VisualizationControllerThread; |
|
96 | QThread m_VisualizationControllerThread; | |
101 | QThread m_CatalogueControllerThread; |
|
|||
102 |
|
97 | |||
103 | std::unique_ptr<DragDropGuiController> m_DragDropGuiController; |
|
98 | std::unique_ptr<DragDropGuiController> m_DragDropGuiController; | |
|
99 | std::unique_ptr<ActionsGuiController> m_ActionsGuiController; | |||
104 |
|
100 | |||
105 | SqpApplication::PlotsInteractionMode m_PlotInterractionMode; |
|
101 | SqpApplication::PlotsInteractionMode m_PlotInterractionMode; | |
106 | SqpApplication::PlotsCursorMode m_PlotCursorMode; |
|
102 | SqpApplication::PlotsCursorMode m_PlotCursorMode; | |
107 | }; |
|
103 | }; | |
108 |
|
104 | |||
109 |
|
105 | |||
110 | SqpApplication::SqpApplication(int &argc, char **argv) |
|
106 | SqpApplication::SqpApplication(int &argc, char **argv) | |
111 | : QApplication{argc, argv}, impl{spimpl::make_unique_impl<SqpApplicationPrivate>()} |
|
107 | : QApplication{argc, argv}, impl{spimpl::make_unique_impl<SqpApplicationPrivate>()} | |
112 | { |
|
108 | { | |
113 | qCDebug(LOG_SqpApplication()) << tr("SqpApplication construction") << QThread::currentThread(); |
|
109 | qCDebug(LOG_SqpApplication()) << tr("SqpApplication construction") << QThread::currentThread(); | |
114 |
|
110 | |||
115 | connect(&impl->m_DataSourceControllerThread, &QThread::started, |
|
111 | connect(&impl->m_DataSourceControllerThread, &QThread::started, | |
116 | impl->m_DataSourceController.get(), &DataSourceController::initialize); |
|
112 | impl->m_DataSourceController.get(), &DataSourceController::initialize); | |
117 | connect(&impl->m_DataSourceControllerThread, &QThread::finished, |
|
113 | connect(&impl->m_DataSourceControllerThread, &QThread::finished, | |
118 | impl->m_DataSourceController.get(), &DataSourceController::finalize); |
|
114 | impl->m_DataSourceController.get(), &DataSourceController::finalize); | |
119 |
|
115 | |||
120 | connect(&impl->m_NetworkControllerThread, &QThread::started, impl->m_NetworkController.get(), |
|
116 | connect(&impl->m_NetworkControllerThread, &QThread::started, impl->m_NetworkController.get(), | |
121 | &NetworkController::initialize); |
|
117 | &NetworkController::initialize); | |
122 | connect(&impl->m_NetworkControllerThread, &QThread::finished, impl->m_NetworkController.get(), |
|
118 | connect(&impl->m_NetworkControllerThread, &QThread::finished, impl->m_NetworkController.get(), | |
123 | &NetworkController::finalize); |
|
119 | &NetworkController::finalize); | |
124 |
|
120 | |||
125 | connect(&impl->m_VariableControllerThread, &QThread::started, impl->m_VariableController.get(), |
|
121 | connect(&impl->m_VariableControllerThread, &QThread::started, impl->m_VariableController.get(), | |
126 | &VariableController::initialize); |
|
122 | &VariableController::initialize); | |
127 | connect(&impl->m_VariableControllerThread, &QThread::finished, impl->m_VariableController.get(), |
|
123 | connect(&impl->m_VariableControllerThread, &QThread::finished, impl->m_VariableController.get(), | |
128 | &VariableController::finalize); |
|
124 | &VariableController::finalize); | |
129 |
|
125 | |||
130 | connect(&impl->m_VisualizationControllerThread, &QThread::started, |
|
126 | connect(&impl->m_VisualizationControllerThread, &QThread::started, | |
131 | impl->m_VisualizationController.get(), &VisualizationController::initialize); |
|
127 | impl->m_VisualizationController.get(), &VisualizationController::initialize); | |
132 | connect(&impl->m_VisualizationControllerThread, &QThread::finished, |
|
128 | connect(&impl->m_VisualizationControllerThread, &QThread::finished, | |
133 | impl->m_VisualizationController.get(), &VisualizationController::finalize); |
|
129 | impl->m_VisualizationController.get(), &VisualizationController::finalize); | |
134 |
|
130 | |||
135 | connect(&impl->m_CatalogueControllerThread, &QThread::started, |
|
|||
136 | impl->m_CatalogueController.get(), &CatalogueController::initialize); |
|
|||
137 | connect(&impl->m_CatalogueControllerThread, &QThread::finished, |
|
|||
138 | impl->m_CatalogueController.get(), &CatalogueController::finalize); |
|
|||
139 |
|
||||
140 | impl->m_DataSourceControllerThread.start(); |
|
131 | impl->m_DataSourceControllerThread.start(); | |
141 | impl->m_NetworkControllerThread.start(); |
|
132 | impl->m_NetworkControllerThread.start(); | |
142 | impl->m_VariableControllerThread.start(); |
|
133 | impl->m_VariableControllerThread.start(); | |
143 | impl->m_VisualizationControllerThread.start(); |
|
134 | impl->m_VisualizationControllerThread.start(); | |
144 | impl->m_CatalogueControllerThread.start(); |
|
|||
145 | } |
|
135 | } | |
146 |
|
136 | |||
147 | SqpApplication::~SqpApplication() |
|
137 | SqpApplication::~SqpApplication() | |
148 | { |
|
138 | { | |
149 | } |
|
139 | } | |
150 |
|
140 | |||
151 | void SqpApplication::initialize() |
|
141 | void SqpApplication::initialize() | |
152 | { |
|
142 | { | |
153 | } |
|
143 | } | |
154 |
|
144 | |||
155 | DataSourceController &SqpApplication::dataSourceController() noexcept |
|
145 | DataSourceController &SqpApplication::dataSourceController() noexcept | |
156 | { |
|
146 | { | |
157 | return *impl->m_DataSourceController; |
|
147 | return *impl->m_DataSourceController; | |
158 | } |
|
148 | } | |
159 |
|
149 | |||
160 | NetworkController &SqpApplication::networkController() noexcept |
|
150 | NetworkController &SqpApplication::networkController() noexcept | |
161 | { |
|
151 | { | |
162 | return *impl->m_NetworkController; |
|
152 | return *impl->m_NetworkController; | |
163 | } |
|
153 | } | |
164 |
|
154 | |||
165 | TimeController &SqpApplication::timeController() noexcept |
|
155 | TimeController &SqpApplication::timeController() noexcept | |
166 | { |
|
156 | { | |
167 | return *impl->m_TimeController; |
|
157 | return *impl->m_TimeController; | |
168 | } |
|
158 | } | |
169 |
|
159 | |||
170 | VariableController &SqpApplication::variableController() noexcept |
|
160 | VariableController &SqpApplication::variableController() noexcept | |
171 | { |
|
161 | { | |
172 | return *impl->m_VariableController; |
|
162 | return *impl->m_VariableController; | |
173 | } |
|
163 | } | |
174 |
|
164 | |||
175 | VisualizationController &SqpApplication::visualizationController() noexcept |
|
165 | VisualizationController &SqpApplication::visualizationController() noexcept | |
176 | { |
|
166 | { | |
177 | return *impl->m_VisualizationController; |
|
167 | return *impl->m_VisualizationController; | |
178 | } |
|
168 | } | |
179 |
|
169 | |||
180 | DragDropGuiController &SqpApplication::dragDropGuiController() noexcept |
|
170 | DragDropGuiController &SqpApplication::dragDropGuiController() noexcept | |
181 | { |
|
171 | { | |
182 | return *impl->m_DragDropGuiController; |
|
172 | return *impl->m_DragDropGuiController; | |
183 | } |
|
173 | } | |
184 |
|
174 | |||
|
175 | ActionsGuiController &SqpApplication::actionsGuiController() noexcept | |||
|
176 | { | |||
|
177 | return *impl->m_ActionsGuiController; | |||
|
178 | } | |||
|
179 | ||||
185 | SqpApplication::PlotsInteractionMode SqpApplication::plotsInteractionMode() const |
|
180 | SqpApplication::PlotsInteractionMode SqpApplication::plotsInteractionMode() const | |
186 | { |
|
181 | { | |
187 | return impl->m_PlotInterractionMode; |
|
182 | return impl->m_PlotInterractionMode; | |
188 | } |
|
183 | } | |
189 |
|
184 | |||
190 | void SqpApplication::setPlotsInteractionMode(SqpApplication::PlotsInteractionMode mode) |
|
185 | void SqpApplication::setPlotsInteractionMode(SqpApplication::PlotsInteractionMode mode) | |
191 | { |
|
186 | { | |
192 | impl->m_PlotInterractionMode = mode; |
|
187 | impl->m_PlotInterractionMode = mode; | |
193 | } |
|
188 | } | |
194 |
|
189 | |||
195 | SqpApplication::PlotsCursorMode SqpApplication::plotsCursorMode() const |
|
190 | SqpApplication::PlotsCursorMode SqpApplication::plotsCursorMode() const | |
196 | { |
|
191 | { | |
197 | return impl->m_PlotCursorMode; |
|
192 | return impl->m_PlotCursorMode; | |
198 | } |
|
193 | } | |
199 |
|
194 | |||
200 | void SqpApplication::setPlotsCursorMode(SqpApplication::PlotsCursorMode mode) |
|
195 | void SqpApplication::setPlotsCursorMode(SqpApplication::PlotsCursorMode mode) | |
201 | { |
|
196 | { | |
202 | impl->m_PlotCursorMode = mode; |
|
197 | impl->m_PlotCursorMode = mode; | |
203 | } |
|
198 | } |
General Comments 0
You need to be logged in to leave comments.
Login now