瀏覽代碼

[launcher] call Install From File button handler asynchronously

Andrey Filipenkov 1 年之前
父節點
當前提交
98cda246a2
共有 1 個文件被更改,包括 11 次插入6 次删除
  1. 11 6
      launcher/modManager/cmodlistview_moc.cpp

+ 11 - 6
launcher/modManager/cmodlistview_moc.cpp

@@ -630,13 +630,18 @@ void CModListView::on_installButton_clicked()
 
 void CModListView::on_installFromFileButton_clicked()
 {
-	QString filter = tr("All supported files") + " (*.h3m *.vmap *.h3c *.vcmp *.zip *.json);;" + tr("Maps") + " (*.h3m *.vmap);;" + tr("Campaigns") + " (*.h3c *.vcmp);;" + tr("Configs") + " (*.json);;" + tr("Mods") + " (*.zip)";
-	QStringList files = QFileDialog::getOpenFileNames(this, tr("Select files (configs, mods, maps, campaigns) to install..."), QDir::homePath(), filter);
-
-	for (const auto & file : files)
+	// iOS can't display modal dialogs when called directly on button press
+	// https://bugreports.qt.io/browse/QTBUG-98651
+	QTimer::singleShot(0, this, [this]
 	{
-		manualInstallFile(file);
-	}
+		QString filter = tr("All supported files") + " (*.h3m *.vmap *.h3c *.vcmp *.zip *.json);;" + tr("Maps") + " (*.h3m *.vmap);;" + tr("Campaigns") + " (*.h3c *.vcmp);;" + tr("Configs") + " (*.json);;" + tr("Mods") + " (*.zip)";
+		QStringList files = QFileDialog::getOpenFileNames(this, tr("Select files (configs, mods, maps, campaigns) to install..."), QDir::homePath(), filter);
+
+		for(const auto & file : files)
+		{
+			manualInstallFile(file);
+		}
+	});
 }
 
 void CModListView::manualInstallFile(QString filePath)