1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-30 04:30:42 +02:00

Merge pull request #2002 from IvanSavenko/fix_launcher

Fix Launcher issues discovered in 1.2
This commit is contained in:
Ivan Savenko 2023-04-18 15:43:26 +03:00 committed by GitHub
commit d55b7b2d10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -190,6 +190,7 @@ void FirstLaunchView::heroesDataMissing()
ui->labelDataCopy->setVisible(true);
ui->labelDataFound->setVisible(false);
ui->pushButtonDataNext->setEnabled(true);
if(hasVCMIBuilderScript)
{
@ -218,6 +219,7 @@ void FirstLaunchView::heroesDataDetected()
}
ui->labelDataFound->setVisible(true);
ui->pushButtonDataNext->setEnabled(true);
heroesLanguageUpdate();
}
@ -247,7 +249,6 @@ void FirstLaunchView::heroesLanguageUpdate()
ui->labelDataFailure->setVisible(!success);
ui->labelDataSuccess->setVisible(success);
ui->pushButtonDataNext->setEnabled(success);
}
void FirstLaunchView::forceHeroesLanguage(const QString & language)
@ -264,6 +265,18 @@ void FirstLaunchView::copyHeroesData()
if(!sourceRoot.exists())
return;
if (sourceRoot.dirName().compare("data", Qt::CaseInsensitive) == 0)
{
// We got Data folder. Possibly user selected "Data" folder of Heroes III install. Check whether valid data might exist 1 level above
QStringList dirData = sourceRoot.entryList({"data"}, QDir::Filter::Dirs);
if (dirData.empty())
{
// This is "Data" folder without any "Data" folders inside. Try to check for data 1 level above
sourceRoot.cdUp();
}
}
QStringList dirData = sourceRoot.entryList({"data"}, QDir::Filter::Dirs);
QStringList dirMaps = sourceRoot.entryList({"maps"}, QDir::Filter::Dirs);
QStringList dirMp3 = sourceRoot.entryList({"mp3"}, QDir::Filter::Dirs);

View File

@ -44,7 +44,7 @@ QString Languages::getHeroesDataLanguage()
QString language = QString::fromStdString(settings["session"]["language"].String());
double deviation = settings["session"]["languageDeviation"].Float();
if(deviation > 0.05)
if(deviation > 0.1)
return QString();
return language;
}