File indexing completed on 2024-04-28 17:06:32

0001 /*
0002     SPDX-FileCopyrightText: 2018-2022 Nikita Melnichenko <nikita+kde@melnichenko.name>
0003     SPDX-FileCopyrightText: 2018-2022 Krusader Krew <https://krusader.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef ICON_H
0009 #define ICON_H
0010 
0011 // QtGui
0012 #include <QIcon>
0013 #include <QIconEngine>
0014 
0015 /**
0016  * @class Icon
0017  *
0018  * Universal icon class for Krusader.
0019  *
0020  * There is a list of configured themes that Icon searches in.
0021  * The order of themes is the following: active theme, theme specified by user,
0022  * fallback themes that provide complete icon set for Krusader.
0023  * If icon is not found in any configured theme, the fallback icon is used.
0024  */
0025 class Icon : public QIcon
0026 {
0027 public:
0028     Icon();
0029     explicit Icon(QString name, QStringList overlays = QStringList());
0030     explicit Icon(QString name, QIcon fallbackIcon, QStringList overlays = QStringList());
0031 
0032     /// Check if icon exists in any configured theme
0033     static bool exists(const QString &iconName);
0034 
0035     /// Apply overlays to the pixmap with fallbacks to standard emblems
0036     static void applyOverlays(QPixmap *pixmap, QStringList overlays);
0037 
0038     /// Determine if light window theme is currently enabled
0039     static bool isLightWindowThemeActive();
0040 };
0041 
0042 #endif // ICON_H