Auto status change to "Under Review"
@@ -0,0 +1,39 | |||||
|
1 | #ifndef SCIQLOP_VISUALIZATIONCONTROLLER_H | |||
|
2 | #define SCIQLOP_VISUALIZATIONCONTROLLER_H | |||
|
3 | ||||
|
4 | #include <QLoggingCategory> | |||
|
5 | #include <QObject> | |||
|
6 | #include <QUuid> | |||
|
7 | ||||
|
8 | #include <Common/spimpl.h> | |||
|
9 | ||||
|
10 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationController) | |||
|
11 | ||||
|
12 | class DataSourceItem; | |||
|
13 | ||||
|
14 | /** | |||
|
15 | * @brief The VisualizationController class aims to make the link between SciQlop and its plugins. | |||
|
16 | * This is the intermediate class that SciQlop has to use in the way to connect a data source. | |||
|
17 | * Please first use register method to initialize a plugin specified by its metadata name (JSON | |||
|
18 | * plugin source) then others specifics method will be able to access it. You can load a data source | |||
|
19 | * driver plugin then create a data source. | |||
|
20 | */ | |||
|
21 | class VisualizationController : public QObject { | |||
|
22 | Q_OBJECT | |||
|
23 | public: | |||
|
24 | explicit VisualizationController(QObject *parent = 0); | |||
|
25 | virtual ~VisualizationController(); | |||
|
26 | ||||
|
27 | public slots: | |||
|
28 | /// Manage init/end of the controller | |||
|
29 | void initialize(); | |||
|
30 | void finalize(); | |||
|
31 | ||||
|
32 | private: | |||
|
33 | void waitForFinish(); | |||
|
34 | ||||
|
35 | class VisualizationControllerPrivate; | |||
|
36 | spimpl::unique_impl_ptr<VisualizationControllerPrivate> impl; | |||
|
37 | }; | |||
|
38 | ||||
|
39 | #endif // SCIQLOP_VISUALIZATIONCONTROLLER_H |
@@ -0,0 +1,46 | |||||
|
1 | #include <Visualization/VisualizationController.h> | |||
|
2 | ||||
|
3 | #include <QMutex> | |||
|
4 | #include <QThread> | |||
|
5 | ||||
|
6 | #include <QDir> | |||
|
7 | #include <QStandardPaths> | |||
|
8 | ||||
|
9 | Q_LOGGING_CATEGORY(LOG_VisualizationController, "VisualizationController") | |||
|
10 | ||||
|
11 | class VisualizationController::VisualizationControllerPrivate { | |||
|
12 | public: | |||
|
13 | QMutex m_WorkingMutex; | |||
|
14 | }; | |||
|
15 | ||||
|
16 | VisualizationController::VisualizationController(QObject *parent) | |||
|
17 | : impl{spimpl::make_unique_impl<VisualizationControllerPrivate>()} | |||
|
18 | { | |||
|
19 | qCDebug(LOG_VisualizationController()) | |||
|
20 | << tr("VisualizationController construction") << QThread::currentThread(); | |||
|
21 | } | |||
|
22 | ||||
|
23 | VisualizationController::~VisualizationController() | |||
|
24 | { | |||
|
25 | qCDebug(LOG_VisualizationController()) | |||
|
26 | << tr("VisualizationController destruction") << QThread::currentThread(); | |||
|
27 | this->waitForFinish(); | |||
|
28 | } | |||
|
29 | ||||
|
30 | void VisualizationController::initialize() | |||
|
31 | { | |||
|
32 | qCDebug(LOG_VisualizationController()) | |||
|
33 | << tr("VisualizationController init") << QThread::currentThread(); | |||
|
34 | impl->m_WorkingMutex.lock(); | |||
|
35 | qCDebug(LOG_VisualizationController()) << tr("VisualizationController init END"); | |||
|
36 | } | |||
|
37 | ||||
|
38 | void VisualizationController::finalize() | |||
|
39 | { | |||
|
40 | impl->m_WorkingMutex.unlock(); | |||
|
41 | } | |||
|
42 | ||||
|
43 | void VisualizationController::waitForFinish() | |||
|
44 | { | |||
|
45 | QMutexLocker locker{&impl->m_WorkingMutex}; | |||
|
46 | } |
@@ -16,6 +16,7 Q_DECLARE_LOGGING_CATEGORY(LOG_SqpApplication) | |||||
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 VisualizationController; | |||
19 |
|
20 | |||
20 | /** |
|
21 | /** | |
21 | * @brief The SqpApplication class aims to make the link between SciQlop |
|
22 | * @brief The SqpApplication class aims to make the link between SciQlop | |
@@ -33,7 +34,9 public: | |||||
33 | virtual ~SqpApplication(); |
|
34 | virtual ~SqpApplication(); | |
34 | void initialize(); |
|
35 | void initialize(); | |
35 |
|
36 | |||
|
37 | /// Accessors for the differents sciqlop controllers | |||
36 | DataSourceController &dataSourceController() const noexcept; |
|
38 | DataSourceController &dataSourceController() const noexcept; | |
|
39 | VisualizationController &visualizationController() const noexcept; | |||
37 |
|
40 | |||
38 | private: |
|
41 | private: | |
39 | class SqpApplicationPrivate; |
|
42 | class SqpApplicationPrivate; |
@@ -2,6 +2,7 | |||||
2 |
|
2 | |||
3 | #include <DataSource/DataSourceController.h> |
|
3 | #include <DataSource/DataSourceController.h> | |
4 | #include <QThread> |
|
4 | #include <QThread> | |
|
5 | #include <Visualization/VisualizationController.h> | |||
5 |
|
6 | |||
6 | Q_LOGGING_CATEGORY(LOG_SqpApplication, "SqpApplication") |
|
7 | Q_LOGGING_CATEGORY(LOG_SqpApplication, "SqpApplication") | |
7 |
|
8 | |||
@@ -17,10 +18,15 public: | |||||
17 | qCInfo(LOG_SqpApplication()) << tr("SqpApplicationPrivate destruction"); |
|
18 | qCInfo(LOG_SqpApplication()) << tr("SqpApplicationPrivate destruction"); | |
18 | m_DataSourceControllerThread.quit(); |
|
19 | m_DataSourceControllerThread.quit(); | |
19 | m_DataSourceControllerThread.wait(); |
|
20 | m_DataSourceControllerThread.wait(); | |
|
21 | ||||
|
22 | m_VisualizationThread.quit(); | |||
|
23 | m_VisualizationThread.wait(); | |||
20 | } |
|
24 | } | |
21 |
|
25 | |||
22 | std::unique_ptr<DataSourceController> m_DataSourceController; |
|
26 | std::unique_ptr<DataSourceController> m_DataSourceController; | |
|
27 | std::unique_ptr<VisualizationController> m_VisualizationController; | |||
23 | QThread m_DataSourceControllerThread; |
|
28 | QThread m_DataSourceControllerThread; | |
|
29 | QThread m_VisualizationThread; | |||
24 | }; |
|
30 | }; | |
25 |
|
31 | |||
26 |
|
32 | |||
@@ -34,7 +40,14 SqpApplication::SqpApplication(int &argc, char **argv) | |||||
34 | connect(&impl->m_DataSourceControllerThread, &QThread::finished, |
|
40 | connect(&impl->m_DataSourceControllerThread, &QThread::finished, | |
35 | impl->m_DataSourceController.get(), &DataSourceController::finalize); |
|
41 | impl->m_DataSourceController.get(), &DataSourceController::finalize); | |
36 |
|
42 | |||
|
43 | connect(&impl->m_VisualizationThread, &QThread::started, impl->m_VisualizationController.get(), | |||
|
44 | &VisualizationController::initialize); | |||
|
45 | connect(&impl->m_VisualizationThread, &QThread::finished, impl->m_VisualizationController.get(), | |||
|
46 | &VisualizationController::finalize); | |||
|
47 | ||||
|
48 | ||||
37 | impl->m_DataSourceControllerThread.start(); |
|
49 | impl->m_DataSourceControllerThread.start(); | |
|
50 | impl->m_VisualizationThread.start(); | |||
38 | } |
|
51 | } | |
39 |
|
52 | |||
40 | SqpApplication::~SqpApplication() |
|
53 | SqpApplication::~SqpApplication() | |
@@ -49,3 +62,8 DataSourceController &SqpApplication::dataSourceController() const noexcept | |||||
49 | { |
|
62 | { | |
50 | return *impl->m_DataSourceController; |
|
63 | return *impl->m_DataSourceController; | |
51 | } |
|
64 | } | |
|
65 | ||||
|
66 | VisualizationController &SqpApplication::visualizationController() const noexcept | |||
|
67 | { | |||
|
68 | return *impl->m_VisualizationController; | |||
|
69 | } |
General Comments 8
Status change > Approved
Pull request updated. Auto status change to "Under Review"
Changed commits: * 1 added * 0 removed Changed files: * M core/CMakeLists.txt
Status change > Approved
You need to be logged in to leave comments.
Login now