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 == "") if (sheetFilePath == "")
{ {
// toolbar color stylesheet // toolbar color stylesheet
QColor tbc = guiSettings->GetValue(GUI::mw_toolBarColor).value<QColor>(); QColor tbc = GUI::mw_tool_bar_color;
QString style_toolbar = QString( QString style_toolbar = QString(
"QLineEdit#mw_searchbar { margin-left:14px; background-color: rgba(%1, %2, %3, %4); }" "QLineEdit#mw_searchbar { margin-left:14px; background-color: rgba(%1, %2, %3, %4); }"
"QToolBar#mw_toolbar { 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); .arg(tbc.red() - 20).arg(tbc.green() - 20).arg(tbc.blue() - 20).arg(tbc.alpha() - 20);
// toolbar icon color stylesheet // 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( QString style_toolbar_icons = QString(
"QLabel#toolbar_icon_color { color: rgba(%1, %2, %3, %4); }") "QLabel#toolbar_icon_color { color: rgba(%1, %2, %3, %4); }")
.arg(tic.red()).arg(tic.green()).arg(tic.blue()).arg(tic.alpha()); .arg(tic.red()).arg(tic.green()).arg(tic.blue()).arg(tic.alpha());
// gamelist toolbar stylesheet // gamelist toolbar stylesheet
QColor gltic = guiSettings->GetValue(GUI::gl_toolIconColor).value<QColor>(); QColor gltic = GUI::gl_tool_icon_color;
QString style_gamelist_toolbar = QString( QString style_gamelist_toolbar = QString(
"QLineEdit#tb_searchbar { background: transparent; }" "QLineEdit#tb_searchbar { background: transparent; }"
"QLabel#gamelist_toolbar_icon_color { color: rgba(%1, %2, %3, %4); }") "QLabel#gamelist_toolbar_icon_color { color: rgba(%1, %2, %3, %4); }")
.arg(gltic.red()).arg(gltic.green()).arg(gltic.blue()).arg(gltic.alpha()); .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 // other objects' stylesheet
QString style_rest = QString( QString style_rest = QString(
"QWidget#header_section { background-color: #ffffff; }" "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); }"); "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)) else if (file.open(QIODevice::ReadOnly | QIODevice::Text))
{ {

View File

@ -788,11 +788,18 @@ void game_list_frame::ResizeIcons(const int& sliderPos)
RepaintIcons(); 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) for (auto& game : m_game_data)

View File

@ -203,7 +203,7 @@ public:
void ResizeIcons(const int& sliderPos); void ResizeIcons(const int& sliderPos);
/** Repaint Gamelist Icons with new background color */ /** Repaint Gamelist Icons with new background color */
void RepaintIcons(const QColor& color = QColor()); void RepaintIcons(const bool& fromSettings = false);
int GetSliderValue(); 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::GuiSettingsSaveRequest, this, &main_window::SaveWindowState);
connect(&dlg, &settings_dialog::GuiSettingsSyncRequest, [=]() {ConfigureGuiFromSettings(true); }); connect(&dlg, &settings_dialog::GuiSettingsSyncRequest, [=]() {ConfigureGuiFromSettings(true); });
connect(&dlg, &settings_dialog::GuiStylesheetRequest, this, &main_window::RequestGlobalStylesheetChange); connect(&dlg, &settings_dialog::GuiStylesheetRequest, this, &main_window::RequestGlobalStylesheetChange);
connect(&dlg, &settings_dialog::ToolBarRepaintRequest, this, &main_window::RepaintToolBarIcons); connect(&dlg, &settings_dialog::GuiRepaintRequest, [this](){
connect(&dlg, &settings_dialog::ToolBarRepaintRequest, gameListFrame, &game_list_frame::RepaintToolBarIcons); gameListFrame->RepaintIcons(true);
connect(&dlg, &settings_dialog::accepted, [this](){ gameListFrame->RepaintToolBarIcons();
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"));
}
RepaintToolbar(); RepaintToolbar();
RepaintToolBarIcons();
}); });
dlg.exec(); 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()); std::vector<std::string> selected_ls = std::vector<std::string>(selectedlle.begin(), selectedlle.end());
xemu_settings->SaveSelectedLibraries(selected_ls); 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, xemu_settings.get(), &emu_settings::SaveSettings);
connect(ui->okButton, &QAbstractButton::clicked, this, &QDialog::accept); 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_stylesheets->setEnabled(false);
ui->gb_configs->setEnabled(false); ui->gb_configs->setEnabled(false);
ui->gb_settings->setEnabled(false); ui->gb_settings->setEnabled(false);
ui->gb_colors->setEnabled(false);
} }
else 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_gl_tool_icon_color->setEnabled(val);
ui->pb_tool_bar_color->setEnabled(val); ui->pb_tool_bar_color->setEnabled(val);
ui->pb_tool_icon_color->setEnabled(val); ui->pb_tool_icon_color->setEnabled(val);
Q_EMIT GuiRepaintRequest();
}); });
auto colorDialog = [&](const GUI_SAVE& color, const QString& title, QPushButton *button){ auto colorDialog = [&](const GUI_SAVE& color, const QString& title, QPushButton *button){
QColor oldColor = xgui_settings->GetValue(color).value<QColor>(); 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()); xgui_settings->SetValue(color, dlg.selectedColor());
button->setIcon(gui_settings::colorizedIcon(button->icon(), oldColor, dlg.selectedColor(), true)); 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); }); 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 GuiSettingsSyncRequest();
void GuiStylesheetRequest(const QString& path); void GuiStylesheetRequest(const QString& path);
void GuiSettingsSaveRequest(); void GuiSettingsSaveRequest();
void ToolBarRepaintRequest(); void GuiRepaintRequest();
private Q_SLOTS: private Q_SLOTS:
void OnBackupCurrentConfig(); void OnBackupCurrentConfig();
void OnApplyConfig(); void OnApplyConfig();

View File

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