From 8b5c70df7071775c05ac59631427858d1f2772e8 Mon Sep 17 00:00:00 2001 From: Christophe Date: Thu, 19 Sep 2024 18:48:35 +0200 Subject: [PATCH] vkconfig3: Don't allow implicit layer forced on --- vkconfig_core/alert.h | 1 + vkconfig_core/test/test_parameter.cpp | 1 + vkconfig_core/type_layer_control.cpp | 2 +- vkconfig_core/type_layer_control.h | 9 ++++++--- vkconfig_gui/widget_tab_configurations_layer.cpp | 12 ++++++++++-- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/vkconfig_core/alert.h b/vkconfig_core/alert.h index 38e030dfae..fa5a4b1029 100644 --- a/vkconfig_core/alert.h +++ b/vkconfig_core/alert.h @@ -33,6 +33,7 @@ struct Alert { static void LayerInvalid(const Path& path, const char* message); static QMessageBox::Button LayerImplicit(const char* layer_name); + static QMessageBox::Button LayerProfiles(); static void PathInvalid(const Path& path, const char* message); diff --git a/vkconfig_core/test/test_parameter.cpp b/vkconfig_core/test/test_parameter.cpp index 422bc358b6..0db2cca793 100644 --- a/vkconfig_core/test/test_parameter.cpp +++ b/vkconfig_core/test/test_parameter.cpp @@ -452,3 +452,4 @@ TEST(test_parameter, OrderParameter_ImplicitLayer) { EXPECT_STREQ(parameters[2].key.c_str(), "Layer E0"); EXPECT_STREQ(parameters[3].key.c_str(), "Layer I0"); } +*/ diff --git a/vkconfig_core/type_layer_control.cpp b/vkconfig_core/type_layer_control.cpp index 42c4675d72..607127c1ea 100644 --- a/vkconfig_core/type_layer_control.cpp +++ b/vkconfig_core/type_layer_control.cpp @@ -28,8 +28,8 @@ const char* GetToken(LayerControl control) { static const char* TOKENS[] = { "Auto", // LAYER_CONTROL_AUTO - "On", // LAYER_CONTROL_ON "Off", // LAYER_CONTROL_OFF + "On", // LAYER_CONTROL_ON "application_enabled_layers", // LAYER_CONTROL_APPLICATIONS "unordered_layer_location" // LAYER_CONTROL_UNORDERED }; diff --git a/vkconfig_core/type_layer_control.h b/vkconfig_core/type_layer_control.h index 2ca084da6c..0150b7f26f 100644 --- a/vkconfig_core/type_layer_control.h +++ b/vkconfig_core/type_layer_control.h @@ -22,16 +22,19 @@ enum LayerControl { LAYER_CONTROL_AUTO = 0, - LAYER_CONTROL_ON, LAYER_CONTROL_OFF, + LAYER_CONTROL_ON, LAYER_CONTROL_APPLICATIONS_API, LAYER_CONTROL_APPLICATIONS_ENV, LAYER_CONTROL_FIRST = LAYER_CONTROL_AUTO, LAYER_CONTROL_LAST = LAYER_CONTROL_APPLICATIONS_ENV, - LAYER_CONTROL_UI_FIRST = LAYER_CONTROL_AUTO, - LAYER_CONTROL_UI_LAST = LAYER_CONTROL_OFF + LAYER_CONTROL_EXPLICIT_FIRST = LAYER_CONTROL_AUTO, + LAYER_CONTROL_EXPLICIT_LAST = LAYER_CONTROL_ON, + + LAYER_CONTROL_IMPLICIT_FIRST = LAYER_CONTROL_AUTO, + LAYER_CONTROL_IMPLICIT_LAST = LAYER_CONTROL_OFF }; enum { LAYER_CONTROL_COUNT = LAYER_CONTROL_LAST - LAYER_CONTROL_FIRST + 1 }; diff --git a/vkconfig_gui/widget_tab_configurations_layer.cpp b/vkconfig_gui/widget_tab_configurations_layer.cpp index 150f312a78..3958c58acf 100644 --- a/vkconfig_gui/widget_tab_configurations_layer.cpp +++ b/vkconfig_gui/widget_tab_configurations_layer.cpp @@ -128,8 +128,16 @@ ConfigurationLayerWidget::ConfigurationLayerWidget(TabConfigurations *tab, const // this->layer_version->installEventFilter(this); this->layer_state = new QComboBox(this); - for (int i = LAYER_CONTROL_UI_FIRST; i <= LAYER_CONTROL_UI_LAST; ++i) { - this->layer_state->addItem(GetToken(static_cast(i))); + if (layer != nullptr) { + if (layer->type == LAYER_TYPE_EXPLICIT) { + for (int i = LAYER_CONTROL_EXPLICIT_FIRST; i <= LAYER_CONTROL_EXPLICIT_LAST; ++i) { + this->layer_state->addItem(GetToken(static_cast(i))); + } + } else { + for (int i = LAYER_CONTROL_IMPLICIT_FIRST; i <= LAYER_CONTROL_IMPLICIT_LAST; ++i) { + this->layer_state->addItem(GetToken(static_cast(i))); + } + } } this->layer_state->setEnabled(!layer_versions.empty()); this->layer_state->setCurrentIndex(parameter.control);