diff --git a/code/studio/src/plugins/world_editor/CMakeLists.txt b/code/studio/src/plugins/world_editor/CMakeLists.txt
index 7b76ed810..ac5231aea 100644
--- a/code/studio/src/plugins/world_editor/CMakeLists.txt
+++ b/code/studio/src/plugins/world_editor/CMakeLists.txt
@@ -20,12 +20,15 @@ SET(OVQT_PLUGIN_WORLD_EDITOR_HDR world_editor_plugin.h
project_settings_dialog.h
property_editor_widget.h
world_editor_settings_page.h
+ const_string_array_property.h
+ const_string_array_editor.h
)
SET(OVQT_PLUGIN_WORLD_EDITOR_UIS world_editor_window.ui
project_settings_dialog.ui
property_editor_widget.ui
world_editor_settings_page.ui
+ const_string_array_editor.ui
)
SET(OVQT_PLUGIN_WORLD_EDITOR_RCS world_editor.qrc)
diff --git a/code/studio/src/plugins/world_editor/const_string_array_editor.cpp b/code/studio/src/plugins/world_editor/const_string_array_editor.cpp
new file mode 100644
index 000000000..05e5e4cf5
--- /dev/null
+++ b/code/studio/src/plugins/world_editor/const_string_array_editor.cpp
@@ -0,0 +1,106 @@
+// Ryzom Core Studio World Editor plugin
+// Copyright (C) 2010 Winch Gate Property Limited
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program 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 Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+
+#include "const_string_array_editor.h"
+
+ConstStrArrEditDialog::ConstStrArrEditDialog( QDialog *parent ) :
+QDialog( parent )
+{
+ setupUi( this );
+ setupConnections();
+}
+
+ConstStrArrEditDialog::~ConstStrArrEditDialog()
+{
+}
+
+void ConstStrArrEditDialog::setStrings( const QStringList &strings )
+{
+ cb->clear();
+
+ QStringListIterator itr( strings );
+ while( itr.hasNext() )
+ {
+ cb->addItem( itr.next() );
+ }
+
+ cb->setCurrentIndex( 0 );
+}
+
+void ConstStrArrEditDialog::setValue( const QString &value )
+{
+ listWidget->clear();
+
+ if( value.isEmpty() )
+ return;
+
+ QStringList l = value.split( ';' );
+
+ QStringListIterator itr( l );
+ while( itr.hasNext() )
+ {
+ listWidget->addItem( itr.next() );
+ }
+}
+
+QString ConstStrArrEditDialog::getValue() const
+{
+ QString value;
+
+ for( int i = 0; i < listWidget->count(); i++ )
+ {
+ QListWidgetItem *item = listWidget->item( i );
+ value += item->text();
+
+ if( i < ( listWidget->count() - 1 ) )
+ value += ';';
+ }
+
+ return value;
+}
+
+void ConstStrArrEditDialog::accept()
+{
+ QDialog::accept();
+}
+
+void ConstStrArrEditDialog::reject()
+{
+ QDialog::reject();
+}
+
+void ConstStrArrEditDialog::onAddClicked()
+{
+ listWidget->addItem( cb->currentText() );
+}
+
+void ConstStrArrEditDialog::onRemoveClicked()
+{
+ QListWidgetItem *item = listWidget->currentItem();
+ if( item == NULL )
+ return;
+
+ delete item;
+}
+
+void ConstStrArrEditDialog::setupConnections()
+{
+ connect( addButton, SIGNAL( clicked( bool ) ), this, SLOT( onAddClicked() ) );
+ connect( removeButton, SIGNAL( clicked( bool ) ), this, SLOT( onRemoveClicked() ) );
+}
+
+
diff --git a/code/studio/src/plugins/world_editor/const_string_array_editor.h b/code/studio/src/plugins/world_editor/const_string_array_editor.h
new file mode 100644
index 000000000..a2c458e7c
--- /dev/null
+++ b/code/studio/src/plugins/world_editor/const_string_array_editor.h
@@ -0,0 +1,50 @@
+// Ryzom Core Studio World Editor plugin
+// Copyright (C) 2010 Winch Gate Property Limited
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program 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 Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+
+#ifndef CONST_STR_ARR_EDIT_DLG
+#define CONST_STR_ARR_EDIT_DLG
+
+#include "ui_const_string_array_editor.h"
+#include
+
+class ConstStrArrEditDialog : public QDialog, public Ui::ConstStrArrEditorDialog
+{
+ Q_OBJECT
+public:
+ ConstStrArrEditDialog( QDialog *parent = NULL );
+ ~ConstStrArrEditDialog();
+
+ void setStrings( const QStringList &strings );
+ void setValue( const QString &value );
+ QString getValue() const;
+
+public Q_SLOTS:
+ void accept();
+ void reject();
+
+private Q_SLOTS:
+ void onAddClicked();
+ void onRemoveClicked();
+
+private:
+ void setupConnections();
+};
+
+
+#endif
+
+
diff --git a/code/studio/src/plugins/world_editor/const_string_array_editor.ui b/code/studio/src/plugins/world_editor/const_string_array_editor.ui
new file mode 100644
index 000000000..6aec02352
--- /dev/null
+++ b/code/studio/src/plugins/world_editor/const_string_array_editor.ui
@@ -0,0 +1,130 @@
+
+
+ ConstStrArrEditorDialog
+
+
+
+ 0
+ 0
+ 392
+ 293
+
+
+
+ Dialog
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Add
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Remove
+
+
+
+ -
+
+
+ -
+
+
+ 6
+
+
+ 0
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 131
+ 31
+
+
+
+
+ -
+
+
+ OK
+
+
+
+ -
+
+
+ Cancel
+
+
+
+
+
+
+
+
+
+
+ okButton
+ clicked()
+ ConstStrArrEditorDialog
+ accept()
+
+
+ 278
+ 253
+
+
+ 96
+ 254
+
+
+
+
+ cancelButton
+ clicked()
+ ConstStrArrEditorDialog
+ reject()
+
+
+ 369
+ 253
+
+
+ 179
+ 282
+
+
+
+
+
diff --git a/code/studio/src/plugins/world_editor/const_string_array_property.cpp b/code/studio/src/plugins/world_editor/const_string_array_property.cpp
new file mode 100644
index 000000000..5ef7566d8
--- /dev/null
+++ b/code/studio/src/plugins/world_editor/const_string_array_property.cpp
@@ -0,0 +1,363 @@
+// Ryzom Core Studio World Editor plugin
+// Copyright (C) 2010 Winch Gate Property Limited
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program 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 Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+
+#include "const_string_array_property.h"
+#include "const_string_array_editor.h"
+#include
+#include
+#include
+#include
+#include
+
+
+////////////////////////////////////////////////////////////////// Manager ///////////////////////////////////////////////////////////////////////////
+
+
+struct ConstStrArrPropMgrPriv
+{
+ QMap< const QtProperty*, QString > values;
+};
+
+ConstStrArrPropMgr::ConstStrArrPropMgr( QObject *parent ) :
+QtAbstractPropertyManager( parent )
+{
+ d_ptr = new ConstStrArrPropMgrPriv();
+}
+
+ConstStrArrPropMgr::~ConstStrArrPropMgr()
+{
+ delete d_ptr;
+ d_ptr = NULL;
+}
+
+QString ConstStrArrPropMgr::value( const QtProperty *p ) const
+{
+ return valueText( p );
+}
+
+void ConstStrArrPropMgr::setValue( QtProperty *p, const QString &value )
+{
+ if( !d_ptr->values.contains( p ) )
+ return;
+
+ if( d_ptr->values[ p ] == value )
+ return;
+
+ d_ptr->values[ p ] = value;
+
+ Q_EMIT propertyChanged( p );
+ Q_EMIT valueChanged( p, value );
+}
+
+void ConstStrArrPropMgr::setStrings( QtProperty *p, const QStringList &strings )
+{
+ Q_EMIT stringsChanged( p, strings );
+}
+
+bool ConstStrArrPropMgr::hasValue( const QtProperty *p ) const
+{
+ return d_ptr->values.contains( p );
+}
+
+QString ConstStrArrPropMgr::valueText( const QtProperty *p ) const
+{
+ if( !d_ptr->values.contains( p ) )
+ return "";
+
+ return d_ptr->values[ p ];
+}
+
+void ConstStrArrPropMgr::initializeProperty( QtProperty *p )
+{
+ if( d_ptr->values.contains( p ) )
+ return;
+
+ d_ptr->values[ p ] = "";
+}
+
+void ConstStrArrPropMgr::uninitializeProperty( QtProperty *p )
+{
+ d_ptr->values.remove( p );
+}
+
+
+
+//////////////////////////////////////////////////////////////////// Factory ///////////////////////////////////////////////////////////////////////
+
+
+
+struct ConstStrArrEditorFactoryPriv
+{
+ QMap< QtProperty*, QList< ConstStrArrEditor* > > createdEditors;
+ QMap< ConstStrArrEditor*, QtProperty* > editorToProperty;
+ QMap< QtProperty*, QStringList > strings;
+
+ ~ConstStrArrEditorFactoryPriv()
+ {
+ createdEditors.clear();
+
+ QMap< ConstStrArrEditor*, QtProperty* >::iterator itr = editorToProperty.begin();
+ while( itr != editorToProperty.end() )
+ {
+ delete itr.key();
+ ++itr;
+ }
+ editorToProperty.clear();
+ }
+
+ void addEditor( QtProperty *p, ConstStrArrEditor *editor )
+ {
+ QMap< QtProperty*, QList< ConstStrArrEditor* > >::iterator itr = createdEditors.find( p );
+
+ if( itr != createdEditors.end() )
+ {
+ itr->push_back( editor );
+ }
+ else
+ {
+ QList< ConstStrArrEditor* > l;
+ l.push_back( editor );
+ createdEditors.insert( p, l );
+ }
+
+ editorToProperty.insert( editor, p );
+ }
+
+ void removeEditor( QObject *o )
+ {
+ // Remove from editorToProperty first
+ QMap< ConstStrArrEditor*, QtProperty* >::iterator itr1 = editorToProperty.begin();
+ while( itr1 != editorToProperty.end() )
+ {
+ if( itr1.key() == o )
+ break;
+
+ ++itr1;
+ }
+ if( itr1 != editorToProperty.end() )
+ editorToProperty.erase( itr1 );
+
+ // Then from createdEditors
+ QMap< QtProperty*, QList< ConstStrArrEditor* > >::iterator itr2 = createdEditors.begin();
+ while( itr2 != createdEditors.end() )
+ {
+ QList< ConstStrArrEditor* > &l = *itr2;
+ QList< ConstStrArrEditor* >::iterator itr = l.begin();
+ while( itr != l.end() )
+ {
+ if( *itr == o )
+ {
+ QList< ConstStrArrEditor* >::iterator d = itr;
+ ++itr;
+ l.erase( d );
+ continue;
+ }
+
+ ++itr;
+ }
+
+ ++itr2;
+ }
+ }
+
+};
+
+ConstStrArrEditorFactory::ConstStrArrEditorFactory( QObject *parent ) :
+QtAbstractEditorFactory( parent )
+{
+ d_ptr = new ConstStrArrEditorFactoryPriv();
+}
+
+ConstStrArrEditorFactory::~ConstStrArrEditorFactory()
+{
+ delete d_ptr;
+ d_ptr = NULL;
+}
+
+void ConstStrArrEditorFactory::connectPropertyManager( ConstStrArrPropMgr *manager )
+{
+ connect( manager, SIGNAL( valueChanged( QtProperty*, const QString& ) ), this, SLOT( onPropertyChanged( QtProperty*, const QString& ) ) );
+ connect( manager, SIGNAL( stringsChanged( QtProperty*, const QStringList& ) ), this, SLOT( onStringsChanged( QtProperty*, const QStringList & ) ) );
+}
+
+void ConstStrArrEditorFactory::disconnectPropertyManager( ConstStrArrPropMgr *manager )
+{
+ disconnect( manager, SIGNAL( valueChanged( QtProperty*, const QString& ) ), this, SLOT( onPropertyChanged( QtProperty*, const QString& ) ) );
+ disconnect( manager, SIGNAL( stringsChanged( const QStringList& ) ), this, SLOT( onStringsChanged( const QStringList & ) ) );
+}
+
+QWidget* ConstStrArrEditorFactory::createEditor( ConstStrArrPropMgr *manager, QtProperty *p, QWidget *parent )
+{
+ ConstStrArrEditor *editor = new ConstStrArrEditor( parent );
+ editor->setValue( manager->value( p ) );
+
+ QMap< QtProperty*, QStringList >::iterator itr = d_ptr->strings.find( p );
+ if( itr != d_ptr->strings.end() )
+ {
+ editor->setStrings( *itr );
+ }
+
+ connect( editor, SIGNAL( valueChanged( const QString& ) ), this, SLOT( onSetValue( const QString& ) ) );
+ connect( editor, SIGNAL( destroyed( QObject* ) ), this, SLOT( onEditorDestroyed( QObject* ) ) );
+
+ d_ptr->addEditor( p, editor );
+
+ return editor;
+}
+
+void ConstStrArrEditorFactory::onPropertyChanged( QtProperty *p, const QString &value )
+{
+ QMap< QtProperty*, QList< ConstStrArrEditor* > >::iterator itr = d_ptr->createdEditors.find( p );
+ if( itr == d_ptr->createdEditors.end() )
+ return;
+
+ QList< ConstStrArrEditor* > &l = *itr;
+ QList< ConstStrArrEditor* >::iterator i = l.begin();
+ while( i != l.end() )
+ {
+ ConstStrArrEditor *editor = *i;
+
+ editor->blockSignals( true );
+ editor->setValue( value );
+ editor->blockSignals( false );
+
+ ++i;
+ }
+}
+
+void ConstStrArrEditorFactory::onStringsChanged( QtProperty *p, const QStringList &strings )
+{
+ if( p == NULL )
+ return;
+
+ d_ptr->strings[ p ] = strings;
+}
+
+void ConstStrArrEditorFactory::onSetValue( const QString &value )
+{
+ QObject *s = sender();
+ ConstStrArrEditor *editor = qobject_cast< ConstStrArrEditor* >( s );
+ if( editor == NULL )
+ return;
+
+ QMap< ConstStrArrEditor*, QtProperty* >::iterator itr = d_ptr->editorToProperty.find( editor );
+ if( itr == d_ptr->editorToProperty.end() )
+ return;
+
+ QtProperty *p = *itr;
+
+ ConstStrArrPropMgr *manager = qobject_cast< ConstStrArrPropMgr* >( p->propertyManager() );
+ if( manager == NULL )
+ return;
+
+ blockSignals( true );
+ manager->setValue( p, value );
+ blockSignals( false );
+}
+
+void ConstStrArrEditorFactory::onEditorDestroyed( QObject *editor )
+{
+ d_ptr->removeEditor( editor );
+}
+
+
+
+//////////////////////////////////////////////////////////////////////// Editor //////////////////////////////////////////////////////////////////
+
+ConstStrArrEditor::ConstStrArrEditor( QWidget *parent ) :
+QWidget( parent )
+{
+ setupUi();
+ setupConnections();
+}
+
+ConstStrArrEditor::~ConstStrArrEditor()
+{
+}
+
+void ConstStrArrEditor::setStrings( const QStringList &strings )
+{
+ this->strings.clear();
+
+ QStringListIterator itr( strings );
+ while( itr.hasNext() )
+ {
+ this->strings.push_back( itr.next() );
+ }
+}
+
+void ConstStrArrEditor::setValue( const QString &value )
+{
+ if( lineEdit->text() == value )
+ return;
+
+ disableConnections();
+ lineEdit->setText( value );
+ setupConnections();
+}
+
+void ConstStrArrEditor::showEvent( QShowEvent *e )
+{
+ QWidget::showEvent( e );
+}
+
+void ConstStrArrEditor::onToolButtonClicked()
+{
+ ConstStrArrEditDialog d;
+ d.setStrings( strings );
+ d.setValue( lineEdit->text() );
+ int result = d.exec();
+ if( QDialog::Accepted != result )
+ return;
+ lineEdit->setText( d.getValue() );
+}
+
+void ConstStrArrEditor::onTextChanged( const QString &text )
+{
+ Q_EMIT valueChanged( text );
+}
+
+void ConstStrArrEditor::setupConnections()
+{
+ connect( toolButton, SIGNAL( clicked( bool ) ), this, SLOT( onToolButtonClicked() ) );
+ connect( lineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChanged( const QString& ) ) );
+}
+
+void ConstStrArrEditor::disableConnections()
+{
+ disconnect( toolButton, SIGNAL( clicked( bool ) ), this, SLOT( onToolButtonClicked() ) );
+ disconnect( lineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChanged( const QString& ) ) );
+}
+
+void ConstStrArrEditor::setupUi()
+{
+ lineEdit = new QLineEdit();
+ toolButton = new QToolButton();
+ toolButton->setText( "..." );
+
+ QHBoxLayout *lt = new QHBoxLayout( this );
+ lt->setContentsMargins( 0, 0, 0, 0 );
+ lt->setSpacing( 0 );
+ lt->addWidget( lineEdit );
+ lt->addWidget( toolButton );
+
+ setFocusProxy( lineEdit );
+ setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Fixed );
+
+}
+
+
diff --git a/code/studio/src/plugins/world_editor/const_string_array_property.h b/code/studio/src/plugins/world_editor/const_string_array_property.h
new file mode 100644
index 000000000..a079f4802
--- /dev/null
+++ b/code/studio/src/plugins/world_editor/const_string_array_property.h
@@ -0,0 +1,131 @@
+// Ryzom Core Studio World Editor plugin
+// Copyright (C) 2010 Winch Gate Property Limited
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program 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 Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+
+#ifndef CONST_STR_ARR_PROP_H
+#define CONST_STR_ARR_PROP_H
+
+#define QT_QTPROPERTYBROWSER_IMPORT
+
+#include "3rdparty/qtpropertybrowser/qtpropertybrowser.h"
+#include
+#include
+
+/////////////////////////////////////////////////////// Manager ///////////////////////////////////////////////////////////////////////////
+
+struct ConstStrArrPropMgrPriv;
+
+class ConstStrArrPropMgr : public QtAbstractPropertyManager
+{
+ Q_OBJECT
+
+public:
+ ConstStrArrPropMgr( QObject *parent = NULL );
+ ~ConstStrArrPropMgr();
+
+ QString value( const QtProperty *p ) const;
+
+public Q_SLOTS:
+ void setValue( QtProperty *p, const QString &value );
+ void setStrings( QtProperty *p, const QStringList &strings );
+
+Q_SIGNALS:
+ void valueChanged( QtProperty *p, const QString &value );
+ void stringsChanged( QtProperty *p, const QStringList &strings );
+
+protected:
+ bool hasValue( const QtProperty *p ) const;
+ QString valueText( const QtProperty *p ) const;
+ void initializeProperty( QtProperty *p );
+ void uninitializeProperty( QtProperty *p );
+
+private:
+ ConstStrArrPropMgrPriv *d_ptr;
+
+ Q_DISABLE_COPY( ConstStrArrPropMgr );
+};
+
+
+////////////////////////////////////////////////////////////////// Factory /////////////////////////////////////////////////////////////////////////
+
+struct ConstStrArrEditorFactoryPriv;
+
+class ConstStrArrEditorFactory : public QtAbstractEditorFactory< ConstStrArrPropMgr >
+{
+ Q_OBJECT
+
+public:
+ ConstStrArrEditorFactory( QObject *parent = NULL );
+ ~ConstStrArrEditorFactory();
+
+protected:
+ void connectPropertyManager( ConstStrArrPropMgr *manager );
+ void disconnectPropertyManager( ConstStrArrPropMgr *manager );
+
+ QWidget* createEditor( ConstStrArrPropMgr *manager, QtProperty *p, QWidget *parent );
+
+private Q_SLOTS:
+ void onPropertyChanged( QtProperty *p, const QString &value );
+ void onStringsChanged( QtProperty *p, const QStringList &strings );
+ void onSetValue( const QString &value );
+ void onEditorDestroyed( QObject *editor );
+
+private:
+ ConstStrArrEditorFactoryPriv *d_ptr;
+
+ Q_DISABLE_COPY( ConstStrArrEditorFactory );
+};
+
+
+///////////////////////////////////////////////////////////////// Editor ///////////////////////////////////////////////////////////////////////////
+
+class QLineEdit;
+class QToolButton;
+
+class ConstStrArrEditor : public QWidget
+{
+ Q_OBJECT
+public:
+ ConstStrArrEditor( QWidget *parent = NULL );
+ ~ConstStrArrEditor();
+ void setStrings( const QStringList &strings );
+
+public Q_SLOTS:
+ void setValue( const QString &value );
+
+protected:
+ void showEvent( QShowEvent *e );
+
+private Q_SLOTS:
+ void onToolButtonClicked();
+ void onTextChanged( const QString &text );
+
+Q_SIGNALS:
+ void valueChanged( const QString &value );
+
+private:
+ void setupUi();
+ void setupConnections();
+ void disableConnections();
+
+
+ QLineEdit *lineEdit;
+ QToolButton *toolButton;
+ QStringList strings;
+};
+
+#endif
+
diff --git a/code/studio/src/plugins/world_editor/property_editor_widget.cpp b/code/studio/src/plugins/world_editor/property_editor_widget.cpp
index 6d3fdaec1..4f28d383d 100644
--- a/code/studio/src/plugins/world_editor/property_editor_widget.cpp
+++ b/code/studio/src/plugins/world_editor/property_editor_widget.cpp
@@ -29,6 +29,8 @@
// Qt includes
#include
+#include "const_string_array_property.h"
+
namespace WorldEditor
{
@@ -42,6 +44,9 @@ PropertyEditorWidget::PropertyEditorWidget(QWidget *parent)
m_enumManager = new QtEnumPropertyManager(this);
m_stringArrayManager = new QtTextPropertyManager(this);
+ m_constStrArrPropMgr = new ConstStrArrPropMgr(this);
+ m_constStrArrEditorFactory = new ConstStrArrEditorFactory(this);
+
QtLineEditFactory *lineEditFactory = new QtLineEditFactory(this);
QtCheckBoxFactory *boolFactory = new QtCheckBoxFactory(this);
QtEnumEditorFactory *enumFactory = new QtEnumEditorFactory(this);
@@ -51,6 +56,7 @@ PropertyEditorWidget::PropertyEditorWidget(QWidget *parent)
m_ui.treePropertyBrowser->setFactoryForManager(m_boolManager, boolFactory);
m_ui.treePropertyBrowser->setFactoryForManager(m_enumManager, enumFactory);
m_ui.treePropertyBrowser->setFactoryForManager(m_stringArrayManager, textFactory);
+ m_ui.treePropertyBrowser->setFactoryForManager(m_constStrArrPropMgr, m_constStrArrEditorFactory);
m_groupManager = new QtGroupPropertyManager(this);
@@ -58,6 +64,7 @@ PropertyEditorWidget::PropertyEditorWidget(QWidget *parent)
connect(m_boolManager, 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_constStrArrPropMgr, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *)));
connect(m_boolManager, SIGNAL(resetProperty(QtProperty *)), this, SLOT(resetProperty(QtProperty *)));
connect(m_stringManager, SIGNAL(resetProperty(QtProperty *)), this, SLOT(resetProperty(QtProperty *)));
@@ -326,32 +333,18 @@ QtProperty *PropertyEditorWidget::addConstStringArrayProperty(const NLLIGO::IPro
primitive->getPropertyByName(name.c_str(), value);
// Create qt property
-// QtProperty *prop = m_enumManager->addProperty(parameter.Name.c_str());
- QtProperty *prop = m_stringArrayManager->addProperty(parameter.Name.c_str());
+ QtProperty *prop = m_constStrArrPropMgr->addProperty(parameter.Name.c_str());
QStringList listEnums = getComboValues(parameter);
if (listEnums.isEmpty())
{
-// listEnums << QString(value.c_str()) + tr(" (WRN: Check leveldesign!)");
-// m_enumManager->setEnumNames(prop, listEnums);
-// m_enumManager->setValue(prop, 0);
prop->setEnabled(false);
}
else
{
// Fill qt property
- m_enumManager->setEnumNames(prop, listEnums);
-
- // Find index of current value
- //for (int i = 0; i < listEnums.size(); i++)
- //{
- // if (value == std::string(listEnums[i].toUtf8().constData()))
- // {
- // m_enumManager->setValue(prop, i);
- // break;
- // }
- //}
+ m_constStrArrPropMgr->setStrings(prop, listEnums);
const NLLIGO::IProperty *ligoProperty;
std::vector vectString;
@@ -371,17 +364,16 @@ QtProperty *PropertyEditorWidget::addConstStringArrayProperty(const NLLIGO::IPro
if (i != (vectString.size() - 1))
temp += '\n';
}
- m_stringArrayManager->setValue(prop, temp.c_str());
+ m_constStrArrPropMgr->setValue(prop, temp.c_str());
prop->setToolTip(temp.c_str());
}
}
else
{
- m_stringArrayManager->setValue(prop, "StringArray :(");
+ m_constStrArrPropMgr->setValue(prop, "StringArray :(");
}
}
- m_enumManager->setValue(prop, 0);
}
return prop;
diff --git a/code/studio/src/plugins/world_editor/property_editor_widget.h b/code/studio/src/plugins/world_editor/property_editor_widget.h
index 85935cccd..81a8ad008 100644
--- a/code/studio/src/plugins/world_editor/property_editor_widget.h
+++ b/code/studio/src/plugins/world_editor/property_editor_widget.h
@@ -33,6 +33,9 @@
// Qt includes
+class ConstStrArrPropMgr;
+class ConstStrArrEditorFactory;
+
namespace WorldEditor
{
/**
@@ -84,6 +87,9 @@ private:
QtGroupPropertyManager *m_groupManager;
QtTextPropertyManager *m_stringArrayManager;
+ ConstStrArrPropMgr *m_constStrArrPropMgr;
+ ConstStrArrEditorFactory *m_constStrArrEditorFactory;
+
Ui::PropertyEditorWidget m_ui;
}; /* PropertyEditorWidget */