File indexing completed on 2024-04-14 15:37:27

0001 /*
0002 *  Copyright 2016  Smith AR <audoban@openmailbox.org>
0003 *                  Michail Vourlakos <mvourlakos@gmail.com>
0004 *
0005 *  This file is part of Latte-Dock
0006 *
0007 *  Latte-Dock is free software; you can redistribute it and/or
0008 *  modify it under the terms of the GNU General Public License as
0009 *  published by the Free Software Foundation; either version 2 of
0010 *  the License, or (at your option) any later version.
0011 *
0012 *  Latte-Dock is distributed in the hope that it will be useful,
0013 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0014 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0015 *  GNU General Public License for more details.
0016 *
0017 *  You should have received a copy of the GNU General Public License
0018 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
0019 */
0020 
0021 #ifndef INFOVIEW_H
0022 #define INFOVIEW_H
0023 
0024 // local
0025 #include "lattecorona.h"
0026 
0027 // Qt
0028 #include <QObject>
0029 #include <QQuickView>
0030 #include <QScreen>
0031 
0032 namespace KWayland {
0033 namespace Client {
0034 class PlasmaShellSurface;
0035 }
0036 }
0037 
0038 namespace Latte {
0039 
0040 class InfoView : public QQuickView
0041 {
0042     Q_OBJECT
0043 
0044     Q_PROPERTY(Plasma::FrameSvg::EnabledBorders enabledBorders READ enabledBorders NOTIFY enabledBordersChanged)
0045 
0046 public:
0047     InfoView(Latte::Corona *corona, QString message, QScreen *screen = qGuiApp->primaryScreen(), QWindow *parent = nullptr);
0048     ~InfoView() override;
0049 
0050     Plasma::FrameSvg::EnabledBorders enabledBorders() const;
0051 
0052     void init();
0053     Qt::WindowFlags wFlags() const;
0054 
0055     void setOnActivities(QStringList activities = {"0"});
0056 
0057 public slots:
0058     Q_INVOKABLE void syncGeometry();
0059 
0060 signals:
0061     void enabledBordersChanged();
0062 
0063 protected:
0064     void showEvent(QShowEvent *ev) override;
0065     bool event(QEvent *e) override;
0066 
0067 private:
0068     void setupWaylandIntegration();
0069 
0070 private:
0071     QString m_message;
0072 
0073     QScreen *m_screen{nullptr};
0074 
0075     Plasma::FrameSvg::EnabledBorders m_borders{Plasma::FrameSvg::TopBorder | Plasma::FrameSvg::BottomBorder};
0076 
0077     KWayland::Client::PlasmaShellSurface *m_shellSurface{nullptr};
0078 
0079     Latte::Corona *m_corona{nullptr};
0080 };
0081 
0082 }
0083 #endif //INFOVIEW_H