From 4c715a9c74bd871dfdea203238e6b7b72a3a736c Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 18 Jan 2016 13:17:12 +0100 Subject: QQuickUniversalImageProvider -> QQuickColorImageProvider Share the same implementation with the upcoming iOS style. Change-Id: I495296832ba57a7c067eb9070ebc5b513d5e0d18 Reviewed-by: Mitch Curtis --- .../universal/qquickuniversalimageprovider.cpp | 79 ---------------------- .../universal/qquickuniversalimageprovider_p.h | 65 ------------------ .../universal/qtlabsuniversalstyleplugin.cpp | 4 +- src/imports/controls/universal/universal.pri | 2 - 4 files changed, 2 insertions(+), 148 deletions(-) delete mode 100644 src/imports/controls/universal/qquickuniversalimageprovider.cpp delete mode 100644 src/imports/controls/universal/qquickuniversalimageprovider_p.h (limited to 'src/imports') diff --git a/src/imports/controls/universal/qquickuniversalimageprovider.cpp b/src/imports/controls/universal/qquickuniversalimageprovider.cpp deleted file mode 100644 index 7cb7b926..00000000 --- a/src/imports/controls/universal/qquickuniversalimageprovider.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Controls module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickuniversalimageprovider_p.h" - -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -QQuickUniversalImageProvider::QQuickUniversalImageProvider() : QQuickImageProvider(Image) -{ -} - -QImage QQuickUniversalImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize) -{ - Q_UNUSED(requestedSize); - - int sep = id.indexOf(QLatin1Char('/')); - QString name = id.left(sep); - QString color = id.mid(sep + 1); - qreal dpr = qApp->primaryScreen()->devicePixelRatio(); - QString file = qt_findAtNxFile(QStringLiteral(":/qt-project.org/imports/Qt/labs/controls/universal/images/") + name + QStringLiteral(".png"), dpr); - - QImage image(file); - if (image.isNull()) { - qWarning() << "QQuickUniversalImageProvider: unknown id:" << id; - return QImage(); - } - - if (size) - *size = image.size(); - - if (!color.isEmpty()) { - QPainter painter(&image); - painter.setCompositionMode(QPainter::CompositionMode_SourceIn); - painter.fillRect(image.rect(), QColor(color)); - } - - return image; -} - -QT_END_NAMESPACE diff --git a/src/imports/controls/universal/qquickuniversalimageprovider_p.h b/src/imports/controls/universal/qquickuniversalimageprovider_p.h deleted file mode 100644 index 15648157..00000000 --- a/src/imports/controls/universal/qquickuniversalimageprovider_p.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Controls module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKUNIVERSALIMAGEPROVIDER_P_H -#define QQUICKUNIVERSALIMAGEPROVIDER_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -QT_BEGIN_NAMESPACE - -class QQuickUniversalImageProvider : public QQuickImageProvider -{ -public: - QQuickUniversalImageProvider(); - - QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) Q_DECL_OVERRIDE; -}; - -QT_END_NAMESPACE - -#endif // QQUICKUNIVERSALIMAGEPROVIDER_P_H diff --git a/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp b/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp index 605c06e5..6e202ce6 100644 --- a/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp +++ b/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp @@ -36,13 +36,13 @@ #include #include "qquickuniversalfocusrectangle_p.h" -#include "qquickuniversalimageprovider_p.h" #include "qquickuniversalprogressring_p.h" #include "qquickuniversalprogressstrip_p.h" #include "qquickuniversalstyle_p.h" #include "qquickuniversaltheme_p.h" #include +#include #include static inline void initResources() @@ -102,7 +102,7 @@ void QtLabsUniversalStylePlugin::initializeEngine(QQmlEngine *engine, const char } } - engine->addImageProvider(QStringLiteral("universal"), new QQuickUniversalImageProvider); + engine->addImageProvider(QStringLiteral("universal"), new QQuickColorImageProvider(QStringLiteral(":/qt-project.org/imports/Qt/labs/controls/universal/images"))); QByteArray import = QByteArray(uri) + ".impl"; qmlRegisterType(import, 1, 0, "FocusRectangle"); diff --git a/src/imports/controls/universal/universal.pri b/src/imports/controls/universal/universal.pri index 8736d352..e576367a 100644 --- a/src/imports/controls/universal/universal.pri +++ b/src/imports/controls/universal/universal.pri @@ -32,7 +32,6 @@ QML_FILES += \ HEADERS += \ $$PWD/qquickuniversalfocusrectangle_p.h \ - $$PWD/qquickuniversalimageprovider_p.h \ $$PWD/qquickuniversalprogressring_p.h \ $$PWD/qquickuniversalprogressstrip_p.h \ $$PWD/qquickuniversalstyle_p.h \ @@ -40,7 +39,6 @@ HEADERS += \ SOURCES += \ $$PWD/qquickuniversalfocusrectangle.cpp \ - $$PWD/qquickuniversalimageprovider.cpp \ $$PWD/qquickuniversalprogressring.cpp \ $$PWD/qquickuniversalprogressstrip.cpp \ $$PWD/qquickuniversalstyle.cpp \ -- cgit v1.2.3