diff options
Diffstat (limited to 'src/gui')
98 files changed, 397 insertions, 325 deletions
diff --git a/src/gui/accessible/accessible.pri b/src/gui/accessible/accessible.pri index 70ac033f77..abffa2ade8 100644 --- a/src/gui/accessible/accessible.pri +++ b/src/gui/accessible/accessible.pri @@ -6,7 +6,7 @@ contains(QT_CONFIG, accessibility) { accessible/qaccessible2.h \ accessible/qaccessibleobject.h \ accessible/qaccessibleplugin.h \ - accessible/qplatformaccessibility_qpa.h + accessible/qplatformaccessibility.h SOURCES += accessible/qaccessible.cpp \ accessible/qaccessible2.cpp \ diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index 6f1d505a4e..ec02086d74 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -48,8 +48,8 @@ #include "qaccessiblebridge.h" #include <QtGui/QGuiApplication> #include <private/qguiapplication_p.h> -#include "qplatformaccessibility_qpa.h" -#include "qplatformintegration_qpa.h" +#include <qpa/qplatformaccessibility.h> +#include <qpa/qplatformintegration.h> #include <QtCore/qdebug.h> #include <QtCore/qmetaobject.h> @@ -570,35 +570,28 @@ QAccessible::RootObjectHandler QAccessible::installRootObjectHandler(RootObjectH QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object) { accessibility_active = true; - QAccessibleInterface *iface = 0; if (!object) return 0; const QMetaObject *mo = object->metaObject(); while (mo) { - const QLatin1String cn(mo->className()); + const QString cn = QLatin1String(mo->className()); for (int i = qAccessibleFactories()->count(); i > 0; --i) { InterfaceFactory factory = qAccessibleFactories()->at(i - 1); - iface = factory(cn, object); - if (iface) + if (QAccessibleInterface *iface = factory(cn, object)) return iface; } #ifndef QT_NO_LIBRARY - QAccessibleFactoryInterface *factory = qobject_cast<QAccessibleFactoryInterface*>(loader()->instance(cn)); - if (factory) { - iface = factory->create(cn, object); - if (iface) - return iface; - } + if (QAccessibleInterface * iface = qLoadPlugin1<QAccessibleInterface, QAccessibleFactoryInterface>(loader(), cn, object)) + return iface; #endif mo = mo->superClass(); } - if (!iface) { - if (object == qApp) - iface = new QAccessibleApplication; - } - return iface; + if (object == qApp) + return new QAccessibleApplication; + + return 0; } /*! diff --git a/src/gui/accessible/qplatformaccessibility_qpa.h b/src/gui/accessible/qplatformaccessibility.h index b1efd7cb34..b1efd7cb34 100644 --- a/src/gui/accessible/qplatformaccessibility_qpa.h +++ b/src/gui/accessible/qplatformaccessibility.h diff --git a/src/gui/accessible/qplatformaccessibility_qpa.cpp b/src/gui/accessible/qplatformaccessibility_qpa.cpp index 91b5de1198..271f324000 100644 --- a/src/gui/accessible/qplatformaccessibility_qpa.cpp +++ b/src/gui/accessible/qplatformaccessibility_qpa.cpp @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "qplatformaccessibility_qpa.h" +#include "qplatformaccessibility.h" #include <private/qfactoryloader_p.h> #include "qaccessibleplugin.h" #include "qaccessibleobject.h" @@ -112,15 +112,21 @@ void QPlatformAccessibility::initialize() isInit = true; // ### not atomic #ifndef QT_NO_LIBRARY - const QStringList l = bridgeloader()->keys(); - for (int i = 0; i < l.count(); ++i) { - if (QAccessibleBridgeFactoryInterface *factory = - qobject_cast<QAccessibleBridgeFactoryInterface*>(bridgeloader()->instance(l.at(i)))) { - QAccessibleBridge * bridge = factory->create(l.at(i)); - if (bridge) { - bridges()->append(bridge); - } + typedef QMultiMap<int, QString> PluginKeyMap; + typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator; + + const PluginKeyMap keyMap = bridgeloader()->keyMap(); + QAccessibleBridgeFactoryInterface *factory = 0; + int i = -1; + const PluginKeyMapConstIterator cend = keyMap.constEnd(); + for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it) { + if (it.key() != i) { + i = it.key(); + factory = qobject_cast<QAccessibleBridgeFactoryInterface*>(bridgeloader()->instance(i)); } + if (factory) + if (QAccessibleBridge *bridge = factory->create(it.value())) + bridges()->append(bridge); } #endif } diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index 34a33aa0f0..737b7fcbd4 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -21,7 +21,7 @@ HEADERS += \ image/qpixmap_blitter_p.h \ image/qpixmapcache.h \ image/qpixmapcache_p.h \ - image/qplatformpixmap_qpa.h \ + image/qplatformpixmap.h \ image/qimagepixmapcleanuphooks_p.h \ SOURCES += \ diff --git a/src/gui/image/qbitmap.cpp b/src/gui/image/qbitmap.cpp index f3c26dd5b2..499f9f48f2 100644 --- a/src/gui/image/qbitmap.cpp +++ b/src/gui/image/qbitmap.cpp @@ -40,8 +40,8 @@ ****************************************************************************/ #include "qbitmap.h" -#include "qplatformpixmap_qpa.h" -#include "qplatformintegration_qpa.h" +#include <qpa/qplatformpixmap.h> +#include <qpa/qplatformintegration.h> #include "qimage.h" #include "qscreen.h" #include "qvariant.h" diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 64decd0fd7..89060cfbb4 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -50,13 +50,13 @@ #include "qstringlist.h" #include "qvariant.h" #include "qimagepixmapcleanuphooks_p.h" -#include "qplatformintegration_qpa.h" +#include <qpa/qplatformintegration.h> #include <private/qguiapplication_p.h> #include <ctype.h> #include <stdlib.h> #include <limits.h> #include <math.h> -#include <qplatformpixmap_qpa.h> +#include <qpa/qplatformpixmap.h> #include <private/qdrawhelper_p.h> #include <private/qmemrotate_p.h> #include <private/qimagescale_p.h> diff --git a/src/gui/image/qimagepixmapcleanuphooks.cpp b/src/gui/image/qimagepixmapcleanuphooks.cpp index b118f5f856..548934829e 100644 --- a/src/gui/image/qimagepixmapcleanuphooks.cpp +++ b/src/gui/image/qimagepixmapcleanuphooks.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qimagepixmapcleanuphooks_p.h" -#include "qplatformpixmap_qpa.h" +#include <qpa/qplatformpixmap.h> #include "private/qimage_p.h" diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index c08ac0593b..4cda7304ac 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -224,15 +224,18 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, QImageIOHandler *handler = 0; #ifndef QT_NO_LIBRARY + typedef QMultiMap<int, QString> PluginKeyMap; + typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator; + // check if we have plugins that support the image format QFactoryLoader *l = loader(); - QStringList keys = l->keys(); + const PluginKeyMap keyMap = l->keyMap(); #endif QByteArray suffix; #ifdef QIMAGEREADER_DEBUG qDebug() << "QImageReader::createReadHandler( device =" << (void *)device << ", format =" << format << ")," - << keys.size() << "plugins available: " << keys; + << keyMap.values().size() << "plugins available: " << keyMap.values(); #endif #ifndef QT_NO_LIBRARY @@ -246,7 +249,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, qDebug() << "QImageReader::createReadHandler: device is a file:" << file->fileName(); #endif if (!(suffix = QFileInfo(file->fileName()).suffix().toLower().toLatin1()).isEmpty()) { - int index = keys.indexOf(QString::fromLatin1(suffix)); + const int index = keyMap.key(QString::fromLatin1(suffix), -1); if (index != -1) { #ifdef QIMAGEREADER_DEBUG qDebug() << "QImageReader::createReadHandler: suffix recognized; the" @@ -269,13 +272,16 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, // check if the plugin that claims support for this format can load // from this device with this format. const qint64 pos = device ? device->pos() : 0; - QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(QString::fromLatin1(suffix))); - if (plugin && plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead) { - handler = plugin->create(device, testFormat); + const int index = keyMap.key(QString::fromLatin1(suffix), -1); + if (index != -1) { + QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(index)); + if (plugin && plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead) { + handler = plugin->create(device, testFormat); #ifdef QIMAGEREADER_DEBUG - qDebug() << "QImageReader::createReadHandler: using the" << suffix - << "plugin"; + qDebug() << "QImageReader::createReadHandler: using the" << suffix + << "plugin"; #endif + } } if (device && !device->isSequential()) device->seek(pos); @@ -287,9 +293,10 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, const qint64 pos = device ? device->pos() : 0; if (autoDetectImageFormat) { - for (int i = 0; i < keys.size(); ++i) { + const int keyCount = keyMap.keys().size(); + for (int i = 0; i < keyCount; ++i) { if (i != suffixPluginIndex) { - QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(keys.at(i))); + QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(i)); if (plugin && plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead) { #ifdef QIMAGEREADER_DEBUG qDebug() << "QImageReader::createReadHandler: the" << keys.at(i) << "plugin can read this format"; @@ -300,12 +307,15 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, } } } else { - QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(QLatin1String(testFormat))); - if (plugin && plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead) { + const int testIndex = keyMap.key(QLatin1String(testFormat), -1); + if (testIndex != -1) { + QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(testIndex)); + if (plugin && plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead) { #ifdef QIMAGEREADER_DEBUG - qDebug() << "QImageReader::createReadHandler: the" << testFormat << "plugin can read this format"; + qDebug() << "QImageReader::createReadHandler: the" << testFormat << "plugin can read this format"; #endif - handler = plugin->create(device, testFormat); + handler = plugin->create(device, testFormat); + } } } if (device && !device->isSequential()) @@ -363,9 +373,10 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, if (!handler && (autoDetectImageFormat || ignoresFormatAndExtension)) { // check if any of our plugins recognize the file from its contents. const qint64 pos = device ? device->pos() : 0; - for (int i = 0; i < keys.size(); ++i) { + const int keyCount = keyMap.keys().size(); + for (int i = 0; i < keyCount; ++i) { if (i != suffixPluginIndex) { - QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(keys.at(i))); + QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(i)); if (plugin && plugin->capabilities(device, QByteArray()) & QImageIOPlugin::CanRead) { handler = plugin->create(device, testFormat); #ifdef QIMAGEREADER_DEBUG @@ -1413,6 +1424,12 @@ QByteArray QImageReader::imageFormat(QIODevice *device) return format; } +#ifndef QT_NO_LIBRARY +void supportedImageHandlerFormats(QFactoryLoader *loader, + QImageIOPlugin::Capability cap, + QSet<QByteArray> *result); +#endif + /*! Returns the list of image formats supported by QImageReader. @@ -1442,6 +1459,7 @@ QByteArray QImageReader::imageFormat(QIODevice *device) \sa setFormat(), QImageWriter::supportedImageFormats(), QImageIOPlugin */ + QList<QByteArray> QImageReader::supportedImageFormats() { QSet<QByteArray> formats; @@ -1449,14 +1467,7 @@ QList<QByteArray> QImageReader::supportedImageFormats() formats << _qt_BuiltInFormats[i].extension; #ifndef QT_NO_LIBRARY - QFactoryLoader *l = loader(); - QStringList keys = l->keys(); - - for (int i = 0; i < keys.count(); ++i) { - QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(keys.at(i))); - if (plugin && plugin->capabilities(0, keys.at(i).toLatin1()) & QImageIOPlugin::CanRead) - formats << keys.at(i).toLatin1(); - } + supportedImageHandlerFormats(loader(), QImageIOPlugin::CanRead, &formats); #endif // QT_NO_LIBRARY QList<QByteArray> sortedFormats; diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp index 56c459ee4d..c1b7a6459a 100644 --- a/src/gui/image/qimagewriter.cpp +++ b/src/gui/image/qimagewriter.cpp @@ -136,9 +136,12 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device, QImageIOHandler *handler = 0; #ifndef QT_NO_LIBRARY + typedef QMultiMap<int, QString> PluginKeyMap; + typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator; + // check if any plugins can write the image QFactoryLoader *l = loader(); - QStringList keys = l->keys(); + const PluginKeyMap keyMap = l->keyMap(); int suffixPluginIndex = -1; #endif @@ -149,7 +152,7 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device, if (QFile *file = qobject_cast<QFile *>(device)) { if (!(suffix = QFileInfo(file->fileName()).suffix().toLower().toLatin1()).isEmpty()) { #ifndef QT_NO_LIBRARY - int index = keys.indexOf(QString::fromLatin1(suffix)); + const int index = keyMap.key(QString::fromLatin1(suffix), -1); if (index != -1) suffixPluginIndex = index; #endif @@ -163,9 +166,12 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device, if (suffixPluginIndex != -1) { // when format is missing, check if we can find a plugin for the // suffix. - QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(QString::fromLatin1(suffix))); - if (plugin && (plugin->capabilities(device, suffix) & QImageIOPlugin::CanWrite)) - handler = plugin->create(device, suffix); + const int index = keyMap.key(QString::fromLatin1(suffix), -1); + if (index != -1) { + QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(index)); + if (plugin && (plugin->capabilities(device, suffix) & QImageIOPlugin::CanWrite)) + handler = plugin->create(device, suffix); + } } #endif // QT_NO_LIBRARY @@ -210,8 +216,9 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device, #ifndef QT_NO_LIBRARY if (!testFormat.isEmpty()) { - for (int i = 0; i < keys.size(); ++i) { - QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(keys.at(i))); + const int keyCount = keyMap.keys().size(); + for (int i = 0; i < keyCount; ++i) { + QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(i)); if (plugin && (plugin->capabilities(device, testFormat) & QImageIOPlugin::CanWrite)) { delete handler; handler = plugin->create(device, testFormat); @@ -647,6 +654,31 @@ bool QImageWriter::supportsOption(QImageIOHandler::ImageOption option) const return d->handler->supportsOption(option); } + +#ifndef QT_NO_LIBRARY +void supportedImageHandlerFormats(QFactoryLoader *loader, + QImageIOPlugin::Capability cap, + QSet<QByteArray> *result) +{ + typedef QMultiMap<int, QString> PluginKeyMap; + typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator; + + const PluginKeyMap keyMap = loader->keyMap(); + const PluginKeyMapConstIterator cend = keyMap.constEnd(); + int i = -1; + QImageIOPlugin *plugin = 0; + for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it) { + if (it.key() != i) { + i = it.key(); + plugin = qobject_cast<QImageIOPlugin *>(loader->instance(i)); + } + const QByteArray key = it.value().toLatin1(); + if (plugin && (plugin->capabilities(0, key) & cap) != 0) + result->insert(key); + } +} +#endif // QT_NO_LIBRARY + /*! Returns the list of image formats supported by QImageWriter. @@ -696,13 +728,7 @@ QList<QByteArray> QImageWriter::supportedImageFormats() #endif #ifndef QT_NO_LIBRARY - QFactoryLoader *l = loader(); - QStringList keys = l->keys(); - for (int i = 0; i < keys.count(); ++i) { - QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(keys.at(i))); - if (plugin && (plugin->capabilities(0, keys.at(i).toLatin1()) & QImageIOPlugin::CanWrite) != 0) - formats << keys.at(i).toLatin1(); - } + supportedImageHandlerFormats(loader(), QImageIOPlugin::CanWrite, &formats); #endif // QT_NO_LIBRARY QList<QByteArray> sortedFormats; diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp index 96d7a0487b..c562b0bd6d 100644 --- a/src/gui/image/qnativeimage.cpp +++ b/src/gui/image/qnativeimage.cpp @@ -41,7 +41,7 @@ #include <qdebug.h> #include "qnativeimage_p.h" -#include "qplatformscreen_qpa.h" +#include <qpa/qplatformscreen.h> #include "private/qguiapplication_p.h" #include "qscreen.h" diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp index 283002b1d3..34ca077e5b 100644 --- a/src/gui/image/qpicture.cpp +++ b/src/gui/image/qpicture.cpp @@ -1400,14 +1400,20 @@ Q_GLOBAL_STATIC(QPHList, pictureHandlers) void qt_init_picture_plugins() { #ifndef QT_NO_LIBRARY + typedef QMultiMap<int, QString> PluginKeyMap; + typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator; + static QBasicMutex mutex; QMutexLocker locker(&mutex); static QFactoryLoader loader(QPictureFormatInterface_iid, QStringLiteral("/pictureformats")); - QStringList keys = loader.keys(); - for (int i = 0; i < keys.count(); ++i) - if (QPictureFormatInterface *format = qobject_cast<QPictureFormatInterface*>(loader.instance(keys.at(i)))) - format->installIOHandler(keys.at(i)); + + const PluginKeyMap keyMap = loader.keyMap(); + const PluginKeyMapConstIterator cend = keyMap.constEnd(); + for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it) { + if (QPictureFormatInterface *format = qobject_cast<QPictureFormatInterface*>(loader.instance(it.key()))) + format->installIOHandler(it.value()); + } #endif } diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 377d7e036a..4cdf61138c 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -42,7 +42,7 @@ #include <qglobal.h> #include "qpixmap.h" -#include "qplatformpixmap_qpa.h" +#include <qpa/qplatformpixmap.h> #include "qimagepixmapcleanuphooks_p.h" #include "qbitmap.h" @@ -63,7 +63,7 @@ #include "qthread.h" #include "qdebug.h" -# include "qplatformintegration_qpa.h" +#include <qpa/qplatformintegration.h> #include "qpixmap_raster_p.h" #include "private/qhexstring_p.h" diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h index 95397374c6..174277f9eb 100644 --- a/src/gui/image/qpixmap_blitter_p.h +++ b/src/gui/image/qpixmap_blitter_p.h @@ -42,7 +42,7 @@ #ifndef QPIXMAP_BLITTER_P_H #define QPIXMAP_BLITTER_P_H -#include <qplatformpixmap_qpa.h> +#include <qpa/qplatformpixmap.h> #include <private/qpaintengine_blitter_p.h> #ifndef QT_NO_BLITTABLE diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h index 864fad42ec..8e1a8ccc03 100644 --- a/src/gui/image/qpixmap_raster_p.h +++ b/src/gui/image/qpixmap_raster_p.h @@ -53,7 +53,7 @@ // We mean it. // -#include <QtGui/qplatformpixmap_qpa.h> +#include <qpa/qplatformpixmap.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp index 66a829f5de..c25393c72e 100644 --- a/src/gui/image/qpixmap_win.cpp +++ b/src/gui/image/qpixmap_win.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qpixmap.h" -#include "qplatformpixmap_qpa.h" +#include <qpa/qplatformpixmap.h> #include "qpixmap_raster_p.h" #include <qglobal.h> diff --git a/src/gui/image/qplatformpixmap.cpp b/src/gui/image/qplatformpixmap.cpp index 073c267fbe..769cf5f90b 100644 --- a/src/gui/image/qplatformpixmap.cpp +++ b/src/gui/image/qplatformpixmap.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qplatformpixmap_qpa.h" -#include "qplatformintegration_qpa.h" +#include "qplatformpixmap.h" +#include <qpa/qplatformintegration.h> #include <QtCore/qbuffer.h> #include <QtGui/qbitmap.h> #include <QtGui/qimagereader.h> diff --git a/src/gui/image/qplatformpixmap_qpa.h b/src/gui/image/qplatformpixmap.h index 154c5079a7..154c5079a7 100644 --- a/src/gui/image/qplatformpixmap_qpa.h +++ b/src/gui/image/qplatformpixmap.h diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 3c1b6b4e48..525871c89b 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -10,27 +10,27 @@ HEADERS += \ kernel/qgenericplugin_qpa.h \ kernel/qwindowsysteminterface_qpa.h \ kernel/qwindowsysteminterface_qpa_p.h \ - kernel/qplatformintegration_qpa.h \ - kernel/qplatformdrag_qpa.h \ - kernel/qplatformscreen_qpa.h \ - kernel/qplatformscreen_qpa_p.h \ - kernel/qplatforminputcontext_qpa.h \ - kernel/qplatforminputcontext_qpa_p.h \ - kernel/qplatformintegrationfactory_qpa_p.h \ - kernel/qplatformintegrationplugin_qpa.h \ - kernel/qplatformtheme_qpa.h\ - kernel/qplatformthemefactory_qpa_p.h \ - kernel/qplatformthemeplugin_qpa.h \ - kernel/qplatformwindow_qpa.h \ - kernel/qplatformcursor_qpa.h \ - kernel/qplatformclipboard_qpa.h \ - kernel/qplatformnativeinterface_qpa.h \ + kernel/qplatformintegration.h \ + kernel/qplatformdrag.h \ + kernel/qplatformscreen.h \ + kernel/qplatformscreen_p.h \ + kernel/qplatforminputcontext.h \ + kernel/qplatforminputcontext_p.h \ + kernel/qplatformintegrationfactory_p.h \ + kernel/qplatformintegrationplugin.h \ + kernel/qplatformtheme.h\ + kernel/qplatformthemefactory_p.h \ + kernel/qplatformthemeplugin.h \ + kernel/qplatformwindow.h \ + kernel/qplatformcursor.h \ + kernel/qplatformclipboard.h \ + kernel/qplatformnativeinterface.h \ kernel/qsurfaceformat.h \ kernel/qguiapplication.h \ kernel/qguiapplication_p.h \ kernel/qwindow_p.h \ kernel/qwindow.h \ - kernel/qplatformsurface_qpa.h \ + kernel/qplatformsurface.h \ kernel/qsurface.h \ kernel/qclipboard.h \ kernel/qcursor.h \ @@ -55,10 +55,10 @@ HEADERS += \ kernel/qstylehints.h \ kernel/qtouchdevice.h \ kernel/qtouchdevice_p.h \ - kernel/qplatformsharedgraphicscache_qpa.h \ - kernel/qplatformdialoghelper_qpa.h \ - kernel/qplatformservices_qpa.h \ - kernel/qplatformscreenpageflipper_qpa.h + kernel/qplatformsharedgraphicscache.h \ + kernel/qplatformdialoghelper.h \ + kernel/qplatformservices.h \ + kernel/qplatformscreenpageflipper.h SOURCES += \ kernel/qclipboard_qpa.cpp \ @@ -107,7 +107,7 @@ SOURCES += \ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) { HEADERS += \ - kernel/qplatformopenglcontext_qpa.h \ + kernel/qplatformopenglcontext.h \ kernel/qopenglcontext.h \ kernel/qopenglcontext_p.h diff --git a/src/gui/kernel/qclipboard_qpa.cpp b/src/gui/kernel/qclipboard_qpa.cpp index 187e09253e..284775c4e2 100644 --- a/src/gui/kernel/qclipboard_qpa.cpp +++ b/src/gui/kernel/qclipboard_qpa.cpp @@ -45,8 +45,8 @@ #include "qmimedata.h" #include "private/qguiapplication_p.h" -#include "qplatformclipboard_qpa.h" -#include "qplatformintegration_qpa.h" +#include <qpa/qplatformclipboard.h> +#include <qpa/qplatformintegration.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qcursor_qpa.cpp b/src/gui/kernel/qcursor_qpa.cpp index 1c719c839e..cc9163fbc0 100644 --- a/src/gui/kernel/qcursor_qpa.cpp +++ b/src/gui/kernel/qcursor_qpa.cpp @@ -42,7 +42,7 @@ #include <qcursor.h> #include <qscreen.h> #include <private/qcursor_p.h> -#include <qplatformcursor_qpa.h> +#include <qpa/qplatformcursor.h> #include <private/qguiapplication_p.h> #include <qbitmap.h> diff --git a/src/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp index 1ed4a96192..8182719830 100644 --- a/src/gui/kernel/qdnd.cpp +++ b/src/gui/kernel/qdnd.cpp @@ -59,8 +59,8 @@ #include "qimagewriter.h" #include "qdebug.h" #include <ctype.h> -#include <qplatformintegration_qpa.h> -#include <qplatformdrag_qpa.h> +#include <qpa/qplatformintegration.h> +#include <qpa/qplatformdrag.h> #include <private/qguiapplication_p.h> diff --git a/src/gui/kernel/qgenericpluginfactory_qpa.cpp b/src/gui/kernel/qgenericpluginfactory_qpa.cpp index d4a7a9c20e..90da16f868 100644 --- a/src/gui/kernel/qgenericpluginfactory_qpa.cpp +++ b/src/gui/kernel/qgenericpluginfactory_qpa.cpp @@ -79,12 +79,12 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, */ QObject *QGenericPluginFactory::create(const QString& key, const QString &specification) { - QString driver = key.toLower(); + const QString driver = key.toLower(); #if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL) #ifndef QT_NO_LIBRARY - if (QGenericPluginFactoryInterface *factory = qobject_cast<QGenericPluginFactoryInterface*>(loader()->instance(driver))) - return factory->create(driver, specification); + if (QObject *object = qLoadPlugin1<QObject, QGenericPluginFactoryInterface>(loader(), driver, specification)) + return object; #endif #endif return 0; @@ -101,11 +101,14 @@ QStringList QGenericPluginFactory::keys() #if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL) #ifndef QT_NO_LIBRARY - QStringList plugins = loader()->keys(); - for (int i = 0; i < plugins.size(); ++i) { - if (!list.contains(plugins.at(i))) - list += plugins.at(i); - } + typedef QMultiMap<int, QString> PluginKeyMap; + typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator; + + const PluginKeyMap keyMap = loader()->keyMap(); + const PluginKeyMapConstIterator cend = keyMap.constEnd(); + for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it) + if (!list.contains(it.value())) + list += it.value(); #endif //QT_NO_LIBRARY #endif //QT_MAKEDLL return list; diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index b63ed78c4b..bdffb985f7 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -42,14 +42,15 @@ #include "qguiapplication.h" #include "private/qguiapplication_p.h" -#include "private/qplatformintegrationfactory_qpa_p.h" +#include <qpa/qplatformintegrationfactory_p.h> #include "private/qevent_p.h" #include "qfont.h" -#include "qplatformfontdatabase_qpa.h" -#include "qplatformwindow_qpa.h" -#include "qplatformnativeinterface_qpa.h" -#include "qplatformtheme_qpa.h" -#include "qplatformintegration_qpa.h" +#include <qpa/qplatformfontdatabase.h> +#include <qpa/qplatformwindow.h> +#include <qpa/qplatformnativeinterface.h> +#include <qpa/qplatformtheme.h> +#include <qpa/qplatformintegration.h> +#include <qpa/qplatformdrag.h> #include <QtCore/QAbstractEventDispatcher> #include <QtCore/QVariant> @@ -64,14 +65,14 @@ #include <private/qscreen_p.h> #include <private/qdrawhelper_p.h> -#include <QtGui/QPlatformIntegration> +#include <qpa/qplatformintegration.h> #include <QtGui/QGenericPluginFactory> #include <QtGui/qstylehints.h> #include <QtGui/qinputpanel.h> #include <QtGui/qpixmapcache.h> -#include <QtGui/qplatformtheme_qpa.h> -#include <QtGui/qplatforminputcontext_qpa.h> -#include <private/qplatforminputcontext_qpa_p.h> +#include <qpa/qplatformtheme.h> +#include <qpa/qplatforminputcontext.h> +#include <qpa/qplatforminputcontext_p.h> #include <QWindowSystemInterface> #include "private/qwindowsysteminterface_qpa_p.h" @@ -79,11 +80,11 @@ #include "private/qcursor_p.h" #include "private/qdnd_p.h" -#include <private/qplatformthemefactory_qpa_p.h> -#include "qplatformdrag_qpa.h" +#include <qpa/qplatformthemefactory_p.h> +#include <qpa/qplatformdrag.h> #ifndef QT_NO_CURSOR -#include "qplatformcursor_qpa.h" +#include <qpa/qplatformcursor.h> #endif #include <QtGui/QPixmap> @@ -1090,6 +1091,10 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv QGuiApplicationPrivate::reportLogicalDotsPerInchChange( static_cast<QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *>(e)); break; + case QWindowSystemInterfacePrivate::ScreenRefreshRate: + QGuiApplicationPrivate::reportRefreshRateChange( + static_cast<QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *>(e)); + break; case QWindowSystemInterfacePrivate::ThemeChange: QGuiApplicationPrivate::processThemeChanged( static_cast<QWindowSystemInterfacePrivate::ThemeChangeEvent *>(e)); @@ -1750,6 +1755,21 @@ void QGuiApplicationPrivate::reportLogicalDotsPerInchChange(QWindowSystemInterfa emit s->logicalDotsPerInchChanged(s->logicalDotsPerInch()); } +void QGuiApplicationPrivate::reportRefreshRateChange(QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *e) +{ + // This operation only makes sense after the QGuiApplication constructor runs + if (QCoreApplication::startingUp()) + return; + + if (!e->screen) + return; + + QScreen *s = e->screen.data(); + s->d_func()->refreshRate = e->rate; + + emit s->refreshRateChanged(s->refreshRate()); +} + void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e) { if (!e->exposed) diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 78641de55b..b7b8afc7ad 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -53,14 +53,13 @@ #include "private/qwindowsysteminterface_qpa_p.h" #include "private/qshortcutmap_p.h" -#include "qplatformdrag_qpa.h" - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE class QPlatformIntegration; class QPlatformTheme; +class QPlatformDragQtResponse; struct QDrawHelperGammaTables; class Q_GUI_EXPORT QGuiApplicationPrivate : public QCoreApplicationPrivate @@ -117,6 +116,7 @@ public: static void reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e); static void reportAvailableGeometryChange(QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e); static void reportLogicalDotsPerInchChange(QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e); + static void reportRefreshRateChange(QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *e); static void processThemeChanged(QWindowSystemInterfacePrivate::ThemeChangeEvent *tce); static void processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e); diff --git a/src/gui/kernel/qinputmethod.cpp b/src/gui/kernel/qinputmethod.cpp index 0e0bc7237a..a699938dc6 100644 --- a/src/gui/kernel/qinputmethod.cpp +++ b/src/gui/kernel/qinputmethod.cpp @@ -43,7 +43,7 @@ #include <private/qinputmethod_p.h> #include <qguiapplication.h> #include <qtimer.h> -#include <private/qplatforminputcontext_qpa_p.h> +#include <qpa/qplatforminputcontext_p.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qinputmethod_p.h b/src/gui/kernel/qinputmethod_p.h index 1e55b00318..ad3d2141c1 100644 --- a/src/gui/kernel/qinputmethod_p.h +++ b/src/gui/kernel/qinputmethod_p.h @@ -46,8 +46,8 @@ #include <private/qobject_p.h> #include <QtCore/QWeakPointer> #include <QTransform> -#include <qplatforminputcontext_qpa.h> -#include <qplatformintegration_qpa.h> +#include <qpa/qplatforminputcontext.h> +#include <qpa/qplatformintegration.h> #include <private/qguiapplication_p.h> QT_BEGIN_HEADER diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index d03294f246..f94c6d541e 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -41,7 +41,7 @@ #include "qkeysequence.h" #include "qkeysequence_p.h" -#include "qplatformtheme_qpa.h" +#include <qpa/qplatformtheme.h> #include "private/qguiapplication_p.h" #ifndef QT_NO_SHORTCUT @@ -246,6 +246,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni \row \li Refresh \li F5 \li F5 \li F5 \li Ctrl+R, F5 \row \li ZoomIn \li Ctrl+Plus \li Ctrl+Plus \li Ctrl+Plus \li Ctrl+Plus \row \li ZoomOut \li Ctrl+Minus \li Ctrl+Minus \li Ctrl+Minus \li Ctrl+Minus + \row \li FullScreen \li F11, Alt+Enter \li Ctrl+Meta+F \li F11, Ctrl+Shift+F \li Ctrl+F11 \row \li Print \li Ctrl+P \li Ctrl+P \li Ctrl+P \li Ctrl+P \row \li AddTab \li Ctrl+T \li Ctrl+T \li Ctrl+Shift+N, Ctrl+T \li Ctrl+T \row \li NextChild \li Ctrl+Tab, Forward, Ctrl+F6 \li Ctrl+}, Forward, Ctrl+Tab \li Ctrl+Tab, Forward, Ctrl+Comma \li Ctrl+Tab, Forward @@ -638,8 +639,9 @@ static const struct { { 0, 0 } }; -//Table of key bindings. It must be sorted on key sequence. -//A priority of 1 indicates that this is the primary key binding when multiple are defined. +// Table of key bindings. It must be sorted on key sequence: +// The integer value of VK_KEY | Modifier Keys (e.g., VK_META, and etc.) +// A priority of 1 indicates that this is the primary key binding when multiple are defined. enum KeyPlatform { KB_Win = (1 << QPlatformTheme::WindowsKeyboardScheme), @@ -671,6 +673,7 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = { {QKeySequence::FindNext, 0, Qt::Key_F3, KB_X11}, {QKeySequence::FindNext, 1, Qt::Key_F3, KB_Win}, {QKeySequence::Refresh, 0, Qt::Key_F5, KB_Win | KB_X11}, + {QKeySequence::FullScreen, 1, Qt::Key_F11, KB_Win | KB_KDE}, {QKeySequence::Undo, 0, Qt::Key_F14, KB_X11}, //Undo on sun keyboards {QKeySequence::Copy, 0, Qt::Key_F16, KB_X11}, //Copy on sun keyboards {QKeySequence::Paste, 0, Qt::Key_F18, KB_X11}, //Paste on sun keyboards @@ -749,6 +752,8 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = { {QKeySequence::Close, 1, Qt::CTRL | Qt::Key_F4, KB_Win}, {QKeySequence::Close, 0, Qt::CTRL | Qt::Key_F4, KB_Mac}, {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_F6, KB_Win}, + {QKeySequence::FullScreen, 1, Qt::CTRL | Qt::Key_F11, KB_Gnome}, + {QKeySequence::FullScreen, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_F, KB_KDE}, {QKeySequence::FindPrevious, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_G, KB_Gnome | KB_Mac}, {QKeySequence::FindPrevious, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_G, KB_Win}, {QKeySequence::AddTab, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_N, KB_KDE}, @@ -769,6 +774,7 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = { {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_F6, KB_Win}, {QKeySequence::Undo, 0, Qt::ALT | Qt::Key_Backspace, KB_Win}, {QKeySequence::DeleteStartOfWord, 0, Qt::ALT | Qt::Key_Backspace, KB_Mac}, + {QKeySequence::FullScreen, 0, Qt::ALT | Qt::Key_Enter, KB_Win}, {QKeySequence::DeleteEndOfWord, 0, Qt::ALT | Qt::Key_Delete, KB_Mac}, {QKeySequence::Back, 1, Qt::ALT | Qt::Key_Left, KB_Win | KB_X11}, {QKeySequence::MoveToPreviousWord, 0, Qt::ALT | Qt::Key_Left, KB_Mac}, @@ -797,7 +803,8 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = { {QKeySequence::SelectStartOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_A, KB_Mac}, {QKeySequence::SelectEndOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_E, KB_Mac}, {QKeySequence::SelectStartOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Left, KB_Mac}, - {QKeySequence::SelectEndOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Right, KB_Mac} + {QKeySequence::SelectEndOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Right, KB_Mac}, + {QKeySequence::FullScreen, 1, Qt::META | Qt::CTRL | Qt::Key_F, KB_Mac} }; const uint QKeySequencePrivate::numberOfKeyBindings = sizeof(QKeySequencePrivate::keyBindings)/(sizeof(QKeyBinding)); @@ -879,6 +886,7 @@ const uint QKeySequencePrivate::numberOfKeyBindings = sizeof(QKeySequencePrivate \value WhatsThis Activate "what's this". \value ZoomIn Zoom in. \value ZoomOut Zoom out. + \value FullScreen Toggle the window state to/from full screen. */ /*! diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h index c926e8de1a..4cae253b50 100644 --- a/src/gui/kernel/qkeysequence.h +++ b/src/gui/kernel/qkeysequence.h @@ -137,7 +137,8 @@ public: InsertLineSeparator, SaveAs, Preferences, - Quit + Quit, + FullScreen }; enum SequenceFormat { diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 4668f9e750..b99a4dbd04 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qplatformopenglcontext_qpa.h" -#include "qplatformintegration_qpa.h" +#include <qpa/qplatformopenglcontext.h> +#include <qpa/qplatformintegration.h> #include "qopenglcontext.h" #include "qopenglcontext_p.h" #include "qwindow.h" diff --git a/src/gui/kernel/qplatformclipboard_qpa.h b/src/gui/kernel/qplatformclipboard.h index 95c8103b7e..95c8103b7e 100644 --- a/src/gui/kernel/qplatformclipboard_qpa.h +++ b/src/gui/kernel/qplatformclipboard.h diff --git a/src/gui/kernel/qplatformclipboard_qpa.cpp b/src/gui/kernel/qplatformclipboard_qpa.cpp index 7273450077..5a29606391 100644 --- a/src/gui/kernel/qplatformclipboard_qpa.cpp +++ b/src/gui/kernel/qplatformclipboard_qpa.cpp @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "qplatformclipboard_qpa.h" +#include "qplatformclipboard.h" #ifndef QT_NO_CLIPBOARD diff --git a/src/gui/kernel/qplatformcursor_qpa.h b/src/gui/kernel/qplatformcursor.h index fb3e4604d2..1f339c86b7 100644 --- a/src/gui/kernel/qplatformcursor_qpa.h +++ b/src/gui/kernel/qplatformcursor.h @@ -57,7 +57,7 @@ #include <QtGui/QMouseEvent> #include <QtCore/QWeakPointer> #include <QtCore/QObject> -#include <QtGui/QPlatformScreen> +#include <qpa/qplatformscreen.h> #include <QtGui/QCursor> QT_BEGIN_HEADER diff --git a/src/gui/kernel/qplatformcursor_qpa.cpp b/src/gui/kernel/qplatformcursor_qpa.cpp index 5ea080c40a..40b7967af7 100644 --- a/src/gui/kernel/qplatformcursor_qpa.cpp +++ b/src/gui/kernel/qplatformcursor_qpa.cpp @@ -38,13 +38,13 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "qplatformcursor_qpa.h" +#include "qplatformcursor.h" #include <QPainter> #include <QBitmap> #include <QGuiApplication> #include <QScreen> -#include <QPlatformScreen> +#include <qpa/qplatformscreen.h> #include <private/qguiapplication_p.h> #include <QDebug> diff --git a/src/gui/kernel/qplatformdialoghelper_qpa.h b/src/gui/kernel/qplatformdialoghelper.h index 5cd3ab055b..5966a241ea 100644 --- a/src/gui/kernel/qplatformdialoghelper_qpa.h +++ b/src/gui/kernel/qplatformdialoghelper.h @@ -90,26 +90,20 @@ public: virtual QVariant styleHint(StyleHint hint) const; - virtual void platformNativeDialogModalHelp() = 0; - virtual void _q_platformRunNativeAppModalPanel() = 0; + virtual void exec_sys() = 0; virtual void deleteNativeDialog_sys() = 0; + virtual bool show_sys(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) = 0; virtual void hide_sys() = 0; - virtual DialogCode dialogResultCode_sys() = 0; - static QVariant defaultStyleHint(QPlatformDialogHelper::StyleHint hint); Q_SIGNALS: - void launchNativeAppModalPanel(); void accept(); void reject(); - -protected Q_SLOTS: - void emitLaunchNativeAppModalPanel(); }; class Q_GUI_EXPORT QColorDialogOptions diff --git a/src/gui/kernel/qplatformdialoghelper_qpa.cpp b/src/gui/kernel/qplatformdialoghelper_qpa.cpp index f2114d17e0..f00437f69b 100644 --- a/src/gui/kernel/qplatformdialoghelper_qpa.cpp +++ b/src/gui/kernel/qplatformdialoghelper_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformdialoghelper_qpa.h" +#include "qplatformdialoghelper.h" #include <QtCore/QVariant> #include <QtCore/QSharedData> @@ -94,11 +94,6 @@ QVariant QPlatformDialogHelper::defaultStyleHint(QPlatformDialogHelper::StyleHi return QVariant(); } -void QPlatformDialogHelper::emitLaunchNativeAppModalPanel() -{ - emit launchNativeAppModalPanel(); -} - // Font dialog class QFontDialogOptionsPrivate : public QSharedData diff --git a/src/gui/kernel/qplatformdrag_qpa.h b/src/gui/kernel/qplatformdrag.h index 14282c5a21..14282c5a21 100644 --- a/src/gui/kernel/qplatformdrag_qpa.h +++ b/src/gui/kernel/qplatformdrag.h diff --git a/src/gui/kernel/qplatformdrag_qpa.cpp b/src/gui/kernel/qplatformdrag_qpa.cpp index d9fc3a2ab8..8367ad8e06 100644 --- a/src/gui/kernel/qplatformdrag_qpa.cpp +++ b/src/gui/kernel/qplatformdrag_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformdrag_qpa.h" +#include "qplatformdrag.h" #include <QtGui/private/qdnd_p.h> #include <QtGui/QKeyEvent> diff --git a/src/gui/kernel/qplatforminputcontext_qpa.h b/src/gui/kernel/qplatforminputcontext.h index 696146b859..696146b859 100644 --- a/src/gui/kernel/qplatforminputcontext_qpa.h +++ b/src/gui/kernel/qplatforminputcontext.h diff --git a/src/gui/kernel/qplatforminputcontext_qpa_p.h b/src/gui/kernel/qplatforminputcontext_p.h index dc12d26ffc..dc12d26ffc 100644 --- a/src/gui/kernel/qplatforminputcontext_qpa_p.h +++ b/src/gui/kernel/qplatforminputcontext_p.h diff --git a/src/gui/kernel/qplatforminputcontext_qpa.cpp b/src/gui/kernel/qplatforminputcontext_qpa.cpp index 53839088c5..0a8633b61d 100644 --- a/src/gui/kernel/qplatforminputcontext_qpa.cpp +++ b/src/gui/kernel/qplatforminputcontext_qpa.cpp @@ -39,11 +39,11 @@ ** ****************************************************************************/ -#include <qplatforminputcontext_qpa.h> +#include "qplatforminputcontext.h" #include <qguiapplication.h> #include <QRect> #include "private/qkeymapper_p.h" -#include "private/qplatforminputcontext_qpa_p.h" +#include <qpa/qplatforminputcontext_p.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration.h index a44f4343ef..fb62dafc5c 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration.h @@ -54,7 +54,7 @@ // #include <QtGui/qwindowdefs.h> -#include <QtGui/qplatformscreen_qpa.h> +#include <qpa/qplatformscreen.h> #include <QtGui/qsurfaceformat.h> QT_BEGIN_HEADER diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp index 5269d8fb24..8e4ed05576 100644 --- a/src/gui/kernel/qplatformintegration_qpa.cpp +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -39,15 +39,15 @@ ** ****************************************************************************/ -#include "qplatformintegration_qpa.h" +#include "qplatformintegration.h" -#include <QtGui/QPlatformFontDatabase> -#include <QtGui/QPlatformClipboard> -#include <QtGui/QPlatformAccessibility> -#include <QtGui/QPlatformTheme> +#include <qpa/qplatformfontdatabase.h> +#include <qpa/qplatformclipboard.h> +#include <qpa/qplatformaccessibility.h> +#include <qpa/qplatformtheme.h> #include <QtGui/private/qguiapplication_p.h> #include <QtGui/private/qpixmap_raster_p.h> -#include <QtGui/private/qplatformscreen_qpa_p.h> +#include <qpa/qplatformscreen_p.h> #include <private/qdnd_p.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatformintegrationfactory_qpa_p.h b/src/gui/kernel/qplatformintegrationfactory_p.h index 4aae7898fa..4aae7898fa 100644 --- a/src/gui/kernel/qplatformintegrationfactory_qpa_p.h +++ b/src/gui/kernel/qplatformintegrationfactory_p.h diff --git a/src/gui/kernel/qplatformintegrationfactory_qpa.cpp b/src/gui/kernel/qplatformintegrationfactory_qpa.cpp index a84c243355..3b05742f09 100644 --- a/src/gui/kernel/qplatformintegrationfactory_qpa.cpp +++ b/src/gui/kernel/qplatformintegrationfactory_qpa.cpp @@ -39,10 +39,11 @@ ** ****************************************************************************/ -#include "qplatformintegrationfactory_qpa_p.h" -#include <QPlatformIntegrationPlugin> +#include <qpa/qplatformintegrationfactory_p.h> +#include <qpa/qplatformintegrationplugin.h> #include "private/qfactoryloader_p.h" #include "qmutex.h" +#include "qdir.h" #include "qguiapplication.h" #include "qdebug.h" @@ -58,26 +59,20 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, QPlatformIntegration *QPlatformIntegrationFactory::create(const QString& key, const QString &platformPluginPath) { - QPlatformIntegration *ret = 0; QStringList paramList = key.split(QLatin1Char(':')); - QString platform = paramList.takeFirst().toLower(); + const QString platform = paramList.takeFirst().toLower(); #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) // Try loading the plugin from platformPluginPath first: if (!platformPluginPath.isEmpty()) { QCoreApplication::addLibraryPath(platformPluginPath); - if (QPlatformIntegrationFactoryInterface *factory = - qobject_cast<QPlatformIntegrationFactoryInterface*>(directLoader()->instance(platform))) - ret = factory->create(key, paramList); - - if (ret) + if (QPlatformIntegration *ret = qLoadPlugin1<QPlatformIntegration, QPlatformIntegrationFactoryInterface >(directLoader(), platform, paramList)) return ret; } - if (QPlatformIntegrationFactoryInterface *factory = qobject_cast<QPlatformIntegrationFactoryInterface*>(loader()->instance(platform))) - ret = factory->create(platform, paramList); + if (QPlatformIntegration *ret = qLoadPlugin1<QPlatformIntegration, QPlatformIntegrationFactoryInterface >(loader(), platform, paramList)) + return ret; #endif - - return ret; + return 0; } /*! @@ -86,23 +81,28 @@ QPlatformIntegration *QPlatformIntegrationFactory::create(const QString& key, co \sa create() */ + QStringList QPlatformIntegrationFactory::keys(const QString &platformPluginPath) { #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) QStringList list; - if (!platformPluginPath.isEmpty()) { QCoreApplication::addLibraryPath(platformPluginPath); - foreach (const QString &key, directLoader()->keys()) { - list += key + QString(QLatin1String(" (from %1)")).arg(platformPluginPath); + list = directLoader()->keyMap().values(); + if (!list.isEmpty()) { + const QString postFix = QStringLiteral(" (from ") + + QDir::toNativeSeparators(platformPluginPath) + + QLatin1Char(')'); + const QStringList::iterator end = list.end(); + for (QStringList::iterator it = list.begin(); it != end; ++it) + (*it).append(postFix); } } - - list += loader()->keys(); + list.append(loader()->keyMap().values()); + return list; #else - QStringList list; + return QStringList(); #endif - return list; } QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformintegrationplugin_qpa.h b/src/gui/kernel/qplatformintegrationplugin.h index d70569cbba..d70569cbba 100644 --- a/src/gui/kernel/qplatformintegrationplugin_qpa.h +++ b/src/gui/kernel/qplatformintegrationplugin.h diff --git a/src/gui/kernel/qplatformintegrationplugin_qpa.cpp b/src/gui/kernel/qplatformintegrationplugin_qpa.cpp index 7bd1caa1d3..d4debd1f3a 100644 --- a/src/gui/kernel/qplatformintegrationplugin_qpa.cpp +++ b/src/gui/kernel/qplatformintegrationplugin_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformintegrationplugin_qpa.h" +#include "qplatformintegrationplugin.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.h b/src/gui/kernel/qplatformnativeinterface.h index 918ba4a9b8..918ba4a9b8 100644 --- a/src/gui/kernel/qplatformnativeinterface_qpa.h +++ b/src/gui/kernel/qplatformnativeinterface.h diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.cpp b/src/gui/kernel/qplatformnativeinterface_qpa.cpp index c17eee4415..f0bd3f0658 100644 --- a/src/gui/kernel/qplatformnativeinterface_qpa.cpp +++ b/src/gui/kernel/qplatformnativeinterface_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformnativeinterface_qpa.h" +#include "qplatformnativeinterface.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatformopenglcontext_qpa.h b/src/gui/kernel/qplatformopenglcontext.h index ddcb87ad5a..ddcb87ad5a 100644 --- a/src/gui/kernel/qplatformopenglcontext_qpa.h +++ b/src/gui/kernel/qplatformopenglcontext.h diff --git a/src/gui/kernel/qplatformopenglcontext_qpa.cpp b/src/gui/kernel/qplatformopenglcontext_qpa.cpp index 33adc26482..d38a5864d6 100644 --- a/src/gui/kernel/qplatformopenglcontext_qpa.cpp +++ b/src/gui/kernel/qplatformopenglcontext_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformopenglcontext_qpa.h" +#include "qplatformopenglcontext.h" #include <QOpenGLFunctions> diff --git a/src/gui/kernel/qplatformscreen_qpa.h b/src/gui/kernel/qplatformscreen.h index 71d734867e..1743024d91 100644 --- a/src/gui/kernel/qplatformscreen_qpa.h +++ b/src/gui/kernel/qplatformscreen.h @@ -63,7 +63,7 @@ #include <QtGui/qcursor.h> #include <QtGui/qimage.h> #include <QtGui/qwindowdefs.h> -#include <QtGui/qplatformpixmap_qpa.h> +#include <qpa/qplatformpixmap.h> QT_BEGIN_HEADER @@ -101,6 +101,8 @@ public: virtual QSizeF physicalSize() const; virtual QDpi logicalDpi() const; + virtual qreal refreshRate() const; + virtual Qt::ScreenOrientation orientation() const; virtual QWindow *topLevelAt(const QPoint &point) const; diff --git a/src/gui/kernel/qplatformscreen_qpa_p.h b/src/gui/kernel/qplatformscreen_p.h index ced66be8d7..ced66be8d7 100644 --- a/src/gui/kernel/qplatformscreen_qpa_p.h +++ b/src/gui/kernel/qplatformscreen_p.h diff --git a/src/gui/kernel/qplatformscreen_qpa.cpp b/src/gui/kernel/qplatformscreen_qpa.cpp index 022f198073..1fd96a80a5 100644 --- a/src/gui/kernel/qplatformscreen_qpa.cpp +++ b/src/gui/kernel/qplatformscreen_qpa.cpp @@ -39,12 +39,12 @@ ** ****************************************************************************/ -#include "qplatformscreen_qpa.h" +#include "qplatformscreen.h" #include <QtGui/qguiapplication.h> -#include <QtGui/qplatformcursor_qpa.h> +#include <qpa/qplatformcursor.h> #include <QtGui/private/qguiapplication_p.h> -#include <QtGui/private/qplatformscreen_qpa_p.h> -#include <QtGui/qplatformintegration_qpa.h> +#include <qpa/qplatformscreen_p.h> +#include <qpa/qplatformintegration.h> #include <QtGui/qscreen.h> #include <QtGui/qwindow.h> @@ -123,8 +123,8 @@ QScreen *QPlatformScreen::screen() const /*! Reimplement this function in subclass to return the physical size of the - screen. The physical size represents the actual physical dimensions of - the display. + screen, in millimeters. The physical size represents the actual physical + dimensions of the display. The default implementation takes the pixel size of the screen, considers a resolution of 100 dots per inch, and returns the calculated physical size. @@ -161,6 +161,17 @@ QDpi QPlatformScreen::logicalDpi() const } /*! + Reimplement this function in subclass to return the vertical refresh rate + of the screen, in Hz. + + The default returns 60, a sensible default for modern displays. +*/ +qreal QPlatformScreen::refreshRate() const +{ + return 60; +} + +/*! Reimplement this function in subclass to return the current orientation of the screen, for example based on accelerometer data to determine the device orientation. diff --git a/src/gui/kernel/qplatformscreenpageflipper_qpa.h b/src/gui/kernel/qplatformscreenpageflipper.h index 116d2dbf82..116d2dbf82 100644 --- a/src/gui/kernel/qplatformscreenpageflipper_qpa.h +++ b/src/gui/kernel/qplatformscreenpageflipper.h diff --git a/src/gui/kernel/qplatformscreenpageflipper_qpa.cpp b/src/gui/kernel/qplatformscreenpageflipper_qpa.cpp index b912c6055e..babecb061f 100644 --- a/src/gui/kernel/qplatformscreenpageflipper_qpa.cpp +++ b/src/gui/kernel/qplatformscreenpageflipper_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformscreenpageflipper_qpa.h" +#include "qplatformscreenpageflipper.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatformservices_qpa.h b/src/gui/kernel/qplatformservices.h index c9bfe020ab..c9bfe020ab 100644 --- a/src/gui/kernel/qplatformservices_qpa.h +++ b/src/gui/kernel/qplatformservices.h diff --git a/src/gui/kernel/qplatformservices_qpa.cpp b/src/gui/kernel/qplatformservices_qpa.cpp index 7993a82f4e..dac9e64e40 100644 --- a/src/gui/kernel/qplatformservices_qpa.cpp +++ b/src/gui/kernel/qplatformservices_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformservices_qpa.h" +#include "qplatformservices.h" #include <QtCore/QUrl> #include <QtCore/QString> diff --git a/src/gui/kernel/qplatformsharedgraphicscache_qpa.h b/src/gui/kernel/qplatformsharedgraphicscache.h index 679b8ab7de..679b8ab7de 100644 --- a/src/gui/kernel/qplatformsharedgraphicscache_qpa.h +++ b/src/gui/kernel/qplatformsharedgraphicscache.h diff --git a/src/gui/kernel/qplatformsharedgraphicscache_qpa.cpp b/src/gui/kernel/qplatformsharedgraphicscache_qpa.cpp index 539bb1458f..a3bb8da358 100644 --- a/src/gui/kernel/qplatformsharedgraphicscache_qpa.cpp +++ b/src/gui/kernel/qplatformsharedgraphicscache_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformsharedgraphicscache_qpa.h" +#include "qplatformsharedgraphicscache.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatformsurface_qpa.h b/src/gui/kernel/qplatformsurface.h index f64a697fc5..f64a697fc5 100644 --- a/src/gui/kernel/qplatformsurface_qpa.h +++ b/src/gui/kernel/qplatformsurface.h diff --git a/src/gui/kernel/qplatformsurface_qpa.cpp b/src/gui/kernel/qplatformsurface_qpa.cpp index 1f752fe3e2..50cdd68ab6 100644 --- a/src/gui/kernel/qplatformsurface_qpa.cpp +++ b/src/gui/kernel/qplatformsurface_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformsurface_qpa.h" +#include "qplatformsurface.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatformtheme_qpa.h b/src/gui/kernel/qplatformtheme.h index 8d936e8267..f4406ffabc 100644 --- a/src/gui/kernel/qplatformtheme_qpa.h +++ b/src/gui/kernel/qplatformtheme.h @@ -86,7 +86,8 @@ public: DialogButtonBoxLayout, DialogButtonBoxButtonsHaveIcons, UseFullScreenForPopupMenu, - KeyboardScheme + KeyboardScheme, + UiEffects }; enum DialogType { @@ -149,6 +150,17 @@ public: CdeKeyboardScheme }; + enum UiEffect + { + GeneralUiEffect = 0x1, + AnimateMenuUiEffect = 0x2, + FadeMenuUiEffect = 0x4, + AnimateComboUiEffect = 0x8, + AnimateTooltipUiEffect = 0x10, + FadeTooltipUiEffect = 0x20, + AnimateToolBoxUiEffect = 0x40 + }; + virtual ~QPlatformTheme(); virtual QPlatformMenu *createPlatformMenu(QMenu *menu = 0) const; diff --git a/src/gui/kernel/qplatformtheme_qpa.cpp b/src/gui/kernel/qplatformtheme_qpa.cpp index c6314825d7..c9ffbe248f 100644 --- a/src/gui/kernel/qplatformtheme_qpa.cpp +++ b/src/gui/kernel/qplatformtheme_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformtheme_qpa.h" +#include "qplatformtheme.h" #include <QtCore/QVariant> #include <QtCore/QStringList> @@ -99,6 +99,8 @@ QT_BEGIN_NAMESPACE \value KeyboardScheme (int) An integer value (enum KeyboardSchemes) specifying the keyboard scheme. + \value UiEffects (int) A flag value consisting of UiEffect values specifying the enabled UI animations. + \sa themeHint(), QStyle::pixelMetric() */ @@ -175,6 +177,8 @@ QVariant QPlatformTheme::themeHint(ThemeHint hint) const return QVariant(-1); case KeyboardScheme: return QVariant(int(WindowsKeyboardScheme)); + case UiEffects: + return QVariant(int(0)); } return QVariant(); } diff --git a/src/gui/kernel/qplatformthemefactory_qpa_p.h b/src/gui/kernel/qplatformthemefactory_p.h index 4d659812dc..4d659812dc 100644 --- a/src/gui/kernel/qplatformthemefactory_qpa_p.h +++ b/src/gui/kernel/qplatformthemefactory_p.h diff --git a/src/gui/kernel/qplatformthemefactory_qpa.cpp b/src/gui/kernel/qplatformthemefactory_qpa.cpp index c023a73e7e..c809a7fba3 100644 --- a/src/gui/kernel/qplatformthemefactory_qpa.cpp +++ b/src/gui/kernel/qplatformthemefactory_qpa.cpp @@ -39,8 +39,9 @@ ** ****************************************************************************/ -#include "qplatformthemefactory_qpa_p.h" -#include <QPlatformThemePlugin> +#include <qpa/qplatformthemefactory_p.h> +#include <qpa/qplatformthemeplugin.h> +#include <QDir> #include "private/qfactoryloader_p.h" #include "qmutex.h" @@ -58,26 +59,20 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, QPlatformTheme *QPlatformThemeFactory::create(const QString& key, const QString &platformPluginPath) { - QPlatformTheme *ret = 0; QStringList paramList = key.split(QLatin1Char(':')); - QString platform = paramList.takeFirst().toLower(); + const QString platform = paramList.takeFirst().toLower(); #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) // Try loading the plugin from platformPluginPath first: if (!platformPluginPath.isEmpty()) { QCoreApplication::addLibraryPath(platformPluginPath); - if (QPlatformThemeFactoryInterface *factory = - qobject_cast<QPlatformThemeFactoryInterface*>(directLoader()->instance(platform))) - ret = factory->create(key, paramList); - - if (ret) + if (QPlatformTheme *ret = qLoadPlugin1<QPlatformTheme, QPlatformThemeFactoryInterface>(directLoader(), platform, paramList)) return ret; } - if (QPlatformThemeFactoryInterface *factory = qobject_cast<QPlatformThemeFactoryInterface*>(loader()->instance(platform))) - ret = factory->create(platform, paramList); + if (QPlatformTheme *ret = qLoadPlugin1<QPlatformTheme, QPlatformThemeFactoryInterface>(loader(), platform, paramList)) + return ret; #endif - - return ret; + return 0; } /*! @@ -93,16 +88,21 @@ QStringList QPlatformThemeFactory::keys(const QString &platformPluginPath) if (!platformPluginPath.isEmpty()) { QCoreApplication::addLibraryPath(platformPluginPath); - foreach (const QString &key, directLoader()->keys()) { - list += key + QString(QLatin1String(" (from %1)")).arg(platformPluginPath); + list += directLoader()->keyMap().values(); + if (!list.isEmpty()) { + const QString postFix = QStringLiteral(" (from ") + + QDir::toNativeSeparators(platformPluginPath) + + QLatin1Char(')'); + const QStringList::iterator end = list.end(); + for (QStringList::iterator it = list.begin(); it != end; ++it) + (*it).append(postFix); } } - - list += loader()->keys(); + list += loader()->keyMap().values(); + return list; #else - QStringList list; + return QStringList(); #endif - return list; } QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformthemeplugin_qpa.h b/src/gui/kernel/qplatformthemeplugin.h index 3ce7cc5b02..3ce7cc5b02 100644 --- a/src/gui/kernel/qplatformthemeplugin_qpa.h +++ b/src/gui/kernel/qplatformthemeplugin.h diff --git a/src/gui/kernel/qplatformthemeplugin_qpa.cpp b/src/gui/kernel/qplatformthemeplugin_qpa.cpp index da2743d6e3..be18716b28 100644 --- a/src/gui/kernel/qplatformthemeplugin_qpa.cpp +++ b/src/gui/kernel/qplatformthemeplugin_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformthemeplugin_qpa.h" +#include "qplatformthemeplugin.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatformwindow_qpa.h b/src/gui/kernel/qplatformwindow.h index 729f35e025..0b4c675e56 100644 --- a/src/gui/kernel/qplatformwindow_qpa.h +++ b/src/gui/kernel/qplatformwindow.h @@ -58,8 +58,8 @@ #include <QtCore/qstring.h> #include <QtGui/qwindowdefs.h> #include <QtGui/qwindow.h> -#include <QtGui/qplatformopenglcontext_qpa.h> -#include <QtGui/qplatformsurface_qpa.h> +#include <qpa/qplatformopenglcontext.h> +#include <qpa/qplatformsurface.h> QT_BEGIN_HEADER diff --git a/src/gui/kernel/qplatformwindow_qpa.cpp b/src/gui/kernel/qplatformwindow_qpa.cpp index b507eb4fdd..20817361f8 100644 --- a/src/gui/kernel/qplatformwindow_qpa.cpp +++ b/src/gui/kernel/qplatformwindow_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformwindow_qpa.h" +#include "qplatformwindow.h" #include <QtGui/qwindowsysteminterface_qpa.h> #include <QtGui/qwindow.h> diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp index 3546ce01dd..2e0df43e66 100644 --- a/src/gui/kernel/qscreen.cpp +++ b/src/gui/kernel/qscreen.cpp @@ -42,7 +42,7 @@ #include "qscreen.h" #include "qscreen_p.h" #include "qpixmap.h" -#include "qplatformscreen_qpa.h" +#include <qpa/qplatformscreen.h> #include <QtCore/private/qobject_p.h> @@ -364,6 +364,16 @@ Qt::ScreenOrientation QScreen::orientation() const } /*! + \property QScreen::refreshRate + \brief the approximate vertical refresh rate of the screen in Hz +*/ +qreal QScreen::refreshRate() const +{ + Q_D(const QScreen); + return d->refreshRate; +} + +/*! \property QScreen::primaryOrientation \brief the primary screen orientation diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h index f69e04a595..17f3cd3d43 100644 --- a/src/gui/kernel/qscreen.h +++ b/src/gui/kernel/qscreen.h @@ -83,6 +83,7 @@ class Q_GUI_EXPORT QScreen : public QObject Q_PROPERTY(QRect availableGeometry READ availableGeometry NOTIFY availableGeometryChanged) Q_PROPERTY(Qt::ScreenOrientation primaryOrientation READ orientation NOTIFY primaryOrientationChanged) Q_PROPERTY(Qt::ScreenOrientation orientation READ orientation NOTIFY orientationChanged) + Q_PROPERTY(qreal refreshRate READ refreshRate NOTIFY refreshRateChanged) public: QPlatformScreen *handle() const; @@ -127,6 +128,8 @@ public: QPixmap grabWindow(WId window, int x, int y, int w, int h); + qreal refreshRate() const; + Q_SIGNALS: void sizeChanged(const QSize &size); void geometryChanged(const QRect &geometry); @@ -140,6 +143,7 @@ Q_SIGNALS: void availableGeometryChanged(const QRect &rect); void primaryOrientationChanged(Qt::ScreenOrientation orientation); void orientationChanged(Qt::ScreenOrientation orientation); + void refreshRateChanged(qreal refreshRate); private: explicit QScreen(QPlatformScreen *screen); diff --git a/src/gui/kernel/qscreen_p.h b/src/gui/kernel/qscreen_p.h index c6bf37e87a..b0e1b8671a 100644 --- a/src/gui/kernel/qscreen_p.h +++ b/src/gui/kernel/qscreen_p.h @@ -43,7 +43,7 @@ #define QSCREEN_P_H #include <QtGui/qscreen.h> -#include <QtGui/qplatformscreen_qpa.h> +#include <qpa/qplatformscreen.h> #include <QtCore/private/qobject_p.h> @@ -63,6 +63,7 @@ public: geometry = screen->geometry(); availableGeometry = screen->availableGeometry(); logicalDpi = screen->logicalDpi(); + refreshRate = screen->refreshRate(); updatePrimaryOrientation(); } @@ -74,6 +75,7 @@ public: QRect geometry; QRect availableGeometry; QDpi logicalDpi; + qreal refreshRate; QPlatformScreen *platformScreen; }; diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp index 9384d34097..a98e5fbd76 100644 --- a/src/gui/kernel/qstylehints.cpp +++ b/src/gui/kernel/qstylehints.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include <qstylehints.h> -#include <qplatformintegration_qpa.h> +#include <qpa/qplatformintegration.h> #include <private/qguiapplication_p.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 8b37fce50c..6183b3f6ac 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -41,11 +41,11 @@ #include "qwindow.h" -#include "qplatformwindow_qpa.h" -#include "qplatformintegration_qpa.h" +#include <qpa/qplatformwindow.h> +#include <qpa/qplatformintegration.h> #include "qsurfaceformat.h" #ifndef QT_NO_OPENGL -#include "qplatformopenglcontext_qpa.h" +#include <qpa/qplatformopenglcontext.h> #include "qopenglcontext.h" #endif #include "qscreen.h" diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index 0afd903ead..92eaf90188 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -43,7 +43,7 @@ #define QWINDOW_P_H #include <QtGui/qwindow.h> -#include <QtGui/qplatformwindow_qpa.h> +#include <qpa/qplatformwindow.h> #include <QtCore/private/qobject_p.h> diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp index a0b77b8208..c3136b0b0a 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp +++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp @@ -39,13 +39,13 @@ ** ****************************************************************************/ #include "qwindowsysteminterface_qpa.h" -#include "qplatformwindow_qpa.h" +#include <qpa/qplatformwindow.h> #include "qwindowsysteminterface_qpa_p.h" #include "private/qguiapplication_p.h" #include "private/qevent_p.h" #include "private/qtouchdevice_p.h" #include <QAbstractEventDispatcher> -#include <QPlatformDrag> +#include <qpa/qplatformdrag.h> #include <qdebug.h> QT_BEGIN_NAMESPACE @@ -434,6 +434,13 @@ void QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(QScreen *scree QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); } +void QWindowSystemInterface::handleScreenRefreshRateChange(QScreen *screen, qreal newRefreshRate) +{ + QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *e = + new QWindowSystemInterfacePrivate::ScreenRefreshRateEvent(screen, newRefreshRate); + QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); +} + void QWindowSystemInterface::handleThemeChange(QWindow *tlw) { QWindowSystemInterfacePrivate::ThemeChangeEvent *e = new QWindowSystemInterfacePrivate::ThemeChangeEvent(tlw); diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h index 1fbf430bf9..7e0ebf0efc 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa.h @@ -144,6 +144,7 @@ public: static void handleScreenGeometryChange(QScreen *screen, const QRect &newGeometry); static void handleScreenAvailableGeometryChange(QScreen *screen, const QRect &newAvailableGeometry); static void handleScreenLogicalDotsPerInchChange(QScreen *screen, qreal newDpiX, qreal newDpiY); + static void handleScreenRefreshRateChange(QScreen *screen, qreal newRefreshRate); static void handleThemeChange(QWindow *tlw); diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h index d7be7699e9..c7ad197b3c 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h @@ -66,6 +66,7 @@ public: ScreenGeometry, ScreenAvailableGeometry, ScreenLogicalDotsPerInch, + ScreenRefreshRate, ThemeChange, Expose }; @@ -233,6 +234,14 @@ public: qreal dpiY; }; + class ScreenRefreshRateEvent : public WindowSystemEvent { + public: + ScreenRefreshRateEvent(QScreen *s, qreal r) + : WindowSystemEvent(ScreenRefreshRate), screen(s), rate(r) { } + QWeakPointer<QScreen> screen; + qreal rate; + }; + class ThemeChangeEvent : public WindowSystemEvent { public: explicit ThemeChangeEvent(QWindow * w) diff --git a/src/gui/opengl/qopenglbuffer.cpp b/src/gui/opengl/qopenglbuffer.cpp index f47f71c121..045eec060b 100644 --- a/src/gui/opengl/qopenglbuffer.cpp +++ b/src/gui/opengl/qopenglbuffer.cpp @@ -523,18 +523,7 @@ void *QOpenGLBuffer::map(QOpenGLBuffer::Access access) #endif if (!d->guard || !d->guard->id()) return 0; -#if 0 - if (!glMapBufferARB) - return 0; - return glMapBufferARB(d->type, access); -#endif - Q_UNUSED(access); - static bool warned = false; - if (!warned) { - qWarning("QOpenGLBuffer::map(): pending implementation"); - warned = true; - } - return 0; + return d->funcs->glMapBuffer(d->type, access); } /*! @@ -559,17 +548,7 @@ bool QOpenGLBuffer::unmap() #endif if (!d->guard || !d->guard->id()) return false; -#if 0 - if (!glUnmapBufferARB) - return false; - return glUnmapBufferARB(d->type) == GL_TRUE; -#endif - static bool warned = false; - if (!warned) { - qWarning("QOpenGLBuffer::map(): pending implementation"); - warned = true; - } - return 0; + return d->funcs->glUnmapBuffer(d->type) == GL_TRUE; } QT_END_NAMESPACE diff --git a/src/gui/opengl/qopengltexturecache.cpp b/src/gui/opengl/qopengltexturecache.cpp index e4d5ff974d..d514d714bd 100644 --- a/src/gui/opengl/qopengltexturecache.cpp +++ b/src/gui/opengl/qopengltexturecache.cpp @@ -42,7 +42,7 @@ #include "qopengltexturecache_p.h" #include <private/qopenglcontext_p.h> #include <private/qimagepixmapcleanuphooks_p.h> -#include <qplatformpixmap_qpa.h> +#include <qpa/qplatformpixmap.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index a8f6a5bf8f..7a20f35b33 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -33,7 +33,7 @@ HEADERS += \ painting/qstroker_p.h \ painting/qtextureglyphcache_p.h \ painting/qtransform.h \ - painting/qplatformbackingstore_qpa.h \ + painting/qplatformbackingstore.h \ painting/qpaintbuffer_p.h \ painting/qpathsimplifier_p.h diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index 63f7ba594f..14694769a9 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -42,8 +42,8 @@ #include <qbackingstore.h> #include <qwindow.h> #include <qpixmap.h> -#include <qplatformbackingstore_qpa.h> -#include <qplatformintegration_qpa.h> +#include <qpa/qplatformbackingstore.h> +#include <qpa/qplatformintegration.h> #include <qscreen.h> #include <private/qguiapplication_p.h> diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp index 57dc5710fa..1a1accc965 100644 --- a/src/gui/painting/qbezier.cpp +++ b/src/gui/painting/qbezier.cpp @@ -54,17 +54,6 @@ QT_BEGIN_NAMESPACE //#define QDEBUG_BEZIER -#ifdef FLOAT_ACCURACY -#define INV_EPS (1L<<23) -#else -/* The value of 1.0 / (1L<<14) is enough for most applications */ -#define INV_EPS (1L<<14) -#endif - -#ifndef M_SQRT2 -#define M_SQRT2 1.41421356237309504880 -#endif - /*! \internal */ diff --git a/src/gui/painting/qplatformbackingstore_qpa.h b/src/gui/painting/qplatformbackingstore.h index a4df63f4d4..a4df63f4d4 100644 --- a/src/gui/painting/qplatformbackingstore_qpa.h +++ b/src/gui/painting/qplatformbackingstore.h diff --git a/src/gui/painting/qplatformbackingstore_qpa.cpp b/src/gui/painting/qplatformbackingstore_qpa.cpp index 485190d301..34cda00a6e 100644 --- a/src/gui/painting/qplatformbackingstore_qpa.cpp +++ b/src/gui/painting/qplatformbackingstore_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include <qplatformbackingstore_qpa.h> +#include "qplatformbackingstore.h" #include <qwindow.h> #include <qpixmap.h> #include <private/qwindow_p.h> diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index cd1556070e..f64b3e823d 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -62,7 +62,7 @@ #include <private/qtextengine_p.h> #include <limits.h> -#include <QtGui/qplatformscreen_qpa.h> +#include <qpa/qplatformscreen.h> #include <QtGui/private/qguiapplication_p.h> #include <QtCore/QMutexLocker> diff --git a/src/gui/text/qfont_qpa.cpp b/src/gui/text/qfont_qpa.cpp index b73b03025b..8422409cb3 100644 --- a/src/gui/text/qfont_qpa.cpp +++ b/src/gui/text/qfont_qpa.cpp @@ -40,8 +40,8 @@ ****************************************************************************/ #include <QtGui/private/qguiapplication_p.h> -#include <QtGui/QPlatformIntegration> -#include <QtGui/QPlatformFontDatabase> +#include <qpa/qplatformintegration.h> +#include <qpa/qplatformfontdatabase.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 42096d9ae7..b8e1e0cc3b 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -50,10 +50,10 @@ #include "qfileinfo.h" #include "private/qunicodetables_p.h" #include "qfontengine_p.h" -#include "qplatformintegration_qpa.h" +#include <qpa/qplatformintegration.h> #include <QtGui/private/qguiapplication_p.h> -#include <QtGui/qplatformfontdatabase_qpa.h> +#include <qpa/qplatformfontdatabase.h> #include <stdlib.h> #include <limits.h> diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp index c2a3aa9722..d7e5441931 100644 --- a/src/gui/text/qfontdatabase_qpa.cpp +++ b/src/gui/text/qfontdatabase_qpa.cpp @@ -46,7 +46,7 @@ #include "qplatformdefs.h" #include <QtGui/private/qguiapplication_p.h> -#include <QtGui/qplatformfontdatabase_qpa.h> +#include <qpa/qplatformfontdatabase.h> #include <QtCore/qmath.h> diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp index bf0cfd1404..dcb0a4f8d1 100644 --- a/src/gui/text/qfontengine_qpa.cpp +++ b/src/gui/text/qfontengine_qpa.cpp @@ -48,8 +48,8 @@ #include <QtGui/private/qpaintengine_raster_p.h> #include <QtGui/private/qguiapplication_p.h> -#include <QtGui/QPlatformFontDatabase> -#include <QtGui/QPlatformIntegration> +#include <qpa/qplatformfontdatabase.h> +#include <qpa/qplatformintegration.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/text/qplatformfontdatabase_qpa.h b/src/gui/text/qplatformfontdatabase.h index 08faf8d84f..08faf8d84f 100644 --- a/src/gui/text/qplatformfontdatabase_qpa.h +++ b/src/gui/text/qplatformfontdatabase.h diff --git a/src/gui/text/qplatformfontdatabase_qpa.cpp b/src/gui/text/qplatformfontdatabase_qpa.cpp index 632d2d89d9..3531202eff 100644 --- a/src/gui/text/qplatformfontdatabase_qpa.cpp +++ b/src/gui/text/qplatformfontdatabase_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformfontdatabase_qpa.h" +#include "qplatformfontdatabase.h" #include <QtGui/private/qfontengine_p.h> #include <QtGui/private/qfontengine_qpa_p.h> #include <QtCore/QLibraryInfo> diff --git a/src/gui/text/qrawfont_qpa.cpp b/src/gui/text/qrawfont_qpa.cpp index d037d5902d..7289450e7f 100644 --- a/src/gui/text/qrawfont_qpa.cpp +++ b/src/gui/text/qrawfont_qpa.cpp @@ -44,8 +44,8 @@ #if !defined(QT_NO_RAWFONT) #include "qrawfont_p.h" -#include "qplatformintegration_qpa.h" -#include <QtGui/qplatformfontdatabase_qpa.h> +#include <qpa/qplatformintegration.h> +#include <qpa/qplatformfontdatabase.h> #include <private/qguiapplication_p.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 9848898d66..20f85d02aa 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1008,11 +1008,11 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const entire_shaper_item.item.length = length(item); entire_shaper_item.item.bidiLevel = si.analysis.bidiLevel; - HB_UChar16 upperCased[256]; // XXX what about making this 4096, so we don't have to extend it ever. + QVarLengthArray<HB_UChar16, 256> casedString; if (hasCaseChange(si)) { - HB_UChar16 *uc = upperCased; - if (entire_shaper_item.item.length > 256) - uc = new HB_UChar16[entire_shaper_item.item.length]; + if (casedString.size() < entire_shaper_item.item.length) + casedString.resize(entire_shaper_item.item.length); + HB_UChar16 *uc = casedString.data(); for (uint i = 0; i < entire_shaper_item.item.length; ++i) { if(si.analysis.flags == QScriptAnalysis::Lowercase) uc[i] = QChar::toLower(entire_shaper_item.string[si.position + i]); @@ -1031,25 +1031,16 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const entire_shaper_item.shaperFlags |= HB_ShaperFlag_UseDesignMetrics; entire_shaper_item.num_glyphs = qMax(layoutData->glyphLayout.numGlyphs - layoutData->used, int(entire_shaper_item.item.length)); - if (! ensureSpace(entire_shaper_item.num_glyphs)) { - if (hasCaseChange(si)) - delete [] const_cast<HB_UChar16 *>(entire_shaper_item.string); + if (!ensureSpace(entire_shaper_item.num_glyphs)) return; - } QGlyphLayout initialGlyphs = availableGlyphs(&si).mid(0, entire_shaper_item.num_glyphs); if (!stringToGlyphs(&entire_shaper_item, &initialGlyphs, font)) { - if (! ensureSpace(entire_shaper_item.num_glyphs)) { - if (hasCaseChange(si)) - delete [] const_cast<HB_UChar16 *>(entire_shaper_item.string); + if (!ensureSpace(entire_shaper_item.num_glyphs)) return; - } initialGlyphs = availableGlyphs(&si).mid(0, entire_shaper_item.num_glyphs); - if (!stringToGlyphs(&entire_shaper_item, &initialGlyphs, font)) { // ############ if this happens there's a bug in the fontengine - if (hasCaseChange(si) && entire_shaper_item.string != upperCased) - delete [] const_cast<HB_UChar16 *>(entire_shaper_item.string); return; } } @@ -1119,11 +1110,8 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const remaining_glyphs -= shaper_item.initialGlyphCount; do { - if (! ensureSpace(glyph_pos + shaper_item.num_glyphs + remaining_glyphs)) { - if (hasCaseChange(si)) - delete [] const_cast<HB_UChar16 *>(entire_shaper_item.string); + if (!ensureSpace(glyph_pos + shaper_item.num_glyphs + remaining_glyphs)) return; - } const QGlyphLayout g = availableGlyphs(&si).mid(glyph_pos); if (shaper_item.num_glyphs > shaper_item.item.length) @@ -1163,9 +1151,6 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const si.num_glyphs = glyph_pos; layoutData->used += si.num_glyphs; - - if (hasCaseChange(si) && entire_shaper_item.string != upperCased) - delete [] const_cast<HB_UChar16 *>(entire_shaper_item.string); } static void init(QTextEngine *e) @@ -1414,12 +1399,14 @@ void QTextEngine::itemize() const s = 0; } Q_ASSERT(position <= length); - itemizer.generate(prevPosition, position - prevPosition, - formats()->charFormat(format).fontCapitalization()); + QFont::Capitalization capitalization = + formats()->charFormat(format).hasProperty(QTextFormat::FontCapitalization) + ? formats()->charFormat(format).fontCapitalization() + : formats()->defaultFont().capitalization(); + itemizer.generate(prevPosition, position - prevPosition, capitalization); if (it == end) { if (position < length) - itemizer.generate(position, length - position, - formats()->charFormat(format).fontCapitalization()); + itemizer.generate(position, length - position, capitalization); break; } format = frag->format; diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index aac2390943..4d9a49c15b 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -339,14 +339,6 @@ public: QFontEngine *fontEngine; }; -inline bool qIsControlChar(ushort uc) -{ - return uc >= 0x200b && uc <= 0x206f - && (uc <= 0x200f /* ZW Space, ZWNJ, ZWJ, LRM and RLM */ - || (uc >= 0x2028 && uc <= 0x202f /* LS, PS, LRE, RLE, PDF, LRO, RLO, NNBSP */) - || uc >= 0x206a /* ISS, ASS, IAFS, AFS, NADS, NODS */); -} - struct Q_AUTOTEST_EXPORT QScriptItem { inline QScriptItem() diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri index 6587769712..d0dd0ed129 100644 --- a/src/gui/text/text.pri +++ b/src/gui/text/text.pri @@ -102,7 +102,7 @@ SOURCES += \ text/qrawfont_qpa.cpp HEADERS += \ - text/qplatformfontdatabase_qpa.h + text/qplatformfontdatabase.h DEFINES += QT_NO_OPENTYPE INCLUDEPATH += ../3rdparty/harfbuzz/src diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp index 1535162735..5e83e7cc00 100644 --- a/src/gui/util/qdesktopservices.cpp +++ b/src/gui/util/qdesktopservices.cpp @@ -52,8 +52,8 @@ #include <private/qguiapplication_p.h> #include <qurl.h> #include <qmutex.h> -#include <qplatformservices_qpa.h> -#include <qplatformintegration_qpa.h> +#include <qpa/qplatformservices.h> +#include <qpa/qplatformintegration.h> #include <qdir.h> QT_BEGIN_NAMESPACE |