Changeset View
Changeset View
Standalone View
Standalone View
cuttlefish/src/iconmodel.h
Show All 34 Lines | |||||
35 | 35 | | |||
36 | 36 | | |||
37 | class IconModel : public QAbstractListModel | 37 | class IconModel : public QAbstractListModel | ||
38 | { | 38 | { | ||
39 | Q_OBJECT | 39 | Q_OBJECT | ||
40 | 40 | | |||
41 | Q_PROPERTY(QString filter READ filter WRITE setFilter NOTIFY filterChanged) | 41 | Q_PROPERTY(QString filter READ filter WRITE setFilter NOTIFY filterChanged) | ||
42 | Q_PROPERTY(QString category READ category WRITE setCategory NOTIFY categoryChanged) | 42 | Q_PROPERTY(QString category READ category WRITE setCategory NOTIFY categoryChanged) | ||
43 | Q_PROPERTY(QString theme READ theme WRITE setTheme NOTIFY themeChanged) | | |||
44 | Q_PROPERTY(QStringList themes READ themes CONSTANT) | | |||
45 | Q_PROPERTY(QStringList plasmathemes READ plasmathemes CONSTANT) | | |||
46 | Q_PROPERTY(QStringList categories READ categories NOTIFY categoriesChanged) | 43 | Q_PROPERTY(QStringList categories READ categories NOTIFY categoriesChanged) | ||
47 | Q_PROPERTY(QString plasmaTheme READ plasmaTheme WRITE setPlasmaTheme NOTIFY plasmaThemeChanged) | | |||
48 | Q_PROPERTY(bool loading READ loading NOTIFY loadingChanged); | 44 | Q_PROPERTY(bool loading READ loading NOTIFY loadingChanged); | ||
49 | 45 | | |||
50 | public: | 46 | public: | ||
51 | enum Roles { | 47 | enum Roles { | ||
52 | FileName = Qt::UserRole + 1, | 48 | FileName = Qt::UserRole + 1, | ||
53 | IconName, | 49 | IconName, | ||
54 | Icon, | 50 | Icon, | ||
55 | FullPath, | 51 | FullPath, | ||
Show All 11 Lines | |||||
67 | QHash<int, QByteArray> roleNames() const override; | 63 | QHash<int, QByteArray> roleNames() const override; | ||
68 | int rowCount(const QModelIndex &parent) const override; | 64 | int rowCount(const QModelIndex &parent) const override; | ||
69 | QVariant data(const QModelIndex &index, int role) const override; | 65 | QVariant data(const QModelIndex &index, int role) const override; | ||
70 | 66 | | |||
71 | QString key(int role) const; | 67 | QString key(int role) const; | ||
72 | 68 | | |||
73 | bool matchIcons(const QFileInfo &info); | 69 | bool matchIcons(const QFileInfo &info); | ||
74 | void add(const QFileInfo &info, const QString &cat); | 70 | void add(const QFileInfo &info, const QString &cat); | ||
75 | void addSvgIcon(const QString &file, const QString &icon); | | |||
76 | void remove(const QString &iconFile); | 71 | void remove(const QString &iconFile); | ||
77 | 72 | | |||
78 | void setCategory(const QString &cat); | 73 | void setCategory(const QString &cat); | ||
79 | QString category() const; | 74 | QString category() const; | ||
80 | 75 | | |||
81 | void setFilter(const QString &filter); | 76 | void setFilter(const QString &filter); | ||
82 | QString filter() const; | 77 | QString filter() const; | ||
83 | 78 | | |||
84 | void setTheme(const QString &theme); | | |||
85 | QString theme() const; | | |||
86 | QStringList themes() const; | | |||
87 | | ||||
88 | void setPlasmaTheme(const QString &ptheme); | | |||
89 | QString plasmaTheme() const; | | |||
90 | QStringList plasmathemes() const; | | |||
91 | QStringList categories() const; | 79 | QStringList categories() const; | ||
92 | QAbstractItemModel* colorschemes() const; | 80 | QAbstractItemModel* colorschemes() const; | ||
93 | 81 | | |||
94 | bool loading(); | 82 | bool loading(); | ||
95 | 83 | | |||
96 | void svgIcons(); | | |||
97 | | ||||
98 | void load(); | 84 | void load(); | ||
99 | 85 | | |||
100 | Q_INVOKABLE void output(const QString &text); | 86 | Q_INVOKABLE void output(const QString &text); | ||
101 | Q_INVOKABLE void sort(); | 87 | Q_INVOKABLE void sort(); | ||
102 | 88 | | |||
103 | 89 | | |||
104 | Q_SIGNALS: | 90 | Q_SIGNALS: | ||
105 | void filterChanged(); | 91 | void filterChanged(); | ||
106 | void categoryChanged(); | 92 | void categoryChanged(); | ||
107 | void categoriesChanged(); | 93 | void categoriesChanged(); | ||
108 | void themeChanged(); | | |||
109 | void svgIconsChanged(); | | |||
110 | void plasmaThemeChanged(); | | |||
111 | void loadingChanged(); | 94 | void loadingChanged(); | ||
112 | 95 | | |||
113 | private: | 96 | private: | ||
114 | QHash<int, QByteArray> m_roleNames; | 97 | QHash<int, QByteArray> m_roleNames; | ||
115 | 98 | | |||
116 | QStringList m_icons; | 99 | QStringList m_icons; | ||
117 | QString m_category; | 100 | QString m_category; | ||
118 | QStringList m_categories; | 101 | QStringList m_categories; | ||
119 | QString m_theme; | | |||
120 | QString m_filter; | 102 | QString m_filter; | ||
121 | QStringList m_themes; | | |||
122 | QStringList m_plasmathemes; | | |||
123 | QString m_plasmatheme; | | |||
124 | QHash<QString, QVariantMap> m_data; | 103 | QHash<QString, QVariantMap> m_data; | ||
125 | QHash<QString, QString> m_categoryTranslations; | 104 | QHash<QString, QString> m_categoryTranslations; | ||
126 | QVariantMap m_svgIcons; | | |||
127 | 105 | | |||
128 | bool m_loading; | 106 | bool m_loading; | ||
129 | QString categoryFromPath(const QString &path); | 107 | QString categoryFromPath(const QString &path); | ||
130 | }; | 108 | }; | ||
131 | 109 | | |||
132 | } // namespace | 110 | } // namespace | ||
133 | 111 | | |||
134 | #endif // CUTTLEFISHICONMODEL_H | 112 | #endif // CUTTLEFISHICONMODEL_H |