Changeset View
Changeset View
Standalone View
Standalone View
kcms/icons/main.h
Show All 30 Lines | |||||
31 | 31 | | |||
32 | #include <QScopedPointer> | 32 | #include <QScopedPointer> | ||
33 | 33 | | |||
34 | class KIconTheme; | 34 | class KIconTheme; | ||
35 | 35 | | |||
36 | class QQuickItem; | 36 | class QQuickItem; | ||
37 | class QTemporaryFile; | 37 | class QTemporaryFile; | ||
38 | 38 | | |||
39 | namespace KIO | ||||
40 | { | ||||
41 | class FileCopyJob; | ||||
42 | } | ||||
43 | | ||||
39 | class IconsModel; | 44 | class IconsModel; | ||
40 | 45 | | |||
41 | class IconModule : public KQuickAddons::ConfigModule | 46 | class IconModule : public KQuickAddons::ConfigModule | ||
42 | { | 47 | { | ||
43 | Q_OBJECT | 48 | Q_OBJECT | ||
44 | 49 | | |||
45 | Q_PROPERTY(IconsModel *iconsModel READ iconsModel CONSTANT) | 50 | Q_PROPERTY(IconsModel *iconsModel READ iconsModel CONSTANT) | ||
46 | 51 | | |||
47 | Q_PROPERTY(QStringList iconGroups READ iconGroups CONSTANT) | 52 | Q_PROPERTY(QStringList iconGroups READ iconGroups CONSTANT) | ||
48 | 53 | | |||
54 | Q_PROPERTY(bool downloadingFile READ downloadingFile NOTIFY downloadingFileChanged) | ||||
55 | | ||||
49 | public: | 56 | public: | ||
50 | IconModule(QObject *parent, const QVariantList &args); | 57 | IconModule(QObject *parent, const QVariantList &args); | ||
51 | ~IconModule() override; | 58 | ~IconModule() override; | ||
52 | 59 | | |||
53 | enum Roles { | 60 | enum Roles { | ||
54 | ThemeNameRole = Qt::UserRole + 1, | 61 | ThemeNameRole = Qt::UserRole + 1, | ||
55 | DescriptionRole, | 62 | DescriptionRole, | ||
56 | RemovableRole, | 63 | RemovableRole, | ||
57 | PendingDeletionRole | 64 | PendingDeletionRole | ||
58 | }; | 65 | }; | ||
59 | 66 | | |||
60 | IconsModel *iconsModel() const; | 67 | IconsModel *iconsModel() const; | ||
61 | 68 | | |||
62 | QStringList iconGroups() const; | 69 | QStringList iconGroups() const; | ||
63 | 70 | | |||
71 | bool downloadingFile() const; | ||||
72 | | ||||
64 | void load() override; | 73 | void load() override; | ||
65 | void save() override; | 74 | void save() override; | ||
66 | void defaults() override; | 75 | void defaults() override; | ||
67 | 76 | | |||
68 | Q_INVOKABLE void getNewStuff(QQuickItem *ctx); | 77 | Q_INVOKABLE void getNewStuff(QQuickItem *ctx); | ||
69 | Q_INVOKABLE void installThemeFromFile(const QUrl &url); | 78 | Q_INVOKABLE void installThemeFromFile(const QUrl &url); | ||
70 | 79 | | |||
71 | Q_INVOKABLE int iconSize(int group) const; | 80 | Q_INVOKABLE int iconSize(int group) const; | ||
72 | Q_INVOKABLE void setIconSize(int group, int size); | 81 | Q_INVOKABLE void setIconSize(int group, int size); | ||
73 | Q_INVOKABLE QList<int> availableIconSizes(int group) const; | 82 | Q_INVOKABLE QList<int> availableIconSizes(int group) const; | ||
74 | 83 | | |||
75 | // QML doesn't understand QList<QPixmap>, hence wrapped in a QVariantList | 84 | // QML doesn't understand QList<QPixmap>, hence wrapped in a QVariantList | ||
76 | Q_INVOKABLE QVariantList previewIcons(const QString &themeName, int size, qreal dpr, int limit = -1); | 85 | Q_INVOKABLE QVariantList previewIcons(const QString &themeName, int size, qreal dpr, int limit = -1); | ||
77 | 86 | | |||
78 | signals: | 87 | signals: | ||
79 | void iconSizesChanged(); | 88 | void iconSizesChanged(); | ||
89 | void downloadingFileChanged(); | ||||
80 | 90 | | |||
81 | void showSuccessMessage(const QString &message); | 91 | void showSuccessMessage(const QString &message); | ||
82 | void showErrorMessage(const QString &message); | 92 | void showErrorMessage(const QString &message); | ||
83 | 93 | | |||
84 | void showProgress(const QString &message); | 94 | void showProgress(const QString &message); | ||
85 | void hideProgress(); | 95 | void hideProgress(); | ||
86 | 96 | | |||
87 | private: | 97 | private: | ||
Show All 17 Lines | |||||
105 | // set when user hits "Defaults" button at which point we'll remove all custom icon effects on Apply | 115 | // set when user hits "Defaults" button at which point we'll remove all custom icon effects on Apply | ||
106 | bool m_revertIconEffects = false; | 116 | bool m_revertIconEffects = false; | ||
107 | 117 | | |||
108 | QVector<int> m_iconSizes; | 118 | QVector<int> m_iconSizes; | ||
109 | 119 | | |||
110 | QStringList m_iconGroups; | 120 | QStringList m_iconGroups; | ||
111 | 121 | | |||
112 | QScopedPointer<QTemporaryFile> m_tempInstallFile; | 122 | QScopedPointer<QTemporaryFile> m_tempInstallFile; | ||
123 | QPointer<KIO::FileCopyJob> m_tempCopyJob; | ||||
113 | 124 | | |||
114 | QPointer<KNS3::DownloadDialog> m_newStuffDialog; | 125 | QPointer<KNS3::DownloadDialog> m_newStuffDialog; | ||
115 | 126 | | |||
116 | }; | 127 | }; |