kcm.h 2.09 KB
Newer Older
1
2
3
/*
   Copyright (c) 2014 Marco Martin <mart@kde.org>
   Copyright (c) 2014 Vishesh Handa <me@vhanda.in>
4
   Copyright (c) 2019 Cyril Rossi <cyril.rossi@enioka.com>
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License version 2 as published by the Free Software Foundation.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#ifndef _KCM_SEARCH_H
#define _KCM_SEARCH_H

24
#include <KPackage/Package>
25
#include <KQuickAddons/ManagedConfigModule>
26
27

class QStandardItemModel;
28
class SplashScreenSettings;
29

30
class KCMSplashScreen : public KQuickAddons::ManagedConfigModule
31
32
{
    Q_OBJECT
33
    Q_PROPERTY(SplashScreenSettings *splashScreenSettings READ splashScreenSettings CONSTANT)
34
    Q_PROPERTY(QStandardItemModel *splashModel READ splashModel CONSTANT)
35
    Q_PROPERTY(bool testing READ testing NOTIFY testingChanged)
36
37
38
39

public:
    enum Roles {
        PluginNameRole = Qt::UserRole +1,
40
        ScreenshotRole,
41
        DescriptionRole
42
43
    };

44
    KCMSplashScreen(QObject* parent, const QVariantList& args);
45

46
    SplashScreenSettings *splashScreenSettings() const;
47
    QStandardItemModel *splashModel() const;
48
49
    bool testing() const;

50
    Q_INVOKABLE int pluginIndex(const QString &pluginName) const;
51

52
public Q_SLOTS:
53
    void getNewClicked();
54
    void save() override;
55
56
57
    void test(const QString &plugin);

Q_SIGNALS:
58
59
60
    void testingChanged();
    void testingFailed();

61
private:
62
    void loadModel();
63
    QList<KPackage::Package> availablePackages(const QString &component);
64
65

    SplashScreenSettings *m_settings;
66
67
    QStandardItemModel *m_model;

68
    QProcess *m_testProcess = nullptr;
69
70
71
};

#endif