From edae208629808a250a97f622f1282bcb5b056a14 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Wed, 25 Jul 2012 22:10:23 +0200 Subject: [PATCH] FIXED: #1471 LinkList should update the edited item's display when the editor is finished. --- .../src/plugins/gui_editor/link_editor.cpp | 2 ++ .../src/plugins/gui_editor/link_editor.h | 3 +++ .../src/plugins/gui_editor/link_list.cpp | 25 ++++++++++++++++++- .../src/plugins/gui_editor/link_list.h | 1 + 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.cpp index 61db9ee84..9fda82432 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.cpp @@ -76,6 +76,8 @@ namespace GUIEditor data.cond = condEdit->text().toStdString(); parser->updateLinkData( data.id, data ); + Q_EMIT okClicked(); + hide(); } } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.h index 2d3e630c0..5211eaa46 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.h @@ -32,6 +32,9 @@ namespace GUIEditor void setup(); void setLinkId( uint32 linkId ); + Q_SIGNALS: + void okClicked(); + private Q_SLOTS: void onOKButtonClicked(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_list.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_list.cpp index 4a7643246..33c71ddc1 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_list.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_list.cpp @@ -41,6 +41,8 @@ namespace GUIEditor connect( linkTree, SIGNAL( itemDoubleClicked( QTreeWidgetItem*, int ) ), this, SLOT( onItemDblClicked( QTreeWidgetItem* ) ) ); + + connect( linkEditor, SIGNAL( okClicked() ), this, SLOT( onEditorFinished() ) ); } LinkList::~LinkList() @@ -50,6 +52,8 @@ namespace GUIEditor void LinkList::onGUILoaded() { + linkTree->clear(); + const std::map< uint32, SLinkData > &linkMap = CWidgetManager::getInstance()->getParser()->getLinkMap(); @@ -125,7 +129,6 @@ namespace GUIEditor void LinkList::onEditButtonClicked() { - QTreeWidgetItem *item = linkTree->currentItem(); if( item == NULL ) @@ -150,5 +153,25 @@ namespace GUIEditor linkEditor->setLinkId( id ); linkEditor->show(); } + + void LinkList::onEditorFinished() + { + QTreeWidgetItem *item = + linkTree->currentItem(); + if( item == NULL ) + return; + + bool ok; + uint32 id = item->data( 3, Qt::UserRole ).toUInt( &ok ); + if( !ok ) + return; + + SLinkData data; + if( !CWidgetManager::getInstance()->getParser()->getLinkData( id, data ) ) + return; + + item->setText( 1, data.target.c_str() ); + item->setText( 2, data.action.c_str() ); + } } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_list.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_list.h index 895ea3b69..514707e45 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_list.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_list.h @@ -39,6 +39,7 @@ namespace GUIEditor void onRemoveButtonClicked(); void onEditButtonClicked(); void onItemDblClicked( QTreeWidgetItem *item ); + void onEditorFinished(); private: LinkEditor *linkEditor;