File indexing completed on 2024-05-12 09:32:10

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 #pragma once
0009 
0010 #include <QObject>
0011 #include <QQmlEngine>
0012 #include <QRect>
0013 #include <QString>
0014 
0015 #include <KScreen/Output>
0016 
0017 #include <memory>
0018 
0019 #include "../common/osdaction.h"
0020 
0021 class QQuickView;
0022 
0023 class QTimer;
0024 
0025 namespace KScreen
0026 {
0027 class Osd : public QObject
0028 {
0029     Q_OBJECT
0030 
0031 public:
0032     explicit Osd(const OutputPtr &output, QObject *parent = nullptr);
0033     ~Osd() override;
0034 
0035     void showActionSelector();
0036     void hideOsd();
0037 
0038 Q_SIGNALS:
0039     void osdActionSelected(OsdAction::Action action);
0040 
0041 private Q_SLOTS:
0042     void onOsdActionSelected(int action);
0043     void onOutputAvailabilityChanged();
0044 
0045 private:
0046     KScreen::OutputPtr m_output;
0047     QQmlEngine m_engine;
0048     std::unique_ptr<QQuickView> m_osdActionSelector;
0049     QTimer *m_osdTimer = nullptr;
0050     int m_timeout = 0;
0051 };
0052 
0053 } // ns