diff --git a/code/nel/include/nel/gui/proc.h b/code/nel/include/nel/gui/proc.h index dd11013db..e80615c49 100644 --- a/code/nel/include/nel/gui/proc.h +++ b/code/nel/include/nel/gui/proc.h @@ -47,6 +47,9 @@ namespace NLGUI // the action handler (may be proc!!) std::string Action; + std::string Parameters; + std::string Conditions; + // A list of string/or param number => to build the final params at execution std::vector< CParamBlock > ParamBlocks; diff --git a/code/nel/src/gui/interface_parser.cpp b/code/nel/src/gui/interface_parser.cpp index 8bb20e5aa..520aec87a 100644 --- a/code/nel/src/gui/interface_parser.cpp +++ b/code/nel/src/gui/interface_parser.cpp @@ -1796,9 +1796,15 @@ namespace NLGUI else action.Action= (const char*)name; if(params) + { + action.Parameters = (const char*)params; action.buildParamBlock((const char*)params); + } if(cond) + { + action.Conditions = (const char*)cond; action.buildCondBlock ((const char*)cond); + } newProc.Actions.push_back(action); } else if (!strcmp((char*)cur->name,"instance")) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/action_editor.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/action_editor.cpp index abcfe1ec5..8f73d4474 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/action_editor.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/action_editor.cpp @@ -16,17 +16,34 @@ #include "action_editor.h" +#include "nel/gui/proc.h" namespace GUIEditor { ActionEditor::ActionEditor( QWidget *parent ) { setupUi( this ); - connect( okButton, SIGNAL( clicked( bool ) ), this, SLOT( hide() ) ); + connect( okButton, SIGNAL( clicked( bool ) ), this, SLOT( onOkButtonClicked() ) ); connect( cancelButton, SIGNAL( clicked( bool ) ), this, SLOT( hide() ) ); } ActionEditor::~ActionEditor() { } + + void ActionEditor::setCurrentAction( NLGUI::CProcAction *action ) + { + currentAction = action; + handlerEdit->setText( currentAction->Action.c_str() ); + handlerEdit->setEnabled( false ); + paramsEdit->setText( currentAction->Parameters.c_str() ); + condEdit->setText( currentAction->Conditions.c_str() ); + } + + void ActionEditor::onOkButtonClicked() + { + currentAction->Parameters = paramsEdit->text().toStdString(); + currentAction->Conditions = condEdit->text().toStdString(); + hide(); + } } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/action_editor.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/action_editor.h index 6d2128c7d..5dd4fb105 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/action_editor.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/action_editor.h @@ -19,6 +19,11 @@ #include "ui_action_editor.h" +namespace NLGUI +{ + class CProcAction; +} + namespace GUIEditor { class ActionEditor : public QWidget, public Ui::ActionEditor @@ -27,6 +32,13 @@ namespace GUIEditor public: ActionEditor( QWidget *parent = NULL ); ~ActionEditor(); + void setCurrentAction( NLGUI::CProcAction *action ); + + private Q_SLOTS: + void onOkButtonClicked(); + + private: + NLGUI::CProcAction *currentAction; }; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/action_editor.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/action_editor.ui index 2a243c6e6..67e453dc9 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/action_editor.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/action_editor.ui @@ -10,7 +10,7 @@ 0 0 340 - 111 + 145 @@ -47,8 +47,35 @@ + + + + Conditions + + + + + + + Conditions + + + + + + + Qt::Vertical + + + + 20 + 11 + + + + @@ -85,6 +112,8 @@ + verticalSpacer + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_editor.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_editor.cpp index 7cacab73c..fee1b1195 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_editor.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_editor.cpp @@ -62,6 +62,17 @@ namespace GUIEditor void ProcEditor::onEditButtonClicked() { + int row = actionList->currentRow(); + QListWidgetItem *item = actionList->item( row ); + if( item == NULL ) + return; + + CProcedure *proc = + CWidgetManager::getInstance()->getParser()->getProc( currentProc.toStdString() ); + if( proc == NULL ) + return; + + actionEditor->setCurrentAction( &( proc->Actions[ row ] ) ); actionEditor->show(); }