@@ -346,121 +346,139 @@ bool Configurator::WriteLayersSettings(OverrideArea override_area, const Path& l
346346 QFile file (layers_settings.settings_path .AbsolutePath ().c_str ());
347347 result_settings_file = result_settings_file && file.open (QIODevice::WriteOnly | QIODevice::Text);
348348 if (!result_settings_file) {
349- fprintf (stderr, " vkconfig: [ERROR] Cannot open file %s\n " , layers_settings.settings_path .AbsolutePath ().c_str ());
349+ fprintf (stderr, " vkconfig: [ERROR] Cannot open file: \t %s\n " , layers_settings.settings_path .AbsolutePath ().c_str ());
350350 continue ;
351351 }
352352 QTextStream stream (&file);
353353
354- // Loop through all the layers
355- for (std::size_t j = 0 , n = configuration->parameters .size (); j < n; ++j) {
356- const Parameter& parameter = configuration->parameters [j];
357- if (!parameter.override_settings ) {
354+ if (configuration->override_settings ) {
355+ QFile original_file (configuration->override_settings_path .AbsolutePath ().c_str ());
356+ bool result_original_file = original_file.open (QIODevice::ReadOnly);
357+ if (!result_settings_file) {
358+ fprintf (stderr, " vkconfig: [ERROR] Cannot open override settings file:\t %s\n " ,
359+ configuration->override_settings_path .AbsolutePath ().c_str ());
358360 continue ;
359361 }
360362
361- if (!(parameter.platform_flags & (1 << VKC_PLATFORM ))) {
362- continue ;
363+ QTextStream instream (&original_file);
364+ while (!instream.atEnd ()) {
365+ QString line = instream.readLine ();
366+ stream << line << ' \n ' ;
363367 }
368+ } else {
369+ // Loop through all the layers
370+ for (std::size_t j = 0 , n = configuration->parameters .size (); j < n; ++j) {
371+ const Parameter& parameter = configuration->parameters [j];
372+ if (!parameter.override_settings ) {
373+ continue ;
374+ }
364375
365- if (parameter.builtin == LAYER_BUILTIN_UNORDERED ) {
366- continue ;
367- }
376+ if (!( parameter.platform_flags & ( 1 << VKC_PLATFORM )) ) {
377+ continue ;
378+ }
368379
369- if (parameter. control == LAYER_CONTROL_DISCARD || parameter.control == LAYER_CONTROL_OFF ) {
370- continue ;
371- }
380+ if ( parameter.builtin == LAYER_BUILTIN_UNORDERED ) {
381+ continue ;
382+ }
372383
373- const Layer* layer = this ->layers .Find (parameter.key .c_str (), parameter.api_version );
374- if (layer == nullptr ) {
375- if (parameter.control == LAYER_CONTROL_ON ) {
376- has_missing_layers = true ;
377- fprintf (stderr,
384+ if (parameter.control == LAYER_CONTROL_DISCARD || parameter.control == LAYER_CONTROL_OFF ) {
385+ continue ;
386+ }
387+
388+ const Layer* layer = this ->layers .Find (parameter.key .c_str (), parameter.api_version );
389+ if (layer == nullptr ) {
390+ if (parameter.control == LAYER_CONTROL_ON ) {
391+ has_missing_layers = true ;
392+ fprintf (
393+ stderr,
378394 " vkconfig: [ERROR] `%s` layer is set to `%s` in `%s` loader configuration but missing and being "
379395 " ignored\n " ,
380396 parameter.key .c_str (), ::GetLabel (parameter.control ), configuration->key .c_str ());
381- } else {
382- fprintf (stderr,
397+ } else {
398+ fprintf (
399+ stderr,
383400 " vkconfig: [WARNING] `%s` layer is set to `%s` in `%s` loader configuration but missing and being "
384401 " ignored\n " ,
385402 parameter.key .c_str (), ::GetLabel (parameter.control ), configuration->key .c_str ());
403+ }
404+ continue ;
386405 }
387- continue ;
388- }
389406
390- stream << " \n " ;
391- stream << " # " << layer->key .c_str () << " \n\n " ;
407+ stream << " \n " ;
408+ stream << " # " << layer->key .c_str () << " \n\n " ;
392409
393- std::string lc_layer_name = GetLayerSettingPrefix (layer->key );
410+ std::string lc_layer_name = GetLayerSettingPrefix (layer->key );
394411
395- for (std::size_t i = 0 , m = parameter.settings .size (); i < m; ++i) {
396- const SettingData* setting_data = parameter.settings [i];
412+ for (std::size_t i = 0 , m = parameter.settings .size (); i < m; ++i) {
413+ const SettingData* setting_data = parameter.settings [i];
397414
398- // Skip groups - they aren't settings, so not relevant in this output
399- if (setting_data->type == SETTING_GROUP ) {
400- continue ;
401- }
415+ // Skip groups - they aren't settings, so not relevant in this output
416+ if (setting_data->type == SETTING_GROUP ) {
417+ continue ;
418+ }
402419
403- // Skip missing settings
404- const SettingMeta* meta = FindSetting (layer->settings , setting_data->key .c_str ());
405- if (meta == nullptr ) {
406- continue ;
407- }
420+ // Skip missing settings
421+ const SettingMeta* meta = FindSetting (layer->settings , setting_data->key .c_str ());
422+ if (meta == nullptr ) {
423+ continue ;
424+ }
408425
409- // Skip overriden settings
410- if (::CheckSettingOverridden (*meta)) {
411- continue ;
412- }
426+ // Skip overriden settings
427+ if (::CheckSettingOverridden (*meta)) {
428+ continue ;
429+ }
413430
414- stream << " # " ;
415- stream << meta->label .c_str ();
416- stream << " \n # =====================\n # <LayerIdentifier>." ;
417- stream << meta->key .c_str ();
431+ stream << " # " ;
432+ stream << meta->label .c_str ();
433+ stream << " \n # =====================\n # <LayerIdentifier>." ;
434+ stream << meta->key .c_str ();
418435
419- if (meta->status != STATUS_STABLE ) {
420- stream << format (" (%s)" , GetToken (meta->status )).c_str ();
421- }
436+ if (meta->status != STATUS_STABLE ) {
437+ stream << format (" (%s)" , GetToken (meta->status )).c_str ();
438+ }
422439
423- stream << " \n " ;
440+ stream << " \n " ;
424441
425- // Break up description into smaller words
426- std::string description = meta->description ;
427- std::vector<std::string> words;
428- std::size_t pos;
429- while ((pos = description.find (" " )) != std::string::npos) {
430- words.push_back (description.substr (0 , pos));
431- description.erase (0 , pos + 1 );
432- }
433- if (description.size () > 0 ) words.push_back (description);
434- if (words.size () > 0 ) {
435- stream << " #" ;
436- std::size_t nchars = 2 ;
437- for (auto word : words) {
438- if (word.size () + nchars > 80 ) {
439- stream << " \n #" ;
440- nchars = 2 ;
442+ // Break up description into smaller words
443+ std::string description = meta->description ;
444+ std::vector<std::string> words;
445+ std::size_t pos;
446+ while ((pos = description.find (" " )) != std::string::npos) {
447+ words.push_back (description.substr (0 , pos));
448+ description.erase (0 , pos + 1 );
449+ }
450+ if (description.size () > 0 ) words.push_back (description);
451+ if (words.size () > 0 ) {
452+ stream << " #" ;
453+ std::size_t nchars = 2 ;
454+ for (auto word : words) {
455+ if (word.size () + nchars > 80 ) {
456+ stream << " \n #" ;
457+ nchars = 2 ;
458+ }
459+ stream << " " << word.c_str ();
460+ nchars += (word.size () + 1 );
441461 }
442- stream << " " << word.c_str ();
443- nchars += (word.size () + 1 );
444462 }
445- }
446- stream << " \n " ;
463+ stream << " \n " ;
447464
448- // If feature has unmet dependency, output it but comment it out
449- if (::CheckDependence (*meta, parameter.settings ) != SETTING_DEPENDENCE_ENABLE ) {
450- stream << " #" ;
451- }
465+ // If feature has unmet dependency, output it but comment it out
466+ if (::CheckDependence (*meta, parameter.settings ) != SETTING_DEPENDENCE_ENABLE ) {
467+ stream << " #" ;
468+ }
452469
453- if (meta->status == STATUS_DEPRECATED && !meta->deprecated_by_key .empty ()) {
454- const SettingMeta* replaced_setting = FindSetting (layer->settings , meta->deprecated_by_key .c_str ());
470+ if (meta->status == STATUS_DEPRECATED && !meta->deprecated_by_key .empty ()) {
471+ const SettingMeta* replaced_setting = FindSetting (layer->settings , meta->deprecated_by_key .c_str ());
455472
456- stream << format (" # This setting was deprecated and replaced by '%s' (%s) setting.\n " ,
457- replaced_setting->label .c_str (), replaced_setting->key .c_str ())
458- .c_str ();
459- }
473+ stream << format (" # This setting was deprecated and replaced by '%s' (%s) setting.\n " ,
474+ replaced_setting->label .c_str (), replaced_setting->key .c_str ())
475+ .c_str ();
476+ }
460477
461- stream << lc_layer_name.c_str () << setting_data->key .c_str () << " = " ;
462- stream << setting_data->Export (EXPORT_MODE_OVERRIDE ).c_str ();
463- stream << " \n\n " ;
478+ stream << lc_layer_name.c_str () << setting_data->key .c_str () << " = " ;
479+ stream << setting_data->Export (EXPORT_MODE_OVERRIDE ).c_str ();
480+ stream << " \n\n " ;
481+ }
464482 }
465483 }
466484 file.close ();
@@ -973,8 +991,8 @@ bool Configurator::Load() {
973991 this ->use_system_tray = json_object.value (" use_system_tray" ).toBool ();
974992 }
975993
976- if (json_object.value (" show_diagnostic_search " ) != QJsonValue::Undefined) {
977- this ->show_diagnostic_search = json_object.value (" show_diagnostic_search " ).toBool ();
994+ if (json_object.value (" show_external_layers_settings " ) != QJsonValue::Undefined) {
995+ this ->show_external_layers_settings = json_object.value (" show_external_layers_settings " ).toBool ();
978996 }
979997
980998 if (json_object.value (" VULKAN_HOME" ) != QJsonValue::Undefined) {
@@ -1039,7 +1057,7 @@ bool Configurator::Save() const {
10391057 json_object.insert (" use_notify_releases" , this ->use_notify_releases );
10401058 json_object.insert (" latest_sdk_version" , this ->latest_sdk_version .str ().c_str ());
10411059 json_object.insert (" last_vkconfig_version" , Version::VKCONFIG .str ().c_str ());
1042- json_object.insert (" show_diagnostic_search " , this ->show_diagnostic_search );
1060+ json_object.insert (" show_external_layers_settings " , this ->show_external_layers_settings );
10431061 json_object.insert (" VULKAN_HOME" , ::Path (Path::HOME ).RelativePath ().c_str ());
10441062 json_object.insert (" VULKAN_DOWNLOAD" , ::Path (Path::DOWNLOAD ).RelativePath ().c_str ());
10451063 json_interface_object.insert (GetToken (TAB_PREFERENCES ), json_object);
@@ -1112,9 +1130,24 @@ bool Configurator::GetUseNotifyReleases() const { return this->use_notify_releas
11121130
11131131void Configurator::SetUseNotifyReleases (bool enabled) { this ->use_notify_releases = enabled; }
11141132
1115- bool Configurator::GetShowDiagnosticSearch () const { return show_diagnostic_search; }
1133+ bool Configurator::GetShowExternalLayersSettings () const { return this ->show_external_layers_settings ; }
1134+
1135+ void Configurator::SetShowExternalLayersSettings (bool enabled) { this ->show_external_layers_settings = enabled; }
1136+
1137+ bool Configurator::IsExternalLayersSettingsUsed (bool icon_mode) const {
1138+ const Configuration* configuration = this ->GetActiveConfiguration ();
1139+ if (configuration == nullptr ) {
1140+ return this ->GetShowExternalLayersSettings ();
1141+ }
1142+
1143+ const bool in_use = configuration->override_settings || !configuration->override_settings_path .Empty ();
11161144
1117- void Configurator::SetShowDiagnosticSearch (bool enabled) { this ->show_diagnostic_search = enabled; }
1145+ if (icon_mode) {
1146+ return in_use;
1147+ } else {
1148+ return in_use || this ->GetShowExternalLayersSettings ();
1149+ }
1150+ }
11181151
11191152bool Configurator::ShouldNotify () const {
11201153 // Notify if
0 commit comments