KWin
Loading...
Searching...
No Matches
onscreennotification.h
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2016 Martin Graesslin <mgraesslin@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
5
6*/
7
8#pragma once
9
10#include <KSharedConfig>
11#include <QObject>
12#include <memory>
13
14class QPropertyAnimation;
15class QTimer;
16class QQmlContext;
17class QQmlComponent;
18class QQmlEngine;
19
20namespace KWin
21{
22
23class OnScreenNotificationInputEventSpy;
24
25class OnScreenNotification : public QObject
26{
27 Q_OBJECT
28 Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
29 Q_PROPERTY(QString message READ message WRITE setMessage NOTIFY messageChanged)
30 Q_PROPERTY(QString iconName READ iconName WRITE setIconName NOTIFY iconNameChanged)
31 Q_PROPERTY(int timeout READ timeout WRITE setTimeout NOTIFY timeoutChanged)
32
33public:
34 explicit OnScreenNotification(QObject *parent = nullptr);
35 ~OnScreenNotification() override;
36 bool isVisible() const;
37 QString message() const;
38 QString iconName() const;
39 int timeout() const;
40
41 QRect geometry() const;
42
43 void setVisible(bool m_visible);
44 void setMessage(const QString &message);
45 void setIconName(const QString &iconName);
46 void setTimeout(int timeout);
47
48 void setConfig(KSharedConfigPtr config);
49 void setEngine(QQmlEngine *engine);
50
51 void setContainsPointer(bool contains);
52 void setSkipCloseAnimation(bool skip);
53
54Q_SIGNALS:
59
61 void show();
62 void ensureQmlContext();
63 void ensureQmlComponent();
64 void createInputSpy();
65 bool m_visible = false;
66 QString m_message;
67 QString m_iconName;
68 QTimer *m_timer;
69 KSharedConfigPtr m_config;
70 std::unique_ptr<QQmlContext> m_qmlContext;
71 std::unique_ptr<QQmlComponent> m_qmlComponent;
72 QQmlEngine *m_qmlEngine = nullptr;
73 std::unique_ptr<QObject> m_mainItem;
74 std::unique_ptr<OnScreenNotificationInputEventSpy> m_spy;
75 QPropertyAnimation *m_animation = nullptr;
76 bool m_containsPointer = false;
77};
78}
void setConfig(KSharedConfigPtr config)
void setEngine(QQmlEngine *engine)
void setIconName(const QString &iconName)
void setMessage(const QString &message)
#define private
#define explicit