1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2025-01-31 20:41:45 +01:00

Qt: remove redundant custom toolbar colors.

They got too complicated when used with stylesheets. I left the gamelist icon color option since it does in no way interfere with the stylesheets
This commit is contained in:
Megamouse 2018-07-01 20:46:26 +02:00 committed by Ivan
parent 1270ee4b38
commit 3a5ce90148
7 changed files with 38 additions and 130 deletions

View File

@ -321,38 +321,32 @@ void rpcs3_app::InitializeConnects()
*/
void rpcs3_app::OnChangeStyleSheetRequest(const QString& path)
{
auto rgba = [](const QColor& c, int v = 0)
{
return QString("rgba(%1, %2, %3, %4);").arg(c.red() + v).arg(c.green() + v).arg(c.blue() + v).arg(c.alpha() + v);
};
QString rgba_tool_bar = rgba(gui::mw_tool_bar_color);
QString style_sheet
(
// main window toolbar search
"QLineEdit#mw_searchbar { padding: 0 1em; background: #fdfdfd; selection-background-color: #148aff; margin: .8em; color:#000000; }"
// main window toolbar slider
"QSlider#sizeSlider { color: #505050; background: " + rgba_tool_bar + "; }"
"QSlider#sizeSlider::handle:horizontal { border: 0em smooth " + rgba(gui::mw_tool_bar_color, -13) + " border-radius: .58em; background: " + rgba(gui::mw_tool_icon_color, -27) + " width: 1.2em; margin: -.5em 0; }"
"QSlider#sizeSlider::groove:horizontal { border-radius: .15em; background: " + rgba(gui::mw_tool_icon_color) + " height: .3em; }"
"QSlider#sizeSlider { color: #505050; background: #F0F0F0; }"
"QSlider#sizeSlider::handle:horizontal { border: 0em smooth rgba(227, 227, 227, 255); border-radius: .58em; background: #404040; width: 1.2em; margin: -.5em 0; }"
"QSlider#sizeSlider::groove:horizontal { border-radius: .15em; background: #5b5b5b; height: .3em; }"
// main window toolbar
"QToolBar#mw_toolbar { background-color: " + rgba_tool_bar + " }"
"QToolBar#mw_toolbar::separator { background-color: " + rgba(gui::mw_tool_bar_color, -20) + " width: 0.125em; margin-top: 0.250em; margin-bottom: 0.250em; }"
"QToolBar#mw_toolbar { background-color: #F0F0F0; }"
"QToolBar#mw_toolbar::separator { background-color: rgba(207, 207, 207, 235); width: 0.125em; margin-top: 0.250em; margin-bottom: 0.250em; }"
// main window toolbar icon color
"QLabel#toolbar_icon_color { color: " + rgba(gui::mw_tool_icon_color) + " }"
"QLabel#toolbar_icon_color { color: #5b5b5b; }"
// thumbnail icon color
"QLabel#thumbnail_icon_color { color: " + rgba(gui::mw_thumb_icon_color) + " }"
"QLabel#thumbnail_icon_color { color: rgba(0, 100, 231, 255); }"
// game list icon color
"QLabel#gamelist_icon_background_color { color: " + rgba(gui::gl_icon_color) + " }"
"QLabel#gamelist_icon_background_color { color: rgba(36, 36, 36, 255); }"
// tables
"QTableWidget { alternate-background-color: #f2f2f2; background-color: rgba(255, 255, 255, 255); }"
"QTableWidget#game_grid { alternate-background-color: #f2f2f2; background-color: rgba(255, 255, 255, 255); font-weight: 600; font-size: 8pt; font-family: Lucida Grande; color: rgba(51, 51, 51, 255); }"
"QTableWidget { alternate-background-color: #f2f2f2; background-color: #fff; }"
"QTableWidget#game_grid { alternate-background-color: #f2f2f2; background-color: #fff; font-weight: 600; font-size: 8pt; font-family: Lucida Grande; color: rgba(51, 51, 51, 255); }"
"QTableView::item { border-left: 0.063em solid white; border-right: 0.063em solid white; padding-left:0.313em; }"
"QTableView::item:selected { background-color: #148aff; color: #fff; }"
"QHeaderView::section { padding-left: .5em; padding-right: .5em; padding-top: .4em; padding-bottom: -.1em; border: 0.063em solid #ffffff; }"

View File

@ -191,7 +191,7 @@ void gui_settings::SetGamelistColVisibility(int col, bool val)
void gui_settings::SetCustomColor(int col, const QColor& val)
{
SetValue(gui_save(gui::meta, "CustomColor" + QString::number(col), gui::mw_tool_bar_color), val);
SetValue(gui_save(gui::meta, "CustomColor" + QString::number(col), gui::gl_icon_color), val);
}
void gui_settings::SaveCurrentConfig(const QString& friendlyName)
@ -212,7 +212,7 @@ bool gui_settings::GetGamelistColVisibility(int col)
QColor gui_settings::GetCustomColor(int col)
{
return GetValue(gui_save(gui::meta, "CustomColor" + QString::number(col), gui::mw_tool_bar_color)).value<QColor>();
return GetValue(gui_save(gui::meta, "CustomColor" + QString::number(col), gui::gl_icon_color)).value<QColor>();
}
QStringList gui_settings::GetConfigEntries()

View File

@ -128,10 +128,7 @@ namespace gui
const QString savedata = "SaveData";
const QString notes = "Notes";
const QColor gl_icon_color = QColor( 36, 36, 36, 255);
const QColor mw_tool_icon_color = QColor( 91, 91, 91, 255);
const QColor mw_tool_bar_color = QColor(240, 240, 240, 255);
const QColor mw_thumb_icon_color = QColor( 0, 100, 231, 255);
const QColor gl_icon_color = QColor(36, 36, 36, 255);
const gui_save rg_freeze = gui_save(main_window, "recentGamesFrozen", false);
const gui_save rg_entries = gui_save(main_window, "recentGamesNames", QVariant::fromValue(q_pair_list()));
@ -151,8 +148,6 @@ namespace gui
const gui_save mw_logger = gui_save(main_window, "loggerVisible", true);
const gui_save mw_gamelist = gui_save(main_window, "gamelistVisible", true);
const gui_save mw_toolBarVisible = gui_save(main_window, "toolBarVisible", true);
const gui_save mw_toolBarColor = gui_save(main_window, "toolBarColor", mw_tool_bar_color);
const gui_save mw_toolIconColor = gui_save(main_window, "toolIconColor", mw_tool_icon_color);
const gui_save mw_geometry = gui_save(main_window, "geometry", QByteArray());
const gui_save mw_windowState = gui_save(main_window, "windowState", QByteArray());
const gui_save mw_mwState = gui_save(main_window, "wwState", QByteArray());

View File

@ -721,16 +721,7 @@ void main_window::RepaintThumbnailIcons()
void main_window::RepaintToolBarIcons()
{
QColor newColor;
if (guiSettings->GetValue(gui::m_enableUIColors).toBool())
{
newColor = guiSettings->GetValue(gui::mw_toolIconColor).value<QColor>();
}
else
{
newColor = gui::utils::get_label_color("toolbar_icon_color");
}
QColor newColor = gui::utils::get_label_color("toolbar_icon_color");
auto icon = [&newColor](const QString& path)
{
@ -1088,40 +1079,10 @@ void main_window::RepaintGui()
m_debuggerFrame->ChangeColors();
}
RepaintToolbar();
RepaintToolBarIcons();
RepaintThumbnailIcons();
}
void main_window::RepaintToolbar()
{
if (guiSettings->GetValue(gui::m_enableUIColors).toBool())
{
QColor tbc = guiSettings->GetValue(gui::mw_toolBarColor).value<QColor>();
QColor tic = guiSettings->GetValue(gui::mw_toolIconColor).value<QColor>();
QString tool_bar_color_1 = QString("rgba(%0, %1, %2, %3)").arg(tbc.red()).arg(tbc.green()).arg(tbc.blue()).arg(tbc.alpha());
QString tool_bar_color_2 = QString("rgba(%0, %1, %2, %3)").arg(tbc.red() - 20).arg(tbc.green() - 20).arg(tbc.blue() - 20).arg(tbc.alpha() - 20);
QString tool_icon_color_1 = QString("rgba(%0, %1, %2, %3)").arg(tic.red()).arg(tic.green()).arg(tic.blue()).arg(tic.alpha());
QString tool_icon_color_2 = QString("rgba(%0, %1, %2, %3)").arg(tic.red() - 10).arg(tic.green() - 10).arg(tic.blue() - 10).arg(tic.alpha() - 10);
ui->toolBar->setStyleSheet(gui::stylesheet + QString
(
"QToolBar { background-color: " + tool_bar_color_1 + "; }"
"QToolBar::separator {background-color: " + tool_bar_color_2 + "; width: 1px; margin-top: 2px; margin-bottom: 2px;}"
"QSlider { color: " + tool_bar_color_2 + "; background: " + tool_bar_color_1 + "; }"
"QSlider::handle:horizontal { border: 0em smooth " + tool_bar_color_2 + "; border-radius: .58em; background: " + tool_icon_color_2 + "; width: 1.2em; margin: -.5em 0; }"
"QSlider::groove:horizontal { border-radius: .15em; color: " + tool_icon_color_2 + "; background: " + tool_icon_color_1 + "; height: .3em; }"
"QLineEdit { background-color: " + tool_bar_color_1 + "; }"
));
}
else
{
ui->toolBar->setStyleSheet(gui::stylesheet);
}
}
void main_window::CreateActions()
{
ui->exitAct->setShortcuts(QKeySequence::Quit);
@ -1535,8 +1496,6 @@ void main_window::ConfigureGuiFromSettings(bool configure_all)
m_gameListFrame->setVisible(ui->showGameListAct->isChecked());
ui->toolBar->setVisible(ui->showToolBarAct->isChecked());
RepaintToolbar();
ui->showHiddenEntriesAct->setChecked(guiSettings->GetValue(gui::gl_show_hidden).toBool());
m_gameListFrame->SetShowHidden(ui->showHiddenEntriesAct->isChecked()); // prevent GetValue in m_gameListFrame->LoadSettings

View File

@ -108,7 +108,6 @@ protected:
void dragLeaveEvent(QDragLeaveEvent* event) override;
void SetAppIconFromPath(const std::string& path);
private:
void RepaintToolbar();
void RepaintToolBarIcons();
void RepaintThumbnailIcons();
void CreateActions();

View File

@ -950,8 +950,6 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
auto AddColoredIcons = [=]()
{
addColoredIcon(ui->pb_gl_icon_color, xgui_settings->GetValue(gui::gl_iconColor).value<QColor>());
addColoredIcon(ui->pb_tool_bar_color, xgui_settings->GetValue(gui::mw_toolBarColor).value<QColor>());
addColoredIcon(ui->pb_tool_icon_color, xgui_settings->GetValue(gui::mw_toolIconColor).value<QColor>());
};
AddColoredIcons();
@ -960,8 +958,6 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
bool enableUIColors = xgui_settings->GetValue(gui::m_enableUIColors).toBool();
ui->cb_custom_colors->setChecked(enableUIColors);
ui->pb_gl_icon_color->setEnabled(enableUIColors);
ui->pb_tool_bar_color->setEnabled(enableUIColors);
ui->pb_tool_icon_color->setEnabled(enableUIColors);
auto ApplyGuiOptions = [&](bool reset = false)
{
@ -1021,8 +1017,6 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
{
xgui_settings->SetValue(gui::m_enableUIColors, val);
ui->pb_gl_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)
@ -1052,16 +1046,6 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
colorDialog(gui::gl_iconColor, tr("Choose gamelist icon color"), ui->pb_gl_icon_color);
});
connect(ui->pb_tool_bar_color, &QAbstractButton::clicked, [=]()
{
colorDialog(gui::mw_toolBarColor, tr("Choose tool bar color"), ui->pb_tool_bar_color);
});
connect(ui->pb_tool_icon_color, &QAbstractButton::clicked, [=]()
{
colorDialog(gui::mw_toolIconColor, tr("Choose tool icon color"), ui->pb_tool_icon_color);
});
AddConfigs();
AddStylesheets();
}

View File

@ -1470,7 +1470,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>55</height>
<height>0</height>
</size>
</property>
</spacer>
@ -1571,20 +1571,6 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pb_tool_bar_color">
<property name="text">
<string>Main window tool bar</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pb_tool_icon_color">
<property name="text">
<string>Main window tool icons</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pb_gl_icon_color">
<property name="text">
@ -1592,43 +1578,27 @@
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
@ -1660,6 +1630,13 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Load Settings:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="combo_configs"/>
</item>