ATLauncher: Abort install if optional mods dialog is closed
This matches the behaviour of ATLauncher.
This commit is contained in:
parent
54c26b05fa
commit
a6b13487f0
@ -736,7 +736,12 @@ void PackInstallTask::downloadMods()
|
||||
QVector<QString> selectedMods;
|
||||
if (!optionalMods.isEmpty()) {
|
||||
setStatus(tr("Selecting optional mods..."));
|
||||
selectedMods = m_support->chooseOptionalMods(m_version, optionalMods);
|
||||
auto mods = m_support->chooseOptionalMods(m_version, optionalMods);
|
||||
if (!mods.has_value()) {
|
||||
emitAborted();
|
||||
return;
|
||||
}
|
||||
selectedMods = mods.value();
|
||||
}
|
||||
|
||||
setStatus(tr("Downloading mods..."));
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
/**
|
||||
* Requests a user interaction to select which optional mods should be installed.
|
||||
*/
|
||||
virtual QVector<QString> chooseOptionalMods(PackVersion version, QVector<ATLauncher::VersionMod> mods) = 0;
|
||||
virtual std::optional<QVector<QString>> chooseOptionalMods(PackVersion version, QVector<ATLauncher::VersionMod> mods) = 0;
|
||||
|
||||
/**
|
||||
* Requests a user interaction to select a component version from a given version list
|
||||
|
@ -43,10 +43,13 @@ AtlUserInteractionSupportImpl::AtlUserInteractionSupportImpl(QWidget *parent) :
|
||||
{
|
||||
}
|
||||
|
||||
QVector<QString> AtlUserInteractionSupportImpl::chooseOptionalMods(ATLauncher::PackVersion version, QVector<ATLauncher::VersionMod> mods)
|
||||
std::optional<QVector<QString>> AtlUserInteractionSupportImpl::chooseOptionalMods(ATLauncher::PackVersion version, QVector<ATLauncher::VersionMod> mods)
|
||||
{
|
||||
AtlOptionalModDialog optionalModDialog(m_parent, version, mods);
|
||||
optionalModDialog.exec();
|
||||
auto result = optionalModDialog.exec();
|
||||
if (result == QDialog::Rejected) {
|
||||
return {};
|
||||
}
|
||||
return optionalModDialog.getResult();
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
|
||||
private:
|
||||
QString chooseVersion(Meta::VersionListPtr vlist, QString minecraftVersion) override;
|
||||
QVector<QString> chooseOptionalMods(ATLauncher::PackVersion version, QVector<ATLauncher::VersionMod> mods) override;
|
||||
std::optional<QVector<QString>> chooseOptionalMods(ATLauncher::PackVersion version, QVector<ATLauncher::VersionMod> mods) override;
|
||||
void displayMessage(QString message) override;
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user