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

@ -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