Mark translated item with green, untranslated ones with red.

This commit is contained in:
dfighter1985 2014-07-21 04:11:53 +02:00
parent 7988a71c98
commit 741fee935e
2 changed files with 53 additions and 0 deletions

View file

@ -55,6 +55,16 @@ QString getLang( const QString &fn )
namespace TranslationManager namespace TranslationManager
{ {
void markItemTranslated( QTableWidgetItem *item )
{
item->setBackground( QColor::fromRgb( 126, 247, 134 ) );
}
void markItemUntranslated( QTableWidgetItem *item )
{
item->setBackground( QColor::fromRgb( 247, 126, 126 ) );
}
class UXTEditorPvt class UXTEditorPvt
{ {
public: public:
@ -140,6 +150,17 @@ void UXTEditor::open( QString filename )
d_ptr->t->setItem( i, 0, name ); d_ptr->t->setItem( i, 0, name );
d_ptr->t->setItem( i, 1, text1 ); d_ptr->t->setItem( i, 1, text1 );
if( ( info.HashValue != 0 ) && !d_ptr->loadedFromWK )
{
markItemTranslated( name );
markItemTranslated( text1 );
}
else
{
markItemUntranslated( name );
markItemUntranslated( text1 );
}
++itr; ++itr;
i++; i++;
} }
@ -317,6 +338,8 @@ void UXTEditor::onCellChanged( int row, int column )
info.Text2 = item->text().toUtf8().constData(); info.Text2 = item->text().toUtf8().constData();
setWindowModified( true ); setWindowModified( true );
markRowTranslated( row );
} }
void UXTEditor::markTranslated() void UXTEditor::markTranslated()
@ -332,6 +355,8 @@ void UXTEditor::markTranslated()
info.Text2 = info.Text; info.Text2 = info.Text;
setWindowModified( true ); setWindowModified( true );
markRowTranslated( r );
} }
void UXTEditor::markUntranslated() void UXTEditor::markUntranslated()
@ -346,6 +371,8 @@ void UXTEditor::markUntranslated()
info.HashValue = 0; info.HashValue = 0;
setWindowModified( true ); setWindowModified( true );
markRowUntranslated( r );
} }
void UXTEditor::setHeaderText( const QString &id, const QString &text ) void UXTEditor::setHeaderText( const QString &id, const QString &text )
@ -366,4 +393,28 @@ void UXTEditor::blockTableSignals( bool block )
connect( d_ptr->t, SIGNAL( cellChanged( int, int ) ), this, SLOT( onCellChanged( int, int ) ) ); connect( d_ptr->t, SIGNAL( cellChanged( int, int ) ), this, SLOT( onCellChanged( int, int ) ) );
} }
void UXTEditor::markRowTranslated( int row )
{
blockTableSignals( true );
QTableWidgetItem *item1 = d_ptr->t->item( row, 0 );
QTableWidgetItem *item2 = d_ptr->t->item( row, 1 );
markItemTranslated( item1 );
markItemTranslated( item2 );
blockTableSignals( false );
}
void UXTEditor::markRowUntranslated( int row )
{
blockTableSignals( true );
QTableWidgetItem *item1 = d_ptr->t->item( row, 0 );
QTableWidgetItem *item2 = d_ptr->t->item( row, 1 );
markItemUntranslated( item1 );
markItemUntranslated( item2 );
blockTableSignals( false );
}
} }

View file

@ -53,6 +53,8 @@ private Q_SLOTS:
private: private:
void setHeaderText( const QString &id, const QString &text ); void setHeaderText( const QString &id, const QString &text );
void blockTableSignals( bool block = false ); void blockTableSignals( bool block = false );
void markRowTranslated( int row );
void markRowUntranslated( int row );
UXTEditorPvt *d_ptr; UXTEditorPvt *d_ptr;
}; };