summaryrefslogtreecommitdiffstats
path: root/src/core/api/qwebenginenotification.h
blob: 646413d39d2e61a2a934b32c77c50465695b0af2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef QWEBENGINENOTIFICATION_H
#define QWEBENGINENOTIFICATION_H

#include <QtWebEngineCore/qtwebenginecoreglobal.h>

#include <QtCore/qobject.h>
#include <QtCore/qscopedpointer.h>
#include <QtCore/qsharedpointer.h>
#include <QtCore/qurl.h>

namespace QtWebEngineCore {
class UserNotificationController;
}

QT_BEGIN_NAMESPACE

class QWebEngineNotificationPrivate;

class Q_WEBENGINECORE_EXPORT QWebEngineNotification : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QUrl origin READ origin CONSTANT FINAL)
    Q_PROPERTY(QString title READ title CONSTANT FINAL)
    Q_PROPERTY(QString message READ message CONSTANT FINAL)
    Q_PROPERTY(QString tag READ tag CONSTANT FINAL)
    Q_PROPERTY(QString language READ language CONSTANT FINAL)
    Q_PROPERTY(Qt::LayoutDirection direction READ direction CONSTANT FINAL)

public:
    virtual ~QWebEngineNotification() override;

    bool matches(const QWebEngineNotification *other) const;

    QUrl origin() const;
    QImage icon() const;
    QString title() const;
    QString message() const;
    QString tag() const;
    QString language() const;
    Qt::LayoutDirection direction() const;

public Q_SLOTS:
    void show() const;
    void click() const;
    void close() const;

Q_SIGNALS:
    void closed();

private:
    Q_DISABLE_COPY(QWebEngineNotification)
    Q_DECLARE_PRIVATE(QWebEngineNotification)
    QWebEngineNotification(const QSharedPointer<QtWebEngineCore::UserNotificationController> &controller);
    QScopedPointer<QWebEngineNotificationPrivate> d_ptr;
    friend class QQuickWebEngineProfilePrivate;
    friend class QWebEngineProfilePrivate;
};

QT_END_NAMESPACE

#endif // QWEBENGINENOTIFICATION_H