From cb9b774a544ceac0c94271dc90d9e5eee9b6079b Mon Sep 17 00:00:00 2001 From: olivierlachance Date: Sun, 12 Jan 2025 20:16:07 -0500 Subject: [PATCH] disable checkboxes when adding app with existing staging directory --- src/ui/addappdialog.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/ui/addappdialog.cpp b/src/ui/addappdialog.cpp index e2f9292..ffce508 100644 --- a/src/ui/addappdialog.cpp +++ b/src/ui/addappdialog.cpp @@ -3,6 +3,7 @@ #include "core/consts.h" #include "core/deployerfactory.h" #include "core/parseerror.h" +#include "core/moddedapplication.h" #include "importfromsteamdialog.h" #include "ui_addappdialog.h" #include @@ -65,8 +66,21 @@ void AddAppDialog::on_path_field_textChanged(const QString& text) { if(!pathIsValid()) enableOkButton(false); - else if(!ui->name_field->text().isEmpty()) + else if(!ui->name_field->text().isEmpty()) { enableOkButton(true); + auto src = std::filesystem::path(ui->path_field->text().toStdString()); + if(std::filesystem::exists(src / ModdedApplication::CONFIG_FILE_NAME)) { + ui->import_checkbox->setEnabled(false); + ui->import_checkbox->setChecked(false); + ui->import_tags_checkbox->setEnabled(false); + ui->import_tags_checkbox->setChecked(false); + } else { + ui->import_checkbox->setEnabled(true); + ui->import_checkbox->setChecked(true); + ui->import_tags_checkbox->setEnabled(true); + ui->import_tags_checkbox->setChecked(true); + } + } } void AddAppDialog::enableOkButton(bool state)