| 1 |
// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-3.0-or-later |
| 4 |
|
| 5 |
#ifndef DICONTHEME_H |
| 6 |
#define DICONTHEME_H |
| 7 |
|
| 8 |
#include <dtkgui_global.h> |
| 9 |
|
| 10 |
#include <QScopedPointer> |
| 11 |
#include <QIcon> |
| 12 |
|
| 13 |
DGUI_BEGIN_NAMESPACE |
| 14 |
|
| 15 |
namespace DIconTheme |
| 16 |
{ |
| 17 |
enum Option { |
| 18 |
DontFallbackToQIconFromTheme = 1 << 0, |
| 19 |
IgnoreBuiltinIcons = 1 << 1, |
| 20 |
IgnoreDciIcons = 1 << 2, |
| 21 |
IgnoreIconCache = 1 << 3 |
| 22 |
}; |
| 23 |
Q_DECLARE_FLAGS(Options, Option) |
| 24 |
|
| 25 |
class CachedData; |
| 26 |
class Cached { |
| 27 |
CachedData *data = nullptr; |
| 28 |
public: |
| 29 |
Cached(); |
| 30 |
~Cached(); |
| 31 |
|
| 32 |
int maxCost() const; |
| 33 |
void setMaxCost(int cost); |
| 34 |
void clear(); |
| 35 |
|
| 36 |
QIcon findQIcon(const QString &iconName, Options options = Options(), const QIcon &fallback = QIcon()); |
| 37 |
QString findDciIconFile(const QString &iconName, const QString &themeName, const QString &fallback = {}); |
| 38 |
}; |
| 39 |
|
| 40 |
Cached *cached(); |
| 41 |
QIcon findQIcon(const QString &iconName, Options options = Options()); |
| 42 |
QIcon findQIcon(const QString &iconName, const QIcon &fallback, Options options = Options()); |
| 43 |
QIconEngine *createIconEngine(const QString &iconName, Options options = DontFallbackToQIconFromTheme); |
| 44 |
|
| 45 |
QString findDciIconFile(const QString &iconName, const QString &themeName); |
| 46 |
|
| 47 |
QStringList dciThemeSearchPaths(); |
| 48 |
void setDciThemeSearchPaths(const QStringList &path); |
| 49 |
|
| 50 |
bool isBuiltinIcon(const QIcon &icon); |
| 51 |
bool isXdgIcon(const QIcon &icon); |
| 52 |
} |
| 53 |
|
| 54 |
DGUI_END_NAMESPACE |
| 55 |
|
| 56 |
#endif // DICONTHEME_H |