Move registration of QtQuick 2 types to separate class
authorKent Hansen <kent.hansen@nokia.com>
Tue, 22 Nov 2011 14:56:10 +0000 (15:56 +0100)
committerQt by Nokia <qt-info@nokia.com>
Thu, 24 Nov 2011 08:10:05 +0000 (09:10 +0100)
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 <martin.jones@nokia.com>
src/declarative/declarative.pro
src/declarative/qml/qdeclarativeengine.cpp
src/declarative/qtquick2.cpp [new file with mode: 0644]
src/declarative/qtquick2_p.h [new file with mode: 0644]

index 31d1e19..266aa65 100644 (file)
@@ -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
index b677a87..93d2fa9 100644 (file)
@@ -83,9 +83,7 @@
 
 #include <private/qobject_p.h>
 
-#include <private/qdeclarativeutilmodule_p.h>
-#include <private/qquickitemsmodule_p.h>
-#include <private/qquickparticlesmodule_p.h>
+#include <private/qtquick2_p.h>
 #include <private/qdeclarativelocale_p.h>
 
 #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 (file)
index 0000000..64739b3
--- /dev/null
@@ -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 <private/qdeclarativeengine_p.h>
+#include <private/qdeclarativeutilmodule_p.h>
+#include <private/qdeclarativevaluetype_p.h>
+#include <private/qquickitemsmodule_p.h>
+#include <private/qquickparticlesmodule_p.h>
+
+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 (file)
index 0000000..7e2b334
--- /dev/null
@@ -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 <private/qdeclarativeglobal_p.h>
+
+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