Skip to content

Commit

Permalink
fix custom core #41
Browse files Browse the repository at this point in the history
  • Loading branch information
arm64v8a committed Sep 7, 2022
1 parent d7d788c commit b0157ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ui/edit/dialog_edit_profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions ui/edit/edit_custom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ void EditCustom::onStart(QSharedPointer<NekoRay::ProxyEntity> _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()) {
Expand Down

0 comments on commit b0157ce

Please sign in to comment.