I don't think the catalogue has any connection with the plugins.
@@ -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 | 1 | #include "SqpApplication.h" |
|
2 | 2 | |
|
3 | #include <Catalogue/CatalogueController.h> | |
|
3 | 4 | #include <Data/IDataProvider.h> |
|
4 | 5 | #include <DataSource/DataSourceController.h> |
|
5 | 6 | #include <DragAndDrop/DragDropHelper.h> |
@@ -22,6 +23,7 public: | |||
|
22 | 23 | m_NetworkController{std::make_unique<NetworkController>()}, |
|
23 | 24 | m_VisualizationController{std::make_unique<VisualizationController>()}, |
|
24 | 25 | m_DragDropHelper{std::make_unique<DragDropHelper>()}, |
|
26 | m_CatalogueController{std::make_unique<CatalogueController>()}, | |
|
25 | 27 | m_PlotInterractionMode(SqpApplication::PlotsInteractionMode::None), |
|
26 | 28 | m_PlotCursorMode(SqpApplication::PlotsCursorMode::NoCursor) |
|
27 | 29 | { |
@@ -60,6 +62,8 public: | |||
|
60 | 62 | m_VariableControllerThread.setObjectName("VariableControllerThread"); |
|
61 | 63 | m_VisualizationController->moveToThread(&m_VisualizationControllerThread); |
|
62 | 64 | m_VisualizationControllerThread.setObjectName("VsualizationControllerThread"); |
|
65 | m_CatalogueController->moveToThread(&m_CatalogueControllerThread); | |
|
66 | m_CatalogueControllerThread.setObjectName("CatalogueControllerThread"); | |
|
63 | 67 | |
|
64 | 68 | |
|
65 | 69 | // Additionnal init |
@@ -79,6 +83,9 public: | |||
|
79 | 83 | |
|
80 | 84 | m_VisualizationControllerThread.quit(); |
|
81 | 85 | m_VisualizationControllerThread.wait(); |
|
86 | ||
|
87 | m_CatalogueControllerThread.quit(); | |
|
88 | m_CatalogueControllerThread.wait(); | |
|
82 | 89 | } |
|
83 | 90 | |
|
84 | 91 | std::unique_ptr<DataSourceController> m_DataSourceController; |
@@ -86,10 +93,12 public: | |||
|
86 | 93 | std::unique_ptr<TimeController> m_TimeController; |
|
87 | 94 | std::unique_ptr<NetworkController> m_NetworkController; |
|
88 | 95 | std::unique_ptr<VisualizationController> m_VisualizationController; |
|
96 | std::unique_ptr<CatalogueController> m_CatalogueController; | |
|
89 | 97 | QThread m_DataSourceControllerThread; |
|
90 | 98 | QThread m_NetworkControllerThread; |
|
91 | 99 | QThread m_VariableControllerThread; |
|
92 | 100 | QThread m_VisualizationControllerThread; |
|
101 | QThread m_CatalogueControllerThread; | |
|
93 | 102 | |
|
94 | 103 | std::unique_ptr<DragDropHelper> m_DragDropHelper; |
|
95 | 104 | |
@@ -123,10 +132,16 SqpApplication::SqpApplication(int &argc, char **argv) | |||
|
123 | 132 | connect(&impl->m_VisualizationControllerThread, &QThread::finished, |
|
124 | 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 | 140 | impl->m_DataSourceControllerThread.start(); |
|
127 | 141 | impl->m_NetworkControllerThread.start(); |
|
128 | 142 | impl->m_VariableControllerThread.start(); |
|
129 | 143 | impl->m_VisualizationControllerThread.start(); |
|
144 | impl->m_CatalogueControllerThread.start(); | |
|
130 | 145 | } |
|
131 | 146 | |
|
132 | 147 | SqpApplication::~SqpApplication() |
General Comments 3
Auto status change to "Under Review"
Status change > Approved
You need to be logged in to leave comments.
Login now