| 998 | } |
| 999 | |
| 1000 | void OpenRGBDialog2::RemovePlugin(OpenRGBPluginEntry* plugin) |
| 1001 | { |
| 1002 | /*-----------------------------------------------------*\ |
| 1003 | | Place plugin as its own top level tab | |
| 1004 | \*-----------------------------------------------------*/ |
| 1005 | if(plugin->info.Location == OPENRGB_PLUGIN_LOCATION_TOP) |
| 1006 | { |
| 1007 | for(int tab_idx = 0; tab_idx < ui->MainTabBar->count(); tab_idx++) |
| 1008 | { |
| 1009 | if(dynamic_cast<OpenRGBPluginContainer*>(ui->MainTabBar->widget(tab_idx)) != nullptr) |
| 1010 | { |
| 1011 | if(dynamic_cast<OpenRGBPluginContainer*>(ui->MainTabBar->widget(tab_idx))->plugin_widget == plugin->widget) |
| 1012 | { |
| 1013 | ui->MainTabBar->removeTab(tab_idx); |
| 1014 | delete plugin->widget; |
| 1015 | } |
| 1016 | } |
| 1017 | } |
| 1018 | } |
| 1019 | /*-----------------------------------------------------*\ |
| 1020 | | Place plugin in the Devices tab | |
| 1021 | \*-----------------------------------------------------*/ |
| 1022 | else if(plugin->info.Location == OPENRGB_PLUGIN_LOCATION_DEVICES) |
| 1023 | { |
| 1024 | for(int tab_idx = 0; tab_idx < ui->DevicesTabBar->count(); tab_idx++) |
| 1025 | { |
| 1026 | if(dynamic_cast<OpenRGBPluginContainer*>(ui->DevicesTabBar->widget(tab_idx)) != nullptr) |
| 1027 | { |
| 1028 | if(dynamic_cast<OpenRGBPluginContainer*>(ui->DevicesTabBar->widget(tab_idx))->plugin_widget == plugin->widget) |
| 1029 | { |
| 1030 | ui->DevicesTabBar->removeTab(tab_idx); |
| 1031 | delete plugin->widget; |
| 1032 | } |
| 1033 | } |
| 1034 | } |
| 1035 | } |
| 1036 | /*-----------------------------------------------------*\ |
| 1037 | | Place plugin in the Information tab | |
| 1038 | \*-----------------------------------------------------*/ |
| 1039 | else if(plugin->info.Location == OPENRGB_PLUGIN_LOCATION_INFORMATION) |
| 1040 | { |
| 1041 | for(int tab_idx = 0; tab_idx < ui->InformationTabBar->count(); tab_idx++) |
| 1042 | { |
| 1043 | if(dynamic_cast<OpenRGBPluginContainer*>(ui->InformationTabBar->widget(tab_idx)) != nullptr) |
| 1044 | { |
| 1045 | if(dynamic_cast<OpenRGBPluginContainer*>(ui->InformationTabBar->widget(tab_idx))->plugin_widget == plugin->widget) |
| 1046 | { |
| 1047 | ui->InformationTabBar->removeTab(tab_idx); |
| 1048 | delete plugin->widget; |
| 1049 | } |
| 1050 | } |
| 1051 | } |
| 1052 | } |
| 1053 | /*-----------------------------------------------------*\ |
| 1054 | | Place plugin in the Settings tab | |
| 1055 | \*-----------------------------------------------------*/ |
| 1056 | else if(plugin->info.Location == OPENRGB_PLUGIN_LOCATION_SETTINGS) |
| 1057 | { |
no test coverage detected