Changeset View
Changeset View
Standalone View
Standalone View
components/containmentlayoutmanager/appletcontainer.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2019 by Marco Martin <mart@kde.org> | ||||
3 | * | ||||
4 | * This program is free software; you can redistribute it and/or modify | ||||
5 | * it under the terms of the GNU Library General Public License as | ||||
6 | * published by the Free Software Foundation; either version 2, or | ||||
7 | * (at your option) any later version. | ||||
8 | * | ||||
9 | * This program is distributed in the hope that it will be useful, | ||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
12 | * GNU Library General Public License for more details | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU Library General Public | ||||
15 | * License along with this program; if not, write to the | ||||
16 | * Free Software Foundation, Inc., | ||||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
18 | * | ||||
19 | */ | ||||
20 | | ||||
21 | #pragma once | ||||
22 | | ||||
23 | #include "itemcontainer.h" | ||||
24 | | ||||
25 | #include <QQmlParserStatus> | ||||
26 | #include <QPointer> | ||||
27 | | ||||
28 | | ||||
29 | namespace PlasmaQuick { | ||||
30 | class AppletQuickItem; | ||||
31 | } | ||||
32 | | ||||
33 | class AppletContainer: public ItemContainer | ||||
34 | { | ||||
35 | Q_OBJECT | ||||
36 | Q_INTERFACES(QQmlParserStatus) | ||||
37 | | ||||
38 | Q_PROPERTY(PlasmaQuick::AppletQuickItem *applet READ applet NOTIFY appletChanged) | ||||
39 | | ||||
40 | Q_PROPERTY(QQmlComponent *busyIndicatorComponent READ busyIndicatorComponent WRITE setBusyIndicatorComponent NOTIFY busyIndicatorComponentChanged) | ||||
41 | | ||||
42 | public: | ||||
43 | AppletContainer(QQuickItem *parent = nullptr); | ||||
44 | ~AppletContainer(); | ||||
45 | | ||||
46 | PlasmaQuick::AppletQuickItem *applet(); | ||||
47 | | ||||
48 | QQmlComponent *busyIndicatorComponent() const; | ||||
49 | void setBusyIndicatorComponent(QQmlComponent *comp); | ||||
50 | | ||||
51 | protected: | ||||
52 | void componentComplete() override; | ||||
53 | | ||||
54 | Q_SIGNALS: | ||||
55 | void appletChanged(); | ||||
56 | void busyIndicatorComponentChanged(); | ||||
57 | | ||||
58 | private: | ||||
59 | void connectBusyIndicator(); | ||||
60 | | ||||
61 | QPointer<PlasmaQuick::AppletQuickItem> m_appletItem; | ||||
62 | QPointer<QQmlComponent> m_busyIndicatorComponent; | ||||
63 | QQuickItem *m_busyIndicatorItem = nullptr; | ||||
64 | }; | ||||
65 | |