##// END OF EJS Templates
correction of merge
perrinel -
r1059:5b22e1d6dd6f
parent child
Show More
@@ -0,0 +1,51
1 #ifndef SCIQLOP_CATALOGUECONTROLLER_H
2 #define SCIQLOP_CATALOGUECONTROLLER_H
3
4 #include "CoreGlobal.h"
5
6 #include <Data/SqpRange.h>
7
8 #include <QLoggingCategory>
9 #include <QObject>
10 #include <QUuid>
11
12 #include <Common/spimpl.h>
13
14 Q_DECLARE_LOGGING_CATEGORY(LOG_CatalogueController)
15
16 class DataSourceItem;
17 class Variable;
18
19 /**
20 * @brief The CatalogueController class aims to make the link between SciQlop and its plugins.
21 * This is the intermediate class that SciQlop has to use in the way to connect a data source.
22 * Please first use register method to initialize a plugin specified by its metadata name (JSON
23 * plugin source) then others specifics method will be able to access it. You can load a data source
24 * driver plugin then create a data source.
25 */
26 class SCIQLOP_CORE_EXPORT CatalogueController : public QObject {
27 Q_OBJECT
28 public:
29 explicit CatalogueController(QObject *parent = 0);
30 virtual ~CatalogueController();
31
32 signals:
33 /// Signal emitted when a variable is about to be deleted from SciQlop
34 void variableAboutToBeDeleted(std::shared_ptr<Variable> variable);
35
36 /// Signal emitted when a data acquisition is requested on a range for a variable
37 void rangeChanged(std::shared_ptr<Variable> variable, const SqpRange &range);
38
39 public slots:
40 /// Manage init/end of the controller
41 void initialize();
42 void finalize();
43
44 private:
45 void waitForFinish();
46
47 class CatalogueControllerPrivate;
48 spimpl::unique_impl_ptr<CatalogueControllerPrivate> impl;
49 };
50
51 #endif // SCIQLOP_CATALOGUECONTROLLER_H
@@ -0,0 +1,52
1 #include <Catalogue/CatalogueController.h>
2
3 #include <Variable/Variable.h>
4
5 #include <CatalogueDao.h>
6
7 #include <QMutex>
8 #include <QThread>
9
10 #include <QDir>
11 #include <QStandardPaths>
12
13 Q_LOGGING_CATEGORY(LOG_CatalogueController, "CatalogueController")
14
15 class CatalogueController::CatalogueControllerPrivate {
16 public:
17 QMutex m_WorkingMutex;
18 CatalogueDao m_CatalogueDao;
19 };
20
21 CatalogueController::CatalogueController(QObject *parent)
22 : impl{spimpl::make_unique_impl<CatalogueControllerPrivate>()}
23 {
24 qCDebug(LOG_CatalogueController()) << tr("CatalogueController construction")
25 << QThread::currentThread();
26 }
27
28 CatalogueController::~CatalogueController()
29 {
30 qCDebug(LOG_CatalogueController()) << tr("CatalogueController destruction")
31 << QThread::currentThread();
32 this->waitForFinish();
33 }
34
35 void CatalogueController::initialize()
36 {
37 qCDebug(LOG_CatalogueController()) << tr("CatalogueController init")
38 << QThread::currentThread();
39 impl->m_WorkingMutex.lock();
40 impl->m_CatalogueDao.initialize();
41 qCDebug(LOG_CatalogueController()) << tr("CatalogueController init END");
42 }
43
44 void CatalogueController::finalize()
45 {
46 impl->m_WorkingMutex.unlock();
47 }
48
49 void CatalogueController::waitForFinish()
50 {
51 QMutexLocker locker{&impl->m_WorkingMutex};
52 }
@@ -1,5 +1,6
1 #include "SqpApplication.h"
1 #include "SqpApplication.h"
2
2
3 #include <Catalogue/CatalogueController.h>
3 #include <Data/IDataProvider.h>
4 #include <Data/IDataProvider.h>
4 #include <DataSource/DataSourceController.h>
5 #include <DataSource/DataSourceController.h>
5 #include <DragAndDrop/DragDropHelper.h>
6 #include <DragAndDrop/DragDropHelper.h>
@@ -22,6 +23,7 public:
22 m_NetworkController{std::make_unique<NetworkController>()},
23 m_NetworkController{std::make_unique<NetworkController>()},
23 m_VisualizationController{std::make_unique<VisualizationController>()},
24 m_VisualizationController{std::make_unique<VisualizationController>()},
24 m_DragDropHelper{std::make_unique<DragDropHelper>()},
25 m_DragDropHelper{std::make_unique<DragDropHelper>()},
26 m_CatalogueController{std::make_unique<CatalogueController>()},
25 m_PlotInterractionMode(SqpApplication::PlotsInteractionMode::None),
27 m_PlotInterractionMode(SqpApplication::PlotsInteractionMode::None),
26 m_PlotCursorMode(SqpApplication::PlotsCursorMode::NoCursor)
28 m_PlotCursorMode(SqpApplication::PlotsCursorMode::NoCursor)
27 {
29 {
@@ -60,6 +62,8 public:
60 m_VariableControllerThread.setObjectName("VariableControllerThread");
62 m_VariableControllerThread.setObjectName("VariableControllerThread");
61 m_VisualizationController->moveToThread(&m_VisualizationControllerThread);
63 m_VisualizationController->moveToThread(&m_VisualizationControllerThread);
62 m_VisualizationControllerThread.setObjectName("VsualizationControllerThread");
64 m_VisualizationControllerThread.setObjectName("VsualizationControllerThread");
65 m_CatalogueController->moveToThread(&m_CatalogueControllerThread);
66 m_CatalogueControllerThread.setObjectName("CatalogueControllerThread");
63
67
64
68
65 // Additionnal init
69 // Additionnal init
@@ -79,6 +83,9 public:
79
83
80 m_VisualizationControllerThread.quit();
84 m_VisualizationControllerThread.quit();
81 m_VisualizationControllerThread.wait();
85 m_VisualizationControllerThread.wait();
86
87 m_CatalogueControllerThread.quit();
88 m_CatalogueControllerThread.wait();
82 }
89 }
83
90
84 std::unique_ptr<DataSourceController> m_DataSourceController;
91 std::unique_ptr<DataSourceController> m_DataSourceController;
@@ -86,10 +93,12 public:
86 std::unique_ptr<TimeController> m_TimeController;
93 std::unique_ptr<TimeController> m_TimeController;
87 std::unique_ptr<NetworkController> m_NetworkController;
94 std::unique_ptr<NetworkController> m_NetworkController;
88 std::unique_ptr<VisualizationController> m_VisualizationController;
95 std::unique_ptr<VisualizationController> m_VisualizationController;
96 std::unique_ptr<CatalogueController> m_CatalogueController;
89 QThread m_DataSourceControllerThread;
97 QThread m_DataSourceControllerThread;
90 QThread m_NetworkControllerThread;
98 QThread m_NetworkControllerThread;
91 QThread m_VariableControllerThread;
99 QThread m_VariableControllerThread;
92 QThread m_VisualizationControllerThread;
100 QThread m_VisualizationControllerThread;
101 QThread m_CatalogueControllerThread;
93
102
94 std::unique_ptr<DragDropHelper> m_DragDropHelper;
103 std::unique_ptr<DragDropHelper> m_DragDropHelper;
95
104
@@ -123,10 +132,16 SqpApplication::SqpApplication(int &argc, char **argv)
123 connect(&impl->m_VisualizationControllerThread, &QThread::finished,
132 connect(&impl->m_VisualizationControllerThread, &QThread::finished,
124 impl->m_VisualizationController.get(), &VisualizationController::finalize);
133 impl->m_VisualizationController.get(), &VisualizationController::finalize);
125
134
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
126 impl->m_DataSourceControllerThread.start();
140 impl->m_DataSourceControllerThread.start();
127 impl->m_NetworkControllerThread.start();
141 impl->m_NetworkControllerThread.start();
128 impl->m_VariableControllerThread.start();
142 impl->m_VariableControllerThread.start();
129 impl->m_VisualizationControllerThread.start();
143 impl->m_VisualizationControllerThread.start();
144 impl->m_CatalogueControllerThread.start();
130 }
145 }
131
146
132 SqpApplication::~SqpApplication()
147 SqpApplication::~SqpApplication()
General Comments 0
You need to be logged in to leave comments. Login now