55 lines
1.1 KiB
C++
55 lines
1.1 KiB
C++
#include "loading.h"
|
|
#include "loading-worker.h"
|
|
#include "locales.h"
|
|
#include "ui_loading.h"
|
|
#include <QThread>
|
|
|
|
Loading::Loading(QWidget *parent)
|
|
: QWidget(parent)
|
|
, ui(new Ui::Loading)
|
|
{
|
|
ui->setupUi(this);
|
|
this->setWindowFlags(Qt::FramelessWindowHint);
|
|
this->startLoading();
|
|
}
|
|
|
|
Loading::~Loading()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void Loading::changeStep(std::string text) {
|
|
this->ui->condition->setText(QString::fromStdString(text));
|
|
}
|
|
|
|
void Loading::setupWelcomeLocale(std::string locale) {
|
|
this->welcome.setupWelcomeLocale(locale);
|
|
}
|
|
|
|
void Loading::finishWorker() {
|
|
this->hide();
|
|
this->welcome.show();
|
|
}
|
|
|
|
void Loading::startLoading()
|
|
{
|
|
QThread* thread = new QThread;
|
|
LoadingWorker* worker = new LoadingWorker(this);
|
|
|
|
worker->moveToThread(thread);
|
|
|
|
connect(thread, &QThread::started,
|
|
worker, &LoadingWorker::process);
|
|
|
|
connect(worker, &LoadingWorker::finished,
|
|
thread, &QThread::quit);
|
|
|
|
connect(worker, &LoadingWorker::finished,
|
|
worker, &QObject::deleteLater);
|
|
|
|
connect(thread, &QThread::finished,
|
|
thread, &QObject::deleteLater);
|
|
|
|
thread->start();
|
|
}
|