[impl] Allow only one application instance only [impl] Automatic start of browser with the right command line argument [chore] Update dependencies to conan
42 lines
1.1 KiB
C++
42 lines
1.1 KiB
C++
#include "CCEngineLoader.h"
|
|
|
|
#include <QtGui/QMovie>
|
|
#include <QtCore/QTimer>
|
|
|
|
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<UpdateWorkerThread>(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();
|
|
}
|