File indexing completed on 2024-04-28 13:25:59

0001 /*
0002     SPDX-FileCopyrightText: 2016 Smith AR <audoban@openmailbox.org>
0003     SPDX-FileCopyrightText: 2016 Michail Vourlakos <mvourlakos@gmail.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef INFOVIEW_H
0009 #define INFOVIEW_H
0010 
0011 // local
0012 #include "lattecorona.h"
0013 #include "wm/windowinfowrap.h"
0014 
0015 // Qt
0016 #include <QObject>
0017 #include <QQuickView>
0018 #include <QScreen>
0019 
0020 namespace KWayland {
0021 namespace Client {
0022 class PlasmaShellSurface;
0023 }
0024 }
0025 
0026 namespace Latte {
0027 
0028 class InfoView : public QQuickView
0029 {
0030     Q_OBJECT
0031 
0032     Q_PROPERTY(Plasma::FrameSvg::EnabledBorders enabledBorders READ enabledBorders NOTIFY enabledBordersChanged)
0033 
0034 public:
0035     InfoView(Latte::Corona *corona, QString message, QScreen *screen, QWindow *parent = nullptr);
0036     ~InfoView() override;
0037 
0038     QString validTitle() const;
0039 
0040     Plasma::FrameSvg::EnabledBorders enabledBorders() const;
0041 
0042     void init();
0043     Qt::WindowFlags wFlags() const;
0044 
0045     void setOnActivities(QStringList activities = {"0"});
0046 
0047 public slots:
0048     Q_INVOKABLE void syncGeometry();
0049 
0050 signals:
0051     void enabledBordersChanged();
0052 
0053 protected:
0054     void showEvent(QShowEvent *ev) override;
0055     bool event(QEvent *e) override;
0056 
0057 private slots:
0058     void setupWaylandIntegration();
0059     void updateWaylandId();
0060 
0061 private:
0062     QString m_id;
0063 
0064     QString m_message;
0065 
0066     QScreen *m_screen{nullptr};
0067 
0068     Plasma::FrameSvg::EnabledBorders m_borders{Plasma::FrameSvg::TopBorder | Plasma::FrameSvg::BottomBorder};
0069 
0070     Latte::WindowSystem::WindowId m_trackedWindowId;
0071     KWayland::Client::PlasmaShellSurface *m_shellSurface{nullptr};
0072 
0073     Latte::Corona *m_corona{nullptr};
0074 };
0075 
0076 }
0077 #endif //INFOVIEW_H