From d9c2620e6e08f2e110ab6c4a6df638148b51539c Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Fri, 18 Jul 2014 01:52:23 +0200 Subject: [PATCH] Implemented row deletion / insertion. --HG-- branch : gsoc2014-dfighter --- .../translation_manager/uxt_editor.cpp | 24 +++++++++++++++++++ .../plugins/translation_manager/uxt_editor.h | 4 ++++ 2 files changed, 28 insertions(+) diff --git a/code/studio/src/plugins/translation_manager/uxt_editor.cpp b/code/studio/src/plugins/translation_manager/uxt_editor.cpp index bf6e787b6..cb4a0a0f3 100644 --- a/code/studio/src/plugins/translation_manager/uxt_editor.cpp +++ b/code/studio/src/plugins/translation_manager/uxt_editor.cpp @@ -148,6 +148,30 @@ void UXTEditor::activateWindow() } +void UXTEditor::insertRow() +{ + d_ptr->infos.push_back( STRING_MANAGER::TStringInfo() ); + d_ptr->t->setRowCount( d_ptr->t->rowCount() + 1 ); + + setWindowModified( true ); +} + + +void UXTEditor::deleteRow() +{ + int r = d_ptr->t->currentRow(); + if( r < 0 ) + return; + + std::vector< STRING_MANAGER::TStringInfo >::iterator itr = d_ptr->infos.begin(); + itr += r; + d_ptr->infos.erase( itr ); + + d_ptr->t->removeRow( r ); + + setWindowModified( true ); +} + void UXTEditor::closeEvent( QCloseEvent *e ) { if( isWindowModified() ) diff --git a/code/studio/src/plugins/translation_manager/uxt_editor.h b/code/studio/src/plugins/translation_manager/uxt_editor.h index 738f88f7d..d37be8c72 100644 --- a/code/studio/src/plugins/translation_manager/uxt_editor.h +++ b/code/studio/src/plugins/translation_manager/uxt_editor.h @@ -37,6 +37,10 @@ public: void saveAs( QString filename ); void activateWindow(); +public Q_SLOTS: + void insertRow(); + void deleteRow(); + protected: void closeEvent( QCloseEvent *e );