Allow switching format for hex color code entry box between RGB (HTML) and BGR (RGBColor)

This commit is contained in:
Adam Honse 2024-11-10 16:06:34 -06:00
parent 330f6d6014
commit 5b7cdf786b
5 changed files with 237 additions and 156 deletions

View file

@ -62,6 +62,14 @@ OpenRGBSettingsPage::OpenRGBSettingsPage(QWidget *parent) :
}
ui->ComboBoxLanguage->blockSignals(false);
/*---------------------------------------------------------*\
| Populate hex format combo box |
\*---------------------------------------------------------*/
ui->ComboBoxHexFormat->addItem("RGB");
ui->ComboBoxHexFormat->addItem("BGR");
hex_format_initialized = true;
/*---------------------------------------------------------*\
| Load theme settings |
\*---------------------------------------------------------*/
@ -158,6 +166,18 @@ OpenRGBSettingsPage::OpenRGBSettingsPage(QWidget *parent) :
ui->CheckboxShowLEDView->setChecked(false);
}
if(ui_settings.contains("hex_format"))
{
if(ui_settings["hex_format"] == "RGB")
{
ui->ComboBoxHexFormat->setCurrentIndex(0);
}
else if(ui_settings["hex_format"] == "BGR")
{
ui->ComboBoxHexFormat->setCurrentIndex(1);
}
}
/*---------------------------------------------------------*\
| Load LogManager settings |
\*---------------------------------------------------------*/
@ -386,6 +406,17 @@ void OpenRGBSettingsPage::on_ComboBoxTheme_currentTextChanged(const QString them
}
}
void OpenRGBSettingsPage::on_ComboBoxHexFormat_currentTextChanged(const QString hex_format)
{
if(hex_format_initialized)
{
json ui_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("UserInterface");
ui_settings["hex_format"] = hex_format.toStdString();
ResourceManager::get()->GetSettingsManager()->SetSettings("UserInterface",ui_settings);
SaveSettings();
}
}
void OpenRGBSettingsPage::on_CheckboxTrayIconGreyscale_clicked()
{
json ui_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("UserInterface");