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