2014-09-10 17:27:45 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vstandardpropertyfactory.cpp
|
|
|
|
** @author hedgeware <internal(at)hedgeware.net>
|
|
|
|
** @date
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
|
|
|
** All rights reserved. This program and the accompanying materials
|
|
|
|
** are made available under the terms of the GNU Lesser General Public License
|
|
|
|
** (LGPL) version 2.1 which accompanies this distribution, and is available at
|
|
|
|
** http://www.gnu.org/licenses/lgpl-2.1.html
|
|
|
|
**
|
|
|
|
** This library is distributed in the hope that it will be useful,
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
** Lesser General Public License for more details.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#include "vstandardpropertyfactory.h"
|
|
|
|
|
|
|
|
#include "vpropertyfactorymanager.h"
|
|
|
|
|
|
|
|
// Supported Properties
|
|
|
|
#include "vproperty.h"
|
|
|
|
#include "plugins/vboolproperty.h"
|
|
|
|
#include "plugins/vcolorproperty.h"
|
|
|
|
#include "plugins/vemptyproperty.h"
|
|
|
|
#include "plugins/venumproperty.h"
|
|
|
|
#include "plugins/vfileproperty.h"
|
|
|
|
#include "plugins/vnumberproperty.h"
|
|
|
|
#include "plugins/vshortcutproperty.h"
|
|
|
|
#include "plugins/Vector3d/vvector3dproperty.h"
|
|
|
|
|
|
|
|
|
|
|
|
using namespace VPE;
|
|
|
|
|
|
|
|
VStandardPropertyFactory::VStandardPropertyFactory()
|
|
|
|
: VAbstractPropertyFactory()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
VStandardPropertyFactory::VStandardPropertyFactory(VPropertyFactoryManager *manager)
|
|
|
|
: VAbstractPropertyFactory()
|
|
|
|
{
|
2014-09-10 19:57:08 +02:00
|
|
|
if (manager)
|
|
|
|
{
|
2014-09-10 17:27:45 +02:00
|
|
|
manager->registerFactory("string", this);
|
|
|
|
manager->registerFactory("bool", this);
|
|
|
|
manager->registerFactory("color", this);
|
|
|
|
manager->registerFactory("empty", this);
|
|
|
|
manager->registerFactory("enum", this);
|
|
|
|
manager->registerFactory("file", this);
|
|
|
|
manager->registerFactory("integer", this);
|
|
|
|
manager->registerFactory("double", this);
|
|
|
|
manager->registerFactory("shortcut", this);
|
|
|
|
manager->registerFactory("vector3d", this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
VProperty *VStandardPropertyFactory::createProperty(const QString &type, const QString &name)
|
|
|
|
{
|
2014-09-10 19:57:08 +02:00
|
|
|
if (type == QString("string"))
|
|
|
|
{
|
2014-09-10 17:27:45 +02:00
|
|
|
return new VProperty(name);
|
2014-09-10 19:57:08 +02:00
|
|
|
}
|
|
|
|
else if (type == QString("bool"))
|
|
|
|
{
|
2014-09-10 17:27:45 +02:00
|
|
|
return new VBoolProperty(name);
|
2014-09-10 19:57:08 +02:00
|
|
|
}
|
|
|
|
else if (type == QString("color"))
|
|
|
|
{
|
2014-09-10 17:27:45 +02:00
|
|
|
return new VColorProperty(name);
|
2014-09-10 19:57:08 +02:00
|
|
|
}
|
|
|
|
else if (type == QString("empty"))
|
|
|
|
{
|
2014-09-10 17:27:45 +02:00
|
|
|
return new VEmptyProperty(name);
|
2014-09-10 19:57:08 +02:00
|
|
|
}
|
|
|
|
else if (type == QString("enum"))
|
|
|
|
{
|
2014-09-10 17:27:45 +02:00
|
|
|
return new VEnumProperty(name);
|
2014-09-10 19:57:08 +02:00
|
|
|
}
|
|
|
|
else if (type == QString("file"))
|
|
|
|
{
|
2014-09-10 17:27:45 +02:00
|
|
|
return new VFileProperty(name);
|
2014-09-10 19:57:08 +02:00
|
|
|
}
|
|
|
|
else if (type == QString("integer"))
|
|
|
|
{
|
2014-09-10 17:27:45 +02:00
|
|
|
return new VIntegerProperty(name);
|
2014-09-10 19:57:08 +02:00
|
|
|
}
|
|
|
|
else if (type == QString("double"))
|
|
|
|
{
|
2014-09-10 17:27:45 +02:00
|
|
|
return new VDoubleProperty(name);
|
2014-09-10 19:57:08 +02:00
|
|
|
}
|
|
|
|
else if (type == QString("shortcut"))
|
|
|
|
{
|
2014-09-10 17:27:45 +02:00
|
|
|
return new VShortcutProperty(name);
|
2014-09-10 19:57:08 +02:00
|
|
|
}
|
|
|
|
else if (type == QString("vector3d"))
|
|
|
|
{
|
2014-09-10 17:27:45 +02:00
|
|
|
return new QVector3DProperty(name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return nullptr;
|
|
|
|
}
|