##// END OF EJS Templates
Initialisation de l'application multithread avec le spimpl....
Initialisation de l'application multithread avec le spimpl. Ajout du DataSourceController dans un thread dédié.

File last commit:

r21:45edf6844d32
r21:45edf6844d32
Show More
SqpApplication.cpp
40 lines | 1.2 KiB | text/x-c | CppLexer
/ gui / src / SqpApplication.cpp
#include "SqpApplication.h"
#include <DataSource/DataSourceController.h>
#include <QThread>
Q_LOGGING_CATEGORY(LOG_SqpApplication, "SqpApplication")
class SqpApplication::SqpApplicationPrivate {
public:
SqpApplicationPrivate() {}
std::unique_ptr<DataSourceController> m_DataSourceController;
QThread m_DataSourceControllerThread;
};
SqpApplication::SqpApplication(int &argc, char **argv)
: QApplication(argc, argv), impl{spimpl::make_unique_impl<SqpApplicationPrivate>()}
{
qCInfo(LOG_SqpApplication()) << tr("Construction du SqpApplication");
impl->m_DataSourceController = std::make_unique<DataSourceController>();
impl->m_DataSourceController->moveToThread(&impl->m_DataSourceControllerThread);
connect(&impl->m_DataSourceControllerThread, &QThread::started,
impl->m_DataSourceController.get(), &DataSourceController::initialize);
connect(&impl->m_DataSourceControllerThread, &QThread::finished,
impl->m_DataSourceController.get(), &DataSourceController::finalize);
impl->m_DataSourceControllerThread.start();
}
SqpApplication::~SqpApplication()
{
impl->m_DataSourceControllerThread.quit();
}
void SqpApplication::initialize()
{
}