File indexing completed on 2024-04-28 16:54:48

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 
0028 protected:
0029     void resizeEvent(QResizeEvent *ev) override;
0030     void mouseReleaseEvent(QMouseEvent *ev) override;
0031     void moveEvent(QMoveEvent *ev) override;
0032     void hideEvent(QHideEvent *ev) override;
0033     void keyPressEvent(QKeyEvent *ev) override;
0034 
0035 protected Q_SLOTS:
0036     void showConfigurationInterface(Plasma::Applet *applet);
0037     void minimumWidthChanged();
0038     void minimumHeightChanged();
0039     void maximumWidthChanged();
0040     void maximumHeightChanged();
0041 
0042 private:
0043     void updateSniIcon();
0044     void updateSniTitle();
0045     void updateSniStatus();
0046 
0047     Plasma::Applet *m_applet;
0048     QPointer<QObject> m_layout;
0049     QPointer<PlasmaQuick::ConfigView> m_configView;
0050     QPointer<QQuickItem> m_rootObject;
0051     QPointer<QQuickItem> m_appletInterface;
0052     QPointer<KStatusNotifierItem> m_statusNotifier;
0053     bool m_withStatusNotifier;
0054 };