stylesheets: UI Colors fixes

This commit is contained in:
Megamouse 2017-08-20 18:10:02 +02:00 committed by Ivan
parent a822d990d2
commit ee98683538
7 changed files with 32 additions and 23 deletions

View File

@ -288,7 +288,7 @@ void rpcs3_app::OnChangeStyleSheetRequest(const QString& sheetFilePath)
if (sheetFilePath == "")
{
// toolbar color stylesheet
QColor tbc = guiSettings->GetValue(GUI::mw_toolBarColor).value<QColor>();
QColor tbc = GUI::mw_tool_bar_color;
QString style_toolbar = QString(
"QLineEdit#mw_searchbar { margin-left:14px; background-color: rgba(%1, %2, %3, %4); }"
"QToolBar#mw_toolbar { background-color: rgba(%1, %2, %3, %4); }"
@ -298,24 +298,30 @@ void rpcs3_app::OnChangeStyleSheetRequest(const QString& sheetFilePath)
.arg(tbc.red() - 20).arg(tbc.green() - 20).arg(tbc.blue() - 20).arg(tbc.alpha() - 20);
// toolbar icon color stylesheet
QColor tic = guiSettings->GetValue(GUI::mw_toolIconColor).value<QColor>();
QColor tic = GUI::mw_tool_icon_color;
QString style_toolbar_icons = QString(
"QLabel#toolbar_icon_color { color: rgba(%1, %2, %3, %4); }")
.arg(tic.red()).arg(tic.green()).arg(tic.blue()).arg(tic.alpha());
// gamelist toolbar stylesheet
QColor gltic = guiSettings->GetValue(GUI::gl_toolIconColor).value<QColor>();
QColor gltic = GUI::gl_tool_icon_color;
QString style_gamelist_toolbar = QString(
"QLineEdit#tb_searchbar { background: transparent; }"
"QLabel#gamelist_toolbar_icon_color { color: rgba(%1, %2, %3, %4); }")
.arg(gltic.red()).arg(gltic.green()).arg(gltic.blue()).arg(gltic.alpha());
// gamelist icon color stylesheet
QColor glic = GUI::gl_icon_color;
QString style_gamelist_icons = QString(
"QLabel#gamelist_icon_background_color { color: rgba(%1, %2, %3, %4); }")
.arg(glic.red()).arg(glic.green()).arg(glic.blue()).arg(glic.alpha());
// other objects' stylesheet
QString style_rest = QString(
"QWidget#header_section { background-color: #ffffff; }"
"QLabel#gamegrid_font { font-weight: 600; font-size: 8pt; font-family: Lucida Grande; color: rgba(51, 51, 51, 255); }");
setStyleSheet(style_toolbar + style_toolbar_icons + style_gamelist_toolbar + style_rest);
setStyleSheet(style_toolbar + style_toolbar_icons + style_gamelist_toolbar + style_gamelist_icons + style_rest);
}
else if (file.open(QIODevice::ReadOnly | QIODevice::Text))
{

View File

@ -788,11 +788,18 @@ void game_list_frame::ResizeIcons(const int& sliderPos)
RepaintIcons();
}
void game_list_frame::RepaintIcons(const QColor& color)
void game_list_frame::RepaintIcons(const bool& fromSettings)
{
if (color.isValid())
if (fromSettings)
{
m_Icon_Color = color;
if (xgui_settings->GetValue(GUI::m_enableUIColors).toBool())
{
m_Icon_Color = xgui_settings->GetValue(GUI::gl_iconColor).value<QColor>();
}
else
{
m_Icon_Color = GUI::get_Label_Color("gamelist_icon_background_color");
}
}
for (auto& game : m_game_data)

View File

@ -203,7 +203,7 @@ public:
void ResizeIcons(const int& sliderPos);
/** Repaint Gamelist Icons with new background color */
void RepaintIcons(const QColor& color = QColor());
void RepaintIcons(const bool& fromSettings = false);
int GetSliderValue();

View File

@ -1138,18 +1138,11 @@ void main_window::CreateConnects()
connect(&dlg, &settings_dialog::GuiSettingsSaveRequest, this, &main_window::SaveWindowState);
connect(&dlg, &settings_dialog::GuiSettingsSyncRequest, [=]() {ConfigureGuiFromSettings(true); });
connect(&dlg, &settings_dialog::GuiStylesheetRequest, this, &main_window::RequestGlobalStylesheetChange);
connect(&dlg, &settings_dialog::ToolBarRepaintRequest, this, &main_window::RepaintToolBarIcons);
connect(&dlg, &settings_dialog::ToolBarRepaintRequest, gameListFrame, &game_list_frame::RepaintToolBarIcons);
connect(&dlg, &settings_dialog::accepted, [this](){
if (guiSettings->GetValue(GUI::m_enableUIColors).toBool())
{
gameListFrame->RepaintIcons(guiSettings->GetValue(GUI::gl_iconColor).value<QColor>());
}
else
{
gameListFrame->RepaintIcons(GUI::get_Label_Color("gamelist_icon_background_color"));
}
connect(&dlg, &settings_dialog::GuiRepaintRequest, [this](){
gameListFrame->RepaintIcons(true);
gameListFrame->RepaintToolBarIcons();
RepaintToolbar();
RepaintToolBarIcons();
});
dlg.exec();
};

View File

@ -93,7 +93,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> xSettings, const
}
std::vector<std::string> selected_ls = std::vector<std::string>(selectedlle.begin(), selectedlle.end());
xemu_settings->SaveSelectedLibraries(selected_ls);
Q_EMIT ToolBarRepaintRequest();
Q_EMIT GuiRepaintRequest();
});
connect(ui->okButton, &QAbstractButton::clicked, xemu_settings.get(), &emu_settings::SaveSettings);
connect(ui->okButton, &QAbstractButton::clicked, this, &QDialog::accept);
@ -688,6 +688,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> xSettings, const
ui->gb_stylesheets->setEnabled(false);
ui->gb_configs->setEnabled(false);
ui->gb_settings->setEnabled(false);
ui->gb_colors->setEnabled(false);
}
else
{
@ -734,6 +735,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> xSettings, const
ui->pb_gl_tool_icon_color->setEnabled(val);
ui->pb_tool_bar_color->setEnabled(val);
ui->pb_tool_icon_color->setEnabled(val);
Q_EMIT GuiRepaintRequest();
});
auto colorDialog = [&](const GUI_SAVE& color, const QString& title, QPushButton *button){
QColor oldColor = xgui_settings->GetValue(color).value<QColor>();
@ -752,6 +754,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> xSettings, const
}
xgui_settings->SetValue(color, dlg.selectedColor());
button->setIcon(gui_settings::colorizedIcon(button->icon(), oldColor, dlg.selectedColor(), true));
Q_EMIT GuiRepaintRequest();
}
};
connect(ui->pb_gl_icon_color, &QAbstractButton::clicked, [=]() { colorDialog(GUI::gl_iconColor, tr("Choose gamelist icon color"), ui->pb_gl_icon_color); });

View File

@ -25,7 +25,7 @@ Q_SIGNALS:
void GuiSettingsSyncRequest();
void GuiStylesheetRequest(const QString& path);
void GuiSettingsSaveRequest();
void ToolBarRepaintRequest();
void GuiRepaintRequest();
private Q_SLOTS:
void OnBackupCurrentConfig();
void OnApplyConfig();

View File

@ -36,7 +36,7 @@
</sizepolicy>
</property>
<property name="currentIndex">
<number>7</number>
<number>0</number>
</property>
<widget class="QWidget" name="coreTab">
<attribute name="title">
@ -1198,7 +1198,7 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<widget class="QGroupBox" name="gb_colors">
<property name="title">
<string>UI Colors</string>
</property>