/**************************************************************************** ** ** Copyright (C) 2009 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$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions ** contained in the Technology Preview License Agreement accompanying ** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, 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. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** ** ** ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qsgitemsmodule_p.h" #include "qsgitem.h" #include "qsgitem_p.h" #include "qsgevents_p_p.h" #include "qsgrectangle_p.h" #include "qsgfocusscope_p.h" #include "qsgtext_p.h" #include "qsgtextinput_p.h" #include "qsgtextedit_p.h" #include "qsgimage_p.h" #include "qsgborderimage_p.h" #include "qsgscalegrid_p_p.h" #include "qsgmousearea_p.h" #include "qsgpincharea_p.h" #include "qsgflickable_p.h" #include "qsgflickable_p_p.h" #include "qsglistview_p.h" #include "qsgvisualitemmodel_p.h" #include "qsggridview_p.h" #include "qsgpathview_p.h" #include #include "qsgpositioners_p.h" #include "qsgrepeater_p.h" #include "qsgloader_p.h" #include "qsganimatedimage_p.h" #include "qsgflipable_p.h" #include "qsgtranslate_p.h" #include "qsgstateoperations_p.h" #include "qsganimation_p.h" #include #include //#include "private/qsgpincharea_p.h" #include "qsgcanvasitem_p.h" #include "qsgcontext2d_p.h" #include "qsgsprite_p.h" #include "qsgspriteimage_p.h" #include "qsgdragtarget_p.h" static QDeclarativePrivate::AutoParentResult qsgitem_autoParent(QObject *obj, QObject *parent) { QSGItem *item = qobject_cast(obj); if (!item) return QDeclarativePrivate::IncompatibleObject; QSGItem *parentItem = qobject_cast(parent); if (!parentItem) return QDeclarativePrivate::IncompatibleParent; item->setParentItem(parentItem); return QDeclarativePrivate::Parented; } static void qt_sgitems_defineModule(const char *uri, int major, int minor) { QDeclarativePrivate::RegisterAutoParent autoparent = { 0, &qsgitem_autoParent }; QDeclarativePrivate::qmlregister(QDeclarativePrivate::AutoParentRegistration, &autoparent); #ifdef QT_NO_MOVIE qmlRegisterTypeNotAvailable(uri,major,minor,"AnimatedImage", qApp->translate("QSGAnimatedImage","Qt was built without support for QMovie")); #else qmlRegisterType(uri,major,minor,"AnimatedImage"); #endif qmlRegisterType(uri,major,minor,"BorderImage"); qmlRegisterType(uri,major,minor,"Column"); qmlRegisterType(uri,major,minor,"Drag"); qmlRegisterType(uri,major,minor,"Flickable"); qmlRegisterType(uri,major,minor,"Flipable"); qmlRegisterType(uri,major,minor,"Flow"); // qmlRegisterType(uri,major,minor,"FocusPanel"); qmlRegisterType(uri,major,minor,"FocusScope"); qmlRegisterType(uri,major,minor,"Gradient"); qmlRegisterType(uri,major,minor,"GradientStop"); qmlRegisterType(uri,major,minor,"Grid"); qmlRegisterType(uri,major,minor,"GridView"); qmlRegisterType(uri,major,minor,"Image"); qmlRegisterType(uri,major,minor,"Item"); qmlRegisterType(uri,major,minor,"ListView"); qmlRegisterType(uri,major,minor,"Loader"); qmlRegisterType(uri,major,minor,"MouseArea"); qmlRegisterType(uri,major,minor,"Path"); qmlRegisterType(uri,major,minor,"PathAttribute"); qmlRegisterType(uri,major,minor,"PathCubic"); qmlRegisterType(uri,major,minor,"PathLine"); qmlRegisterType(uri,major,minor,"PathPercent"); qmlRegisterType(uri,major,minor,"PathQuad"); qmlRegisterType(uri,major,minor,"PathView"); #ifndef QT_NO_VALIDATOR qmlRegisterType(uri,major,minor,"IntValidator"); qmlRegisterType(uri,major,minor,"DoubleValidator"); qmlRegisterType(uri,major,minor,"RegExpValidator"); #endif qmlRegisterType(uri,major,minor,"Rectangle"); qmlRegisterType(uri,major,minor,"Repeater"); qmlRegisterType(uri,major,minor,"Row"); qmlRegisterType(uri,major,minor,"Translate"); qmlRegisterType(uri,major,minor,"Rotation"); qmlRegisterType(uri,major,minor,"Scale"); qmlRegisterType(uri,major,minor,"Text"); qmlRegisterType(uri,major,minor,"TextEdit"); qmlRegisterType(uri,major,minor,"TextInput"); qmlRegisterType(uri,major,minor,"ViewSection"); qmlRegisterType(uri,major,minor,"VisualDataModel"); qmlRegisterType(uri,major,minor,"VisualItemModel"); qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); #ifndef QT_NO_VALIDATOR qmlRegisterType(); #endif qmlRegisterType(); #ifndef QT_NO_ACTION qmlRegisterType(); #endif qmlRegisterType(); qmlRegisterType(); qRegisterMetaType("QSGAnchorLine"); qmlRegisterUncreatableType(uri,major,minor,"KeyNavigation",QSGKeyNavigationAttached::tr("KeyNavigation is only available via attached properties")); qmlRegisterUncreatableType(uri,major,minor,"Keys",QSGKeysAttached::tr("Keys is only available via attached properties")); qmlRegisterUncreatableType(uri,major,minor,"LayoutMirroring", QSGLayoutMirroringAttached::tr("LayoutMirroring is only available via attached properties")); qmlRegisterType(uri,major,minor,"PinchArea"); qmlRegisterType(uri,major,minor,"Pinch"); qmlRegisterType(); qmlRegisterType("QtQuick", 2, 0, "ShaderEffectItem"); qmlRegisterType("QtQuick", 2, 0, "ShaderEffectSource"); qmlRegisterUncreatableType("QtQuick", 2, 0, "ShaderEffectMesh", QSGShaderEffectMesh::tr("Cannot create instance of abstract class ShaderEffectMesh.")); qmlRegisterType("QtQuick", 2, 0, "GridMesh"); qmlRegisterUncreatableType("QtQuick", 2, 0, "PaintedItem", QSGPaintedItem::tr("Cannot create instance of abstract class PaintedItem")); qmlRegisterType("QtQuick", 2, 0, "Canvas"); qmlRegisterType(); qmlRegisterType(); qmlRegisterType("QtQuick", 2, 0, "Sprite"); qmlRegisterType("QtQuick", 2, 0, "SpriteImage"); qmlRegisterType(uri, major, minor,"ParentChange"); qmlRegisterType(uri, major, minor,"AnchorChanges"); qmlRegisterType(); qmlRegisterType(uri, major, minor,"AnchorAnimation"); qmlRegisterType(uri, major, minor,"ParentAnimation"); qmlRegisterType("QtQuick", 2, 0, "DragTarget"); qmlRegisterType(); } void QSGItemsModule::defineModule() { static bool initialized = false; if (initialized) return; initialized = true; // XXX todo - Remove before final integration... QByteArray mode = qgetenv("QMLSCENE_IMPORT_NAME"); QByteArray name = "QtQuick"; int majorVersion = 2; int minorVersion = 0; if (mode == "quick1") { majorVersion = 1; } else if (mode == "qt") { name = "Qt"; majorVersion = 4; minorVersion = 7; } qt_sgitems_defineModule(name, majorVersion, minorVersion); }