mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 19:05:46 -05:00
[netinstall] Move translation of widget headers
Editorial: I really don't like plain CALAMARES_RETRANSLATE() thrown into the middle of code.
This commit is contained in:
parent
45c15de623
commit
497ecda14d
2 changed files with 14 additions and 2 deletions
|
@ -41,6 +41,7 @@ NetInstallPage::NetInstallPage( QWidget* parent )
|
||||||
, m_groups( nullptr )
|
, m_groups( nullptr )
|
||||||
{
|
{
|
||||||
ui->setupUi( this );
|
ui->setupUi( this );
|
||||||
|
CALAMARES_RETRANSLATE_SLOT( &NetInstallPage::retranslate );
|
||||||
}
|
}
|
||||||
|
|
||||||
NetInstallPage::~NetInstallPage()
|
NetInstallPage::~NetInstallPage()
|
||||||
|
@ -49,6 +50,16 @@ NetInstallPage::~NetInstallPage()
|
||||||
delete m_reply;
|
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
|
bool
|
||||||
NetInstallPage::readGroups( const QByteArray& yamlData )
|
NetInstallPage::readGroups( const QByteArray& yamlData )
|
||||||
{
|
{
|
||||||
|
@ -62,8 +73,6 @@ NetInstallPage::readGroups( const QByteArray& yamlData )
|
||||||
}
|
}
|
||||||
Q_ASSERT( groups.IsSequence() );
|
Q_ASSERT( groups.IsSequence() );
|
||||||
m_groups = new PackageModel( groups );
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
catch ( YAML::Exception& e )
|
catch ( YAML::Exception& e )
|
||||||
|
@ -125,6 +134,7 @@ NetInstallPage::dataIsHere()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
retranslate(); // For changed model
|
||||||
ui->groupswidget->setModel( m_groups );
|
ui->groupswidget->setModel( m_groups );
|
||||||
ui->groupswidget->header()->setSectionResizeMode( 0, QHeaderView::ResizeToContents );
|
ui->groupswidget->header()->setSectionResizeMode( 0, QHeaderView::ResizeToContents );
|
||||||
ui->groupswidget->header()->setSectionResizeMode( 1, QHeaderView::Stretch );
|
ui->groupswidget->header()->setSectionResizeMode( 1, QHeaderView::Stretch );
|
||||||
|
|
|
@ -64,6 +64,8 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void dataIsHere();
|
void dataIsHere();
|
||||||
|
|
||||||
|
void retranslate();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void checkReady( bool );
|
void checkReady( bool );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue