[netinstall] Move translation of widget headers

Editorial: I really don't like plain CALAMARES_RETRANSLATE() thrown
into the middle of code.
main
Adriaan de Groot 5 years ago
parent 45c15de623
commit 497ecda14d

@ -41,6 +41,7 @@ NetInstallPage::NetInstallPage( QWidget* parent )
, m_groups( nullptr )
{
ui->setupUi( this );
CALAMARES_RETRANSLATE_SLOT( &NetInstallPage::retranslate );
}
NetInstallPage::~NetInstallPage()
@ -49,6 +50,16 @@ NetInstallPage::~NetInstallPage()
delete m_reply;
}
void
NetInstallPage::retranslate()
{
if ( m_groups )
{
m_groups->setHeaderData( 0, Qt::Horizontal, tr( "Name" ) );
m_groups->setHeaderData( 1, Qt::Horizontal, tr( "Description" ) );
}
}
bool
NetInstallPage::readGroups( const QByteArray& yamlData )
{
@ -62,8 +73,6 @@ NetInstallPage::readGroups( const QByteArray& yamlData )
}
Q_ASSERT( groups.IsSequence() );
m_groups = new PackageModel( groups );
CALAMARES_RETRANSLATE( m_groups->setHeaderData( 0, Qt::Horizontal, tr( "Name" ) );
m_groups->setHeaderData( 1, Qt::Horizontal, tr( "Description" ) ); )
return true;
}
catch ( YAML::Exception& e )
@ -125,6 +134,7 @@ NetInstallPage::dataIsHere()
return;
}
retranslate(); // For changed model
ui->groupswidget->setModel( m_groups );
ui->groupswidget->header()->setSectionResizeMode( 0, QHeaderView::ResizeToContents );
ui->groupswidget->header()->setSectionResizeMode( 1, QHeaderView::Stretch );

@ -64,6 +64,8 @@ public:
public slots:
void dataIsHere();
void retranslate();
signals:
void checkReady( bool );

Loading…
Cancel
Save