Skip to content

Commit

Permalink
vkconfig: fix profile name invalid init
Browse files Browse the repository at this point in the history
Change-Id: I25493632e09a00aff42baf4c8f6ea33f9a497fea
  • Loading branch information
christophe-lunarg committed May 25, 2023
1 parent 930d98c commit b106fe9
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions vkconfig/widget_setting_filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ void WidgetSettingFilesystem::LoadFile(const std::string& path) {
file_setting_data.profile_names = GetProfileNames(path);

SettingDataString* enum_setting_data = FindSetting<SettingDataString>(this->data_set, "profile_name");
enum_setting_data->value.clear();
if (!file_setting_data.profile_names.empty() && enum_setting_data != nullptr) {
enum_setting_data->value = file_setting_data.profile_names[0];
}
Expand Down Expand Up @@ -135,12 +136,6 @@ void WidgetSettingFilesystem::browseButtonClicked() {

if (!file.empty()) {
file = ConvertNativeSeparators(file);
LoadFile(file);

if (VKC_ENV == VKC_ENV_WIN32) {
file = ConvertSeparators(file, "/", GetNativeSeparator());
}

this->data().value = file;

field->setText(this->data().value.c_str());
Expand All @@ -151,6 +146,15 @@ void WidgetSettingFilesystem::browseButtonClicked() {

void WidgetSettingFilesystem::textFieldChanged(const QString& value) {
std::string file = value.toStdString();

if (!file.empty()) {
LoadFile(file);

if (VKC_ENV == VKC_ENV_WIN32) {
file = ConvertSeparators(file, "/", GetNativeSeparator());
}
}

this->data().value = file;
this->field->setToolTip(this->field->text());

Expand Down

0 comments on commit b106fe9

Please sign in to comment.