Debian Codegraph @

src/librssguard/miscellaneous/iconfactory.h

raw symbols SCIP
1 // For license of this file, see <project-root-folder>/LICENSE.md.
2
3 #ifndef ICONFACTORY_H
4 #define ICONFACTORY_H
5
6 #include "definitions/definitions.h"
7 #include "miscellaneous/application.h"
8
9 #include <QDir>
10 #include <QHash>
11 #include <QIcon>
12 #include <QObject>
13 #include <QString>
14
15 class RSSGUARD_DLLSPEC IconFactory : public QObject {
16 Q_OBJECT
17
18 public:
19 explicit IconFactory(QObject* parent = nullptr);
20 virtual ~IconFactory();
21
22 // Generates round icon of given color.
23 static QIcon generateIcon(const QColor& color);
24
25 // Used to store/retrieve QIcons from/to Base64-encoded
26 // byte array.
27 static QIcon fromByteArray(QByteArray array);
28 static QByteArray toByteArray(const QIcon& icon);
29
30 // Returns icon from active theme or invalid icon if
31 // "no icon theme" is set.
32 QIcon fromTheme(const QString& name, const QString& fallback = {});
33
34 QPixmap miscPixmap(const QString& name);
35 QIcon miscIcon(const QString& name);
36
37 // Adds custom application path to be search for icons.
38 void setupSearchPaths();
39
40 // Returns list of installed themes, including "default" theme.
41 QStringList installedIconThemes() const;
42
43 // Loads name of selected icon theme (from settings) for the application and
44 // activates it. If that particular theme is not installed, then
45 // "default" theme is loaded.
46 void loadCurrentIconTheme();
47
48 // Returns name of currently activated theme for the application.
49 QString currentIconTheme() const;
50
51 // Sets icon theme with given name as the active one and loads it.
52 void setCurrentIconTheme(const QString& theme_name);
53 };
54
55 #endif // ICONFACTORY_H