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