1
0
mirror of https://github.com/vcmi/vcmi.git synced 2026-05-22 09:55:17 +02:00

Merge pull request #3879 from Laserlicht/innoextract_process

progress of innoextract extraction
This commit is contained in:
Ivan Savenko
2024-05-05 12:11:45 +03:00
committed by GitHub
3 changed files with 40 additions and 10 deletions
+11 -9
View File
@@ -311,13 +311,9 @@ void FirstLaunchView::extractGogData()
if(fileBin.isEmpty())
return;
ui->pushButtonGogInstall->setText(tr("Installing... Please wait!"));
QPalette pal = ui->pushButtonGogInstall->palette();
pal.setColor(QPalette::Button, QColor(Qt::yellow));
ui->pushButtonGogInstall->setAutoFillBackground(true);
ui->pushButtonGogInstall->setPalette(pal);
ui->pushButtonGogInstall->update();
ui->pushButtonGogInstall->repaint();
ui->progressBarGog->setVisible(true);
ui->pushButtonGogInstall->setVisible(false);
setEnabled(false);
QTimer::singleShot(100, this, [this, fileExe, fileBin](){ // background to make sure FileDialog is closed...
QTemporaryDir dir;
@@ -340,14 +336,20 @@ void FirstLaunchView::extractGogData()
o.filenames.set_expand(true);
o.preserve_file_times = true; // also correctly closes file -> without it: on Windows the files are not written completly
process_file(tmpFileExe.toStdString(), o, [this](float progress) {
ui->progressBarGog->setValue(progress * 100);
qApp->processEvents();
});
process_file(tmpFileExe.toStdString(), o);
ui->progressBarGog->setVisible(false);
ui->pushButtonGogInstall->setVisible(true);
setEnabled(true);
QStringList dirData = tempDir.entryList({"data"}, QDir::Filter::Dirs);
if(dirData.empty() || QDir(tempDir.filePath(dirData.front())).entryList({"*.lod"}, QDir::Filter::Files).empty())
{
QMessageBox::critical(this, tr("No Heroes III data!"), tr("Selected files do not contain Heroes III data!"), QMessageBox::Ok, QMessageBox::Ok);
ui->pushButtonGogInstall->setText(tr("Install gog.com files"));
return;
}
copyHeroesData(dir.path(), true);
+28
View File
@@ -289,6 +289,34 @@ Heroes® of Might and Magic® III HD is currently not supported!</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QProgressBar" name="progressBarGog">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="textVisible">
<bool>true</bool>
</property>
<property name="invertedAppearance">
<bool>false</bool>
</property>
<property name="format">
<string>Installing... %p%</string>
</property>
<property name="visible">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="pushButtonDataSearch">
<property name="sizePolicy">