MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / AddPlugin

Method AddPlugin

qt/OpenRGBDialog2/OpenRGBDialog2.cpp:916–998  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

914}
915
916void OpenRGBDialog2::AddPlugin(OpenRGBPluginEntry* plugin)
917{
918 /*-----------------------------------------------------*\
919 | Create the tab label |
920 \*-----------------------------------------------------*/
921 TabLabel* PluginTabLabel = new TabLabel(OpenRGBFont::extension, QString::fromStdString(plugin->info.Label), (char *)plugin->info.Label.c_str(), (char *)context);
922
923 /*-----------------------------------------------------*\
924 | Place plugin as its own top level tab |
925 \*-----------------------------------------------------*/
926 if(plugin->info.Location == OPENRGB_PLUGIN_LOCATION_TOP)
927 {
928 QWidget* NewPluginTab = plugin->plugin->GetWidget();
929
930 plugin->widget = NewPluginTab;
931
932 OpenRGBPluginContainer* NewPluginContainer = new OpenRGBPluginContainer(NewPluginTab, this);
933
934 ui->MainTabBar->addTab(NewPluginContainer,QString().fromStdString(plugin->info.Label));
935 }
936 /*-----------------------------------------------------*\
937 | Place plugin in the Devices tab |
938 \*-----------------------------------------------------*/
939 else if(plugin->info.Location == OPENRGB_PLUGIN_LOCATION_DEVICES)
940 {
941 QWidget* NewPluginTab = plugin->plugin->GetWidget();
942
943 plugin->widget = NewPluginTab;
944
945 OpenRGBPluginContainer* NewPluginContainer = new OpenRGBPluginContainer(NewPluginTab, this);
946
947 ui->DevicesTabBar->addTab(NewPluginContainer," ");
948
949 ui->DevicesTabBar->tabBar()->setTabButton((ui->DevicesTabBar->count() - 1),QTabBar::LeftSide , PluginTabLabel);
950 }
951 /*-----------------------------------------------------*\
952 | Place plugin in the Information tab |
953 \*-----------------------------------------------------*/
954 else if(plugin->info.Location == OPENRGB_PLUGIN_LOCATION_INFORMATION)
955 {
956 QWidget* NewPluginTab = plugin->plugin->GetWidget();
957
958 plugin->widget = NewPluginTab;
959
960 OpenRGBPluginContainer* NewPluginContainer = new OpenRGBPluginContainer(NewPluginTab, this);
961
962 ui->InformationTabBar->addTab(NewPluginContainer," ");
963
964 ui->InformationTabBar->tabBar()->setTabButton((ui->InformationTabBar->count() - 1),QTabBar::LeftSide , PluginTabLabel);
965 }
966 /*-----------------------------------------------------*\
967 | Place plugin in the Settings tab |
968 \*-----------------------------------------------------*/
969 else if(plugin->info.Location == OPENRGB_PLUGIN_LOCATION_SETTINGS)
970 {
971 QWidget* NewPluginTab = plugin->plugin->GetWidget();
972
973 plugin->widget = NewPluginTab;

Callers 2

InstallPluginMethod · 0.45
CreatePluginCallbackFunction · 0.45

Calls 1

countMethod · 0.45

Tested by

no test coverage detected