1 /*
2     SPDX-FileCopyrightText: 2014 Bhushan Shah <bhush94@gmail.com>
3     SPDX-FileCopyrightText: 2014 Marco Martin <notmart@gmail.com>
4 
5     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
6 */
7 
8 #pragma once
9 
10 #include "plasmawindowedcorona.h"
11 #include <PlasmaQuick/ConfigView>
12 #include <QPointer>
13 #include <QQuickView>
14 
15 class KStatusNotifierItem;
16 
17 class PlasmaWindowedView : public QQuickView
18 {
19     Q_OBJECT
20 
21 public:
22     explicit PlasmaWindowedView(QWindow *parent = nullptr);
23     ~PlasmaWindowedView() override;
24 
25     void setApplet(Plasma::Applet *applet);
26     void setHasStatusNotifier(bool stay);
27 
28 protected:
29     void resizeEvent(QResizeEvent *ev) override;
30     void mouseReleaseEvent(QMouseEvent *ev) override;
31     void moveEvent(QMoveEvent *ev) override;
32     void hideEvent(QHideEvent *ev) override;
33     void keyPressEvent(QKeyEvent *ev) override;
34 
35 protected Q_SLOTS:
36     void showConfigurationInterface(Plasma::Applet *applet);
37     void minimumWidthChanged();
38     void minimumHeightChanged();
39     void maximumWidthChanged();
40     void maximumHeightChanged();
41 
42 private:
43     void updateSniIcon();
44     void updateSniTitle();
45     void updateSniStatus();
46 
47     Plasma::Applet *m_applet;
48     QPointer<QObject> m_layout;
49     QPointer<PlasmaQuick::ConfigView> m_configView;
50     QPointer<QQuickItem> m_rootObject;
51     QPointer<QQuickItem> m_appletInterface;
52     QPointer<KStatusNotifierItem> m_statusNotifier;
53     bool m_withStatusNotifier;
54 };
55