mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-18 17:40:48 +02:00
38 lines
615 B
C++
38 lines
615 B
C++
|
#include "generatorprogress.h"
|
||
|
#include "ui_generatorprogress.h"
|
||
|
#include <thread>
|
||
|
#include <chrono>
|
||
|
|
||
|
GeneratorProgress::GeneratorProgress(Load::Progress & source, QWidget *parent) :
|
||
|
QDialog(parent),
|
||
|
ui(new Ui::GeneratorProgress),
|
||
|
source(source)
|
||
|
{
|
||
|
ui->setupUi(this);
|
||
|
|
||
|
setAttribute(Qt::WA_DeleteOnClose);
|
||
|
|
||
|
setWindowFlags(Qt::Window);
|
||
|
|
||
|
show();
|
||
|
}
|
||
|
|
||
|
GeneratorProgress::~GeneratorProgress()
|
||
|
{
|
||
|
delete ui;
|
||
|
}
|
||
|
|
||
|
|
||
|
void GeneratorProgress::update()
|
||
|
{
|
||
|
while(!source.finished())
|
||
|
{
|
||
|
int status = float(source.get()) / 2.55f;
|
||
|
ui->progressBar->setValue(status);
|
||
|
qApp->processEvents();
|
||
|
}
|
||
|
|
||
|
//delete source;
|
||
|
close();
|
||
|
}
|