##// END OF EJS Templates
unthread the catalogue controller
trabillard -
r1267:f8134d25db94
parent child
Show More
@@ -49,10 +49,12 int main(int argc, char *argv[])
49 #endif
49 #endif
50 Q_INIT_RESOURCE(sqpguiresources);
50 Q_INIT_RESOURCE(sqpguiresources);
51
51
52 SqpApplication a{argc, argv};
53 SqpApplication::setOrganizationName("LPP");
52 SqpApplication::setOrganizationName("LPP");
54 SqpApplication::setOrganizationDomain("lpp.fr");
53 SqpApplication::setOrganizationDomain("lpp.fr");
55 SqpApplication::setApplicationName("SciQLop");
54 SqpApplication::setApplicationName("SciQLop");
55
56 SqpApplication a{argc, argv};
57
56 MainWindow w;
58 MainWindow w;
57 w.show();
59 w.show();
58
60
@@ -71,11 +71,8 public:
71 public slots:
71 public slots:
72 /// Manage init/end of the controller
72 /// Manage init/end of the controller
73 void initialize();
73 void initialize();
74 void finalize();
75
74
76 private:
75 private:
77 void waitForFinish();
78
79 class CatalogueControllerPrivate;
76 class CatalogueControllerPrivate;
80 spimpl::unique_impl_ptr<CatalogueControllerPrivate> impl;
77 spimpl::unique_impl_ptr<CatalogueControllerPrivate> impl;
81 };
78 };
@@ -32,7 +32,6 class CatalogueController::CatalogueControllerPrivate {
32 public:
32 public:
33 explicit CatalogueControllerPrivate(CatalogueController *parent) : m_Q{parent} {}
33 explicit CatalogueControllerPrivate(CatalogueController *parent) : m_Q{parent} {}
34
34
35 QMutex m_WorkingMutex;
36 CatalogueDao m_CatalogueDao;
35 CatalogueDao m_CatalogueDao;
37
36
38 QStringList m_RepositoryList;
37 QStringList m_RepositoryList;
@@ -58,7 +57,6 CatalogueController::~CatalogueController()
58 {
57 {
59 qCDebug(LOG_CatalogueController()) << tr("CatalogueController destruction")
58 qCDebug(LOG_CatalogueController()) << tr("CatalogueController destruction")
60 << QThread::currentThread();
59 << QThread::currentThread();
61 this->waitForFinish();
62 }
60 }
63
61
64 QStringList CatalogueController::getRepositories() const
62 QStringList CatalogueController::getRepositories() const
@@ -279,9 +277,14 CatalogueController::eventsForMimeData(const QByteArray &mimeData) const
279
277
280 void CatalogueController::initialize()
278 void CatalogueController::initialize()
281 {
279 {
280 <<<<<<< HEAD
282 qCDebug(LOG_CatalogueController()) << tr("CatalogueController init")
281 qCDebug(LOG_CatalogueController()) << tr("CatalogueController init")
283 << QThread::currentThread();
282 << QThread::currentThread();
284 impl->m_WorkingMutex.lock();
283 impl->m_WorkingMutex.lock();
284 =======
285 qCDebug(LOG_CatalogueController())
286 << tr("CatalogueController init") << QThread::currentThread();
287 >>>>>>> 286decc... unthread the catalogue controller
285 impl->m_CatalogueDao.initialize();
288 impl->m_CatalogueDao.initialize();
286 auto defaultRepositoryLocation
289 auto defaultRepositoryLocation
287 = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
290 = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
@@ -303,16 +306,6 void CatalogueController::initialize()
303 qCDebug(LOG_CatalogueController()) << tr("CatalogueController init END");
306 qCDebug(LOG_CatalogueController()) << tr("CatalogueController init END");
304 }
307 }
305
308
306 void CatalogueController::finalize()
307 {
308 impl->m_WorkingMutex.unlock();
309 }
310
311 void CatalogueController::waitForFinish()
312 {
313 QMutexLocker locker{&impl->m_WorkingMutex};
314 }
315
316 void CatalogueController::CatalogueControllerPrivate::copyDBtoDB(const QString &dbFrom,
309 void CatalogueController::CatalogueControllerPrivate::copyDBtoDB(const QString &dbFrom,
317 const QString &dbTo)
310 const QString &dbTo)
318 {
311 {
@@ -64,9 +64,6 public:
64 m_VariableControllerThread.setObjectName("VariableControllerThread");
64 m_VariableControllerThread.setObjectName("VariableControllerThread");
65 m_VisualizationController->moveToThread(&m_VisualizationControllerThread);
65 m_VisualizationController->moveToThread(&m_VisualizationControllerThread);
66 m_VisualizationControllerThread.setObjectName("VsualizationControllerThread");
66 m_VisualizationControllerThread.setObjectName("VsualizationControllerThread");
67 m_CatalogueController->moveToThread(&m_CatalogueControllerThread);
68 m_CatalogueControllerThread.setObjectName("CatalogueControllerThread");
69
70
67
71 // Additionnal init
68 // Additionnal init
72 m_VariableController->setTimeController(m_TimeController.get());
69 m_VariableController->setTimeController(m_TimeController.get());
@@ -85,9 +82,6 public:
85
82
86 m_VisualizationControllerThread.quit();
83 m_VisualizationControllerThread.quit();
87 m_VisualizationControllerThread.wait();
84 m_VisualizationControllerThread.wait();
88
89 m_CatalogueControllerThread.quit();
90 m_CatalogueControllerThread.wait();
91 }
85 }
92
86
93 std::unique_ptr<DataSourceController> m_DataSourceController;
87 std::unique_ptr<DataSourceController> m_DataSourceController;
@@ -101,7 +95,6 public:
101 QThread m_NetworkControllerThread;
95 QThread m_NetworkControllerThread;
102 QThread m_VariableControllerThread;
96 QThread m_VariableControllerThread;
103 QThread m_VisualizationControllerThread;
97 QThread m_VisualizationControllerThread;
104 QThread m_CatalogueControllerThread;
105
98
106 std::unique_ptr<DragDropGuiController> m_DragDropGuiController;
99 std::unique_ptr<DragDropGuiController> m_DragDropGuiController;
107 std::unique_ptr<ActionsGuiController> m_ActionsGuiController;
100 std::unique_ptr<ActionsGuiController> m_ActionsGuiController;
@@ -136,16 +129,11 SqpApplication::SqpApplication(int &argc, char **argv)
136 connect(&impl->m_VisualizationControllerThread, &QThread::finished,
129 connect(&impl->m_VisualizationControllerThread, &QThread::finished,
137 impl->m_VisualizationController.get(), &VisualizationController::finalize);
130 impl->m_VisualizationController.get(), &VisualizationController::finalize);
138
131
139 connect(&impl->m_CatalogueControllerThread, &QThread::started,
140 impl->m_CatalogueController.get(), &CatalogueController::initialize);
141 connect(&impl->m_CatalogueControllerThread, &QThread::finished,
142 impl->m_CatalogueController.get(), &CatalogueController::finalize);
143
144 impl->m_DataSourceControllerThread.start();
132 impl->m_DataSourceControllerThread.start();
145 impl->m_NetworkControllerThread.start();
133 impl->m_NetworkControllerThread.start();
146 impl->m_VariableControllerThread.start();
134 impl->m_VariableControllerThread.start();
147 impl->m_VisualizationControllerThread.start();
135 impl->m_VisualizationControllerThread.start();
148 impl->m_CatalogueControllerThread.start();
136 impl->m_CatalogueController->initialize();
149 }
137 }
150
138
151 SqpApplication::~SqpApplication()
139 SqpApplication::~SqpApplication()
General Comments 0
You need to be logged in to leave comments. Login now