diff options
author | TheKodeToad <TheKodeToad@proton.me> | 2022-12-14 15:36:42 +0000 |
---|---|---|
committer | TheKodeToad <TheKodeToad@proton.me> | 2022-12-14 15:40:20 +0000 |
commit | ee003cd9ee433a073393bdd47bd20d6d8cb38ca2 (patch) | |
tree | 6757ca4cebf4e2301db146ede8f719789d0573fa /launcher/ui/pages | |
parent | 127b094c4158f7a2315bb35cea05f5644a0db1c5 (diff) | |
download | PrismLauncher-ee003cd9ee433a073393bdd47bd20d6d8cb38ca2.tar.gz PrismLauncher-ee003cd9ee433a073393bdd47bd20d6d8cb38ca2.tar.bz2 PrismLauncher-ee003cd9ee433a073393bdd47bd20d6d8cb38ca2.zip |
Add confirmation on customised components
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
Diffstat (limited to 'launcher/ui/pages')
-rw-r--r-- | launcher/ui/pages/instance/VersionPage.cpp | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/launcher/ui/pages/instance/VersionPage.cpp b/launcher/ui/pages/instance/VersionPage.cpp index c8a65f10..413b2f85 100644 --- a/launcher/ui/pages/instance/VersionPage.cpp +++ b/launcher/ui/pages/instance/VersionPage.cpp @@ -318,13 +318,29 @@ void VersionPage::on_actionReload_triggered() void VersionPage::on_actionRemove_triggered() { - if (ui->packageView->currentIndex().isValid()) + if (!ui->packageView->currentIndex().isValid()) { - // FIXME: use actual model, not reloading. - if (!m_profile->remove(ui->packageView->currentIndex().row())) - { - QMessageBox::critical(this, tr("Error"), tr("Couldn't remove file")); - } + return; + } + int index = ui->packageView->currentIndex().row(); + auto component = m_profile->getComponent(index); + if (component->isCustom()) + { + auto response = CustomMessageBox::selectable(this, tr("CAREFUL!"), + tr("About to remove: %1\n" + "This is permanent and will completely remove the custom component.\n\n" + "Are you sure?") + .arg(component->getName()), + QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No) + ->exec(); + + if (response != QMessageBox::Yes) + return; + } + // FIXME: use actual model, not reloading. + if (!m_profile->remove(index)) + { + QMessageBox::critical(this, tr("Error"), tr("Couldn't remove file")); } updateButtons(); reloadPackProfile(); @@ -707,6 +723,19 @@ void VersionPage::on_actionRevert_triggered() { return; } + auto component = m_profile->getComponent(version); + + auto response = CustomMessageBox::selectable(this, tr("CAREFUL!"), + tr("About to revert: %1\n" + "This is permanent and will completely revert your customizations.\n\n" + "Are you sure?") + .arg(component->getName()), + QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No) + ->exec(); + + if (response != QMessageBox::Yes) + return; + if(!m_profile->revertToBase(version)) { // TODO: some error box here |