diff --git a/qt/OpenRGBDialog2.cpp b/qt/OpenRGBDialog2.cpp index b7996336..8c9a014a 100644 --- a/qt/OpenRGBDialog2.cpp +++ b/qt/OpenRGBDialog2.cpp @@ -161,11 +161,26 @@ OpenRGBDialog2::OpenRGBDialog2(std::vector& bus, std::vec | Update the device list | \*-----------------------------------------------------*/ UpdateDevicesList(); +} +OpenRGBDialog2::~OpenRGBDialog2() +{ + delete ui; +} + +void OpenRGBDialog2::closeEvent(QCloseEvent *event) +{ + ResourceManager::get()->WaitForDeviceDetection(); + event->accept(); +} + +void OpenRGBDialog2::AddSoftwareInfoPage() +{ /*-----------------------------------------------------*\ | Create the Software Information page | \*-----------------------------------------------------*/ SoftInfoPage = new OpenRGBSoftwareInfoPage(); + ui->InformationTabBar->addTab(SoftInfoPage, ""); QString SoftwareLabelString = "
InformationTabBar->addTab(SMBusToolsPage, ""); + /*-----------------------------------------------------*\ + | Create the I2C Tools tab in the Information bar | + \*-----------------------------------------------------*/ + ui->InformationTabBar->addTab(SMBusToolsPage, ""); - QString SMBusToolsLabelString = "
SMBus Tools
"; + QString SMBusToolsLabelString = "
SMBus Tools
"; - QLabel *SMBusToolsTabLabel = new QLabel(); - SMBusToolsTabLabel->setText(SMBusToolsLabelString); - SMBusToolsTabLabel->setIndent(20); - SMBusToolsTabLabel->setGeometry(0, 0, 200, 20); + QLabel *SMBusToolsTabLabel = new QLabel(); + SMBusToolsTabLabel->setText(SMBusToolsLabelString); + SMBusToolsTabLabel->setIndent(20); + SMBusToolsTabLabel->setGeometry(0, 0, 200, 20); - ui->InformationTabBar->tabBar()->setTabButton(ui->InformationTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SMBusToolsTabLabel); - } + ui->InformationTabBar->tabBar()->setTabButton(ui->InformationTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SMBusToolsTabLabel); } void OpenRGBDialog2::AddClientTab() @@ -347,6 +350,19 @@ void OpenRGBDialog2::UpdateDevicesList() InformationTabBar->setTabButton(dev_idx, QTabBar::LeftSide, NewTabLabel); } + + /*-----------------------------------------------------*\ + | Add the Software Info page | + \*-----------------------------------------------------*/ + AddSoftwareInfoPage(); + + /*-----------------------------------------------------*\ + | Add the SMBus Tools page if enabled | + \*-----------------------------------------------------*/ + if(ShowI2CTools) + { + AddI2CToolsPage(); + } } void OpenRGBDialog2::UpdateProfileList() diff --git a/qt/OpenRGBDialog2.h b/qt/OpenRGBDialog2.h index a6f144a4..00780500 100644 --- a/qt/OpenRGBDialog2.h +++ b/qt/OpenRGBDialog2.h @@ -52,6 +52,8 @@ private: OpenRGBSystemInfoPage *SMBusToolsPage; OpenRGBSoftwareInfoPage *SoftInfoPage; + bool ShowI2CTools = false; + /*-------------------------------------*\ | System tray icon and menu | \*-------------------------------------*/ @@ -63,6 +65,8 @@ private: \*-------------------------------------*/ Ui::OpenRGBDialog2Ui *ui; + void AddSoftwareInfoPage(); + void ClearDevicesList(); void UpdateDevicesList(); void UpdateProfileList();