mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-05-24 14:35:01 -04:00
Add geometry settings to settings page
This commit is contained in:
@@ -10,7 +10,9 @@ OpenRGBSettingsPage::OpenRGBSettingsPage(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Load theme settings (Windows only) |
|
||||
\*---------------------------------------------------------*/
|
||||
#ifdef _WIN32
|
||||
ui->ComboBoxTheme->addItems({"auto", "light", "dark"});
|
||||
|
||||
@@ -26,8 +28,28 @@ OpenRGBSettingsPage::OpenRGBSettingsPage(QWidget *parent) :
|
||||
ui->ThemeLabel->hide();
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Load user interface settings (Windows only) |
|
||||
\*---------------------------------------------------------*/
|
||||
json ui_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("UserInterface");
|
||||
ui->CheckboxMinimizeOnClose->setChecked(ui_settings["minimize_on_close"]);
|
||||
|
||||
if(ui_settings.contains("minimize_on_close"))
|
||||
{
|
||||
ui->CheckboxMinimizeOnClose->setChecked(ui_settings["minimize_on_close"]);
|
||||
}
|
||||
|
||||
if(ui_settings.contains("geometry"))
|
||||
{
|
||||
if(ui_settings["geometry"].contains("load_geometry"))
|
||||
{
|
||||
ui->CheckboxLoadGeometry->setChecked(ui_settings["geometry"]["load_geometry"]);
|
||||
}
|
||||
|
||||
if(ui_settings["geometry"].contains("save_on_exit"))
|
||||
{
|
||||
ui->CheckboxSaveGeometry->setChecked(ui_settings["geometry"]["save_on_exit"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OpenRGBSettingsPage::~OpenRGBSettingsPage()
|
||||
@@ -51,9 +73,23 @@ void OpenRGBSettingsPage::on_CheckboxMinimizeOnClose_clicked()
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
void Ui::OpenRGBSettingsPage::on_CheckboxLoadGeometry_clicked()
|
||||
{
|
||||
json ui_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("UserInterface");
|
||||
ui_settings["geometry"]["load_geometry"] = ui->CheckboxLoadGeometry->isChecked();
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("UserInterface", ui_settings);
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
void Ui::OpenRGBSettingsPage::on_CheckboxSaveGeometry_clicked()
|
||||
{
|
||||
json ui_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("UserInterface");
|
||||
ui_settings["geometry"]["save_on_exit"] = ui->CheckboxSaveGeometry->isChecked();
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("UserInterface", ui_settings);
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
void OpenRGBSettingsPage::SaveSettings()
|
||||
{
|
||||
ResourceManager::get()->GetSettingsManager()->SaveSettings();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@ private:
|
||||
private slots:
|
||||
void on_ComboBoxTheme_currentTextChanged(const QString);
|
||||
void on_CheckboxMinimizeOnClose_clicked();
|
||||
void on_CheckboxLoadGeometry_clicked();
|
||||
void on_CheckboxSaveGeometry_clicked();
|
||||
};
|
||||
|
||||
#endif // OPENRGBSETTINGSPAGE_H
|
||||
|
||||
@@ -14,24 +14,7 @@
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="ComboBoxTheme"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxMinimizeOnClose">
|
||||
<property name="text">
|
||||
<string>Minimize on close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="ThemeLabel">
|
||||
<property name="text">
|
||||
<string>Theme</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="7" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -44,6 +27,37 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxLoadGeometry">
|
||||
<property name="text">
|
||||
<string>Load Window Geometry</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="ComboBoxTheme"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxMinimizeOnClose">
|
||||
<property name="text">
|
||||
<string>Minimize On Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="ThemeLabel">
|
||||
<property name="text">
|
||||
<string>Theme</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxSaveGeometry">
|
||||
<property name="text">
|
||||
<string>Save Geometry On Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
||||
Reference in New Issue
Block a user