Prompt users to resize or setup zones. #1407
This commit is contained in:
parent
bdc1b6f3f4
commit
3699889250
9 changed files with 513 additions and 86 deletions
|
|
@ -181,6 +181,7 @@ HEADERS +=
|
|||
qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsPage.h \
|
||||
qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsEntry.h \
|
||||
qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsPage.h \
|
||||
qt/OpenRGBZonesBulkResizer.h \
|
||||
qt/TabLabel.h \
|
||||
serial_port/find_usb_serial_port.h \
|
||||
serial_port/serial_port.h \
|
||||
|
|
@ -498,6 +499,7 @@ SOURCES +=
|
|||
qt/OpenRGBSupportedDevicesPage.cpp \
|
||||
qt/OpenRGBSystemInfoPage.cpp \
|
||||
qt/OpenRGBZoneResizeDialog.cpp \
|
||||
qt/OpenRGBZonesBulkResizer.cpp \
|
||||
qt/TabLabel.cpp \
|
||||
qt/hsv.cpp \
|
||||
qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsEntry.cpp \
|
||||
|
|
@ -849,6 +851,7 @@ FORMS +=
|
|||
qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsPage.ui \
|
||||
qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsEntry.ui \
|
||||
qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsPage.ui \
|
||||
qt/OpenRGBZonesBulkResizer.ui \
|
||||
qt/TabLabel.ui \
|
||||
|
||||
#-----------------------------------------------------------------------------------------------#
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include "OpenRGBProfileSaveDialog.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "TabLabel.h"
|
||||
#include "OpenRGBZonesBulkResizer.h"
|
||||
#include <QLabel>
|
||||
#include <QTabBar>
|
||||
#include <QMessageBox>
|
||||
|
|
@ -110,6 +111,13 @@ static void DeletePluginCallback(void * this_ptr, OpenRGBPluginEntry* plugin)
|
|||
this_obj->RemovePlugin(plugin);
|
||||
}
|
||||
|
||||
static void DetectionEndedCallback(void * this_ptr)
|
||||
{
|
||||
OpenRGBDialog2 * this_obj = (OpenRGBDialog2 *)this_ptr;
|
||||
|
||||
QMetaObject::invokeMethod(this_obj, "onDetectionEnded", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
bool OpenRGBDialog2::IsDarkTheme()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
|
@ -258,6 +266,7 @@ OpenRGBDialog2::OpenRGBDialog2(QWidget *parent) : QMainWindow(parent), ui(new Op
|
|||
\*-----------------------------------------------------*/
|
||||
ResourceManager::get()->RegisterDetectionProgressCallback(UpdateDetectionProgressCallback, this);
|
||||
ResourceManager::get()->RegisterDeviceListChangeCallback(UpdateDeviceListCallback, this);
|
||||
ResourceManager::get()->RegisterDetectionEndCallback(DetectionEndedCallback, this);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Initialize page pointers |
|
||||
|
|
@ -1236,6 +1245,14 @@ void OpenRGBDialog2::onDetectionProgressUpdated()
|
|||
}
|
||||
}
|
||||
|
||||
void OpenRGBDialog2::onDetectionEnded()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Detect unconfigured zones and prompt for resizing |
|
||||
\*-----------------------------------------------------*/
|
||||
OpenRGBZonesBulkResizer::RunChecks(this);
|
||||
}
|
||||
|
||||
void OpenRGBDialog2::on_SetAllDevices(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
for(int device = 0; device < ui->DevicesTabBar->count(); device++)
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ private slots:
|
|||
void on_QuickWhite();
|
||||
void onDeviceListUpdated();
|
||||
void onDetectionProgressUpdated();
|
||||
void onDetectionEnded();
|
||||
void on_SetAllDevices(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void on_SaveSizeProfile();
|
||||
void on_ShowHide();
|
||||
|
|
|
|||
|
|
@ -58,6 +58,15 @@ OpenRGBSettingsPage::OpenRGBSettingsPage(QWidget *parent) :
|
|||
}
|
||||
}
|
||||
|
||||
if(ui_settings.contains("RunZoneChecks"))
|
||||
{
|
||||
ui->CheckboxRunZoneChecks->setChecked(ui_settings["RunZoneChecks"]);
|
||||
}
|
||||
else
|
||||
{ // default value
|
||||
ui->CheckboxRunZoneChecks->setChecked(true);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Load AutoStart settings |
|
||||
\*---------------------------------------------------------*/
|
||||
|
|
@ -156,6 +165,14 @@ void Ui::OpenRGBSettingsPage::on_CheckboxSaveGeometry_clicked()
|
|||
SaveSettings();
|
||||
}
|
||||
|
||||
void Ui::OpenRGBSettingsPage::on_CheckboxRunZoneChecks_clicked()
|
||||
{
|
||||
json ui_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("UserInterface");
|
||||
ui_settings["RunZoneChecks"] = ui->CheckboxRunZoneChecks->isChecked();
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("UserInterface", ui_settings);
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
void Ui::OpenRGBSettingsPage::on_CheckboxAutoStart_clicked()
|
||||
{
|
||||
if(autostart_initialized)
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ private slots:
|
|||
void on_ComboBoxAutoStartProfile_currentTextChanged(const QString);
|
||||
void on_CheckboxAutoStartSetServerPort_clicked();
|
||||
void on_CheckboxAutoStartCustom_clicked();
|
||||
void on_CheckboxRunZoneChecks_clicked();
|
||||
};
|
||||
|
||||
#endif // OPENRGBSETTINGSPAGE_H
|
||||
|
|
|
|||
|
|
@ -24,119 +24,47 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>412</width>
|
||||
<height>480</height>
|
||||
<width>449</width>
|
||||
<height>574</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="5" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxSaveGeometry">
|
||||
<property name="text">
|
||||
<string>Save Geometry On Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartProfile">
|
||||
<property name="text">
|
||||
<string>Load Profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<widget class="QLineEdit" name="TextCustomArgs"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="ComboBoxTheme"/>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QLineEdit" name="TextServerPort">
|
||||
<property name="inputMask">
|
||||
<string>90000</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxMinimizeOnClose">
|
||||
<property name="text">
|
||||
<string>Minimize On Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="AutoStartLabel">
|
||||
<property name="text">
|
||||
<string>Start At Login Settings:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<item row="11" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartSetServerPort">
|
||||
<property name="text">
|
||||
<string>Set Server Port</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="ThemeLabel">
|
||||
<property name="text">
|
||||
<string>Theme</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="7" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStart">
|
||||
<property name="text">
|
||||
<string>Start At Login</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartCustom">
|
||||
<property name="text">
|
||||
<string>Custom Arguments</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartMinimized">
|
||||
<widget class="QLabel" name="AutoStartLabel">
|
||||
<property name="text">
|
||||
<string>Start Minimized</string>
|
||||
<string>Start At Login Settings:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="0">
|
||||
<widget class="QLabel" name="AutoStartStatusLabel">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartProfile">
|
||||
<property name="text">
|
||||
<string>Start at Login Status</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QLineEdit" name="TextClientHost"/>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartClient">
|
||||
<property name="text">
|
||||
<string>Start Client</string>
|
||||
<string>Load Profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<widget class="QComboBox" name="ComboBoxAutoStartProfile"/>
|
||||
<widget class="QLineEdit" name="TextCustomArgs"/>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartServer">
|
||||
<property name="text">
|
||||
<string>Start Server</string>
|
||||
</property>
|
||||
</widget>
|
||||
<item row="12" column="1">
|
||||
<widget class="QLineEdit" name="TextClientHost"/>
|
||||
</item>
|
||||
<item row="14" column="1">
|
||||
<widget class="QComboBox" name="ComboBoxAutoStartProfile"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxLoadGeometry">
|
||||
|
|
@ -146,6 +74,20 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="15" column="0">
|
||||
<widget class="QLabel" name="AutoStartStatusLabel">
|
||||
<property name="text">
|
||||
<string>Start at Login Status</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartServer">
|
||||
<property name="text">
|
||||
<string>Start Server</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
|
@ -161,6 +103,71 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="ComboBoxTheme"/>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartCustom">
|
||||
<property name="text">
|
||||
<string>Custom Arguments</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartClient">
|
||||
<property name="text">
|
||||
<string>Start Client</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartMinimized">
|
||||
<property name="text">
|
||||
<string>Start Minimized</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxSaveGeometry">
|
||||
<property name="text">
|
||||
<string>Save Geometry On Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="ThemeLabel">
|
||||
<property name="text">
|
||||
<string>Theme</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxMinimizeOnClose">
|
||||
<property name="text">
|
||||
<string>Minimize On Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QLineEdit" name="TextServerPort">
|
||||
<property name="inputMask">
|
||||
<string>90000</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxRunZoneChecks">
|
||||
<property name="text">
|
||||
<string>Run zone checks on rescan</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
|
|
|||
232
qt/OpenRGBZonesBulkResizer.cpp
Normal file
232
qt/OpenRGBZonesBulkResizer.cpp
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
#include "OpenRGBZonesBulkResizer.h"
|
||||
#include "ui_OpenRGBZonesBulkResizer.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "LogManager.h"
|
||||
#include "OpenRGBDialog2.h"
|
||||
#include <QDialog>
|
||||
#include <QFile>
|
||||
|
||||
using namespace Ui;
|
||||
|
||||
void OpenRGBZonesBulkResizer::RunChecks(QWidget *parent)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Determine if we should run (user setting) |
|
||||
\*---------------------------------------------------------*/
|
||||
SettingsManager* settings_manager = ResourceManager::get()->GetSettingsManager();
|
||||
json ui_settings = settings_manager->GetSettings("UserInterface");
|
||||
|
||||
if(!ui_settings.is_null() && ui_settings.contains("RunZoneChecks"))
|
||||
{
|
||||
json run_zone_checks = ui_settings["RunZoneChecks"];
|
||||
|
||||
if(!run_zone_checks.is_null() && run_zone_checks.is_boolean())
|
||||
{
|
||||
bool should_run = run_zone_checks;
|
||||
|
||||
if(!should_run)
|
||||
{
|
||||
LOG_DEBUG("Skipping zones sizes checks.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LOG_DEBUG("Running zones sizes checks...");
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Collect the unconfigured zones |
|
||||
\*---------------------------------------------------------*/
|
||||
std::vector<RGBController*>& controllers = ResourceManager::get()->GetRGBControllers();
|
||||
|
||||
std::vector<std::tuple<RGBController*, unsigned int>> zones;
|
||||
|
||||
for(RGBController* controller: controllers)
|
||||
{
|
||||
for(unsigned int zone_index = 0; zone_index < controller->zones.size(); zone_index++)
|
||||
{
|
||||
// Consider unconfigured if 0 leds AND led_count < leds_max
|
||||
if(controller->zones[zone_index].leds_count == 0
|
||||
&& controller->zones[zone_index].leds_count < controller->zones[zone_index].leds_max)
|
||||
{
|
||||
zones.push_back({controller, zone_index});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LOG_DEBUG("Zones checks finished: %d unconfigured zone(s).", zones.size());
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Show the configuration tool GUI if we have some |
|
||||
| unconfigured zones |
|
||||
\*---------------------------------------------------------*/
|
||||
if(!zones.empty())
|
||||
{
|
||||
QDialog* dialog = new QDialog(parent);
|
||||
dialog->setWindowTitle("Resize the zones");
|
||||
|
||||
if (OpenRGBDialog2::IsDarkTheme())
|
||||
{
|
||||
QPalette pal;
|
||||
pal.setColor(QPalette::WindowText, Qt::white);
|
||||
dialog->setPalette(pal);
|
||||
QFile dark_theme(":/windows_dark.qss");
|
||||
dark_theme.open(QFile::ReadOnly);
|
||||
dialog->setStyleSheet(dark_theme.readAll());
|
||||
dark_theme.close();
|
||||
}
|
||||
|
||||
dialog->setMinimumSize(600,480);
|
||||
dialog->setModal(true);
|
||||
|
||||
QVBoxLayout* dialog_layout = new QVBoxLayout(dialog);
|
||||
|
||||
OpenRGBZonesBulkResizer* widget = new OpenRGBZonesBulkResizer(dialog, zones);
|
||||
|
||||
dialog_layout->addWidget(widget);
|
||||
|
||||
connect(widget, &OpenRGBZonesBulkResizer::CloseRequest, [=](){
|
||||
dialog->reject();
|
||||
});
|
||||
|
||||
dialog->exec();
|
||||
}
|
||||
}
|
||||
|
||||
OpenRGBZonesBulkResizer::OpenRGBZonesBulkResizer(QWidget *parent, const std::vector<std::tuple<RGBController*, unsigned int>>& unconfigured_zones) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::OpenRGBZonesBulkResizerUi),
|
||||
unconfigured_zones(unconfigured_zones)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set the table view settings (headers, resize behavior...) |
|
||||
\*---------------------------------------------------------*/
|
||||
ui->zones_table->setColumnCount(3);
|
||||
ui->zones_table->verticalHeader()->setVisible(false);
|
||||
ui->zones_table->setSelectionMode(QAbstractItemView::SelectionMode::NoSelection);
|
||||
ui->zones_table->setSelectionBehavior(QAbstractItemView::SelectionBehavior::SelectRows);
|
||||
|
||||
ui->zones_table->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
|
||||
ui->zones_table->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch);
|
||||
ui->zones_table->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Fixed);
|
||||
|
||||
ui->zones_table->setHorizontalHeaderLabels({"Controller", "Zone", "Size"});
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Fill the table with widgets (labels, spinbox) |
|
||||
\*---------------------------------------------------------*/
|
||||
for(const std::tuple<RGBController*, unsigned int>& tuple: unconfigured_zones)
|
||||
{
|
||||
CreateZoneWidget(std::get<0>(tuple), std::get<1>(tuple));
|
||||
}
|
||||
}
|
||||
|
||||
OpenRGBZonesBulkResizer::~OpenRGBZonesBulkResizer()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OpenRGBZonesBulkResizer::CreateZoneWidget(RGBController* controller, unsigned int zone_index)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Labels: controller name + zone name |
|
||||
\*---------------------------------------------------------*/
|
||||
QLabel* controller_label = new QLabel(this);
|
||||
controller_label->setText(QString::fromStdString(controller->name));
|
||||
|
||||
QLabel* zone_label = new QLabel(this);
|
||||
zone_label->setText(QString::fromStdString(controller->zones[zone_index].name));
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Spin box: controls the zone size |
|
||||
\*---------------------------------------------------------*/
|
||||
QSpinBox* spin_box = new QSpinBox(this);
|
||||
spin_box->setValue(0);
|
||||
spin_box->setMinimum(controller->zones[zone_index].leds_min);
|
||||
spin_box->setMaximum(controller->zones[zone_index].leds_max);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Insert labels + spinbox |
|
||||
\*---------------------------------------------------------*/
|
||||
int row = ui->zones_table->rowCount();
|
||||
|
||||
ui->zones_table->insertRow(row);
|
||||
ui->zones_table->setCellWidget(row, 0, controller_label);
|
||||
ui->zones_table->setCellWidget(row, 1, zone_label);
|
||||
ui->zones_table->setCellWidget(row, 2, spin_box);
|
||||
}
|
||||
|
||||
void OpenRGBZonesBulkResizer::on_save_button_clicked()
|
||||
{
|
||||
bool has_changes = false;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Resize what needs to be resized |
|
||||
\*---------------------------------------------------------*/
|
||||
for(unsigned int i = 0; i < unconfigured_zones.size(); i++)
|
||||
{
|
||||
unsigned int new_size = ((QSpinBox*)ui->zones_table->cellWidget(i,2))->value();
|
||||
|
||||
if(new_size > 0)
|
||||
{
|
||||
RGBController* controller = std::get<0>(unconfigured_zones[i]);
|
||||
unsigned int zone_index = std::get<1>(unconfigured_zones[i]);
|
||||
|
||||
controller->ResizeZone(zone_index, new_size);
|
||||
|
||||
has_changes = true;
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Save the sizes if the user did any changes |
|
||||
\*---------------------------------------------------------*/
|
||||
if(has_changes)
|
||||
{
|
||||
ProfileManager* profile_manager = ResourceManager::get()->GetProfileManager();
|
||||
|
||||
if(profile_manager != NULL)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Save the profile |
|
||||
\*---------------------------------------------------------*/
|
||||
profile_manager->SaveProfile("sizes", true);
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Save the "Do not show again" checkbox state, then close |
|
||||
\*---------------------------------------------------------*/
|
||||
SaveDoNotRunState();
|
||||
|
||||
emit CloseRequest();
|
||||
}
|
||||
|
||||
void OpenRGBZonesBulkResizer::on_ignore_button_clicked()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Save the "Do not show again" checkbox state, then close |
|
||||
\*---------------------------------------------------------*/
|
||||
SaveDoNotRunState();
|
||||
|
||||
emit CloseRequest();
|
||||
}
|
||||
|
||||
void OpenRGBZonesBulkResizer::SaveDoNotRunState()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Save the "Do not show again" checkbox state in |
|
||||
| settings manager |
|
||||
\*---------------------------------------------------------*/
|
||||
SettingsManager* settings_manager = ResourceManager::get()->GetSettingsManager();
|
||||
json ui_settings = settings_manager->GetSettings("UserInterface");
|
||||
|
||||
bool state = ui->do_not_show_again_checkbox->checkState() == Qt::Checked;
|
||||
|
||||
ui_settings["RunZoneChecks"] = !state;
|
||||
|
||||
settings_manager->SetSettings("UserInterface", ui_settings);
|
||||
settings_manager->SaveSettings();
|
||||
}
|
||||
40
qt/OpenRGBZonesBulkResizer.h
Normal file
40
qt/OpenRGBZonesBulkResizer.h
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
#ifndef OPENRGBZONESBULKRESIZER_H
|
||||
#define OPENRGBZONESBULKRESIZER_H
|
||||
|
||||
#include "ui_OpenRGBZonesBulkResizer.h"
|
||||
#include "RGBController.h"
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class OpenRGBZonesBulkResizer;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBZonesBulkResizer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static void RunChecks(QWidget *parent);
|
||||
|
||||
explicit OpenRGBZonesBulkResizer(QWidget*, const std::vector<std::tuple<RGBController*, unsigned int>>&);
|
||||
~OpenRGBZonesBulkResizer();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBZonesBulkResizerUi *ui;
|
||||
|
||||
const std::vector<std::tuple<RGBController*, unsigned int>>& unconfigured_zones;
|
||||
|
||||
void CreateZoneWidget(RGBController*, unsigned int);
|
||||
|
||||
void SaveDoNotRunState();
|
||||
|
||||
signals:
|
||||
void CloseRequest();
|
||||
|
||||
private slots:
|
||||
void on_save_button_clicked();
|
||||
void on_ignore_button_clicked();
|
||||
|
||||
};
|
||||
|
||||
#endif // OPENRGBZONESBULKRESIZER_H
|
||||
109
qt/OpenRGBZonesBulkResizer.ui
Normal file
109
qt/OpenRGBZonesBulkResizer.ui
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenRGBZonesBulkResizerUi</class>
|
||||
<widget class="QWidget" name="OpenRGBZonesBulkResizerUi">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>980</width>
|
||||
<height>824</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="help_label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>There are some Addressable RGB zones that are not yet configured.<br/> Please enter the count of LEDs attached to each zone below.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="do_not_show_again_checkbox">
|
||||
<property name="text">
|
||||
<string>Do not show again</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QPushButton" name="save_button">
|
||||
<property name="text">
|
||||
<string>Save and close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QTableWidget" name="zones_table">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>100</horstretch>
|
||||
<verstretch>100</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<property name="showGrid">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="gridStyle">
|
||||
<enum>Qt::NoPen</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QPushButton" name="ignore_button">
|
||||
<property name="text">
|
||||
<string>Ignore</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Loading…
Add table
Add a link
Reference in a new issue