Add initial version of the Plugin Container, which prevents plugins from resizing the window unless shown
This commit is contained in:
parent
30623b36fd
commit
dd4865c3e0
5 changed files with 117 additions and 6 deletions
|
|
@ -145,6 +145,7 @@ HEADERS +=
|
|||
pci_ids/pci_ids.h \
|
||||
qt/DeviceView.h \
|
||||
qt/OpenRGBDialog2.h \
|
||||
qt/OpenRGBPluginContainer.h \
|
||||
qt/OpenRGBProfileSaveDialog.h \
|
||||
qt/OpenRGBServerInfoPage.h \
|
||||
qt/OpenRGBSoftwareInfoPage.h \
|
||||
|
|
@ -378,6 +379,7 @@ SOURCES +=
|
|||
net_port/net_port.cpp \
|
||||
qt/DeviceView.cpp \
|
||||
qt/OpenRGBDialog2.cpp \
|
||||
qt/OpenRGBPluginContainer.cpp \
|
||||
qt/OpenRGBProfileSaveDialog.cpp \
|
||||
qt/OpenRGBServerInfoPage.cpp \
|
||||
qt/OpenRGBSoftwareInfoPage.cpp \
|
||||
|
|
@ -655,6 +657,7 @@ FORMS +=
|
|||
qt/OpenRGBDevicePage.ui \
|
||||
qt/OpenRGBDialog.ui \
|
||||
qt/OpenRGBDialog2.ui \
|
||||
qt/OpenRGBPluginContainer.ui \
|
||||
qt/OpenRGBProfileSaveDialog.ui \
|
||||
qt/OpenRGBServerInfoPage.ui \
|
||||
qt/OpenRGBSoftwareInfoPage.ui \
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include "OpenRGBDevicePage.h"
|
||||
#include "OpenRGBDeviceInfoPage.h"
|
||||
#include "OpenRGBServerInfoPage.h"
|
||||
#include "OpenRGBPluginContainer.h"
|
||||
#include "OpenRGBProfileSaveDialog.h"
|
||||
#include "ResourceManager.h"
|
||||
#include <QLabel>
|
||||
|
|
@ -489,9 +490,11 @@ void OpenRGBDialog2::AddPluginTab(PluginManager* plugin_manager, int plugin_inde
|
|||
if(Location == "InformationTab" && !TopBarAlreadyLoaded)
|
||||
{
|
||||
QWidget* NewPluginTab = new QWidget;
|
||||
|
||||
NewPluginTab = plugin_manager->ActivePlugins[plugin_index]->CreateGUI(NewPluginTab);
|
||||
ui->InformationTabBar->addTab(NewPluginTab," ");
|
||||
|
||||
OpenRGBPluginContainer* NewPluginContainer = new OpenRGBPluginContainer(NewPluginTab);
|
||||
|
||||
ui->InformationTabBar->addTab(NewPluginContainer," ");
|
||||
|
||||
ui->InformationTabBar->tabBar()->setTabButton((ui->InformationTabBar->count() - 1),QTabBar::LeftSide , PluginTabLabel);
|
||||
}
|
||||
|
|
@ -501,9 +504,11 @@ void OpenRGBDialog2::AddPluginTab(PluginManager* plugin_manager, int plugin_inde
|
|||
else if(Location == "DevicesTab")
|
||||
{
|
||||
QWidget* NewPluginTab = new QWidget;
|
||||
|
||||
NewPluginTab = plugin_manager->ActivePlugins[plugin_index]->CreateGUI(NewPluginTab);
|
||||
ui->DevicesTabBar->addTab(NewPluginTab," ");
|
||||
|
||||
OpenRGBPluginContainer* NewPluginContainer = new OpenRGBPluginContainer(NewPluginTab);
|
||||
|
||||
ui->DevicesTabBar->addTab(NewPluginContainer," ");
|
||||
|
||||
ui->DevicesTabBar->tabBar()->setTabButton((ui->DevicesTabBar->count() - 1),QTabBar::LeftSide , PluginTabLabel);
|
||||
}
|
||||
|
|
@ -513,10 +518,11 @@ void OpenRGBDialog2::AddPluginTab(PluginManager* plugin_manager, int plugin_inde
|
|||
else if(Location == "TopTabBar" && !TopBarAlreadyLoaded)
|
||||
{
|
||||
QWidget* NewPluginTab = new QWidget;
|
||||
|
||||
NewPluginTab = plugin_manager->ActivePlugins[plugin_index]->CreateGUI(NewPluginTab);
|
||||
|
||||
ui->MainTabBar->addTab(NewPluginTab,QString().fromStdString(plugin_manager->ActivePlugins[plugin_index]->info.PluginName));
|
||||
OpenRGBPluginContainer* NewPluginContainer = new OpenRGBPluginContainer(NewPluginTab);
|
||||
|
||||
ui->MainTabBar->addTab(NewPluginContainer,QString().fromStdString(plugin_manager->ActivePlugins[plugin_index]->info.PluginName));
|
||||
}
|
||||
/*-----------------------------------------------------*\
|
||||
| Display an error message if the plugin does not |
|
||||
|
|
|
|||
32
qt/OpenRGBPluginContainer.cpp
Normal file
32
qt/OpenRGBPluginContainer.cpp
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#include "OpenRGBPluginContainer.h"
|
||||
#include "ui_OpenRGBPluginContainer.h"
|
||||
|
||||
Ui::OpenRGBPluginContainer::OpenRGBPluginContainer(QWidget *plugin, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::OpenRGBPluginContainerUi)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
plugin_widget = plugin;
|
||||
|
||||
ui->PluginContainerLayout->layout()->addWidget(plugin_widget);
|
||||
|
||||
plugin_widget->hide();
|
||||
}
|
||||
|
||||
Ui::OpenRGBPluginContainer::~OpenRGBPluginContainer()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void Ui::OpenRGBPluginContainer::on_ShowPluginButton_clicked()
|
||||
{
|
||||
if(plugin_widget->isHidden())
|
||||
{
|
||||
plugin_widget->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin_widget->hide();
|
||||
}
|
||||
}
|
||||
29
qt/OpenRGBPluginContainer.h
Normal file
29
qt/OpenRGBPluginContainer.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef OPENRGBPLUGINCONTAINER_H
|
||||
#define OPENRGBPLUGINCONTAINER_H
|
||||
|
||||
#include "ui_OpenRGBPluginContainer.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBPluginContainer;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBPluginContainer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenRGBPluginContainer(QWidget *plugin, QWidget *parent = nullptr);
|
||||
~OpenRGBPluginContainer();
|
||||
|
||||
private slots:
|
||||
void on_ShowPluginButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBPluginContainerUi *ui;
|
||||
QWidget* plugin_widget;
|
||||
};
|
||||
|
||||
#endif // OPENRGBPLUGINCONTAINER_H
|
||||
41
qt/OpenRGBPluginContainer.ui
Normal file
41
qt/OpenRGBPluginContainer.ui
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenRGBPluginContainerUi</class>
|
||||
<widget class="QWidget" name="OpenRGBPluginContainerUi">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="PluginContainerLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetNoConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="ShowPluginButton">
|
||||
<property name="text">
|
||||
<string>Show/Hide Plugin</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Loading…
Add table
Add a link
Reference in a new issue