diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index 528e62e147..8ba250e739 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -1421,11 +1421,27 @@ void main_window::RepaintThumbnailIcons() void main_window::RepaintToolBarIcons() { - const QColor new_color = gui::utils::get_label_color("toolbar_icon_color"); + std::map new_colors{}; + new_colors[QIcon::Normal] = gui::utils::get_label_color("toolbar_icon_color"); - const auto icon = [&new_color](const QString& path) + const QString sheet = static_cast(QCoreApplication::instance())->styleSheet(); + + if (sheet.contains("toolbar_icon_color_disabled")) { - return gui::utils::get_colorized_icon(QIcon(path), Qt::black, new_color); + new_colors[QIcon::Disabled] = gui::utils::get_label_color("toolbar_icon_color_disabled"); + } + if (sheet.contains("toolbar_icon_color_active")) + { + new_colors[QIcon::Active] = gui::utils::get_label_color("toolbar_icon_color_active"); + } + if (sheet.contains("toolbar_icon_color_selected")) + { + new_colors[QIcon::Selected] = gui::utils::get_label_color("toolbar_icon_color_selected"); + } + + const auto icon = [&new_colors](const QString& path) + { + return gui::utils::get_colorized_icon(QIcon(path), Qt::black, new_colors); }; m_icon_play = icon(":/Icons/play.png"); @@ -1465,6 +1481,7 @@ void main_window::RepaintToolBarIcons() ui->toolbar_fullscreen->setIcon(m_icon_fullscreen_on); } + const QColor& new_color = new_colors[QIcon::Normal]; ui->sizeSlider->setStyleSheet(ui->sizeSlider->styleSheet().append("QSlider::handle:horizontal{ background: rgba(%1, %2, %3, %4); }") .arg(new_color.red()).arg(new_color.green()).arg(new_color.blue()).arg(new_color.alpha())); diff --git a/rpcs3/rpcs3qt/qt_utils.cpp b/rpcs3/rpcs3qt/qt_utils.cpp index e3d0a9b6cb..2de69a3127 100644 --- a/rpcs3/rpcs3qt/qt_utils.cpp +++ b/rpcs3/rpcs3qt/qt_utils.cpp @@ -150,6 +150,17 @@ namespace gui return QIcon(get_colorized_pixmap(old_icon.pixmap(old_icon.availableSizes().at(0)), old_color, new_color, use_special_masks, colorize_all)); } + QIcon get_colorized_icon(const QIcon& old_icon, const QColor& old_color, const std::map& new_colors, bool use_special_masks, bool colorize_all) + { + QIcon icon{}; + const QPixmap old_pixmap = old_icon.pixmap(old_icon.availableSizes().at(0)); + for (const auto& [mode, color] : new_colors) + { + icon.addPixmap(get_colorized_pixmap(old_pixmap, old_color, color, use_special_masks, colorize_all), mode); + } + return icon; + } + QStringList get_dir_entries(const QDir& dir, const QStringList& name_filters) { QFileInfoList entries = dir.entryInfoList(name_filters, QDir::Files); diff --git a/rpcs3/rpcs3qt/qt_utils.h b/rpcs3/rpcs3qt/qt_utils.h index 2d8e075188..222d46ba48 100644 --- a/rpcs3/rpcs3qt/qt_utils.h +++ b/rpcs3/rpcs3qt/qt_utils.h @@ -13,6 +13,7 @@ #include #include +#include namespace gui { @@ -57,6 +58,7 @@ namespace gui // use colorize_all to repaint every opaque pixel with the chosen color // use_special_masks is only used for icons with multiple predefined colors QIcon get_colorized_icon(const QIcon& old_icon, const QColor& old_color, const QColor& new_color, bool use_special_masks = false, bool colorize_all = false); + QIcon get_colorized_icon(const QIcon& old_icon, const QColor& old_color, const std::map& new_colors, bool use_special_masks = false, bool colorize_all = false); // Returns a list of all base names of files in dir whose complete file names contain one of the given name_filters QStringList get_dir_entries(const QDir& dir, const QStringList& name_filters);