From 70a2fa81c87311c0731ea1b9e2ff810720424940 Mon Sep 17 00:00:00 2001 From: morg Date: Tue, 7 Sep 2021 13:13:44 +0200 Subject: [PATCH] Enable the remove plugin button only when a plugin is selected. --- qt/OpenRGBPluginsPage/OpenRGBPluginsPage.cpp | 8 ++++++++ qt/OpenRGBPluginsPage/OpenRGBPluginsPage.h | 2 ++ qt/OpenRGBPluginsPage/OpenRGBPluginsPage.ui | 3 +++ 3 files changed, 13 insertions(+) diff --git a/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.cpp b/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.cpp index f17aa2e3..46a280b3 100644 --- a/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.cpp +++ b/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.cpp @@ -298,3 +298,11 @@ void Ui::OpenRGBPluginsPage::on_EnableButton_clicked(OpenRGBPluginsEntry* entry) plugin_manager->UnloadPlugin(entry_path); } } + +void Ui::OpenRGBPluginsPage::on_PluginsList_itemSelectionChanged() +{ + /*-----------------------------------------------------*\ + | Enable the remove button when there's a selected item | + \*-----------------------------------------------------*/ + ui->RemovePluginButton->setEnabled(!ui->PluginsList->selectedItems().empty()); +} diff --git a/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.h b/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.h index 75bfc50b..405e747d 100644 --- a/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.h +++ b/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.h @@ -26,6 +26,8 @@ private slots: void on_RemovePluginButton_clicked(); + void on_PluginsList_itemSelectionChanged(); + private: Ui::OpenRGBPluginsPageUi* ui; PluginManager* plugin_manager; diff --git a/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.ui b/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.ui index 6f31057a..c8a69ae3 100644 --- a/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.ui +++ b/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.ui @@ -23,6 +23,9 @@ + + false + Remove Plugin