New context menu options: mark / unmark translated.

This commit is contained in:
dfighter1985 2014-07-21 03:51:03 +02:00
parent 232e830c3c
commit 7988a71c98
2 changed files with 38 additions and 1 deletions

View file

@ -290,12 +290,18 @@ void UXTEditor::contextMenuEvent( QContextMenuEvent *e )
QMenu *menu = new QMenu( this );
QAction *insertAction = new QAction( "Insert row", menu );
QAction *deleteAction = new QAction( "Delete row", menu );
QAction *markAction = new QAction( "Mark translated", menu );
QAction *unmarkAction = new QAction( "Mark not-translated", menu );
connect( insertAction, SIGNAL( triggered( bool ) ), this, SLOT( insertRow() ) );
connect( deleteAction, SIGNAL( triggered( bool ) ), this, SLOT( deleteRow() ) );
connect( markAction, SIGNAL( triggered( bool ) ), this, SLOT( markTranslated() ) );
connect( unmarkAction, SIGNAL( triggered( bool ) ), this, SLOT( markUntranslated() ) );
menu->addAction( insertAction );
menu->addAction( deleteAction );
menu->addAction( markAction );
menu->addAction( unmarkAction );
menu->exec( e->globalPos() );
}
@ -313,6 +319,35 @@ void UXTEditor::onCellChanged( int row, int column )
setWindowModified( true );
}
void UXTEditor::markTranslated()
{
int r = d_ptr->t->currentRow();
if( r < 0 )
return;
STRING_MANAGER::TStringInfo &info = d_ptr->infos[ r ];
if( !info.Text2.empty() )
return;
info.Text2 = info.Text;
setWindowModified( true );
}
void UXTEditor::markUntranslated()
{
int r = d_ptr->t->currentRow();
if( r < 0 )
return;
STRING_MANAGER::TStringInfo &info = d_ptr->infos[ r ];
info.Text2.clear();
info.HashValue = 0;
setWindowModified( true );
}
void UXTEditor::setHeaderText( const QString &id, const QString &text )
{
QTableWidgetItem *h1 = new QTableWidgetItem( id );

View file

@ -47,6 +47,8 @@ protected:
private Q_SLOTS:
void onCellChanged( int row, int column );
void markTranslated();
void markUntranslated();
private:
void setHeaderText( const QString &id, const QString &text );