@@ -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 | } |
@@ -21,6 +21,7 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 | |
@@ -48,6 +49,7 public: | |||||
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 |
@@ -17,7 +17,8 gui_moc_headers = [ | |||||
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 = [ | |
@@ -84,7 +85,9 gui_sources = [ | |||||
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']) |
@@ -1,6 +1,6 | |||||
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> | |
@@ -24,6 +24,7 public: | |||||
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 | { | |
@@ -62,8 +63,6 public: | |||||
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 | |
@@ -83,9 +82,6 public: | |||||
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; | |
@@ -93,14 +89,14 public: | |||||
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; | |
@@ -132,16 +128,10 SqpApplication::SqpApplication(int &argc, char **argv) | |||||
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() | |
@@ -182,6 +172,11 DragDropGuiController &SqpApplication::dragDropGuiController() noexcept | |||||
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; |
General Comments 0
You need to be logged in to leave comments.
Login now