Add server settings to settings page

This commit is contained in:
Adam Honse 2025-07-15 17:56:29 -05:00
parent c5795492e1
commit 25d45fd9db
3 changed files with 245 additions and 189 deletions

View file

@ -441,6 +441,23 @@ void OpenRGBSettingsPage::UpdateProfiles()
}
}
}
/*---------------------------------------------------------*\
| Load server settings |
\*---------------------------------------------------------*/
json server_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("Server");
if(server_settings.contains("all_devices"))
{
bool all_devices = server_settings["all_devices"];
ui->CheckboxAllDevices->setChecked(all_devices);
}
if(server_settings.contains("legacy_workaround"))
{
bool legacy_workaround = server_settings["legacy_workaround"];
ui->CheckboxLegacyWorkaround->setChecked(legacy_workaround);
}
}
void OpenRGBSettingsPage::on_ComboBoxLanguage_currentTextChanged(const QString language)
@ -604,6 +621,22 @@ void OpenRGBSettingsPage::on_ComboBoxSuspendProfile_currentTextChanged(const QSt
SaveSettings();
}
void OpenRGBSettingsPage::on_CheckboxAllDevices_clicked(bool checked)
{
json server_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("Server");
server_settings["all_devices"] = checked;
ResourceManager::get()->GetSettingsManager()->SetSettings("Server", server_settings);
SaveSettings();
}
void OpenRGBSettingsPage::on_CheckboxLegacyWorkaround_clicked(bool checked)
{
json server_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("Server");
server_settings["legacy_workaround"] = checked;
ResourceManager::get()->GetSettingsManager()->SetSettings("Server", server_settings);
SaveSettings();
}
void OpenRGBSettingsPage::on_CheckboxAutoStart_clicked()
{
if(autostart_initialized)

View file

@ -89,4 +89,6 @@ private slots:
void on_ComboBoxSuspendProfile_currentTextChanged(const QString suspend_profile_name);
void on_CheckboxDisableKeyExpansion_clicked();
void on_CheckboxShowLEDView_clicked();
void on_CheckboxAllDevices_clicked(bool checked);
void on_CheckboxLegacyWorkaround_clicked(bool checked);
};

View file

@ -30,51 +30,16 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>460</width>
<height>950</height>
<y>-321</y>
<width>554</width>
<height>1052</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="5" column="0">
<widget class="QCheckBox" name="CheckboxMinimizeOnClose">
<item row="27" column="0">
<widget class="QCheckBox" name="CheckboxAutoStartMinimized">
<property name="text">
<string>Minimize on Close</string>
</property>
</widget>
</item>
<item row="19" column="0">
<widget class="QLabel" name="AutoStartLabel">
<property name="text">
<string>Start at Login Settings:</string>
</property>
</widget>
</item>
<item row="17" column="0">
<widget class="QCheckBox" name="CheckboxAMDSMBusReduceCPU">
<property name="text">
<string>AMD SMBus: Reduce CPU Usage (restart required)</string>
</property>
</widget>
</item>
<item row="25" column="0">
<widget class="QCheckBox" name="CheckboxAutoStartServer">
<property name="text">
<string>Start Server</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="CheckboxTrayIconGreyscale">
<property name="text">
<string>Greyscale Tray Icon</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QCheckBox" name="CheckboxDisableKeyExpansion">
<property name="text">
<string>Disable Key Expansion in Device View</string>
<string>Start Minimized</string>
</property>
</widget>
</item>
@ -85,25 +50,50 @@
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QCheckBox" name="CheckboxSaveGeometry">
<item row="17" column="0">
<widget class="QCheckBox" name="CheckboxAMDSMBusReduceCPU">
<property name="text">
<string>Save Geometry on Close</string>
<string>AMD SMBus: Reduce CPU Usage (restart required)</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="ComboBoxLanguage"/>
<item row="33" column="1">
<widget class="QComboBox" name="ComboBoxAutoStartProfile"/>
</item>
<item row="12" column="1">
<widget class="QComboBox" name="ComboBoxHexFormat"/>
<item row="31" column="0">
<widget class="QCheckBox" name="CheckboxAutoStartClient">
<property name="text">
<string>Start Client</string>
</property>
</widget>
</item>
<item row="29" column="1">
<item row="10" column="0">
<widget class="QCheckBox" name="CheckboxDisableKeyExpansion">
<property name="text">
<string>Disable Key Expansion in Device View</string>
</property>
</widget>
</item>
<item row="32" column="1">
<widget class="QLineEdit" name="TextCustomArgs"/>
</item>
<item row="33" column="1">
<item row="12" column="0">
<widget class="QLabel" name="HexFormatLabel">
<property name="text">
<string>Hex Format</string>
</property>
</widget>
</item>
<item row="36" column="1">
<widget class="QComboBox" name="ComboBoxExitProfile"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="UserInterfaceSettingsLabel">
<property name="text">
<string>User Interface Settings:</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QCheckBox" name="CheckboxRunZoneChecks">
<property name="text">
@ -111,16 +101,40 @@
</property>
</widget>
</item>
<item row="31" column="1">
<widget class="QComboBox" name="ComboBoxSuspendProfile"/>
<item row="35" column="1">
<widget class="QComboBox" name="ComboBoxResumeProfile"/>
</item>
<item row="35" column="0">
<item row="4" column="0">
<widget class="QLabel" name="ThemeLabel">
<property name="text">
<string>Theme (restart required)</string>
</property>
</widget>
</item>
<item row="16" column="0">
<widget class="QLabel" name="DriversSettingsLabel">
<property name="text">
<string>Drivers Settings:</string>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QComboBox" name="ComboBoxHexFormat"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="LabelLanguage">
<property name="text">
<string>Language</string>
</property>
</widget>
</item>
<item row="38" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
<enum>QSizePolicy::Policy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -130,14 +144,144 @@
</property>
</spacer>
</item>
<item row="27" column="0">
<item row="28" column="0">
<widget class="QCheckBox" name="CheckboxAutoStartServer">
<property name="text">
<string>Start Server</string>
</property>
</widget>
</item>
<item row="33" column="0">
<widget class="QCheckBox" name="CheckboxAutoStartProfile">
<property name="text">
<string>Load Profile</string>
</property>
</widget>
</item>
<item row="23" column="0">
<widget class="QCheckBox" name="CheckboxAutoStart">
<property name="text">
<string>Start at Login</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QCheckBox" name="CheckboxSaveGeometry">
<property name="text">
<string>Save Geometry on Close</string>
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QCheckBox" name="CheckboxLogFile">
<property name="text">
<string>Enable Log File (restart required)</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="CheckboxTrayIconGreyscale">
<property name="text">
<string>Greyscale Tray Icon</string>
</property>
</widget>
</item>
<item row="29" column="1">
<widget class="QLineEdit" name="TextServerHost"/>
</item>
<item row="34" column="1">
<widget class="QComboBox" name="ComboBoxSuspendProfile"/>
</item>
<item row="30" column="0">
<widget class="QCheckBox" name="CheckboxAutoStartSetServerPort">
<property name="text">
<string>Set Server Port</string>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QCheckBox" name="CheckboxShowLEDView">
<property name="text">
<string>Show LED View by Default</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="CheckboxMinimizeOnClose">
<property name="text">
<string>Minimize on Close</string>
</property>
</widget>
</item>
<item row="36" column="0">
<widget class="QCheckBox" name="CheckboxSetOnExit">
<property name="text">
<string>Set Profile on Exit</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="CheckboxLoadGeometry">
<property name="text">
<string>Load Window Geometry</string>
</property>
</widget>
</item>
<item row="30" column="1">
<widget class="QSpinBox" name="TextServerPort">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>6742</number>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="LogManagerSettingsLabel">
<property name="text">
<string>Log Manager Settings:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="ComboBoxLanguage"/>
</item>
<item row="34" column="0">
<widget class="QCheckBox" name="CheckboxSetOnSuspend">
<property name="text">
<string>Set Profile on Suspend</string>
</property>
</widget>
</item>
<item row="32" column="0">
<widget class="QCheckBox" name="CheckboxAutoStartCustom">
<property name="text">
<string>Custom Arguments</string>
</property>
</widget>
</item>
<item row="20" column="0">
<widget class="QCheckBox" name="CheckboxAllDevices">
<property name="text">
<string>Serve All Devices (Including those from client connections)</string>
</property>
</widget>
</item>
<item row="31" column="1">
<widget class="QLineEdit" name="TextClientHost"/>
</item>
<item row="29" column="0">
<widget class="QCheckBox" name="CheckboxAutoStartSetServerHost">
<property name="text">
<string>Set Server Host</string>
</property>
</widget>
</item>
<item row="37" column="0">
<widget class="QLabel" name="AutoStartStatusLabel">
<property name="text">
<string>Start at Login Status</string>
@ -151,157 +295,34 @@
</property>
</widget>
</item>
<item row="28" column="0">
<widget class="QCheckBox" name="CheckboxAutoStartClient">
<item row="22" column="0">
<widget class="QLabel" name="AutoStartLabel">
<property name="text">
<string>Start Client</string>
</property>
</widget>
</item>
<item row="26" column="1">
<widget class="QLineEdit" name="TextServerHost"/>
</item>
<item row="30" column="0">
<widget class="QCheckBox" name="CheckboxAutoStartProfile">
<property name="text">
<string>Load Profile</string>
</property>
</widget>
</item>
<item row="33" column="0">
<widget class="QCheckBox" name="CheckboxSetOnExit">
<property name="text">
<string>Set Profile on Exit</string>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="HexFormatLabel">
<property name="text">
<string>Hex Format</string>
</property>
</widget>
</item>
<item row="32" column="1">
<widget class="QComboBox" name="ComboBoxResumeProfile"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="ThemeLabel">
<property name="text">
<string>Theme (restart required)</string>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QCheckBox" name="CheckboxShowLEDView">
<property name="text">
<string>Show LED View by Default</string>
</property>
</widget>
</item>
<item row="31" column="0">
<widget class="QCheckBox" name="CheckboxSetOnSuspend">
<property name="text">
<string>Set Profile on Suspend</string>
</property>
</widget>
</item>
<item row="26" column="0">
<widget class="QCheckBox" name="CheckboxAutoStartSetServerHost">
<property name="text">
<string>Set Server Host</string>
<string>Start at Login Settings:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="ComboBoxTheme"/>
</item>
<item row="24" column="0">
<widget class="QCheckBox" name="CheckboxAutoStartMinimized">
<property name="text">
<string>Start Minimized</string>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="LogManagerSettingsLabel">
<property name="text">
<string>Log Manager Settings:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="UserInterfaceSettingsLabel">
<property name="text">
<string>User Interface Settings:</string>
</property>
</widget>
</item>
<item row="28" column="1">
<widget class="QLineEdit" name="TextClientHost"/>
</item>
<item row="32" column="0">
<item row="35" column="0">
<widget class="QCheckBox" name="CheckboxSetOnResume">
<property name="text">
<string>Set Profile on Resume</string>
</property>
</widget>
</item>
<item row="16" column="0">
<widget class="QLabel" name="DriversSettingsLabel">
<item row="19" column="0">
<widget class="QLabel" name="ServerSettingsLabel">
<property name="text">
<string>Drivers Settings</string>
<string>Server Settings:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="LabelLanguage">
<item row="21" column="0">
<widget class="QCheckBox" name="CheckboxLegacyWorkaround">
<property name="text">
<string>Language</string>
</property>
</widget>
</item>
<item row="29" column="0">
<widget class="QCheckBox" name="CheckboxAutoStartCustom">
<property name="text">
<string>Custom Arguments</string>
</property>
</widget>
</item>
<item row="30" column="1">
<widget class="QComboBox" name="ComboBoxAutoStartProfile"/>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="CheckboxLoadGeometry">
<property name="text">
<string>Load Window Geometry</string>
</property>
</widget>
</item>
<item row="20" column="0">
<widget class="QCheckBox" name="CheckboxAutoStart">
<property name="text">
<string>Start at Login</string>
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QCheckBox" name="CheckboxLogFile">
<property name="text">
<string>Enable Log File (restart required)</string>
</property>
</widget>
</item>
<item row="27" column="1">
<widget class="QSpinBox" name="TextServerPort">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>6742</number>
<string>Legacy Workaround</string>
</property>
</widget>
</item>