Backport changes from yuzu-emu/yuzu#2057

This commit is contained in:
FearlessTobi 2019-09-22 17:47:18 +02:00
parent 0a3f75c25f
commit a5d880979c
2 changed files with 15 additions and 11 deletions

View File

@ -49,11 +49,7 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
if (!new_bg_color.isValid()) { if (!new_bg_color.isValid()) {
return; return;
} }
bg_color = new_bg_color; UpdateBackgroundColorButton(new_bg_color);
QPixmap pixmap(ui->bg_button->size());
pixmap.fill(bg_color);
const QIcon color_icon(pixmap);
ui->bg_button->setIcon(color_icon);
}); });
} }
@ -71,12 +67,8 @@ void ConfigureGraphics::SetConfiguration() {
ui->toggle_linear_filter->setChecked(Settings::values.filter_mode); ui->toggle_linear_filter->setChecked(Settings::values.filter_mode);
ui->layout_combobox->setCurrentIndex(static_cast<int>(Settings::values.layout_option)); ui->layout_combobox->setCurrentIndex(static_cast<int>(Settings::values.layout_option));
ui->swap_screen->setChecked(Settings::values.swap_screen); ui->swap_screen->setChecked(Settings::values.swap_screen);
bg_color = QColor::fromRgbF(Settings::values.bg_red, Settings::values.bg_green, UpdateBackgroundColorButton(QColor::fromRgbF(Settings::values.bg_red, Settings::values.bg_green,
Settings::values.bg_blue); Settings::values.bg_blue));
QPixmap pixmap(ui->bg_button->size());
pixmap.fill(bg_color);
const QIcon color_icon(pixmap);
ui->bg_button->setIcon(color_icon);
} }
void ConfigureGraphics::ApplyConfiguration() { void ConfigureGraphics::ApplyConfiguration() {
@ -117,6 +109,16 @@ void ConfigureGraphics::updateShaders(bool anaglyph) {
} }
} }
void ConfigureGraphics::UpdateBackgroundColorButton(QColor color) {
bg_color = color;
QPixmap pixmap(ui->bg_button->size());
pixmap.fill(bg_color);
const QIcon color_icon(pixmap);
ui->bg_button->setIcon(color_icon);
}
void ConfigureGraphics::RetranslateUI() { void ConfigureGraphics::RetranslateUI() {
ui->retranslateUi(this); ui->retranslateUi(this);
} }

View File

@ -22,6 +22,8 @@ public:
void RetranslateUI(); void RetranslateUI();
void SetConfiguration(); void SetConfiguration();
void UpdateBackgroundColorButton(QColor color);
std::unique_ptr<Ui::ConfigureGraphics> ui; std::unique_ptr<Ui::ConfigureGraphics> ui;
QColor bg_color; QColor bg_color;