|
|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
#include "OpenRGBDialog2.h"
|
|
|
|
|
#include "OpenRGBDevicePage.h"
|
|
|
|
|
#include "OpenRGBDeviceInfoPage.h"
|
|
|
|
|
#include "OpenRGBServerInfoPage.h"
|
|
|
|
|
#include "OpenRGBSoftwareInfoPage.h"
|
|
|
|
|
#include "OpenRGBSystemInfoPage.h"
|
|
|
|
|
#include "OpenRGBProfileSaveDialog.h"
|
|
|
|
|
@ -10,7 +11,7 @@
|
|
|
|
|
|
|
|
|
|
using namespace Ui;
|
|
|
|
|
|
|
|
|
|
OpenRGBDialog2::OpenRGBDialog2(std::vector<i2c_smbus_interface *>& bus, std::vector<RGBController *>& control, ProfileManager& manager, QWidget *parent) : QMainWindow(parent), busses(bus), controllers(control), profile_manager(manager), ui(new OpenRGBDialog2Ui)
|
|
|
|
|
OpenRGBDialog2::OpenRGBDialog2(std::vector<i2c_smbus_interface *>& bus, std::vector<RGBController *>& control, ProfileManager* manager, NetworkServer* server, QWidget *parent) : QMainWindow(parent), busses(bus), controllers(control), profile_manager(manager), network_server(server), ui(new OpenRGBDialog2Ui)
|
|
|
|
|
{
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
|
|
|
|
@ -242,6 +243,16 @@ OpenRGBDialog2::OpenRGBDialog2(std::vector<i2c_smbus_interface *>& bus, std::vec
|
|
|
|
|
{
|
|
|
|
|
InformationTabBar->setTabButton(control.size(), QTabBar::LeftSide, SoftwareTabLabel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-----------------------------------------------------*\
|
|
|
|
|
| Add server information tab if there is a server |
|
|
|
|
|
\*-----------------------------------------------------*/
|
|
|
|
|
if(network_server != NULL)
|
|
|
|
|
{
|
|
|
|
|
OpenRGBServerInfoPage *ServerInfoPage = new OpenRGBServerInfoPage(network_server);
|
|
|
|
|
|
|
|
|
|
ui->MainTabBar->addTab(ServerInfoPage, "SDK Server");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OpenRGBDialog2::~OpenRGBDialog2()
|
|
|
|
|
@ -256,26 +267,29 @@ void OpenRGBDialog2::show()
|
|
|
|
|
|
|
|
|
|
void OpenRGBDialog2::RefreshProfileList()
|
|
|
|
|
{
|
|
|
|
|
/*-----------------------------------------------------*\
|
|
|
|
|
| Clear profile combo box and tray icon menu |
|
|
|
|
|
\*-----------------------------------------------------*/
|
|
|
|
|
ui->ProfileBox->clear();
|
|
|
|
|
profileMenu->clear();
|
|
|
|
|
|
|
|
|
|
for(std::size_t profile_index = 0; profile_index < profile_manager.profile_list.size(); profile_index++)
|
|
|
|
|
if(profile_manager != NULL)
|
|
|
|
|
{
|
|
|
|
|
/*-----------------------------------------------------*\
|
|
|
|
|
| Fill in profile combo box |
|
|
|
|
|
| Clear profile combo box and tray icon menu |
|
|
|
|
|
\*-----------------------------------------------------*/
|
|
|
|
|
ui->ProfileBox->addItem(profile_manager.profile_list[profile_index].c_str());
|
|
|
|
|
ui->ProfileBox->clear();
|
|
|
|
|
profileMenu->clear();
|
|
|
|
|
|
|
|
|
|
/*-----------------------------------------------------*\
|
|
|
|
|
| Fill in profile tray icon menu |
|
|
|
|
|
\*-----------------------------------------------------*/
|
|
|
|
|
QAction* actionProfileSelected = new QAction(profile_manager.profile_list[profile_index].c_str(), this);
|
|
|
|
|
actionProfileSelected->setObjectName(profile_manager.profile_list[profile_index].c_str());
|
|
|
|
|
connect(actionProfileSelected, SIGNAL(triggered()), this, SLOT(on_ProfileSelected()));
|
|
|
|
|
profileMenu->addAction(actionProfileSelected);
|
|
|
|
|
for(std::size_t profile_index = 0; profile_index < profile_manager->profile_list.size(); profile_index++)
|
|
|
|
|
{
|
|
|
|
|
/*-----------------------------------------------------*\
|
|
|
|
|
| Fill in profile combo box |
|
|
|
|
|
\*-----------------------------------------------------*/
|
|
|
|
|
ui->ProfileBox->addItem(profile_manager->profile_list[profile_index].c_str());
|
|
|
|
|
|
|
|
|
|
/*-----------------------------------------------------*\
|
|
|
|
|
| Fill in profile tray icon menu |
|
|
|
|
|
\*-----------------------------------------------------*/
|
|
|
|
|
QAction* actionProfileSelected = new QAction(profile_manager->profile_list[profile_index].c_str(), this);
|
|
|
|
|
actionProfileSelected->setObjectName(profile_manager->profile_list[profile_index].c_str());
|
|
|
|
|
connect(actionProfileSelected, SIGNAL(triggered()), this, SLOT(on_ProfileSelected()));
|
|
|
|
|
profileMenu->addAction(actionProfileSelected);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -336,10 +350,13 @@ void OpenRGBDialog2::on_SetAllDevices(unsigned char red, unsigned char green, un
|
|
|
|
|
|
|
|
|
|
void OpenRGBDialog2::on_SaveSizeProfile()
|
|
|
|
|
{
|
|
|
|
|
/*---------------------------------------------------------*\
|
|
|
|
|
| Save the profile |
|
|
|
|
|
\*---------------------------------------------------------*/
|
|
|
|
|
profile_manager.SaveProfile("sizes.ors");
|
|
|
|
|
if(profile_manager != NULL)
|
|
|
|
|
{
|
|
|
|
|
/*---------------------------------------------------------*\
|
|
|
|
|
| Save the profile |
|
|
|
|
|
\*---------------------------------------------------------*/
|
|
|
|
|
profile_manager->SaveProfile("sizes.ors");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OpenRGBDialog2::on_ShowHide()
|
|
|
|
|
@ -356,19 +373,22 @@ void OpenRGBDialog2::on_ShowHide()
|
|
|
|
|
|
|
|
|
|
void Ui::OpenRGBDialog2::on_ProfileSelected()
|
|
|
|
|
{
|
|
|
|
|
/*---------------------------------------------------------*\
|
|
|
|
|
| Get the profile filename from the selected object |
|
|
|
|
|
\*---------------------------------------------------------*/
|
|
|
|
|
std::string profile_name = QObject::sender()->objectName().toStdString();
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------*\
|
|
|
|
|
| Load the profile |
|
|
|
|
|
\*---------------------------------------------------------*/
|
|
|
|
|
if(profile_manager.LoadProfile(profile_name))
|
|
|
|
|
if(profile_manager != NULL)
|
|
|
|
|
{
|
|
|
|
|
for(int device = 0; device < ui->DevicesTabBar->count(); device++)
|
|
|
|
|
/*---------------------------------------------------------*\
|
|
|
|
|
| Get the profile filename from the selected object |
|
|
|
|
|
\*---------------------------------------------------------*/
|
|
|
|
|
std::string profile_name = QObject::sender()->objectName().toStdString();
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------*\
|
|
|
|
|
| Load the profile |
|
|
|
|
|
\*---------------------------------------------------------*/
|
|
|
|
|
if(profile_manager->LoadProfile(profile_name))
|
|
|
|
|
{
|
|
|
|
|
qobject_cast<OpenRGBDevicePage *>(ui->DevicesTabBar->widget(device))->UpdateDevice();
|
|
|
|
|
for(int device = 0; device < ui->DevicesTabBar->count(); device++)
|
|
|
|
|
{
|
|
|
|
|
qobject_cast<OpenRGBDevicePage *>(ui->DevicesTabBar->widget(device))->UpdateDevice();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -377,64 +397,73 @@ void Ui::OpenRGBDialog2::on_ButtonSaveProfile_clicked()
|
|
|
|
|
{
|
|
|
|
|
OpenRGBProfileSaveDialog dialog;
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------*\
|
|
|
|
|
| Open Profile Name Dialog |
|
|
|
|
|
\*---------------------------------------------------------*/
|
|
|
|
|
std::string profile_name = dialog.show();
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------*\
|
|
|
|
|
| Extension .orp - OpenRgb Profile |
|
|
|
|
|
\*---------------------------------------------------------*/
|
|
|
|
|
std::string filename = profile_name + ".orp";
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------*\
|
|
|
|
|
| Save the profile |
|
|
|
|
|
\*---------------------------------------------------------*/
|
|
|
|
|
if(profile_manager.SaveProfile(filename))
|
|
|
|
|
if(profile_manager != NULL)
|
|
|
|
|
{
|
|
|
|
|
RefreshProfileList();
|
|
|
|
|
/*---------------------------------------------------------*\
|
|
|
|
|
| Open Profile Name Dialog |
|
|
|
|
|
\*---------------------------------------------------------*/
|
|
|
|
|
std::string profile_name = dialog.show();
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------*\
|
|
|
|
|
| Extension .orp - OpenRgb Profile |
|
|
|
|
|
\*---------------------------------------------------------*/
|
|
|
|
|
std::string filename = profile_name + ".orp";
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------*\
|
|
|
|
|
| Save the profile |
|
|
|
|
|
\*---------------------------------------------------------*/
|
|
|
|
|
if(profile_manager->SaveProfile(filename))
|
|
|
|
|
{
|
|
|
|
|
RefreshProfileList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Ui::OpenRGBDialog2::on_ButtonLoadProfile_clicked()
|
|
|
|
|
{
|
|
|
|
|
/*---------------------------------------------------------*\
|
|
|
|
|
| Get the profile filename from the profiles list |
|
|
|
|
|
\*---------------------------------------------------------*/
|
|
|
|
|
std::string profile_name = ui->ProfileBox->currentText().toStdString();
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------*\
|
|
|
|
|
| Load the profile |
|
|
|
|
|
\*---------------------------------------------------------*/
|
|
|
|
|
if(profile_manager.LoadProfile(profile_name))
|
|
|
|
|
if(profile_manager != NULL)
|
|
|
|
|
{
|
|
|
|
|
for(int device = 0; device < ui->DevicesTabBar->count(); device++)
|
|
|
|
|
/*---------------------------------------------------------*\
|
|
|
|
|
| Get the profile filename from the profiles list |
|
|
|
|
|
\*---------------------------------------------------------*/
|
|
|
|
|
std::string profile_name = ui->ProfileBox->currentText().toStdString();
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------*\
|
|
|
|
|
| Load the profile |
|
|
|
|
|
\*---------------------------------------------------------*/
|
|
|
|
|
if(profile_manager->LoadProfile(profile_name))
|
|
|
|
|
{
|
|
|
|
|
qobject_cast<OpenRGBDevicePage *>(ui->DevicesTabBar->widget(device))->UpdateDevice();
|
|
|
|
|
for(int device = 0; device < ui->DevicesTabBar->count(); device++)
|
|
|
|
|
{
|
|
|
|
|
qobject_cast<OpenRGBDevicePage *>(ui->DevicesTabBar->widget(device))->UpdateDevice();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Ui::OpenRGBDialog2::on_ButtonDeleteProfile_clicked()
|
|
|
|
|
{
|
|
|
|
|
/*---------------------------------------------------------*\
|
|
|
|
|
| Get the profile filename from the profiles list |
|
|
|
|
|
\*---------------------------------------------------------*/
|
|
|
|
|
std::string profile_name = ui->ProfileBox->currentText().toStdString();
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------*\
|
|
|
|
|
| Confirm we want to delete the profile |
|
|
|
|
|
\*---------------------------------------------------------*/
|
|
|
|
|
QMessageBox::StandardButton reply;
|
|
|
|
|
reply = QMessageBox::question(this, "Delete Profile", "Do you really want to delete this profile?", QMessageBox::Yes|QMessageBox::No);
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------*\
|
|
|
|
|
| Load the profile |
|
|
|
|
|
\*---------------------------------------------------------*/
|
|
|
|
|
if(reply == QMessageBox::Yes)
|
|
|
|
|
if(profile_manager != NULL)
|
|
|
|
|
{
|
|
|
|
|
profile_manager.DeleteProfile(profile_name);
|
|
|
|
|
/*---------------------------------------------------------*\
|
|
|
|
|
| Get the profile filename from the profiles list |
|
|
|
|
|
\*---------------------------------------------------------*/
|
|
|
|
|
std::string profile_name = ui->ProfileBox->currentText().toStdString();
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------*\
|
|
|
|
|
| Confirm we want to delete the profile |
|
|
|
|
|
\*---------------------------------------------------------*/
|
|
|
|
|
QMessageBox::StandardButton reply;
|
|
|
|
|
reply = QMessageBox::question(this, "Delete Profile", "Do you really want to delete this profile?", QMessageBox::Yes|QMessageBox::No);
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------*\
|
|
|
|
|
| Load the profile |
|
|
|
|
|
\*---------------------------------------------------------*/
|
|
|
|
|
if(reply == QMessageBox::Yes)
|
|
|
|
|
{
|
|
|
|
|
profile_manager->DeleteProfile(profile_name);
|
|
|
|
|
|
|
|
|
|
RefreshProfileList();
|
|
|
|
|
RefreshProfileList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|