1
0
Fork 0

Scenery extraction: set progress text

Fixes bug:https://sourceforge.net/p/flightgear/codetickets/1938/
This commit is contained in:
James Turner 2017-01-31 17:11:44 +01:00
parent 0bf80f9b2a
commit 8f7c0d6801
2 changed files with 15 additions and 2 deletions

View file

@ -87,6 +87,8 @@ signals:
void extractionError(QString file, QString msg);
void progress(int percent);
void extractingArchive(QString archiveName);
private:
void extractNextArchive()
{
@ -97,6 +99,8 @@ private:
m_remainingPaths.pop_front();
QFileInfo finfo(path);
emit extractingArchive(path);
QFile f(path);
f.open(QIODevice::ReadOnly);
Q_ASSERT(f.isOpen());
@ -168,6 +172,7 @@ void InstallSceneryDialog::updateUi()
case STATE_EXTRACTING:
b->setEnabled(false);
cancel->setEnabled(false);
ui->progressText->setText(tr("Extracting"));
ui->stack->setCurrentIndex(1);
break;
@ -234,6 +239,8 @@ void InstallSceneryDialog::pickFiles()
this, &InstallSceneryDialog::onExtractError);
connect(m_thread.data(), &InstallSceneryThread::progress,
this, &InstallSceneryDialog::onExtractProgress);
connect(m_thread.data(), &InstallSceneryThread::extractingArchive,
this, &InstallSceneryDialog::onExtractFile);
updateUi();
m_thread->start();
} else {
@ -260,6 +267,11 @@ void InstallSceneryDialog::onExtractProgress(int percent)
ui->progressBar->setValue(percent);
}
void InstallSceneryDialog::onExtractFile(QString file)
{
ui->progressText->setText(tr("Extracting %1").arg(file));
}
QString InstallSceneryDialog::sceneryPath()
{
if (m_state == STATE_FINISHED) {

View file

@ -40,8 +40,8 @@ public:
QString sceneryPath();
private slots:
virtual void reject();
virtual void accept();
virtual void reject() override;
virtual void accept() override;
private:
void updateUi();
@ -51,6 +51,7 @@ private:
void onThreadFinished();
void onExtractError(QString file, QString msg);
void onExtractProgress(int percent);
void onExtractFile(QString file);
enum State {
STATE_START = 0, // awaiting user input on first screen