aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2016-01-18 13:17:12 +0100
committerMitch Curtis <mitch.curtis@theqtcompany.com>2016-01-18 13:31:24 +0000
commit4c715a9c74bd871dfdea203238e6b7b72a3a736c (patch)
tree3f8c9b38631e4e3ca134e87358e4033d857016e4 /src/imports
parentc40541afcbe425b4a7c95ab93d3ba66fcbb95a10 (diff)
QQuickUniversalImageProvider -> QQuickColorImageProvider
Share the same implementation with the upcoming iOS style. Change-Id: I495296832ba57a7c067eb9070ebc5b513d5e0d18 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/controls/universal/qquickuniversalimageprovider.cpp79
-rw-r--r--src/imports/controls/universal/qquickuniversalimageprovider_p.h65
-rw-r--r--src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp4
-rw-r--r--src/imports/controls/universal/universal.pri2
4 files changed, 2 insertions, 148 deletions
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 <QtCore/qdebug.h>
-#include <QtGui/qpainter.h>
-#include <QtGui/qguiapplication.h>
-#include <QtGui/qscreen.h>
-#include <QtGui/qicon.h>
-
-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 <QtQuick/qquickimageprovider.h>
-
-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 <QtQml/qqmlextensionplugin.h>
#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 <QtGui/private/qguiapplication_p.h>
+#include <QtLabsControls/private/qquickcolorimageprovider_p.h>
#include <QtLabsControls/private/qquickstyleselector_p.h>
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<QQuickUniversalFocusRectangle>(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 \