1 | // Copyright (C) 2016 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 QPLATFORMINTEGRATION_MINIMAL_H |
5 | #define QPLATFORMINTEGRATION_MINIMAL_H |
6 | |
7 | #include <qpa/qplatformintegration.h> |
8 | #include <qpa/qplatformscreen.h> |
9 | |
10 | #include <qscopedpointer.h> |
11 | |
12 | QT_BEGIN_NAMESPACE |
13 | |
14 | class QMinimalScreen : public QPlatformScreen |
15 | { |
16 | public: |
17 | QMinimalScreen() |
18 | : mDepth(32), mFormat(QImage::Format_ARGB32_Premultiplied) {} |
19 | |
20 | QRect geometry() const override { return mGeometry; } |
21 | int depth() const override { return mDepth; } |
22 | QImage::Format format() const override { return mFormat; } |
23 | |
24 | public: |
25 | QRect mGeometry; |
26 | int mDepth; |
27 | QImage::Format mFormat; |
28 | QSize mPhysicalSize; |
29 | }; |
30 | |
31 | class QMinimalIntegration : public QPlatformIntegration |
32 | { |
33 | public: |
34 | enum Options { // Options to be passed on command line or determined from environment |
35 | DebugBackingStore = 0x1, |
36 | EnableFonts = 0x2, |
37 | FreeTypeFontDatabase = 0x4, |
38 | FontconfigDatabase = 0x8 |
39 | }; |
40 | |
41 | explicit QMinimalIntegration(const QStringList ¶meters); |
42 | ~QMinimalIntegration(); |
43 | |
44 | bool hasCapability(QPlatformIntegration::Capability cap) const override; |
45 | QPlatformFontDatabase *fontDatabase() const override; |
46 | |
47 | QPlatformWindow *createPlatformWindow(QWindow *window) const override; |
48 | QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override; |
49 | QAbstractEventDispatcher *createEventDispatcher() const override; |
50 | |
51 | QPlatformNativeInterface *nativeInterface() const override; |
52 | |
53 | unsigned options() const { return m_options; } |
54 | |
55 | static QMinimalIntegration *instance(); |
56 | |
57 | private: |
58 | mutable QPlatformFontDatabase *m_fontDatabase; |
59 | mutable QScopedPointer<QPlatformNativeInterface> m_nativeInterface; |
60 | QMinimalScreen *m_primaryScreen; |
61 | unsigned m_options; |
62 | }; |
63 | |
64 | QT_END_NAMESPACE |
65 | |
66 | #endif |
67 |