Changeset View
Changeset View
Standalone View
Standalone View
src/kcm.h
Show All 21 Lines | |||||
22 | #define _KCM_PLYMOUTH_H | 22 | #define _KCM_PLYMOUTH_H | ||
23 | 23 | | |||
24 | #include <QDir> | 24 | #include <QDir> | ||
25 | 25 | | |||
26 | #include <KNewStuff3/KNS3/DownloadDialog> | 26 | #include <KNewStuff3/KNS3/DownloadDialog> | ||
27 | 27 | | |||
28 | #include <KQuickAddons/ConfigModule> | 28 | #include <KQuickAddons/ConfigModule> | ||
29 | 29 | | |||
30 | class QQuickView; | 30 | class QQuickItem; | ||
31 | class QStandardItemModel; | 31 | class QStandardItemModel; | ||
32 | 32 | | |||
33 | class KCMPlymouth : public KQuickAddons::ConfigModule | 33 | class KCMPlymouth : public KQuickAddons::ConfigModule | ||
34 | { | 34 | { | ||
35 | Q_OBJECT | 35 | Q_OBJECT | ||
36 | Q_PROPERTY(QStandardItemModel *themesModel READ themesModel CONSTANT) | 36 | Q_PROPERTY(QStandardItemModel *themesModel READ themesModel CONSTANT) | ||
37 | Q_PROPERTY(QString selectedPlugin READ selectedPlugin WRITE setSelectedPlugin NOTIFY selectedPluginChanged) | 37 | Q_PROPERTY(QString selectedPlugin READ selectedPlugin WRITE setSelectedPlugin NOTIFY selectedPluginChanged) | ||
38 | Q_PROPERTY(int selectedPluginIndex READ selectedPluginIndex NOTIFY selectedPluginIndexChanged) | ||||
39 | Q_PROPERTY(bool busy READ busy WRITE setBusy NOTIFY busyChanged) | ||||
38 | 40 | | |||
39 | public: | 41 | public: | ||
40 | enum Roles { | 42 | enum Roles { | ||
41 | PluginNameRole = Qt::UserRole +1, | 43 | DescriptionRole = Qt::UserRole + 1, | ||
44 | PluginNameRole, | ||||
42 | ScreenhotRole, | 45 | ScreenhotRole, | ||
43 | UninstallableRole | 46 | UninstallableRole | ||
44 | }; | 47 | }; | ||
45 | explicit KCMPlymouth(QObject* parent, const QVariantList& args); | 48 | explicit KCMPlymouth(QObject* parent, const QVariantList& args); | ||
46 | ~KCMPlymouth() Q_DECL_OVERRIDE; | 49 | ~KCMPlymouth() Q_DECL_OVERRIDE; | ||
47 | 50 | | |||
48 | QStandardItemModel *themesModel(); | 51 | QStandardItemModel *themesModel(); | ||
49 | 52 | | |||
50 | QString selectedPlugin() const; | 53 | QString selectedPlugin() const; | ||
51 | void setSelectedPlugin(const QString &plugin); | 54 | void setSelectedPlugin(const QString &plugin); | ||
52 | 55 | | |||
53 | Q_INVOKABLE int selectedPluginIndex() const; | 56 | int selectedPluginIndex() const; | ||
54 | Q_INVOKABLE void getNewStuff(); | 57 | | ||
58 | bool busy() const; | ||||
59 | void setBusy(const bool &busy); | ||||
60 | | ||||
61 | Q_INVOKABLE void reloadModel(); | ||||
62 | Q_INVOKABLE void getNewStuff(QQuickItem *ctx); | ||||
55 | Q_INVOKABLE void uninstall(const QString &plugin); | 63 | Q_INVOKABLE void uninstall(const QString &plugin); | ||
56 | 64 | | |||
57 | public Q_SLOTS: | 65 | public Q_SLOTS: | ||
58 | void load() Q_DECL_OVERRIDE; | 66 | void load() Q_DECL_OVERRIDE; | ||
59 | void save() Q_DECL_OVERRIDE; | 67 | void save() Q_DECL_OVERRIDE; | ||
60 | void defaults() Q_DECL_OVERRIDE; | 68 | void defaults() Q_DECL_OVERRIDE; | ||
61 | 69 | | |||
62 | Q_SIGNALS: | 70 | Q_SIGNALS: | ||
63 | void selectedPluginChanged(); | 71 | void selectedPluginChanged(); | ||
72 | void selectedPluginIndexChanged(); | ||||
73 | | ||||
74 | void busyChanged(); | ||||
75 | | ||||
76 | void showSuccessMessage(const QString &message); | ||||
77 | void showErrorMessage(const QString &message); | ||||
broulik: I think this should be a property `Q_PROPERTY(bool saving...)` or more generic `busy` like in… | |||||
64 | 78 | | |||
65 | private: | 79 | private: | ||
66 | QStandardItemModel *m_model; | 80 | QStandardItemModel *m_model; | ||
67 | QString m_selectedPlugin; | 81 | QString m_selectedPlugin; | ||
82 | bool m_busy = false; | ||||
68 | QPointer<KNS3::DownloadDialog> m_newStuffDialog; | 83 | QPointer<KNS3::DownloadDialog> m_newStuffDialog; | ||
69 | }; | 84 | }; | ||
70 | 85 | | |||
71 | #endif | 86 | #endif |
I think this should be a property Q_PROPERTY(bool saving...) or more generic busy like in the other KCMs and then proper bindings in the UI