File indexing completed on 2024-04-28 16:45:09
0001 /* 0002 SPDX-FileCopyrightText: 2014 Martin Klapetek <mklapetek@kde.org> 0003 SPDX-FileCopyrightText: 2016 Sebastian Kügler <sebas@kde.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef KSCREEN_OSD_H 0009 #define KSCREEN_OSD_H 0010 0011 #include <QObject> 0012 #include <QQmlEngine> 0013 #include <QRect> 0014 #include <QString> 0015 0016 #include <KScreen/Output> 0017 0018 #include <memory> 0019 0020 #include "../common/osdaction.h" 0021 0022 namespace KDeclarative 0023 { 0024 class QmlObject; 0025 } 0026 0027 class QQuickView; 0028 0029 class QTimer; 0030 0031 namespace KScreen 0032 { 0033 class Osd : public QObject 0034 { 0035 Q_OBJECT 0036 0037 public: 0038 explicit Osd(const OutputPtr &output, QObject *parent = nullptr); 0039 ~Osd() override; 0040 0041 void showActionSelector(); 0042 void hideOsd(); 0043 0044 Q_SIGNALS: 0045 void osdActionSelected(OsdAction::Action action); 0046 0047 private Q_SLOTS: 0048 void onOsdActionSelected(int action); 0049 void onOutputAvailabilityChanged(); 0050 0051 private: 0052 KScreen::OutputPtr m_output; 0053 QQmlEngine m_engine; 0054 std::unique_ptr<QQuickView> m_osdActionSelector; 0055 QTimer *m_osdTimer = nullptr; 0056 int m_timeout = 0; 0057 }; 0058 0059 } // ns 0060 0061 #endif // KSCREEN_OSD_H