feat: allow skipping the update confirmation dialog
Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
parent
08d008a5aa
commit
82699cc297
@ -44,6 +44,9 @@ class InstanceTask : public Task, public InstanceName {
|
|||||||
void setGroup(const QString& group) { m_instGroup = group; }
|
void setGroup(const QString& group) { m_instGroup = group; }
|
||||||
QString group() const { return m_instGroup; }
|
QString group() const { return m_instGroup; }
|
||||||
|
|
||||||
|
[[nodiscard]] bool shouldConfirmUpdate() const { return m_confirm_update; }
|
||||||
|
void setConfirmUpdate(bool confirm) { m_confirm_update = confirm; }
|
||||||
|
|
||||||
bool shouldOverride() const { return m_override_existing; }
|
bool shouldOverride() const { return m_override_existing; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -56,4 +59,5 @@ class InstanceTask : public Task, public InstanceName {
|
|||||||
QString m_stagingPath;
|
QString m_stagingPath;
|
||||||
|
|
||||||
bool m_override_existing = false;
|
bool m_override_existing = false;
|
||||||
|
bool m_confirm_update = true;
|
||||||
};
|
};
|
||||||
|
@ -102,12 +102,14 @@ bool FlameCreationTask::updateInstance()
|
|||||||
auto version_id = inst->getManagedPackVersionName();
|
auto version_id = inst->getManagedPackVersionName();
|
||||||
auto version_str = !version_id.isEmpty() ? tr(" (version %1)").arg(version_id) : "";
|
auto version_str = !version_id.isEmpty() ? tr(" (version %1)").arg(version_id) : "";
|
||||||
|
|
||||||
auto should_update = askIfShouldUpdate(m_parent, version_str);
|
if (shouldConfirmUpdate()) {
|
||||||
if (should_update == ShouldUpdate::SkipUpdating)
|
auto should_update = askIfShouldUpdate(m_parent, version_str);
|
||||||
return false;
|
if (should_update == ShouldUpdate::SkipUpdating)
|
||||||
if (should_update == ShouldUpdate::Cancel) {
|
return false;
|
||||||
m_abort = true;
|
if (should_update == ShouldUpdate::Cancel) {
|
||||||
return false;
|
m_abort = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QDir old_inst_dir(inst->instanceRoot());
|
QDir old_inst_dir(inst->instanceRoot());
|
||||||
|
@ -49,12 +49,14 @@ bool ModrinthCreationTask::updateInstance()
|
|||||||
auto version_name = inst->getManagedPackVersionName();
|
auto version_name = inst->getManagedPackVersionName();
|
||||||
auto version_str = !version_name.isEmpty() ? tr(" (version %1)").arg(version_name) : "";
|
auto version_str = !version_name.isEmpty() ? tr(" (version %1)").arg(version_name) : "";
|
||||||
|
|
||||||
auto should_update = askIfShouldUpdate(m_parent, version_str);
|
if (shouldConfirmUpdate()) {
|
||||||
if (should_update == ShouldUpdate::SkipUpdating)
|
auto should_update = askIfShouldUpdate(m_parent, version_str);
|
||||||
return false;
|
if (should_update == ShouldUpdate::SkipUpdating)
|
||||||
if (should_update == ShouldUpdate::Cancel) {
|
return false;
|
||||||
m_abort = true;
|
if (should_update == ShouldUpdate::Cancel) {
|
||||||
return false;
|
m_abort = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove repeated files, we don't need to download them!
|
// Remove repeated files, we don't need to download them!
|
||||||
|
Loading…
Reference in New Issue
Block a user