mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-23 21:29:13 +02:00
code review
This commit is contained in:
parent
ce46f43eca
commit
c2e02297e1
@ -313,7 +313,7 @@ QString FirstLaunchView::getHeroesInstallDir()
|
|||||||
void FirstLaunchView::extractGogData()
|
void FirstLaunchView::extractGogData()
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_INNOEXTRACT
|
#ifdef ENABLE_INNOEXTRACT
|
||||||
auto fileSelection = [this](QString magic, QString filter, QString startPath = {}) {
|
auto fileSelection = [this](QByteArray magic, QString filter, QString startPath = {}) {
|
||||||
QString titleSel = tr("Select %1 file...", "param is file extension").arg(filter);
|
QString titleSel = tr("Select %1 file...", "param is file extension").arg(filter);
|
||||||
QString titleErr = tr("You have to select %1 file!", "param is file extension").arg(filter);
|
QString titleErr = tr("You have to select %1 file!", "param is file extension").arg(filter);
|
||||||
#if defined(VCMI_MOBILE)
|
#if defined(VCMI_MOBILE)
|
||||||
@ -331,7 +331,7 @@ void FirstLaunchView::extractGogData()
|
|||||||
return QString{};
|
return QString{};
|
||||||
}
|
}
|
||||||
QByteArray magicFile = tmpFile.read(magic.length());
|
QByteArray magicFile = tmpFile.read(magic.length());
|
||||||
if(!magicFile.startsWith(QByteArray{magic.toStdString().c_str()}))
|
if(!magicFile.startsWith(magic))
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, tr("Invalid file selected"), titleErr);
|
QMessageBox::critical(this, tr("Invalid file selected"), titleErr);
|
||||||
return QString{};
|
return QString{};
|
||||||
@ -340,10 +340,10 @@ void FirstLaunchView::extractGogData()
|
|||||||
return file;
|
return file;
|
||||||
};
|
};
|
||||||
|
|
||||||
QString fileBin = fileSelection("idska32", tr("GOG data") + " (*.bin)");
|
QString fileBin = fileSelection(QByteArray{"idska32"}, tr("GOG data") + " (*.bin)");
|
||||||
if(fileBin.isEmpty())
|
if(fileBin.isEmpty())
|
||||||
return;
|
return;
|
||||||
QString fileExe = fileSelection("MZ", tr("GOG installer") + " (*.exe)", QFileInfo(fileBin).absolutePath());
|
QString fileExe = fileSelection(QByteArray{"MZ"}, tr("GOG installer") + " (*.exe)", QFileInfo(fileBin).absolutePath());
|
||||||
if(fileExe.isEmpty())
|
if(fileExe.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user