From b0157cee4a4f370f95c0071225d8cb9116e6e643 Mon Sep 17 00:00:00 2001 From: arm64v8a <48624112+arm64v8a@users.noreply.github.com> Date: Wed, 7 Sep 2022 18:30:28 +0800 Subject: [PATCH] fix custom core #41 --- ui/edit/dialog_edit_profile.cpp | 2 +- ui/edit/edit_custom.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ui/edit/dialog_edit_profile.cpp b/ui/edit/dialog_edit_profile.cpp index 1ea7700..bafe8b3 100644 --- a/ui/edit/dialog_edit_profile.cpp +++ b/ui/edit/dialog_edit_profile.cpp @@ -145,7 +145,7 @@ void DialogEditProfile::typeSelected(const QString &newType) { auto _innerWidget = new EditCustom(this); innerWidget = _innerWidget; innerEditor = _innerWidget; - if (type == "hysteria" || ent->CustomBean()->core == "hysteria") { + if (type == "hysteria" || (!newEnt && ent->CustomBean()->core == "hysteria")) { _innerWidget->preset_core = type; _innerWidget->preset_command = Preset::Hysteria::command; _innerWidget->preset_config = Preset::Hysteria::config; diff --git a/ui/edit/edit_custom.cpp b/ui/edit/edit_custom.cpp index 632a30b..42efda2 100644 --- a/ui/edit/edit_custom.cpp +++ b/ui/edit/edit_custom.cpp @@ -25,16 +25,16 @@ void EditCustom::onStart(QSharedPointer _ent) { this->ent = _ent; auto bean = this->ent->CustomBean(); - P_LOAD_COMBO(core) - ui->command->setText(bean->command.join(" ")); - P_LOAD_STRING(config_simple) - // load known core auto core_map = QString2QJsonObject(NekoRay::dataStore->extraCore->core_map); for (const auto &key: core_map.keys()) { ui->core->addItem(key); } + P_LOAD_COMBO(core) + ui->command->setText(bean->command.join(" ")); + P_LOAD_STRING(config_simple) + if (!bean->core.isEmpty()) { ui->core->setDisabled(true); } else if (!preset_core.isEmpty()) {