Update to the latest plugin API version

This commit is contained in:
Adam Honse 2021-08-30 11:36:58 -05:00
parent 99d9498e45
commit 48f7513e17
3 changed files with 46 additions and 36 deletions

@ -1 +1 @@
Subproject commit 468cf81a610947355f4273fdc4ae99cdc31515ac
Subproject commit cbdebf7ec89f448b98d4ae23cf4af5f2e21b99f7

View file

@ -10,29 +10,29 @@
#include "OpenRGBE131ReceiverPlugin.h"
#include "OpenRGBE131ReceiverDialog.h"
/*-----------------------------------------*\
| Initialize |
| |
| This function must be present in all |
| OpenRGB plugins. It defines the plugin |
| name, description, location, and other |
| plugin information. It creates the tab |
| label and is the entry point for plugin |
| code |
\*-----------------------------------------*/
OpenRGBPluginInfo OpenRGBPlugin::Initialize(bool dark_theme, ResourceManager* resource_manager_ptr)
OpenRGBPluginInfo OpenRGBPlugin::GetPluginInfo()
{
info.PluginName = "E1.31 Receiver";
info.PluginDescription = "OpenRGB E1.31 Receiver Plugin";
info.PluginLocation = "TopTabBar";
info.HasCustom = false;
info.PluginLabel = new QLabel();
OpenRGBPluginInfo info;
/*-----------------------------------------------------*\
| Set the label text |
\*-----------------------------------------------------*/
info.PluginLabel->setText("E1.31 Receiver");
info.Name = "OpenRGB E1.31 Receiver Plugin";
info.Description = "Receive E1.31 lighting control data from external applications to control OpenRGB devices";
info.Version = "0";
info.Commit = "";
info.URL = "https://gitlab.com/OpenRGBDevelopers/OpenRGBE131ReceiverPlugin";
info.Location = OPENRGB_PLUGIN_LOCATION_TOP;
info.Label = "E1.31 Receiver";
return(info);
}
unsigned int OpenRGBPlugin::GetPluginAPIVersion()
{
return(OPENRGB_PLUGIN_API_VERSION);
}
void OpenRGBPlugin::Load(bool dark_theme, ResourceManager* resource_manager_ptr)
{
/*-----------------------------------------------------*\
| Save the arguments to Initialize based on what you |
| need for this plugin's functionality. In this example|
@ -40,26 +40,27 @@ OpenRGBPluginInfo OpenRGBPlugin::Initialize(bool dark_theme, ResourceManager* re
| list, so save the Resource Manager pointer locally. |
\*-----------------------------------------------------*/
resource_manager = resource_manager_ptr;
return info;
}
/*-----------------------------------------*\
| CreateGUI |
| |
| This function must be present in all |
| OpenRGB plugins. It creates the QWidget |
| that represents the plugin tab's content |
\*-----------------------------------------*/
QWidget* OpenRGBPlugin::CreateGUI(QWidget* parent)
QWidget* OpenRGBPlugin::GetWidget()
{
/*-----------------------------------------------------*\
| Create the main widget for this plugin tab |
\*-----------------------------------------------------*/
QWidget* plugin_widget = new OpenRGBE131ReceiverDialog(resource_manager, parent);
QWidget* plugin_widget = new OpenRGBE131ReceiverDialog(resource_manager, nullptr);
/*-----------------------------------------------------*\
| The CreateGUI function must return the main widget |
\*-----------------------------------------------------*/
return plugin_widget;
}
QMenu* OpenRGBPlugin::GetTrayMenu()
{
return(nullptr);
}
void OpenRGBPlugin::Unload()
{
}

View file

@ -24,12 +24,21 @@ class OpenRGBPlugin : public QObject, public OpenRGBPluginInterface
Q_INTERFACES(OpenRGBPluginInterface)
public:
virtual ~OpenRGBPlugin() {};
virtual ~OpenRGBPlugin() {}
virtual OpenRGBPluginInfo Initialize(bool dark_theme, ResourceManager* resource_manager_ptr) override;
virtual QWidget *CreateGUI(QWidget* parent) override;
/*-------------------------------------------------------------------------------------------------*\
| Plugin Information |
\*-------------------------------------------------------------------------------------------------*/
virtual OpenRGBPluginInfo GetPluginInfo() override;
virtual unsigned int GetPluginAPIVersion() override;
/*-------------------------------------------------------------------------------------------------*\
| Plugin Functionality |
\*-------------------------------------------------------------------------------------------------*/
virtual void Load(bool dark_theme, ResourceManager* resource_manager_ptr) override;
virtual QWidget* GetWidget() override;
virtual QMenu* GetTrayMenu() override;
virtual void Unload() override;
private:
ResourceManager* resource_manager;
};