@@ -1,69 +1,72 | |||||
1 | #include "SqpApplication.h" |
|
1 | #include "SqpApplication.h" | |
2 |
|
2 | |||
3 | #include <DataSource/DataSourceController.h> |
|
3 | #include <DataSource/DataSourceController.h> | |
4 | #include <QThread> |
|
4 | #include <QThread> | |
5 | #include <Visualization/VisualizationController.h> |
|
5 | #include <Visualization/VisualizationController.h> | |
6 |
|
6 | |||
7 | Q_LOGGING_CATEGORY(LOG_SqpApplication, "SqpApplication") |
|
7 | Q_LOGGING_CATEGORY(LOG_SqpApplication, "SqpApplication") | |
8 |
|
8 | |||
9 | class SqpApplication::SqpApplicationPrivate { |
|
9 | class SqpApplication::SqpApplicationPrivate { | |
10 | public: |
|
10 | public: | |
11 | SqpApplicationPrivate() : m_DataSourceController{std::make_unique<DataSourceController>()} |
|
11 | SqpApplicationPrivate() | |
|
12 | : m_DataSourceController{std::make_unique<DataSourceController>()}, | |||
|
13 | m_VisualizationController{std::make_unique<VisualizationController>()} | |||
12 | { |
|
14 | { | |
13 | m_DataSourceController->moveToThread(&m_DataSourceControllerThread); |
|
15 | m_DataSourceController->moveToThread(&m_DataSourceControllerThread); | |
|
16 | m_VisualizationController->moveToThread(&m_VisualizationControllerThread); | |||
14 | } |
|
17 | } | |
15 |
|
18 | |||
16 | virtual ~SqpApplicationPrivate() |
|
19 | virtual ~SqpApplicationPrivate() | |
17 | { |
|
20 | { | |
18 | qCInfo(LOG_SqpApplication()) << tr("SqpApplicationPrivate destruction"); |
|
21 | qCInfo(LOG_SqpApplication()) << tr("SqpApplicationPrivate destruction"); | |
19 | m_DataSourceControllerThread.quit(); |
|
22 | m_DataSourceControllerThread.quit(); | |
20 | m_DataSourceControllerThread.wait(); |
|
23 | m_DataSourceControllerThread.wait(); | |
21 |
|
24 | |||
22 | m_VisualizationThread.quit(); |
|
25 | m_VisualizationControllerThread.quit(); | |
23 | m_VisualizationThread.wait(); |
|
26 | m_VisualizationControllerThread.wait(); | |
24 | } |
|
27 | } | |
25 |
|
28 | |||
26 | std::unique_ptr<DataSourceController> m_DataSourceController; |
|
29 | std::unique_ptr<DataSourceController> m_DataSourceController; | |
27 | std::unique_ptr<VisualizationController> m_VisualizationController; |
|
30 | std::unique_ptr<VisualizationController> m_VisualizationController; | |
28 | QThread m_DataSourceControllerThread; |
|
31 | QThread m_DataSourceControllerThread; | |
29 | QThread m_VisualizationThread; |
|
32 | QThread m_VisualizationControllerThread; | |
30 | }; |
|
33 | }; | |
31 |
|
34 | |||
32 |
|
35 | |||
33 | SqpApplication::SqpApplication(int &argc, char **argv) |
|
36 | SqpApplication::SqpApplication(int &argc, char **argv) | |
34 | : QApplication{argc, argv}, impl{spimpl::make_unique_impl<SqpApplicationPrivate>()} |
|
37 | : QApplication{argc, argv}, impl{spimpl::make_unique_impl<SqpApplicationPrivate>()} | |
35 | { |
|
38 | { | |
36 | qCInfo(LOG_SqpApplication()) << tr("SqpApplication construction"); |
|
39 | qCInfo(LOG_SqpApplication()) << tr("SqpApplication construction"); | |
37 |
|
40 | |||
38 | connect(&impl->m_DataSourceControllerThread, &QThread::started, |
|
41 | connect(&impl->m_DataSourceControllerThread, &QThread::started, | |
39 | impl->m_DataSourceController.get(), &DataSourceController::initialize); |
|
42 | impl->m_DataSourceController.get(), &DataSourceController::initialize); | |
40 | connect(&impl->m_DataSourceControllerThread, &QThread::finished, |
|
43 | connect(&impl->m_DataSourceControllerThread, &QThread::finished, | |
41 | impl->m_DataSourceController.get(), &DataSourceController::finalize); |
|
44 | impl->m_DataSourceController.get(), &DataSourceController::finalize); | |
42 |
|
45 | |||
43 |
connect(&impl->m_VisualizationThread, &QThread::started, |
|
46 | connect(&impl->m_VisualizationControllerThread, &QThread::started, | |
44 | &VisualizationController::initialize); |
|
47 | impl->m_VisualizationController.get(), &VisualizationController::initialize); | |
45 |
connect(&impl->m_VisualizationThread, &QThread::finished, |
|
48 | connect(&impl->m_VisualizationControllerThread, &QThread::finished, | |
46 | &VisualizationController::finalize); |
|
49 | impl->m_VisualizationController.get(), &VisualizationController::finalize); | |
47 |
|
50 | |||
48 |
|
51 | |||
49 | impl->m_DataSourceControllerThread.start(); |
|
52 | impl->m_DataSourceControllerThread.start(); | |
50 | impl->m_VisualizationThread.start(); |
|
53 | impl->m_VisualizationControllerThread.start(); | |
51 | } |
|
54 | } | |
52 |
|
55 | |||
53 | SqpApplication::~SqpApplication() |
|
56 | SqpApplication::~SqpApplication() | |
54 | { |
|
57 | { | |
55 | } |
|
58 | } | |
56 |
|
59 | |||
57 | void SqpApplication::initialize() |
|
60 | void SqpApplication::initialize() | |
58 | { |
|
61 | { | |
59 | } |
|
62 | } | |
60 |
|
63 | |||
61 | DataSourceController &SqpApplication::dataSourceController() const noexcept |
|
64 | DataSourceController &SqpApplication::dataSourceController() const noexcept | |
62 | { |
|
65 | { | |
63 | return *impl->m_DataSourceController; |
|
66 | return *impl->m_DataSourceController; | |
64 | } |
|
67 | } | |
65 |
|
68 | |||
66 | VisualizationController &SqpApplication::visualizationController() const noexcept |
|
69 | VisualizationController &SqpApplication::visualizationController() const noexcept | |
67 | { |
|
70 | { | |
68 | return *impl->m_VisualizationController; |
|
71 | return *impl->m_VisualizationController; | |
69 | } |
|
72 | } |
General Comments 0
You need to be logged in to leave comments.
Login now