From 702be2401b6affa824c2121e21523bf2b4bb20ce Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Sun, 29 Aug 2021 14:32:19 -0500 Subject: [PATCH] Add comment indicating location is mandatory, list possible locations, rename SettingsTabBar to SettingsTab for consistency --- OpenRGBPluginInterface.h | 4 +++- qt/OpenRGBDialog2.cpp | 14 +++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/OpenRGBPluginInterface.h b/OpenRGBPluginInterface.h index 3552bf33..d16c7e3d 100644 --- a/OpenRGBPluginInterface.h +++ b/OpenRGBPluginInterface.h @@ -33,7 +33,9 @@ struct OpenRGBPluginInfo /*-------------------------------------------------------------------------------------------------*\ | Plugin Tab Configuration | \*-------------------------------------------------------------------------------------------------*/ - std::string Location; /* Plugin tab location, such as "TopTabBar" */ + std::string Location; /* Plugin tab location. This field is mandatory */ + /* Options are "TopTabBar", "DevicesTab", */ + /* "InformationTab", or "SettingsTab" */ std::string Label; /* Plugin tab label string */ std::string TabIconString; /* Plugin tab icon string, leave empty to use custom */ QImage TabIcon; /* Custom tab icon image (displayed 16x16) */ diff --git a/qt/OpenRGBDialog2.cpp b/qt/OpenRGBDialog2.cpp index 883403c7..eee31a72 100644 --- a/qt/OpenRGBDialog2.cpp +++ b/qt/OpenRGBDialog2.cpp @@ -769,9 +769,9 @@ void OpenRGBDialog2::AddPluginTab(OpenRGBPluginEntry* plugin) ui->MainTabBar->addTab(NewPluginContainer,QString().fromStdString(plugin->info.Label)); } /*-----------------------------------------------------*\ - | SettingsTabBar - Place plugin in the Settings tab | + | SettingsTab - Place plugin in the Settings tab | \*-----------------------------------------------------*/ - else if(plugin->info.Location == "SettingsTabBar") + else if(plugin->info.Location == "SettingsTab") { QWidget* NewPluginTab = plugin->plugin->CreateGUI(this); @@ -819,11 +819,11 @@ void OpenRGBDialog2::RemovePluginTab(OpenRGBPluginEntry* plugin) { for(int tab_idx = 0; tab_idx < ui->DevicesTabBar->count(); tab_idx++) { - if(dynamic_cast(ui->DevicesTabBar->widget(tab_idx)) != nullptr) + if(dynamic_cast(ui->DeviceTabBar->widget(tab_idx)) != nullptr) { - if(dynamic_cast(ui->DevicesTabBar->widget(tab_idx))->plugin_widget == plugin->widget) + if(dynamic_cast(ui->DeviceTabBar->widget(tab_idx))->plugin_widget == plugin->widget) { - ui->DevicesTabBar->removeTab(tab_idx); + ui->DeviceTabBar->removeTab(tab_idx); delete plugin->widget; } } @@ -847,9 +847,9 @@ void OpenRGBDialog2::RemovePluginTab(OpenRGBPluginEntry* plugin) } } /*-----------------------------------------------------*\ - | SettingsTabBar - Place plugin in the Settings tab | + | SettingsTab - Place plugin in the Settings tab | \*-----------------------------------------------------*/ - else if(plugin->info.Location == "SettingsTabBar") + else if(plugin->info.Location == "SettingsTab") { for(int tab_idx = 0; tab_idx < ui->SettingsTabBar->count(); tab_idx++) {