diff --git a/src/app/GUI/BoxesList/boxsinglewidget.cpp b/src/app/GUI/BoxesList/boxsinglewidget.cpp index facc76a1f..2bcf1c02a 100644 --- a/src/app/GUI/BoxesList/boxsinglewidget.cpp +++ b/src/app/GUI/BoxesList/boxsinglewidget.cpp @@ -575,40 +575,34 @@ void BoxSingleWidget::setTargetAbstraction(SWT_Abstraction *abs) { void BoxSingleWidget::loadStaticPixmaps(int iconSize) { if (sStaticPixmapsLoaded) { return; } - const auto sizes = QIcon::fromTheme("visible").availableSizes(); - - qWarning() << "Icon theme:" << QIcon::themeName() << iconSize; - qWarning() << "Icon path:" << QIcon::themeSearchPaths(); - qWarning() << "Icon sizes:" << sizes; - - if (!sizes.contains(QSize(iconSize, iconSize))) { + if (!ThemeSupport::hasIconSize(iconSize)) { QMessageBox::warning(nullptr, tr("Icon issues"), tr("
Requested icon size %1 is not available," - " expect blurry and missing icons.
" + " expect blurry icons." "Note that this may happen if you change the display scaling" " in Windows without restarting." " If you still have issues after restarting please report this issue.
").arg(iconSize)); } - - VISIBLE_ICON = new QPixmap(QIcon::fromTheme("visible").pixmap(iconSize, iconSize)); - INVISIBLE_ICON = new QPixmap(QIcon::fromTheme("hidden").pixmap(iconSize, iconSize)); - BOX_CHILDREN_VISIBLE_ICON = new QPixmap(QIcon::fromTheme("visible-child").pixmap(iconSize, iconSize)); - BOX_CHILDREN_HIDDEN_ICON = new QPixmap(QIcon::fromTheme("hidden-child").pixmap(iconSize, iconSize)); - ANIMATOR_CHILDREN_VISIBLE_ICON = new QPixmap(QIcon::fromTheme("visible-child-small").pixmap(iconSize, iconSize)); - ANIMATOR_CHILDREN_HIDDEN_ICON = new QPixmap(QIcon::fromTheme("hidden-child-small").pixmap(iconSize, iconSize)); - LOCKED_ICON = new QPixmap(QIcon::fromTheme("locked").pixmap(iconSize, iconSize)); - UNLOCKED_ICON = new QPixmap(QIcon::fromTheme("unlocked").pixmap(iconSize, iconSize)); - MUTED_ICON = new QPixmap(QIcon::fromTheme("muted").pixmap(iconSize, iconSize)); - UNMUTED_ICON = new QPixmap(QIcon::fromTheme("unmuted").pixmap(iconSize, iconSize)); - ANIMATOR_RECORDING_ICON = new QPixmap(QIcon::fromTheme("record").pixmap(iconSize, iconSize)); - ANIMATOR_NOT_RECORDING_ICON = new QPixmap(QIcon::fromTheme("norecord").pixmap(iconSize, iconSize)); - ANIMATOR_DESCENDANT_RECORDING_ICON = new QPixmap(QIcon::fromTheme("record-child").pixmap(iconSize, iconSize)); - C_ICON = new QPixmap(QIcon::fromTheme("cpu-active").pixmap(iconSize, iconSize)); - G_ICON = new QPixmap(QIcon::fromTheme("gpu-active").pixmap(iconSize, iconSize)); - CG_ICON = new QPixmap(QIcon::fromTheme("cpu-gpu").pixmap(iconSize, iconSize)); - GRAPH_PROPERTY_ICON = new QPixmap(QIcon::fromTheme("graph_property_2").pixmap(iconSize, iconSize)); - PROMOTE_TO_LAYER_ICON = new QPixmap(QIcon::fromTheme("layer").pixmap(iconSize, iconSize)); + const auto pixmapSize = ThemeSupport::getIconSize(iconSize); + VISIBLE_ICON = new QPixmap(QIcon::fromTheme("visible").pixmap(pixmapSize)); + INVISIBLE_ICON = new QPixmap(QIcon::fromTheme("hidden").pixmap(pixmapSize)); + BOX_CHILDREN_VISIBLE_ICON = new QPixmap(QIcon::fromTheme("visible-child").pixmap(pixmapSize)); + BOX_CHILDREN_HIDDEN_ICON = new QPixmap(QIcon::fromTheme("hidden-child").pixmap(pixmapSize)); + ANIMATOR_CHILDREN_VISIBLE_ICON = new QPixmap(QIcon::fromTheme("visible-child-small").pixmap(pixmapSize)); + ANIMATOR_CHILDREN_HIDDEN_ICON = new QPixmap(QIcon::fromTheme("hidden-child-small").pixmap(pixmapSize)); + LOCKED_ICON = new QPixmap(QIcon::fromTheme("locked").pixmap(pixmapSize)); + UNLOCKED_ICON = new QPixmap(QIcon::fromTheme("unlocked").pixmap(pixmapSize)); + MUTED_ICON = new QPixmap(QIcon::fromTheme("muted").pixmap(pixmapSize)); + UNMUTED_ICON = new QPixmap(QIcon::fromTheme("unmuted").pixmap(pixmapSize)); + ANIMATOR_RECORDING_ICON = new QPixmap(QIcon::fromTheme("record").pixmap(pixmapSize)); + ANIMATOR_NOT_RECORDING_ICON = new QPixmap(QIcon::fromTheme("norecord").pixmap(pixmapSize)); + ANIMATOR_DESCENDANT_RECORDING_ICON = new QPixmap(QIcon::fromTheme("record-child").pixmap(pixmapSize)); + C_ICON = new QPixmap(QIcon::fromTheme("cpu-active").pixmap(pixmapSize)); + G_ICON = new QPixmap(QIcon::fromTheme("gpu-active").pixmap(pixmapSize)); + CG_ICON = new QPixmap(QIcon::fromTheme("cpu-gpu").pixmap(pixmapSize)); + GRAPH_PROPERTY_ICON = new QPixmap(QIcon::fromTheme("graph_property_2").pixmap(pixmapSize)); + PROMOTE_TO_LAYER_ICON = new QPixmap(QIcon::fromTheme("layer").pixmap(pixmapSize)); sStaticPixmapsLoaded = true; } diff --git a/src/app/friction.qss b/src/app/friction.qss index a202dc61c..b730bbd07 100644 --- a/src/app/friction.qss +++ b/src/app/friction.qss @@ -20,6 +20,8 @@ /* +Colors and icon size from 'src/core/themesupport.cpp'. + %1 = getThemeButtonBaseColor %2 = getThemeButtonBorderColor %3 = getThemeBaseDarkerColor @@ -312,7 +314,6 @@ QPushButton#FlatButton:hover, QToolButton#FlatButton:hover { background-color: rgb(19, 19, 21); border-color: rgb(104, 144, 206); - } QTabWidget#ThirdPartyBrowser { border: 0; } diff --git a/src/core/themesupport.cpp b/src/core/themesupport.cpp index 0c26585f9..5ae6e3d05 100644 --- a/src/core/themesupport.cpp +++ b/src/core/themesupport.cpp @@ -196,7 +196,7 @@ const QString ThemeSupport::getThemeStyle(int iconSize) getThemeHighlightColor().name(), getThemeBaseColor().name(), getThemeAlternateColor().name(), - QString::number(iconSize), + QString::number(getIconSize(iconSize).width()), getThemeColorOrange().name(), getThemeRangeSelectedColor().name()); } @@ -227,3 +227,32 @@ void ThemeSupport::setupTheme(const int iconSize) qApp->setPalette(palette); qApp->setStyleSheet(getThemeStyle(iconSize)); } + +const QList