From 10d858bfe4986ecc5d70cd088a686a51135d89da Mon Sep 17 00:00:00 2001 From: Christophe Date: Wed, 25 Sep 2024 13:29:41 +0200 Subject: [PATCH] vkconfig: Notify risk when overriding implicit layer Change-Id: I6d271cbe3c8e825415713905b91531c0bcb82e32 --- vkconfig/dialog_layers.cpp | 8 +++++--- vkconfig_core/alert.cpp | 8 ++++---- vkconfig_core/alert.h | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/vkconfig/dialog_layers.cpp b/vkconfig/dialog_layers.cpp index 448bdbf19e..9db37628b8 100644 --- a/vkconfig/dialog_layers.cpp +++ b/vkconfig/dialog_layers.cpp @@ -285,7 +285,9 @@ void LayersDialog::AddLayerItem(const Parameter ¶meter) { } else { // A layers configuration may have excluded layer that are misssing because they are not available on this platform // We simply hide these layers to avoid confusing the Vulkan developers - if (parameter.state == LAYER_STATE_EXCLUDED) return; + if (parameter.state == LAYER_STATE_EXCLUDED) { + return; + } decorated_name += " (Missing)"; } @@ -600,13 +602,13 @@ void LayersDialog::layerUseChanged(QTreeWidgetItem *item, int selection) { if (Alert::LayerProfiles() == QMessageBox::Yes) { OverrideAllExplicitLayers(); } - } else if (layer_state == LAYER_STATE_EXCLUDED) { + } else if (layer_state != LAYER_STATE_APPLICATION_CONTROLLED) { const std::vector &selected_layers = Configurator::Get().layers.selected_layers; const Layer *layer = FindByKey(selected_layers, tree_layer_item->layer_name.c_str()); if (layer != nullptr) { if (layer->type == LAYER_TYPE_IMPLICIT) { - if (Alert::LayerImplicitExcluded(tree_layer_item->layer_name.c_str()) == QMessageBox::No) { + if (Alert::LayerImplicit(tree_layer_item->layer_name.c_str()) == QMessageBox::No) { layer_state = LAYER_STATE_APPLICATION_CONTROLLED; } } diff --git a/vkconfig_core/alert.cpp b/vkconfig_core/alert.cpp index efee9f2c2d..da9721bc62 100644 --- a/vkconfig_core/alert.cpp +++ b/vkconfig_core/alert.cpp @@ -88,15 +88,15 @@ void Alert::PathInvalid(const char* path, const char* message) { alert.exec(); } -QMessageBox::Button Alert::LayerImplicitExcluded(const char* layer_name) { - const char* text = "%s was excluded but it is an implicit layer. This may cause undefined behavior, including crashes."; +QMessageBox::Button Alert::LayerImplicit(const char* layer_name) { + const char* text = "%s was overridden but it is an implicit layer. This may cause undefined behavior, including crashes."; QMessageBox alert; - alert.QDialog::setWindowTitle("Implicit layer excluded..."); + alert.QDialog::setWindowTitle("Implicit layer was overridden..."); alert.setText(format(text, layer_name).c_str()); alert.setInformativeText("Do you want to continue?"); alert.setStandardButtons(QMessageBox::Yes | QMessageBox::No); - alert.setIcon(QMessageBox::Warning); + alert.setIcon(QMessageBox::Critical); return static_cast(alert.exec()); } diff --git a/vkconfig_core/alert.h b/vkconfig_core/alert.h index fafbcf5f43..bc071eeefd 100644 --- a/vkconfig_core/alert.h +++ b/vkconfig_core/alert.h @@ -33,7 +33,7 @@ struct Alert { static void ApplicationListEmpty(); static void LayerInvalid(const char* path, const char* message); - static QMessageBox::Button LayerImplicitExcluded(const char* layer_name); + static QMessageBox::Button LayerImplicit(const char* layer_name); static QMessageBox::Button LayerProfiles(); static void PathInvalid(const char* path, const char* message);