1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-13 01:20:34 +02:00

[launcher] call button handlers that show dialogs asynchronously

fixes freeze on iOS: https://bugreports.qt.io/browse/QTBUG-98651
This commit is contained in:
Andrey Filipenkov
2024-06-08 22:30:54 +03:00
parent a33a37b1a4
commit 65d30a444e

View File

@ -112,13 +112,17 @@ void FirstLaunchView::on_pushButtonDataCopy_clicked()
thiz = this; thiz = this;
QtAndroid::androidActivity().callMethod<void>("copyHeroesData"); QtAndroid::androidActivity().callMethod<void>("copyHeroesData");
#else #else
copyHeroesData(); // iOS can't display modal dialogs when called directly on button press
// https://bugreports.qt.io/browse/QTBUG-98651
QTimer::singleShot(0, this, [this]{ copyHeroesData(); });
#endif #endif
} }
void FirstLaunchView::on_pushButtonGogInstall_clicked() void FirstLaunchView::on_pushButtonGogInstall_clicked()
{ {
extractGogData(); // iOS can't display modal dialogs when called directly on button press
// https://bugreports.qt.io/browse/QTBUG-98651
QTimer::singleShot(0, this, &FirstLaunchView::extractGogData);
} }
void FirstLaunchView::on_comboBoxLanguage_currentIndexChanged(int index) void FirstLaunchView::on_comboBoxLanguage_currentIndexChanged(int index)
@ -314,7 +318,6 @@ QString FirstLaunchView::getHeroesInstallDir()
void FirstLaunchView::extractGogData() void FirstLaunchView::extractGogData()
{ {
#ifdef ENABLE_INNOEXTRACT #ifdef ENABLE_INNOEXTRACT
auto fileSelection = [this](QString type, QString filter, QString startPath = {}) { auto fileSelection = [this](QString type, 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);