MCPcopy Create free account
hub / github.com/LunarG/VulkanTools / LoadPath

Method LoadPath

vkconfig_gui/widget_setting_filesystem.cpp:97–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97void WidgetSettingFilesystem::LoadPath(const Path& path) {
98 switch (this->meta.type) {
99 case SETTING_LOAD_FILE: {
100 const SettingMetaFileLoad& setting_meta = static_cast<const SettingMetaFileLoad&>(this->meta);
101 if (setting_meta.format == "PROFILE") {
102 if (path.Empty()) {
103 return;
104 }
105
106 SettingDataFileLoad& file_setting_data = static_cast<SettingDataFileLoad&>(this->data());
107 file_setting_data.profile_names = CollectProfileNamesFromFile(path);
108
109 SettingDataString* enum_setting_data = FindSetting<SettingDataString>(this->data_set, "profile_name");
110 if (!file_setting_data.profile_names.empty() && enum_setting_data != nullptr) {
111 enum_setting_data->SetValue(file_setting_data.profile_names[0].c_str());
112 } else {
113 enum_setting_data->SetValue("");
114 }
115 }
116 break;
117 }
118 case SETTING_LOAD_FOLDER: {
119 const SettingMetaFolderLoad& setting_meta = static_cast<const SettingMetaFolderLoad&>(this->meta);
120 if (setting_meta.format == "PROFILE") {
121 if (path.Empty()) {
122 return;
123 }
124
125 SettingDataFolderLoad& setting_data = static_cast<SettingDataFolderLoad&>(this->data());
126 setting_data.profile_names = CollectProfileNamesFromDir(path);
127
128 SettingDataString* enum_setting_data = FindSetting<SettingDataString>(this->data_set, "profile_name");
129 if (enum_setting_data != nullptr) {
130 if (std::find(setting_data.profile_names.begin(), setting_data.profile_names.end(),
131 enum_setting_data->GetValue()) == setting_data.profile_names.end()) {
132 enum_setting_data->SetValue("${VP_DEFAULT}");
133 }
134 }
135 }
136 break;
137 }
138 default:
139 break;
140 }
141}
142
143void WidgetSettingFilesystem::browseButtonClicked() {
144 Path path(this->field->text().toStdString());

Callers 1

Calls 5

GetValueMethod · 0.80
EmptyMethod · 0.45
SetValueMethod · 0.45

Tested by

no test coverage detected