File indexing completed on 2024-04-28 05:35:49

0001 /*
0002     SPDX-FileCopyrightText: 2014 Bhushan Shah <bhush94@gmail.com>
0003     SPDX-FileCopyrightText: 2014 Marco Martin <notmart@gmail.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006 */
0007 
0008 #pragma once
0009 
0010 #include "plasmawindowedcorona.h"
0011 #include <PlasmaQuick/ConfigView>
0012 #include <QPointer>
0013 #include <QQuickView>
0014 
0015 class KStatusNotifierItem;
0016 
0017 class PlasmaWindowedView : public QQuickView
0018 {
0019     Q_OBJECT
0020 
0021 public:
0022     explicit PlasmaWindowedView(QWindow *parent = nullptr);
0023     ~PlasmaWindowedView() override;
0024 
0025     void setApplet(Plasma::Applet *applet);
0026     void setHasStatusNotifier(bool stay);
0027     void showConfigurationInterface();
0028 
0029 protected:
0030     void resizeEvent(QResizeEvent *ev) override;
0031     void mouseReleaseEvent(QMouseEvent *ev) override;
0032     void moveEvent(QMoveEvent *ev) override;
0033     void hideEvent(QHideEvent *ev) override;
0034     void keyPressEvent(QKeyEvent *ev) override;
0035 
0036 protected Q_SLOTS:
0037     void showConfigurationInterface(Plasma::Applet *applet);
0038     void minimumWidthChanged();
0039     void minimumHeightChanged();
0040     void maximumWidthChanged();
0041     void maximumHeightChanged();
0042 
0043 private:
0044     void updateSniIcon();
0045     void updateSniTitle();
0046     void updateSniStatus();
0047 
0048     Plasma::Applet *m_applet;
0049     QPointer<QObject> m_layout;
0050     QPointer<PlasmaQuick::ConfigView> m_configView;
0051     QPointer<QQuickItem> m_rootObject;
0052     QPointer<QQuickItem> m_appletInterface;
0053     QPointer<KStatusNotifierItem> m_statusNotifier;
0054     bool m_withStatusNotifier;
0055 };