| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). |
| 4 | ** Contact: http://www.qt-project.org/legal |
| 5 | ** |
| 6 | ** This file is part of the plugins of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL21$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and Digia. For licensing terms and |
| 14 | ** conditions see http://qt.digia.com/licensing. For further information |
| 15 | ** use the contact form at http://qt.digia.com/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 2.1 or version 3 as published by the Free |
| 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and |
| 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the |
| 22 | ** following information to ensure the GNU Lesser General Public License |
| 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and |
| 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
| 25 | ** |
| 26 | ** In addition, as a special exception, Digia gives you certain additional |
| 27 | ** rights. These rights are described in the Digia Qt LGPL Exception |
| 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
| 29 | ** |
| 30 | ** $QT_END_LICENSE$ |
| 31 | ** |
| 32 | ****************************************************************************/ |
| 33 | |
| 34 | #include "qcustomintegration.h"cxx . . $ `<file>/tests/unit/custom_qpa/qcustomintegration.h`/ |
| 35 | |
| 36 | #include <QtGui/qpa/qplatformfontdatabase.h> |
| 37 | #include <QtGui/qpa/qplatformnativeinterface.h> |
| 38 | #include <QtGui/qpa/qplatformwindow.h> |
| 39 | #include <QtGui/private/qguiapplication_p.h> |
| 40 | #if QT_VERSIONcxx . . $ `<external>/15045578679651060896/qglobal.h:57:9`! >= QT_VERSION_CHECKcxx . . $ `<external>/15045578679651060896/qglobal.h:61:9`!(6, 0, 0) |
| 41 | #include <QtGui/private/qgenericunixeventdispatcher_p.h> |
| 42 | #else |
| 43 | #include <QtEventDispatcherSupport/private/qgenericunixeventdispatcher_p.h> |
| 44 | #endif |
| 45 | |
| 46 | #include "qcustombackingstore.h"cxx . . $ `<file>/tests/unit/custom_qpa/qcustombackingstore.h`/ |
| 47 | |
| 48 | static const char devicePixelRatioEnvironmentVariablecxx . . $ devicePixelRatioEnvironmentVariable.[] = "QT_DEVICE_PIXEL_RATIO"; |
| 49 | |
| 50 | class QCustomNativeInterfacecxx . . $ QCustomNativeInterface# : public QPlatformNativeInterfacecxx . . $ QPlatformNativeInterface# |
| 51 | { |
| 52 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 53 | public: |
| 54 | QVariantcxx . . $ QVariant# windowPropertycxx . . $ QCustomNativeInterface#windowProperty(ccecd49a0d6bf0d4).(QPlatformWindowcxx . . $ QPlatformWindow# */*window*/, const QStringcxx . . $ QString# &name) const override |
| 55 | { |
| 56 | if (name ==cxx . . $ `operator==`(5bc2975d2d751687). QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("scale")) |
| 57 | return m_scalecxx . . $ QVariant#QVariant(9364e6e7bff7660).; |
| 58 | |
| 59 | return QVariantcxx . . $ QVariant#QVariant(ced63f7c635d850d).(); |
| 60 | } |
| 61 | |
| 62 | Q_INVOKABLEcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:124:9`! void changeScalecxx . . $ QCustomNativeInterface#changeScale(9364e6e7bff7660).(float scale) |
| 63 | { |
| 64 | m_scalecxx . . $ QCustomNativeInterface#m_scale. = scale; |
| 65 | Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! windowPropertyChangedcxx . . $ QPlatformNativeInterface#windowPropertyChanged(3a4f3fd801b1c1d2).(nullptr, "scale"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 66 | } |
| 67 | |
| 68 | private: |
| 69 | float m_scalecxx . . $ QCustomNativeInterface#m_scale. = 1; |
| 70 | }; |
| 71 | |
| 72 | QCustomScreencxx . . $ QCustomScreen#::QCustomScreencxx . . $ QCustomScreen#QCustomScreen(49f6e7a06ebc5aa8).() |
| 73 | : mDepthcxx . . $ QCustomScreen#mDepth.(32), mFormatcxx . . $ QCustomScreen#mFormat.(QImagecxx . . $ QImage#::Format_ARGB32_Premultipliedcxx . . $ QImage#Format_ARGB32_Premultiplied.), mDprcxx . . $ QCustomScreen#mDpr.(1.0) |
| 74 | { |
| 75 | if (qEnvironmentVariableIsSetcxx . . $ qEnvironmentVariableIsSet(ab1b0059a8051c5c).(devicePixelRatioEnvironmentVariablecxx . . $ devicePixelRatioEnvironmentVariable.)) { |
| 76 | bool ok = false; |
| 77 | const float dpr = qgetenvcxx . . $ qgetenv(531409eeffcde449).(devicePixelRatioEnvironmentVariablecxx . . $ devicePixelRatioEnvironmentVariable.).toFloatcxx . . $ QByteArray#toFloat(abac0204e50f9cf0).(&ok); |
| 78 | if (ok && dpr > 0) { |
| 79 | mDprcxx . . $ QCustomScreen#mDpr. = dpr; |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | QCustomIntegrationcxx . . $ QCustomIntegration#::QCustomIntegrationcxx . . $ QCustomIntegration#QCustomIntegration(49f6e7a06ebc5aa8).() |
| 85 | : m_nativeInterfacecxx . . $ QCustomIntegration#m_nativeInterface.(new QCustomNativeInterfacecxx . . $ QCustomNativeInterface#()) |
| 86 | { |
| 87 | QCustomScreencxx . . $ QCustomScreen# *mPrimaryScreen = new QCustomScreencxx . . $ QCustomScreen#(); |
| 88 | |
| 89 | mPrimaryScreen->mGeometrycxx . . $ QCustomScreen#mGeometry. =cxx . . $ QRect#`operator=`(2f0950bc81ec7a1b). QRectcxx . . $ QRect#QRect(2261ffe5112eab06).(0, 0, 240, 320); |
| 90 | mPrimaryScreen->mDepthcxx . . $ QCustomScreen#mDepth. = 32; |
| 91 | mPrimaryScreen->mFormatcxx . . $ QCustomScreen#mFormat. = QImagecxx . . $ QImage#::Format_ARGB32_Premultipliedcxx . . $ QImage#Format_ARGB32_Premultiplied.; |
| 92 | |
| 93 | #if QT_VERSIONcxx . . $ `<external>/15045578679651060896/qglobal.h:57:9`! >= QT_VERSION_CHECKcxx . . $ `<external>/15045578679651060896/qglobal.h:61:9`!(5, 13, 0) |
| 94 | QWindowSystemInterfacecxx . . $ QWindowSystemInterface#::handleScreenAddedcxx . . $ QWindowSystemInterface#handleScreenAdded(1814127ae5de15cc).(mPrimaryScreen); |
| 95 | #else |
| 96 | screenAdded(mPrimaryScreen); |
| 97 | #endif |
| 98 | } |
| 99 | |
| 100 | QCustomIntegrationcxx . . $ QCustomIntegration#::~cxx . . $ QCustomIntegration#`~QCustomIntegration`(ced63f7c635d850d).QCustomIntegrationcxx . . $ QCustomIntegration#() |
| 101 | { |
| 102 | delete m_nativeInterfacecxx . . $ QCustomIntegration#m_nativeInterface.; |
| 103 | } |
| 104 | |
| 105 | bool QCustomIntegrationcxx . . $ QCustomIntegration#::hasCapabilitycxx . . $ QCustomIntegration#hasCapability(4f43d5faa3cadba7).(QPlatformIntegrationcxx . . $ QPlatformIntegration#::Capabilitycxx . . $ QPlatformIntegration#Capability# cap) const |
| 106 | { |
| 107 | switch (cap) { |
| 108 | case ThreadedPixmapscxx . . $ QPlatformIntegration#ThreadedPixmaps.: return true; |
| 109 | case MultipleWindowscxx . . $ QPlatformIntegration#MultipleWindows.: return true; |
| 110 | default: return QPlatformIntegrationcxx . . $ QPlatformIntegration#::hasCapabilitycxx . . $ QPlatformIntegration#hasCapability(4f43d5faa3cadba7).(cap); |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | // Dummy font database that does not scan the fonts directory to be |
| 115 | // used for command line tools like qmlplugindump that do not create windows |
| 116 | // unless DebugBackingStore is activated. |
| 117 | class DummyFontDatabasecxx . . $ DummyFontDatabase# : public QPlatformFontDatabasecxx . . $ QPlatformFontDatabase# |
| 118 | { |
| 119 | public: |
| 120 | void populateFontDatabasecxx . . $ DummyFontDatabase#populateFontDatabase(49f6e7a06ebc5aa8).() override {} |
| 121 | }; |
| 122 | |
| 123 | QPlatformFontDatabasecxx . . $ QPlatformFontDatabase# *QCustomIntegrationcxx . . $ QCustomIntegration#::fontDatabasecxx . . $ QCustomIntegration#fontDatabase(57715c87169750e8).() const |
| 124 | { |
| 125 | return new DummyFontDatabasecxx . . $ DummyFontDatabase#; |
| 126 | } |
| 127 | |
| 128 | QPlatformNativeInterfacecxx . . $ QPlatformNativeInterface# *QCustomIntegrationcxx . . $ QCustomIntegration#::nativeInterfacecxx . . $ QCustomIntegration#nativeInterface(37d321b6325c0200).() const |
| 129 | { |
| 130 | return m_nativeInterfacecxx . . $ QCustomIntegration#m_nativeInterface.; |
| 131 | } |
| 132 | |
| 133 | QPlatformWindowcxx . . $ QPlatformWindow# *QCustomIntegrationcxx . . $ QCustomIntegration#::createPlatformWindowcxx . . $ QCustomIntegration#createPlatformWindow(619269b977198650).(QWindowcxx . . $ QWindow# *window) const |
| 134 | { |
| 135 | QPlatformWindowcxx . . $ QPlatformWindow# *w = new QPlatformWindowcxx . . $ QPlatformWindow#QPlatformWindow(35681b993d9a3c79).(window); |
| 136 | w->requestActivateWindowcxx . . $ QPlatformWindow#requestActivateWindow(49f6e7a06ebc5aa8).(); |
| 137 | return w; |
| 138 | } |
| 139 | |
| 140 | QPlatformBackingStorecxx . . $ QPlatformBackingStore# *QCustomIntegrationcxx . . $ QCustomIntegration#::createPlatformBackingStorecxx . . $ QCustomIntegration#createPlatformBackingStore(6f11ffa03d55ac96).(QWindowcxx . . $ QWindow# *window) const |
| 141 | { |
| 142 | return new QCustomBackingStorecxx . . $ QCustomBackingStore#(window); |
| 143 | } |
| 144 | |
| 145 | QAbstractEventDispatchercxx . . $ QAbstractEventDispatcher# *QCustomIntegrationcxx . . $ QCustomIntegration#::createEventDispatchercxx . . $ QCustomIntegration#createEventDispatcher(25304d0802b78d8).() const |
| 146 | { |
| 147 | return createUnixEventDispatchercxx . . $ createUnixEventDispatcher(3653c843938297dc).(); |
| 148 | } |
| 149 | |
| 150 | QCustomIntegrationcxx . . $ QCustomIntegration# *QCustomIntegrationcxx . . $ QCustomIntegration#::instancecxx . . $ QCustomIntegration#instance(775f88cd38079220).() |
| 151 | { |
| 152 | return static_cast<QCustomIntegrationcxx . . $ QCustomIntegration# *>(QGuiApplicationPrivatecxx . . $ QGuiApplicationPrivate#::platformIntegrationcxx . . $ QGuiApplicationPrivate#platformIntegration(97338c7bce6884b1).()); |
| 153 | } |
| 154 | |
| 155 | #include "qcustomintegration.moc"cxx . . $ `<file>/tests/unit/custom_qpa/.moc/qcustomintegration.moc`/ |