Skip to content

Commit

Permalink
vkconfig: Fix switching of missing layer
Browse files Browse the repository at this point in the history
  • Loading branch information
christophe-lunarg committed Sep 11, 2024
1 parent bb8b322 commit 85a615b
Show file tree
Hide file tree
Showing 14 changed files with 853 additions and 983 deletions.
2 changes: 2 additions & 0 deletions vkconfig_core/layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@

const char* Layer::NO_PRESET = "User-Defined Settings";

bool operator<(const LayersPathInfo& a, const LayersPathInfo& b) { return a.path.RelativePath() < b.path.RelativePath(); }

Layer::Layer() : status(STATUS_STABLE), platforms(PLATFORM_DESKTOP_BIT) {}

Layer::Layer(const std::string& key) : key(key), status(STATUS_STABLE), platforms(PLATFORM_DESKTOP_BIT) {}
Expand Down
2 changes: 2 additions & 0 deletions vkconfig_core/layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ struct LayersPathInfo {
bool enabled = true;
};

bool operator<(const LayersPathInfo& a, const LayersPathInfo& b);

class Layer {
public:
static const char* NO_PRESET;
Expand Down
5 changes: 5 additions & 0 deletions vkconfig_core/layer_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ const Layer *LayerManager::Find(const std::string &layer_name, const Version &la
return this->Find(layer_name, latest);
} else {
for (std::size_t i = 0, n = this->selected_layers.size(); i < n; ++i) {
if (this->selected_layers[i].visible == false) {
continue;
}
if (this->selected_layers[i].key != layer_name) {
continue;
}
Expand Down Expand Up @@ -359,6 +362,8 @@ void LayerManager::AddPath(const LayersPathInfo &info) {
} else {
this->paths[LAYERS_PATHS_GUI].push_back(info);
}

std::sort(this->paths[LAYERS_PATHS_GUI].begin(), this->paths[LAYERS_PATHS_GUI].end());
}

void LayerManager::RemovePath(const LayersPathInfo &path_info) {
Expand Down
4 changes: 2 additions & 2 deletions vkconfig_core/type_tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
const char* GetToken(TabType type) {
static const char* TOKENS[]{
"DIAGNOSTIC", // TAB_DIAGNOSTIC
"APPLICATIONS", // TAB_APPLICATIONS
"LAYERS", // TAB_LAYERS
"CONFIGURATIONS", // TAB_CONFIGURATIONS
"LAYERS", // TAB_LAYERS
"APPLICATIONS", // TAB_APPLICATIONS
"PREFERENCES", // TAB_PREFERENCES
"HELP" // TAB_HELP
};
Expand Down
4 changes: 2 additions & 2 deletions vkconfig_core/type_tab.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

enum TabType {
TAB_DIAGNOSTIC = 0,
TAB_APPLICATIONS,
TAB_LAYERS,
TAB_CONFIGURATIONS,
TAB_LAYERS,
TAB_APPLICATIONS,
TAB_PREFERENCES,
TAB_HELP,

Expand Down
5 changes: 4 additions & 1 deletion vkconfig_gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,10 @@ QStringList MainWindow::BuildEnvVariables() const {
return env;
}

void MainWindow::on_tab_widget_currentChanged(int index) { this->tabs[index]->UpdateUI(UPDATE_REBUILD_UI); }
void MainWindow::on_tab_widget_currentChanged(int index) {
assert(index >= 0);
this->tabs[index]->UpdateUI(UPDATE_REBUILD_UI);
}

void MainWindow::on_push_button_launcher_clicked() {
// Are we already monitoring a running app? If so, terminate it
Expand Down
Loading

0 comments on commit 85a615b

Please sign in to comment.