00001 /****************************************************************************** 00002 * This file is part of the Gluon Development Platform 00003 * Copyright (c) 2010 Dan Leinir Turthra Jensen <admin@leinir.dk> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 */ 00019 #include "propertywidgetitemfactory.h" 00020 00021 #include <core/debughelper.h> 00022 00023 #include "nullpropertywidgetitem.h" 00024 #include "textpropertywidgetitem.h" 00025 #include "vectorpropertywidgetitem.h" 00026 #include "boolpropertywidgetitem.h" 00027 #include "floatpropertywidgetitem.h" 00028 #include "intpropertywidgetitem.h" 00029 #include "qsizefpropertywidgetitem.h" 00030 #include "colorpropertywidgetitem.h" 00031 #include "quaternionpropertywidgetitem.h" 00032 #include "qrealpropertywidgetitem.h" 00033 00034 using namespace GluonCreator; 00035 00036 template<> PropertyWidgetItemFactory* GluonCore::Singleton<PropertyWidgetItemFactory>::m_instance = 0; 00037 00038 PropertyWidgetItem* PropertyWidgetItemFactory::create( const QString& type, QWidget* parent ) 00039 { 00040 DEBUG_BLOCK 00041 00042 if( type == "QString" ) 00043 return new TextPropertyWidgetItem( parent ); 00044 if( type == "QVector3D" ) 00045 return new VectorPropertyWidgetItem( parent ); 00046 if( type == "bool" ) 00047 return new BoolPropertyWidgetItem( parent ); 00048 if( type == "float" ) 00049 return new FloatPropertyWidgetItem( parent ); 00050 if( type == "int" ) 00051 return new IntPropertyWidgetItem( parent ); 00052 if( type == "QSizeF" ) 00053 return new QSizeFPropertyWidgetItem( parent ); 00054 if( type == "QColor" ) 00055 return new ColorPropertyWidgetItem( parent ); 00056 if( type == "QQuaternion" ) 00057 return new QuaternionPropertyWidgetItem( parent ); 00058 if( type == "qreal" ) 00059 return new QRealPropertyWidgetItem( parent ); 00060 00061 DEBUG_TEXT( QString( "Attempting to instantiate unknown property widget item of type %1" ).arg( type ) ); 00062 00063 return new NullPropertyWidgetItem( parent ); 00064 00065 } 00066