1 | // Copyright (C) 2022 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QPERMISSIONS_P_H |
5 | #define QPERMISSIONS_P_H |
6 | |
7 | #include "qpermissions.h" |
8 | |
9 | #include <private/qglobal_p.h> |
10 | #include <QtCore/qloggingcategory.h> |
11 | |
12 | #include <QtCore/QObject> |
13 | |
14 | #include <functional> |
15 | |
16 | QT_REQUIRE_CONFIG(permissions); |
17 | |
18 | // |
19 | // W A R N I N G |
20 | // ------------- |
21 | // |
22 | // This file is not part of the Qt API. It exists purely as an |
23 | // implementation detail. This header file may change from version to |
24 | // version without notice, or even be removed. |
25 | // |
26 | // We mean it. |
27 | // |
28 | |
29 | QT_BEGIN_NAMESPACE |
30 | |
31 | Q_DECLARE_EXPORTED_LOGGING_CATEGORY(lcPermissions, Q_CORE_EXPORT) |
32 | |
33 | namespace QPermissions::Private |
34 | { |
35 | using PermissionCallback = std::function<void(Qt::PermissionStatus)>; |
36 | |
37 | Qt::PermissionStatus checkPermission(const QPermission &permission); |
38 | void requestPermission(const QPermission &permission, const PermissionCallback &callback); |
39 | } |
40 | |
41 | #define QPermissionPluginInterface_iid "org.qt-project.QPermissionPluginInterface.6.5" |
42 | |
43 | class Q_CORE_EXPORT QPermissionPlugin : public QObject |
44 | { |
45 | public: |
46 | virtual ~QPermissionPlugin(); |
47 | |
48 | virtual Qt::PermissionStatus checkPermission(const QPermission &permission) = 0; |
49 | virtual void requestPermission(const QPermission &permission, |
50 | const QPermissions::Private::PermissionCallback &callback) = 0; |
51 | }; |
52 | |
53 | QT_END_NAMESPACE |
54 | |
55 | #endif // QPERMISSIONS_P_H |
56 |