Changed: #85 Compilation with STLport + EOL

This commit is contained in:
kervala 2013-11-22 11:25:53 +01:00
parent fae156d22d
commit eb7299b8eb

View file

@ -1,434 +1,434 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by> // Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// Project includes // Project includes
#include "property_editor_widget.h" #include "property_editor_widget.h"
#include "world_editor_misc.h" #include "world_editor_misc.h"
// NeL includes // NeL includes
#include <nel/misc/debug.h> #include <nel/misc/debug.h>
// STL includes // STL includes
#include <vector> #include <vector>
#include <string> #include <string>
// Qt includes // Qt includes
#include <QtCore/QModelIndex> #include <QtCore/QModelIndex>
namespace WorldEditor namespace WorldEditor
{ {
PropertyEditorWidget::PropertyEditorWidget(QWidget *parent) PropertyEditorWidget::PropertyEditorWidget(QWidget *parent)
: QWidget(parent) : QWidget(parent)
{ {
m_ui.setupUi(this); m_ui.setupUi(this);
m_stringManager = new QtStringPropertyManager(this); m_stringManager = new QtStringPropertyManager(this);
m_boolManager = new QtBoolPropertyManager(this); m_boolManager = new QtBoolPropertyManager(this);
m_enumManager = new QtEnumPropertyManager(this); m_enumManager = new QtEnumPropertyManager(this);
m_stringArrayManager = new QtTextPropertyManager(this); m_stringArrayManager = new QtTextPropertyManager(this);
QtLineEditFactory *lineEditFactory = new QtLineEditFactory(this); QtLineEditFactory *lineEditFactory = new QtLineEditFactory(this);
QtCheckBoxFactory *boolFactory = new QtCheckBoxFactory(this); QtCheckBoxFactory *boolFactory = new QtCheckBoxFactory(this);
QtEnumEditorFactory *enumFactory = new QtEnumEditorFactory(this); QtEnumEditorFactory *enumFactory = new QtEnumEditorFactory(this);
QtTextEditorFactory *textFactory = new QtTextEditorFactory(this); QtTextEditorFactory *textFactory = new QtTextEditorFactory(this);
m_ui.treePropertyBrowser->setFactoryForManager(m_stringManager, lineEditFactory); m_ui.treePropertyBrowser->setFactoryForManager(m_stringManager, lineEditFactory);
m_ui.treePropertyBrowser->setFactoryForManager(m_boolManager, boolFactory); m_ui.treePropertyBrowser->setFactoryForManager(m_boolManager, boolFactory);
m_ui.treePropertyBrowser->setFactoryForManager(m_enumManager, enumFactory); m_ui.treePropertyBrowser->setFactoryForManager(m_enumManager, enumFactory);
m_ui.treePropertyBrowser->setFactoryForManager(m_stringArrayManager, textFactory); m_ui.treePropertyBrowser->setFactoryForManager(m_stringArrayManager, textFactory);
m_groupManager = new QtGroupPropertyManager(this); m_groupManager = new QtGroupPropertyManager(this);
connect(m_stringManager, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *))); connect(m_stringManager, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *)));
connect(m_boolManager, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *))); connect(m_boolManager, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *)));
connect(m_enumManager, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *))); connect(m_enumManager, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *)));
connect(m_stringArrayManager, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *))); connect(m_stringArrayManager, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *)));
connect(m_boolManager, SIGNAL(resetProperty(QtProperty *)), this, SLOT(resetProperty(QtProperty *))); connect(m_boolManager, SIGNAL(resetProperty(QtProperty *)), this, SLOT(resetProperty(QtProperty *)));
connect(m_stringManager, SIGNAL(resetProperty(QtProperty *)), this, SLOT(resetProperty(QtProperty *))); connect(m_stringManager, SIGNAL(resetProperty(QtProperty *)), this, SLOT(resetProperty(QtProperty *)));
connect(m_enumManager, SIGNAL(resetProperty(QtProperty *)), this, SLOT(resetProperty(QtProperty *))); connect(m_enumManager, SIGNAL(resetProperty(QtProperty *)), this, SLOT(resetProperty(QtProperty *)));
connect(m_stringArrayManager, SIGNAL(resetProperty(QtProperty *)), this, SLOT(resetProperty(QtProperty *))); connect(m_stringArrayManager, SIGNAL(resetProperty(QtProperty *)), this, SLOT(resetProperty(QtProperty *)));
} }
PropertyEditorWidget::~PropertyEditorWidget() PropertyEditorWidget::~PropertyEditorWidget()
{ {
} }
void PropertyEditorWidget::clearProperties() void PropertyEditorWidget::clearProperties()
{ {
m_ui.treePropertyBrowser->clear(); m_ui.treePropertyBrowser->clear();
} }
void PropertyEditorWidget::updateSelection(Node *node) void PropertyEditorWidget::updateSelection(Node *node)
{ {
clearProperties(); clearProperties();
if ((node == 0) || (node->type() != Node::PrimitiveNodeType)) if ((node == 0) || (node->type() != Node::PrimitiveNodeType))
return; return;
blockSignalsOfProperties(true); blockSignalsOfProperties(true);
// The parameter list // The parameter list
std::list<NLLIGO::CPrimitiveClass::CParameter> parameterList; std::list<NLLIGO::CPrimitiveClass::CParameter> parameterList;
PrimitiveNode *primNode = static_cast<PrimitiveNode *>(node); PrimitiveNode *primNode = static_cast<PrimitiveNode *>(node);
const NLLIGO::IPrimitive *primitive = primNode->primitive(); const NLLIGO::IPrimitive *primitive = primNode->primitive();
const NLLIGO::CPrimitiveClass *primClass = primNode->primitiveClass(); const NLLIGO::CPrimitiveClass *primClass = primNode->primitiveClass();
// Use the class or not ? // Use the class or not ?
if (primClass) if (primClass)
{ {
// For each properties of the class // For each properties of the class
for (uint p = 0; p < primClass->Parameters.size(); p++) for (uint p = 0; p < primClass->Parameters.size(); p++)
{ {
// Is the parameter visible ? // Is the parameter visible ?
if (primClass->Parameters[p].Visible) if (primClass->Parameters[p].Visible)
{ {
if (primClass->Parameters[p].Name == "name") if (primClass->Parameters[p].Name == "name")
parameterList.push_front(primClass->Parameters[p]); parameterList.push_front(primClass->Parameters[p]);
else else
parameterList.push_back(primClass->Parameters[p]); parameterList.push_back(primClass->Parameters[p]);
} }
} }
} }
else else
{ {
// For each primitive property // For each primitive property
uint numProp = primitive->getNumProperty(); uint numProp = primitive->getNumProperty();
for (uint p = 0; p < numProp; p++) for (uint p = 0; p < numProp; p++)
{ {
// Get the property // Get the property
std::string propertyName; std::string propertyName;
const NLLIGO::IProperty *prop; const NLLIGO::IProperty *prop;
nlverify(primitive->getProperty(p, propertyName, prop)); nlverify(primitive->getProperty(p, propertyName, prop));
// Add a default property // Add a default property
NLLIGO::CPrimitiveClass::CParameter defProp(*prop, propertyName.c_str()); NLLIGO::CPrimitiveClass::CParameter defProp(*prop, propertyName.c_str());
if (defProp.Name == "name") if (defProp.Name == "name")
parameterList.push_front(defProp); parameterList.push_front(defProp);
else else
parameterList.push_back(defProp); parameterList.push_back(defProp);
} }
} }
// Remove property class // Remove property class
std::list<NLLIGO::CPrimitiveClass::CParameter>::iterator ite = parameterList.begin (); std::list<NLLIGO::CPrimitiveClass::CParameter>::iterator ite = parameterList.begin ();
while (ite != parameterList.end ()) while (ite != parameterList.end ())
{ {
std::list<NLLIGO::CPrimitiveClass::CParameter>::iterator next = ite; std::list<NLLIGO::CPrimitiveClass::CParameter>::iterator next = ite;
next++; next++;
if (ite->Name == "class") if (ite->Name == "class")
{ {
parameterList.erase(ite); parameterList.erase(ite);
} }
ite = next; ite = next;
} }
QtProperty *groupNode; QtProperty *groupNode;
groupNode = m_groupManager->addProperty(QString("%1(%2)").arg(node->data(Qt::DisplayRole).toString()).arg(primClass->Name.c_str())); groupNode = m_groupManager->addProperty(QString("%1(%2)").arg(node->data(Qt::DisplayRole).toString()).arg(primClass->Name.c_str()));
m_ui.treePropertyBrowser->addProperty(groupNode); m_ui.treePropertyBrowser->addProperty(groupNode);
ite = parameterList.begin(); ite = parameterList.begin();
while (ite != parameterList.end()) while (ite != parameterList.end())
{ {
NLLIGO::CPrimitiveClass::CParameter &parameter = (*ite); NLLIGO::CPrimitiveClass::CParameter &parameter = (*ite);
QtProperty *prop; QtProperty *prop;
NLLIGO::IProperty *ligoProperty = 0; NLLIGO::IProperty *ligoProperty = 0;
primitive->getPropertyByName(parameter.Name.c_str(), ligoProperty); primitive->getPropertyByName(parameter.Name.c_str(), ligoProperty);
if (parameter.Type == NLLIGO::CPrimitiveClass::CParameter::ConstString) if (parameter.Type == NLLIGO::CPrimitiveClass::CParameter::ConstString)
prop = addConstStringProperty(ligoProperty, parameter, primitive); prop = addConstStringProperty(ligoProperty, parameter, primitive);
else if (parameter.Type == NLLIGO::CPrimitiveClass::CParameter::String) else if (parameter.Type == NLLIGO::CPrimitiveClass::CParameter::String)
prop = addStringProperty(ligoProperty, parameter, primitive); prop = addStringProperty(ligoProperty, parameter, primitive);
else if (parameter.Type == NLLIGO::CPrimitiveClass::CParameter::StringArray) else if (parameter.Type == NLLIGO::CPrimitiveClass::CParameter::StringArray)
prop = addStringArrayProperty(ligoProperty, parameter, primitive); prop = addStringArrayProperty(ligoProperty, parameter, primitive);
else if (parameter.Type == NLLIGO::CPrimitiveClass::CParameter::ConstStringArray) else if (parameter.Type == NLLIGO::CPrimitiveClass::CParameter::ConstStringArray)
prop = addConstStringArrayProperty(ligoProperty, parameter, primitive); prop = addConstStringArrayProperty(ligoProperty, parameter, primitive);
else else
prop = addBoolProperty(ligoProperty, parameter, primitive); prop = addBoolProperty(ligoProperty, parameter, primitive);
// Default value ? // Default value ?
if ((ligoProperty == NULL) || (ligoProperty->Default)) if ((ligoProperty == NULL) || (ligoProperty->Default))
prop->setModified(false); prop->setModified(false);
else else
prop->setModified(true); prop->setModified(true);
bool staticChildSelected = Utils::ligoConfig()->isStaticChild(*primitive); bool staticChildSelected = Utils::ligoConfig()->isStaticChild(*primitive);
if (parameter.ReadOnly || (staticChildSelected && (parameter.Name == "name"))) if (parameter.ReadOnly || (staticChildSelected && (parameter.Name == "name")))
prop->setEnabled(false); prop->setEnabled(false);
// File ? // File ?
if (parameter.Filename && (parameter.FileExtension.empty() || parameter.Type != NLLIGO::CPrimitiveClass::CParameter::StringArray)) if (parameter.Filename && (parameter.FileExtension.empty() || parameter.Type != NLLIGO::CPrimitiveClass::CParameter::StringArray))
{ {
// TODO: Create an edit box // TODO: Create an edit box
// CHECK: only for ConstString // CHECK: only for ConstString
} }
groupNode->addSubProperty(prop); groupNode->addSubProperty(prop);
ite++; ite++;
} }
blockSignalsOfProperties(false); blockSignalsOfProperties(false);
} }
void PropertyEditorWidget::propertyChanged(QtProperty *property) void PropertyEditorWidget::propertyChanged(QtProperty *property)
{ {
nlinfo(QString("property %1 changed").arg(property->propertyName()).toStdString().c_str()); nlinfo(QString("property %1 changed").arg(property->propertyName()).toUtf8().constData());
} }
void PropertyEditorWidget::resetProperty(QtProperty *property) void PropertyEditorWidget::resetProperty(QtProperty *property)
{ {
nlinfo(QString("property %1 reset").arg(property->propertyName()).toStdString().c_str()); nlinfo(QString("property %1 reset").arg(property->propertyName()).toUtf8().constData());
} }
QtProperty *PropertyEditorWidget::addBoolProperty(const NLLIGO::IProperty *property, QtProperty *PropertyEditorWidget::addBoolProperty(const NLLIGO::IProperty *property,
const NLLIGO::CPrimitiveClass::CParameter &parameter, const NLLIGO::CPrimitiveClass::CParameter &parameter,
const NLLIGO::IPrimitive *primitive) const NLLIGO::IPrimitive *primitive)
{ {
std::string value; std::string value;
std::string name = parameter.Name.c_str(); std::string name = parameter.Name.c_str();
primitive->getPropertyByName(name.c_str(), value); primitive->getPropertyByName(name.c_str(), value);
QtProperty *prop = m_boolManager->addProperty(name.c_str()); QtProperty *prop = m_boolManager->addProperty(name.c_str());
// if (Default) // if (Default)
{ {
//DialogProperties->setDefaultValue (this, value); //DialogProperties->setDefaultValue (this, value);
m_boolManager->setValue(prop, bool((value=="true")?1:0)); m_boolManager->setValue(prop, bool((value=="true")?1:0));
} }
return prop; return prop;
} }
QtProperty *PropertyEditorWidget::addConstStringProperty(const NLLIGO::IProperty *property, QtProperty *PropertyEditorWidget::addConstStringProperty(const NLLIGO::IProperty *property,
const NLLIGO::CPrimitiveClass::CParameter &parameter, const NLLIGO::CPrimitiveClass::CParameter &parameter,
const NLLIGO::IPrimitive *primitive) const NLLIGO::IPrimitive *primitive)
{ {
std::string value; std::string value;
std::string name = parameter.Name.c_str(); std::string name = parameter.Name.c_str();
// Get current value // Get current value
primitive->getPropertyByName(name.c_str(), value); primitive->getPropertyByName(name.c_str(), value);
// Create qt property // Create qt property
QtProperty *prop = m_enumManager->addProperty(parameter.Name.c_str()); QtProperty *prop = m_enumManager->addProperty(parameter.Name.c_str());
QStringList listEnums = getComboValues(parameter); QStringList listEnums = getComboValues(parameter);
if (listEnums.isEmpty()) if (listEnums.isEmpty())
{ {
listEnums << QString(value.c_str()) + tr(" (WRN: Check leveldesign!)"); listEnums << QString(value.c_str()) + tr(" (WRN: Check leveldesign!)");
m_enumManager->setEnumNames(prop, listEnums); m_enumManager->setEnumNames(prop, listEnums);
m_enumManager->setValue(prop, 0); m_enumManager->setValue(prop, 0);
prop->setEnabled(false); prop->setEnabled(false);
} }
else else
{ {
// TODO: check this logic // TODO: check this logic
if (parameter.DefaultValue.empty() || (parameter.DefaultValue[0].Name.empty())) if (parameter.DefaultValue.empty() || (parameter.DefaultValue[0].Name.empty()))
listEnums.prepend(""); listEnums.prepend("");
// Fill qt property // Fill qt property
m_enumManager->setEnumNames(prop, listEnums); m_enumManager->setEnumNames(prop, listEnums);
// Find index of current value // Find index of current value
for (int i = 0; i < listEnums.size(); i++) for (int i = 0; i < listEnums.size(); i++)
{ {
if (value == listEnums[i].toStdString()) if (value == std::string(listEnums[i].toUtf8().constData()))
{ {
m_enumManager->setValue(prop, i); m_enumManager->setValue(prop, i);
break; break;
} }
} }
} }
return prop; return prop;
} }
QtProperty *PropertyEditorWidget::addStringProperty(const NLLIGO::IProperty *property, QtProperty *PropertyEditorWidget::addStringProperty(const NLLIGO::IProperty *property,
const NLLIGO::CPrimitiveClass::CParameter &parameter, const NLLIGO::CPrimitiveClass::CParameter &parameter,
const NLLIGO::IPrimitive *primitive) const NLLIGO::IPrimitive *primitive)
{ {
std::string value; std::string value;
std::string name = parameter.Name.c_str(); std::string name = parameter.Name.c_str();
primitive->getPropertyByName(name.c_str(), value); primitive->getPropertyByName(name.c_str(), value);
QtProperty *prop = m_stringManager->addProperty(parameter.Name.c_str()); QtProperty *prop = m_stringManager->addProperty(parameter.Name.c_str());
m_stringManager->setValue(prop, QString(value.c_str())); m_stringManager->setValue(prop, QString(value.c_str()));
return prop; return prop;
} }
QtProperty *PropertyEditorWidget::addStringArrayProperty(const NLLIGO::IProperty *property, QtProperty *PropertyEditorWidget::addStringArrayProperty(const NLLIGO::IProperty *property,
const NLLIGO::CPrimitiveClass::CParameter &parameter, const NLLIGO::CPrimitiveClass::CParameter &parameter,
const NLLIGO::IPrimitive *primitive) const NLLIGO::IPrimitive *primitive)
{ {
std::string name = parameter.Name.c_str(); std::string name = parameter.Name.c_str();
QtProperty *prop = m_stringArrayManager->addProperty(parameter.Name.c_str()); QtProperty *prop = m_stringArrayManager->addProperty(parameter.Name.c_str());
const NLLIGO::IProperty *ligoProperty; const NLLIGO::IProperty *ligoProperty;
std::vector<std::string> vectString; std::vector<std::string> vectString;
if (primitive->getPropertyByName(parameter.Name.c_str (), ligoProperty)) if (primitive->getPropertyByName(parameter.Name.c_str (), ligoProperty))
{ {
const NLLIGO::CPropertyStringArray *const propStringArray = dynamic_cast<const NLLIGO::CPropertyStringArray *> (ligoProperty); const NLLIGO::CPropertyStringArray *const propStringArray = dynamic_cast<const NLLIGO::CPropertyStringArray *> (ligoProperty);
if (propStringArray) if (propStringArray)
{ {
const std::vector<std::string> &vectString = propStringArray->StringArray; const std::vector<std::string> &vectString = propStringArray->StringArray;
if (!vectString.empty()) if (!vectString.empty())
{ {
std::string temp; std::string temp;
for (size_t i = 0; i < vectString.size(); i++) for (size_t i = 0; i < vectString.size(); i++)
{ {
temp += vectString[i]; temp += vectString[i];
if (i != (vectString.size() - 1)) if (i != (vectString.size() - 1))
temp += '\n'; temp += '\n';
} }
m_stringArrayManager->setValue(prop, temp.c_str()); m_stringArrayManager->setValue(prop, temp.c_str());
prop->setToolTip(temp.c_str()); prop->setToolTip(temp.c_str());
} }
} }
else else
{ {
m_stringArrayManager->setValue(prop, "StringArray :("); m_stringArrayManager->setValue(prop, "StringArray :(");
} }
} }
// Create an "EDIT" button if the text is editable (FileExtension != "") // Create an "EDIT" button if the text is editable (FileExtension != "")
if (parameter.FileExtension != "") if (parameter.FileExtension != "")
{ {
// Create an edit box // Create an edit box
// TODO: // TODO:
} }
return prop; return prop;
} }
QtProperty *PropertyEditorWidget::addConstStringArrayProperty(const NLLIGO::IProperty *property, QtProperty *PropertyEditorWidget::addConstStringArrayProperty(const NLLIGO::IProperty *property,
const NLLIGO::CPrimitiveClass::CParameter &parameter, const NLLIGO::CPrimitiveClass::CParameter &parameter,
const NLLIGO::IPrimitive *primitive) const NLLIGO::IPrimitive *primitive)
{ {
std::string value; std::string value;
std::string name = parameter.Name.c_str(); std::string name = parameter.Name.c_str();
// Get current value // Get current value
primitive->getPropertyByName(name.c_str(), value); primitive->getPropertyByName(name.c_str(), value);
// Create qt property // Create qt property
// QtProperty *prop = m_enumManager->addProperty(parameter.Name.c_str()); // QtProperty *prop = m_enumManager->addProperty(parameter.Name.c_str());
QtProperty *prop = m_stringArrayManager->addProperty(parameter.Name.c_str()); QtProperty *prop = m_stringArrayManager->addProperty(parameter.Name.c_str());
QStringList listEnums = getComboValues(parameter); QStringList listEnums = getComboValues(parameter);
if (listEnums.isEmpty()) if (listEnums.isEmpty())
{ {
// listEnums << QString(value.c_str()) + tr(" (WRN: Check leveldesign!)"); // listEnums << QString(value.c_str()) + tr(" (WRN: Check leveldesign!)");
// m_enumManager->setEnumNames(prop, listEnums); // m_enumManager->setEnumNames(prop, listEnums);
// m_enumManager->setValue(prop, 0); // m_enumManager->setValue(prop, 0);
prop->setEnabled(false); prop->setEnabled(false);
} }
else else
{ {
// Fill qt property // Fill qt property
m_enumManager->setEnumNames(prop, listEnums); m_enumManager->setEnumNames(prop, listEnums);
// Find index of current value // Find index of current value
//for (int i = 0; i < listEnums.size(); i++) //for (int i = 0; i < listEnums.size(); i++)
//{ //{
// if (value == listEnums[i].toStdString()) // if (value == std::string(listEnums[i].toUtf8().constData()))
// { // {
// m_enumManager->setValue(prop, i); // m_enumManager->setValue(prop, i);
// break; // break;
// } // }
//} //}
const NLLIGO::IProperty *ligoProperty; const NLLIGO::IProperty *ligoProperty;
std::vector<std::string> vectString; std::vector<std::string> vectString;
if (primitive->getPropertyByName (parameter.Name.c_str(), ligoProperty)) if (primitive->getPropertyByName (parameter.Name.c_str(), ligoProperty))
{ {
const NLLIGO::CPropertyStringArray *const propStringArray = dynamic_cast<const NLLIGO::CPropertyStringArray *> (ligoProperty); const NLLIGO::CPropertyStringArray *const propStringArray = dynamic_cast<const NLLIGO::CPropertyStringArray *> (ligoProperty);
if (propStringArray) if (propStringArray)
{ {
const std::vector<std::string> &vectString = propStringArray->StringArray; const std::vector<std::string> &vectString = propStringArray->StringArray;
if (!vectString.empty()) if (!vectString.empty())
{ {
std::string temp; std::string temp;
for (size_t i = 0; i < vectString.size(); i++) for (size_t i = 0; i < vectString.size(); i++)
{ {
temp += vectString[i]; temp += vectString[i];
if (i != (vectString.size() - 1)) if (i != (vectString.size() - 1))
temp += '\n'; temp += '\n';
} }
m_stringArrayManager->setValue(prop, temp.c_str()); m_stringArrayManager->setValue(prop, temp.c_str());
prop->setToolTip(temp.c_str()); prop->setToolTip(temp.c_str());
} }
} }
else else
{ {
m_stringArrayManager->setValue(prop, "StringArray :("); m_stringArrayManager->setValue(prop, "StringArray :(");
} }
} }
m_enumManager->setValue(prop, 0); m_enumManager->setValue(prop, 0);
} }
return prop; return prop;
} }
QStringList PropertyEditorWidget::getComboValues(const NLLIGO::CPrimitiveClass::CParameter &parameter) QStringList PropertyEditorWidget::getComboValues(const NLLIGO::CPrimitiveClass::CParameter &parameter)
{ {
// TODO: get context value from dialog // TODO: get context value from dialog
std::string context("jungle"); std::string context("jungle");
std::string defaultContext("default"); std::string defaultContext("default");
std::vector<std::string> listContext; std::vector<std::string> listContext;
if (context != defaultContext) if (context != defaultContext)
listContext.push_back(context); listContext.push_back(context);
listContext.push_back(defaultContext); listContext.push_back(defaultContext);
QStringList listEnums; QStringList listEnums;
// Correct fill properties with *both* contexts if the current context is not default and is valid. // Correct fill properties with *both* contexts if the current context is not default and is valid.
for (size_t j = 0; j < listContext.size(); j++) for (size_t j = 0; j < listContext.size(); j++)
{ {
std::map<std::string, NLLIGO::CPrimitiveClass::CParameter::CConstStringValue>::const_iterator ite = parameter.ComboValues.find(listContext[j].c_str()); std::map<std::string, NLLIGO::CPrimitiveClass::CParameter::CConstStringValue>::const_iterator ite = parameter.ComboValues.find(listContext[j].c_str());
if (ite != parameter.ComboValues.end()) if (ite != parameter.ComboValues.end())
{ {
std::vector<std::string> pathList; std::vector<std::string> pathList;
// Fill pathList // Fill pathList
ite->second.appendFilePath(pathList); ite->second.appendFilePath(pathList);
if (parameter.SortEntries) if (parameter.SortEntries)
std::sort(pathList.begin(), pathList.end()); std::sort(pathList.begin(), pathList.end());
for (size_t i = 0; i < pathList.size(); ++i) for (size_t i = 0; i < pathList.size(); ++i)
listEnums.append(pathList[i].c_str()); listEnums.append(pathList[i].c_str());
} }
} }
return listEnums; return listEnums;
} }
void PropertyEditorWidget::blockSignalsOfProperties(bool block) void PropertyEditorWidget::blockSignalsOfProperties(bool block)
{ {
m_stringManager->blockSignals(block); m_stringManager->blockSignals(block);
m_boolManager->blockSignals(block); m_boolManager->blockSignals(block);
m_enumManager->blockSignals(block); m_enumManager->blockSignals(block);
m_stringArrayManager->blockSignals(block); m_stringArrayManager->blockSignals(block);
} }
} /* namespace WorldEditor */ } /* namespace WorldEditor */