File indexing completed on 2024-05-12 17:08:53

0001 /*
0002     SPDX-FileCopyrightText: 2019 Marco Martin <mart@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "itemcontainer.h"
0010 
0011 #include <QPointer>
0012 #include <QQmlParserStatus>
0013 
0014 namespace PlasmaQuick
0015 {
0016 class AppletQuickItem;
0017 }
0018 
0019 class AppletContainer : public ItemContainer
0020 {
0021     Q_OBJECT
0022     Q_INTERFACES(QQmlParserStatus)
0023 
0024     Q_PROPERTY(PlasmaQuick::AppletQuickItem *applet READ applet NOTIFY appletChanged)
0025 
0026     Q_PROPERTY(QQmlComponent *busyIndicatorComponent READ busyIndicatorComponent WRITE setBusyIndicatorComponent NOTIFY busyIndicatorComponentChanged)
0027 
0028     Q_PROPERTY(QQmlComponent *configurationRequiredComponent READ configurationRequiredComponent WRITE setConfigurationRequiredComponent NOTIFY
0029                    configurationRequiredComponentChanged)
0030 
0031 public:
0032     AppletContainer(QQuickItem *parent = nullptr);
0033     ~AppletContainer();
0034 
0035     PlasmaQuick::AppletQuickItem *applet();
0036 
0037     QQmlComponent *busyIndicatorComponent() const;
0038     void setBusyIndicatorComponent(QQmlComponent *comp);
0039 
0040     QQmlComponent *configurationRequiredComponent() const;
0041     void setConfigurationRequiredComponent(QQmlComponent *comp);
0042 
0043 protected:
0044     void componentComplete() override;
0045 
0046 Q_SIGNALS:
0047     void appletChanged();
0048     void busyIndicatorComponentChanged();
0049     void configurationRequiredComponentChanged();
0050 
0051 private:
0052     void connectBusyIndicator();
0053     void connectConfigurationRequired();
0054 
0055     QPointer<PlasmaQuick::AppletQuickItem> m_appletItem;
0056     QPointer<QQmlComponent> m_busyIndicatorComponent;
0057     QQuickItem *m_busyIndicatorItem = nullptr;
0058     QPointer<QQmlComponent> m_configurationRequiredComponent;
0059     QQuickItem *m_configurationRequiredItem = nullptr;
0060 };