Changeset View
Changeset View
Standalone View
Standalone View
krusader/icon.h
- This file was moved from krusader/kicons.cpp.
1 | /***************************************************************************** | 1 | /***************************************************************************** | ||
---|---|---|---|---|---|
2 | * Copyright (C) 2000 Shie Erlich <erlich@users.sourceforge.net> * | 2 | * Copyright (C) 2018 Nikita Melnichenko <nikita+kde@melnichenko.name> * | ||
3 | * Copyright (C) 2000 Rafi Yanai <yanai@users.sourceforge.net> * | 3 | * Copyright (C) 2018 Krusader Krew [https://krusader.org] * | ||
4 | * Copyright (C) 2004-2018 Krusader Krew [https://krusader.org] * | | |||
5 | * * | 4 | * * | ||
6 | * This file is part of Krusader [https://krusader.org]. * | 5 | * This file is part of Krusader [https://krusader.org]. * | ||
7 | * * | 6 | * * | ||
8 | * Krusader is free software: you can redistribute it and/or modify * | 7 | * Krusader is free software: you can redistribute it and/or modify * | ||
9 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * | ||
10 | * the Free Software Foundation, either version 2 of the License, or * | 9 | * the Free Software Foundation, either version 2 of the License, or * | ||
11 | * (at your option) any later version. * | 10 | * (at your option) any later version. * | ||
12 | * * | 11 | * * | ||
13 | * Krusader is distributed in the hope that it will be useful, * | 12 | * Krusader is distributed in the hope that it will be useful, * | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
16 | * GNU General Public License for more details. * | 15 | * GNU General Public License for more details. * | ||
17 | * * | 16 | * * | ||
18 | * You should have received a copy of the GNU General Public License * | 17 | * You should have received a copy of the GNU General Public License * | ||
19 | * along with Krusader. If not, see [http://www.gnu.org/licenses/]. * | 18 | * along with Krusader. If not, see [http://www.gnu.org/licenses/]. * | ||
20 | *****************************************************************************/ | 19 | *****************************************************************************/ | ||
21 | 20 | | |||
22 | #include "kicons.h" | 21 | #ifndef ICON_H | ||
23 | #include "krglobal.h" | 22 | #define ICON_H | ||
24 | #include "defaults.h" | | |||
25 | 23 | | |||
26 | // QtCore | | |||
27 | #include <QString> | | |||
28 | // QtGui | 24 | // QtGui | ||
29 | #include <QPixmap> | 25 | #include <QIcon> | ||
30 | // QtWidgets | 26 | #include <QIconEngine> | ||
31 | #include <QStyle> | | |||
32 | 27 | | |||
33 | #include <KConfigCore/KSharedConfig> | 28 | /** | ||
34 | #include <KIconThemes/KIconLoader> | 29 | * @class Icon | ||
35 | 30 | * | |||
36 | QPixmap FL_LOADICON(QString name) | 31 | * Universal icon class for Krusader. | ||
32 | * | ||||
33 | * There is a list of configured themes that Icon searches in. | ||||
34 | * The order of themes is the following: active theme, theme specified by user, | ||||
35 | * fallback themes that provide complete icon set for Krusader. | ||||
36 | * If icon is not found in any configured theme, the fallback icon is used. | ||||
37 | */ | ||||
38 | class Icon : public QIcon | ||||
37 | { | 39 | { | ||
38 | KConfigGroup group(krConfig, "Look&Feel"); | 40 | public: | ||
39 | int size = (group.readEntry("Filelist Icon Size", _FilelistIconSize)).toInt(); | 41 | Icon(); | ||
40 | return krLoader->loadIcon(name, KIconLoader::Desktop, size); | 42 | explicit Icon(QString name); | ||
41 | } | 43 | | ||
44 | /// Check if icon exists in any configured theme | ||||
45 | static bool exists(QString iconName); | ||||
46 | }; | ||||
47 | | ||||
48 | #endif // ICON_H |