2012-03-14 09:01:00 +04:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
|
|
|
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
|
** All rights reserved.
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
**
|
|
|
|
** This file is part of the plugins of the Qt Toolkit.
|
|
|
|
**
|
|
|
|
** $QT_BEGIN_LICENSE:LGPL$
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this
|
|
|
|
** file. Please review the following information to ensure the GNU Lesser
|
|
|
|
** General Public License version 2.1 requirements will be met:
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
**
|
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
**
|
|
|
|
** GNU General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU General
|
|
|
|
** Public License version 3.0 as published by the Free Software Foundation
|
|
|
|
** and appearing in the file LICENSE.GPL included in the packaging of this
|
|
|
|
** file. Please review the following information to ensure the GNU General
|
|
|
|
** Public License version 3.0 requirements will be met:
|
|
|
|
** http://www.gnu.org/copyleft/gpl.html.
|
|
|
|
**
|
|
|
|
** Other Usage
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
**
|
|
|
|
**
|
|
|
|
**
|
|
|
|
**
|
|
|
|
**
|
|
|
|
** $QT_END_LICENSE$
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-07-24 21:25:46 +04:00
|
|
|
#include "phantomintegration.h"
|
|
|
|
#include "phantombackingstore.h"
|
2012-03-14 09:01:00 +04:00
|
|
|
|
2014-07-24 21:25:46 +04:00
|
|
|
#include <private/qpixmap_raster_p.h>
|
2012-03-14 09:01:00 +04:00
|
|
|
|
2014-07-24 21:25:46 +04:00
|
|
|
#if defined(Q_OS_MAC)
|
|
|
|
# include <QtPlatformSupport/private/qcoretextfontdatabase_p.h>
|
|
|
|
#else
|
2015-02-15 12:57:28 +03:00
|
|
|
# include <QtPlatformSupport/private/qfontconfigdatabase_p.h>
|
2014-07-24 21:25:46 +04:00
|
|
|
#endif
|
2012-03-14 09:01:00 +04:00
|
|
|
|
2014-07-24 21:25:46 +04:00
|
|
|
#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
|
|
|
|
|
|
|
|
PhantomIntegration::PhantomIntegration()
|
2012-03-14 09:01:00 +04:00
|
|
|
{
|
2014-07-24 21:25:46 +04:00
|
|
|
PhantomScreen *mPrimaryScreen = new PhantomScreen();
|
2012-03-14 09:01:00 +04:00
|
|
|
|
2012-12-24 00:03:10 +04:00
|
|
|
// Simulate typical desktop screen
|
|
|
|
int width = 1024;
|
|
|
|
int height = 768;
|
|
|
|
int dpi = 72;
|
2014-07-24 21:25:46 +04:00
|
|
|
qreal physicalWidth = width * 25.4 / dpi;
|
|
|
|
qreal physicalHeight = height * 25.4 / dpi;
|
2012-12-24 00:03:10 +04:00
|
|
|
mPrimaryScreen->mGeometry = QRect(0, 0, width, height);
|
2014-07-24 21:25:46 +04:00
|
|
|
mPrimaryScreen->mPhysicalSize = QSizeF(physicalWidth, physicalHeight);
|
2012-03-14 09:01:00 +04:00
|
|
|
|
|
|
|
mPrimaryScreen->mDepth = 32;
|
|
|
|
mPrimaryScreen->mFormat = QImage::Format_ARGB32_Premultiplied;
|
|
|
|
|
2014-07-24 21:25:46 +04:00
|
|
|
screenAdded(mPrimaryScreen);
|
2014-08-27 10:25:01 +04:00
|
|
|
|
|
|
|
m_phantomPlatformNativeInterface = new PhantomPlatformNativeInterface();
|
|
|
|
}
|
|
|
|
|
|
|
|
PhantomIntegration::~PhantomIntegration()
|
|
|
|
{
|
|
|
|
delete m_phantomPlatformNativeInterface;
|
2012-03-14 09:01:00 +04:00
|
|
|
}
|
|
|
|
|
2014-07-24 21:25:46 +04:00
|
|
|
bool PhantomIntegration::hasCapability(QPlatformIntegration::Capability cap) const
|
2012-03-14 09:01:00 +04:00
|
|
|
{
|
|
|
|
switch (cap) {
|
|
|
|
case ThreadedPixmaps: return true;
|
|
|
|
default: return QPlatformIntegration::hasCapability(cap);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-24 21:25:46 +04:00
|
|
|
QPlatformWindow* PhantomIntegration::createPlatformWindow(QWindow* window) const
|
2012-03-14 09:01:00 +04:00
|
|
|
{
|
2014-07-24 21:25:46 +04:00
|
|
|
return new QPlatformWindow(window);
|
2012-03-14 09:01:00 +04:00
|
|
|
}
|
|
|
|
|
2014-07-24 21:25:46 +04:00
|
|
|
QPlatformBackingStore* PhantomIntegration::createPlatformBackingStore(QWindow* window) const
|
2012-03-14 09:01:00 +04:00
|
|
|
{
|
2014-07-24 21:25:46 +04:00
|
|
|
return new PhantomBackingStore(window);
|
2012-03-14 09:01:00 +04:00
|
|
|
}
|
|
|
|
|
2014-07-24 21:25:46 +04:00
|
|
|
QPlatformFontDatabase *PhantomIntegration::fontDatabase() const
|
2012-03-14 09:01:00 +04:00
|
|
|
{
|
|
|
|
static QPlatformFontDatabase *db = 0;
|
|
|
|
if (!db) {
|
2014-07-24 21:25:46 +04:00
|
|
|
#if defined(Q_OS_MAC)
|
|
|
|
db = new QCoreTextFontDatabase();
|
|
|
|
#else
|
2015-02-15 12:57:28 +03:00
|
|
|
db = new QFontconfigDatabase();
|
2014-07-24 21:25:46 +04:00
|
|
|
#endif
|
2012-03-14 09:01:00 +04:00
|
|
|
}
|
|
|
|
return db;
|
|
|
|
}
|
2014-07-24 21:25:46 +04:00
|
|
|
|
|
|
|
QAbstractEventDispatcher *PhantomIntegration::createEventDispatcher() const
|
|
|
|
{
|
|
|
|
return createUnixEventDispatcher();
|
|
|
|
}
|
2014-08-27 10:25:01 +04:00
|
|
|
|
|
|
|
QPlatformNativeInterface *PhantomIntegration::nativeInterface() const
|
|
|
|
{
|
|
|
|
return m_phantomPlatformNativeInterface;
|
|
|
|
}
|