From a822d990d2fffafc67fbcd0ca2f2919c863ed187 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Sun, 20 Aug 2017 16:02:39 +0200 Subject: [PATCH] stylesheets: UI_Colors hotfix --- rpcs3/rpcs3_app.cpp | 33 ++++++++++++++++++++++++++----- rpcs3/rpcs3qt/game_list_frame.cpp | 4 ++-- rpcs3/rpcs3qt/main_window.cpp | 17 ++++++++-------- 3 files changed, 39 insertions(+), 15 deletions(-) diff --git a/rpcs3/rpcs3_app.cpp b/rpcs3/rpcs3_app.cpp index 78e8432fbb..ff30a4e40c 100644 --- a/rpcs3/rpcs3_app.cpp +++ b/rpcs3/rpcs3_app.cpp @@ -287,12 +287,35 @@ void rpcs3_app::OnChangeStyleSheetRequest(const QString& sheetFilePath) QFile file(sheetFilePath); if (sheetFilePath == "") { - setStyleSheet( - "QWidget#header_section { background-color: #ffffff; }" - "QLineEdit#mw_searchbar { margin-left:14px; }" + // toolbar color stylesheet + QColor tbc = guiSettings->GetValue(GUI::mw_toolBarColor).value(); + 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); }" + "QToolBar#mw_toolbar QSlider { background-color: rgba(%1, %2, %3, %4); }" + "QToolBar#mw_toolbar::separator {background-color: rgba(%5, %6, %7, %8); width: 1px; margin-top: 2px; margin-bottom: 2px;}") + .arg(tbc.red()).arg(tbc.green()).arg(tbc.blue()).arg(tbc.alpha()) + .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(); + 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(); + QString style_gamelist_toolbar = QString( "QLineEdit#tb_searchbar { background: transparent; }" - "QLabel#gamegrid_font { font-weight: 600; font-size: 8pt; font-family: Lucida Grande; color: rgba(51, 51, 51, 255); }" - ); + "QLabel#gamelist_toolbar_icon_color { color: rgba(%1, %2, %3, %4); }") + .arg(gltic.red()).arg(gltic.green()).arg(gltic.blue()).arg(gltic.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); } else if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index c33c48a206..a097cbef08 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -853,11 +853,11 @@ void game_list_frame::RepaintToolBarIcons() if (xgui_settings->GetValue(GUI::m_enableUIColors).toBool()) { - newColor = GUI::get_Label_Color("gamelist_toolbar_icon_color"); + newColor = xgui_settings->GetValue(GUI::gl_toolIconColor).value(); } else { - newColor = xgui_settings->GetValue(GUI::gl_toolIconColor).value(); + newColor = GUI::get_Label_Color("gamelist_toolbar_icon_color"); } m_catActHDD.colored = gui_settings::colorizedIcon(QIcon(":/Icons/hdd_blue.png"), GUI::gl_tool_icon_color, newColor, true); diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index 92c35aa0c0..94d2a1dd83 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -76,6 +76,7 @@ void main_window::Init() ui->menuUtilities->menuAction()->setVisible(guiSettings->GetValue(GUI::m_showDebugTab).toBool()); // add toolbar widgets (crappy Qt designer is not able to) + ui->toolBar->setObjectName("mw_toolbar"); ui->sizeSlider->setRange(0, GUI::gl_max_slider_pos); ui->sizeSlider->setSliderPosition(guiSettings->GetValue(GUI::gl_iconSize).toInt()); ui->toolBar->addWidget(ui->sizeSliderContainer); @@ -704,11 +705,11 @@ void main_window::RepaintToolBarIcons() if (guiSettings->GetValue(GUI::m_enableUIColors).toBool()) { - newColor = GUI::get_Label_Color("toolbar_icon_color"); + newColor = guiSettings->GetValue(GUI::mw_toolIconColor).value(); } else { - newColor = guiSettings->GetValue(GUI::mw_toolIconColor).value(); + newColor = GUI::get_Label_Color("toolbar_icon_color"); } icon_play = gui_settings::colorizedIcon(QIcon(":/Icons/play.png"), GUI::mw_tool_icon_color, newColor); @@ -1042,10 +1043,6 @@ void main_window::AddRecentAction(const q_string_pair& entry) void main_window::RepaintToolbar() { if (guiSettings->GetValue(GUI::m_enableUIColors).toBool()) - { - ui->toolBar->setStyleSheet(GUI::stylesheet); - } - else { QColor tbc = guiSettings->GetValue(GUI::mw_toolBarColor).value(); @@ -1058,6 +1055,10 @@ void main_window::RepaintToolbar() .arg(tbc.red() - 20).arg(tbc.green() - 20).arg(tbc.blue() - 20).arg(tbc.alpha() - 20) ); } + else + { + ui->toolBar->setStyleSheet(GUI::stylesheet); + } } void main_window::CreateActions() @@ -1142,11 +1143,11 @@ void main_window::CreateConnects() connect(&dlg, &settings_dialog::accepted, [this](){ if (guiSettings->GetValue(GUI::m_enableUIColors).toBool()) { - gameListFrame->RepaintIcons(GUI::get_Label_Color("gamelist_icon_background_color")); + gameListFrame->RepaintIcons(guiSettings->GetValue(GUI::gl_iconColor).value()); } else { - gameListFrame->RepaintIcons(guiSettings->GetValue(GUI::gl_iconColor).value()); + gameListFrame->RepaintIcons(GUI::get_Label_Color("gamelist_icon_background_color")); } RepaintToolbar(); });