From 296951a630d932f0834d26efb8912dc04cf79823 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 22 Nov 2011 15:56:10 +0100 Subject: [PATCH] Move registration of QtQuick 2 types to separate class Just a bit of cleanup to make QtQuick2's definition follow the convention of QtQuick1, in preparation of moving QtQuick2 to its own library. Change-Id: If9e19e5f5512f9417373bb977bcb424186554c8f Reviewed-by: Martin Jones --- src/declarative/declarative.pro | 3 ++ src/declarative/qml/qdeclarativeengine.cpp | 10 +---- src/declarative/qtquick2.cpp | 61 +++++++++++++++++++++++++++++ src/declarative/qtquick2_p.h | 63 ++++++++++++++++++++++++++++++ 4 files changed, 129 insertions(+), 8 deletions(-) create mode 100644 src/declarative/qtquick2.cpp create mode 100644 src/declarative/qtquick2_p.h diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro index 31d1e19..266aa65 100644 --- a/src/declarative/declarative.pro +++ b/src/declarative/declarative.pro @@ -36,6 +36,9 @@ include(items/items.pri) include(particles/particles.pri) include(designer/designer.pri) +HEADERS += qtquick2_p.h +SOURCES += qtquick2.cpp + linux-g++-maemo:DEFINES += QDECLARATIVEVIEW_NOBACKGROUND DEFINES += QT_NO_OPENTYPE diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index b677a87..93d2fa9 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -83,9 +83,7 @@ #include -#include -#include -#include +#include #include #ifdef Q_OS_WIN // for %APPDATA% @@ -347,11 +345,7 @@ QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e) { if (!qt_QmlQtModule_registered) { qt_QmlQtModule_registered = true; - QDeclarativeUtilModule::defineModule(); - QDeclarativeEnginePrivate::defineModule(); - QQuickItemsModule::defineModule(); - QQuickParticlesModule::defineModule(); - QDeclarativeValueTypeFactory::registerValueTypes(); + QDeclarativeQtQuick2Module::defineModule(); } } diff --git a/src/declarative/qtquick2.cpp b/src/declarative/qtquick2.cpp new file mode 100644 index 0000000..64739b3 --- /dev/null +++ b/src/declarative/qtquick2.cpp @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtquick2_p.h" +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +void QDeclarativeQtQuick2Module::defineModule() +{ + QDeclarativeUtilModule::defineModule(); + QDeclarativeEnginePrivate::defineModule(); + QQuickItemsModule::defineModule(); + QQuickParticlesModule::defineModule(); + QDeclarativeValueTypeFactory::registerValueTypes(); +} + +QT_END_NAMESPACE + diff --git a/src/declarative/qtquick2_p.h b/src/declarative/qtquick2_p.h new file mode 100644 index 0000000..7e2b334 --- /dev/null +++ b/src/declarative/qtquick2_p.h @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTQUICK2_P_H +#define QTQUICK2_P_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeQtQuick2Module +{ +public: + static void defineModule(); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTQUICK2_P_H -- 2.7.4