#include "CCEngineLoader.h" #include #include CCEngineLoader::CCEngineLoader( const boost::filesystem::path& appPath, unsigned callerProcessPid, QWidget *parent) : QDialog(parent) { ui.setupUi(this); QMovie *movie = new QMovie(":/CCEngineLoader/Resources/ajax-loader.gif", QByteArray(), this); ui.lblAnimation->setMovie(movie); movie->start(); m_updateWorker = std::make_unique(appPath, callerProcessPid); bool success = connect(m_updateWorker.get(), SIGNAL(progressChanged(UpdateStatus, QString)), this, SLOT(onProgressChanged(UpdateStatus, QString))); QTimer *timer = new QTimer(this); timer->setSingleShot(true); connect(timer, SIGNAL(timeout()), this, SLOT(onStartWorker())); timer->start(0); } void CCEngineLoader::onProgressChanged(UpdateStatus status, QString info) { ui.lblInformation->setText(info); if (status == UpdateStatus::done) { qApp->quit(); } } void CCEngineLoader::onStartWorker() { m_updateWorker->start(); }