Changeset View
Changeset View
Standalone View
Standalone View
kcms/ksplash/kcm.h
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | Copyright (c) 2014 Marco Martin <mart@kde.org> | 2 | Copyright (c) 2014 Marco Martin <mart@kde.org> | ||
3 | Copyright (c) 2014 Vishesh Handa <me@vhanda.in> | 3 | Copyright (c) 2014 Vishesh Handa <me@vhanda.in> | ||
4 | Copyright (c) 2019 Cyril Rossi <cyril.rossi@enioka.com> | ||||
4 | 5 | | |||
5 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public | ||
7 | License version 2 as published by the Free Software Foundation. | 8 | License version 2 as published by the Free Software Foundation. | ||
8 | 9 | | |||
9 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | Library General Public License for more details. | 13 | Library General Public License for more details. | ||
13 | 14 | | |||
14 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License | ||
15 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to | ||
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
17 | Boston, MA 02110-1301, USA. | 18 | Boston, MA 02110-1301, USA. | ||
18 | */ | 19 | */ | ||
19 | 20 | | |||
20 | #ifndef _KCM_SEARCH_H | 21 | #ifndef _KCM_SEARCH_H | ||
21 | #define _KCM_SEARCH_H | 22 | #define _KCM_SEARCH_H | ||
22 | 23 | | |||
23 | #include <KConfig> | | |||
24 | #include <KConfigGroup> | | |||
25 | | ||||
26 | #include <Plasma/Package> | 24 | #include <Plasma/Package> | ||
27 | #include <KQuickAddons/ConfigModule> | 25 | #include <KQuickAddons/ConfigModule> | ||
28 | 26 | | |||
29 | class QStandardItemModel; | 27 | class QStandardItemModel; | ||
28 | class SplashScreenSettings; | ||||
30 | 29 | | |||
31 | class KCMSplashScreen : public KQuickAddons::ConfigModule | 30 | class KCMSplashScreen : public KQuickAddons::ConfigModule | ||
32 | { | 31 | { | ||
33 | Q_OBJECT | 32 | Q_OBJECT | ||
33 | Q_PROPERTY(SplashScreenSettings *splashScreenSettings READ splashScreenSettings CONSTANT) | ||||
34 | Q_PROPERTY(QStandardItemModel *splashModel READ splashModel CONSTANT) | 34 | Q_PROPERTY(QStandardItemModel *splashModel READ splashModel CONSTANT) | ||
35 | Q_PROPERTY(QString selectedPlugin READ selectedPlugin WRITE setSelectedPlugin NOTIFY selectedPluginChanged) | | |||
36 | Q_PROPERTY(int selectedPluginIndex READ selectedPluginIndex NOTIFY selectedPluginIndexChanged) | | |||
37 | Q_PROPERTY(bool testing READ testing NOTIFY testingChanged) | 35 | Q_PROPERTY(bool testing READ testing NOTIFY testingChanged) | ||
38 | 36 | | |||
39 | public: | 37 | public: | ||
40 | enum Roles { | 38 | enum Roles { | ||
41 | PluginNameRole = Qt::UserRole +1, | 39 | PluginNameRole = Qt::UserRole +1, | ||
42 | ScreenshotRole, | 40 | ScreenshotRole, | ||
43 | DescriptionRole | 41 | DescriptionRole | ||
44 | }; | 42 | }; | ||
45 | KCMSplashScreen(QObject* parent, const QVariantList& args); | | |||
46 | 43 | | |||
47 | QList<Plasma::Package> availablePackages(const QString &component); | 44 | KCMSplashScreen(QObject* parent, const QVariantList& args); | ||
48 | 45 | | |||
46 | SplashScreenSettings *splashScreenSettings() const; | ||||
49 | QStandardItemModel *splashModel() const; | 47 | QStandardItemModel *splashModel() const; | ||
50 | | ||||
51 | QString selectedPlugin() const; | | |||
52 | void setSelectedPlugin(const QString &plugin); | | |||
53 | | ||||
54 | int selectedPluginIndex() const; | | |||
55 | | ||||
56 | bool testing() const; | 48 | bool testing() const; | ||
57 | 49 | | |||
58 | void loadModel(); | 50 | Q_INVOKABLE int pluginIndex(const QString &pluginName) const; | ||
59 | 51 | | |||
60 | public Q_SLOTS: | 52 | public Q_SLOTS: | ||
61 | void getNewClicked(); | 53 | void getNewClicked(); | ||
62 | void load() override; | 54 | void load() override; | ||
63 | void save() override; | 55 | void save() override; | ||
64 | void defaults() override; | 56 | void defaults() override; | ||
65 | void test(const QString &plugin); | 57 | void test(const QString &plugin); | ||
66 | 58 | | |||
67 | Q_SIGNALS: | 59 | Q_SIGNALS: | ||
68 | void selectedPluginChanged(); | | |||
69 | void selectedPluginIndexChanged(); | | |||
70 | | ||||
71 | void testingChanged(); | 60 | void testingChanged(); | ||
72 | void testingFailed(); | 61 | void testingFailed(); | ||
73 | 62 | | |||
74 | private: | 63 | private: | ||
64 | void loadModel(); | ||||
65 | QList<Plasma::Package> availablePackages(const QString &component); | ||||
66 | | ||||
67 | SplashScreenSettings *m_settings; | ||||
75 | QStandardItemModel *m_model; | 68 | QStandardItemModel *m_model; | ||
76 | Plasma::Package m_package; | | |||
77 | QString m_selectedPlugin; | | |||
78 | 69 | | |||
79 | QProcess *m_testProcess = nullptr; | 70 | QProcess *m_testProcess = nullptr; | ||
80 | | ||||
81 | KConfig m_config; | | |||
82 | KConfigGroup m_configGroup; | | |||
83 | }; | 71 | }; | ||
84 | 72 | | |||
85 | #endif | 73 | #endif |