FIXED: #1471 LinkList should update the edited item's display when the editor is finished.

--HG--
branch : gsoc2012-gui-editor
hg/feature/sse2
dfighter1985 12 years ago
parent 515657823b
commit feeb3165c4

@ -76,6 +76,8 @@ namespace GUIEditor
data.cond = condEdit->text().toStdString(); data.cond = condEdit->text().toStdString();
parser->updateLinkData( data.id, data ); parser->updateLinkData( data.id, data );
Q_EMIT okClicked();
hide(); hide();
} }
} }

@ -32,6 +32,9 @@ namespace GUIEditor
void setup(); void setup();
void setLinkId( uint32 linkId ); void setLinkId( uint32 linkId );
Q_SIGNALS:
void okClicked();
private Q_SLOTS: private Q_SLOTS:
void onOKButtonClicked(); void onOKButtonClicked();

@ -41,6 +41,8 @@ namespace GUIEditor
connect( linkTree, SIGNAL( itemDoubleClicked( QTreeWidgetItem*, int ) ), connect( linkTree, SIGNAL( itemDoubleClicked( QTreeWidgetItem*, int ) ),
this, SLOT( onItemDblClicked( QTreeWidgetItem* ) ) ); this, SLOT( onItemDblClicked( QTreeWidgetItem* ) ) );
connect( linkEditor, SIGNAL( okClicked() ), this, SLOT( onEditorFinished() ) );
} }
LinkList::~LinkList() LinkList::~LinkList()
@ -50,6 +52,8 @@ namespace GUIEditor
void LinkList::onGUILoaded() void LinkList::onGUILoaded()
{ {
linkTree->clear();
const std::map< uint32, SLinkData > &linkMap = const std::map< uint32, SLinkData > &linkMap =
CWidgetManager::getInstance()->getParser()->getLinkMap(); CWidgetManager::getInstance()->getParser()->getLinkMap();
@ -125,7 +129,6 @@ namespace GUIEditor
void LinkList::onEditButtonClicked() void LinkList::onEditButtonClicked()
{ {
QTreeWidgetItem *item = QTreeWidgetItem *item =
linkTree->currentItem(); linkTree->currentItem();
if( item == NULL ) if( item == NULL )
@ -150,5 +153,25 @@ namespace GUIEditor
linkEditor->setLinkId( id ); linkEditor->setLinkId( id );
linkEditor->show(); 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() );
}
} }

@ -39,6 +39,7 @@ namespace GUIEditor
void onRemoveButtonClicked(); void onRemoveButtonClicked();
void onEditButtonClicked(); void onEditButtonClicked();
void onItemDblClicked( QTreeWidgetItem *item ); void onItemDblClicked( QTreeWidgetItem *item );
void onEditorFinished();
private: private:
LinkEditor *linkEditor; LinkEditor *linkEditor;

Loading…
Cancel
Save