Use retranslate pattern in GreetingPage.

main
Teo Mrnjavac 10 years ago
parent 9e9a922498
commit 2617ef369e

@ -77,20 +77,16 @@ GreetingPage::GreetingPage( QWidget* parent )
} ); } );
} }
QLabel* text = new QLabel( tr( "<h1>Welcome to the %1 installer.</h1><br/>" m_text = new QLabel( this );
"This program will ask you some questions and " m_text->setAlignment( Qt::AlignCenter );
"set up %2 on your computer." ) m_text->setWordWrap( true );
.arg( Calamares::Branding::instance()-> m_text->setOpenExternalLinks( true );
string( Calamares::Branding::VersionedName ) )
.arg( Calamares::Branding::instance()->
string( Calamares::Branding::ProductName ) ), this );
text->setAlignment( Qt::AlignCenter );
text->setWordWrap( true );
text->setOpenExternalLinks( true );
mainLayout->addStretch(); mainLayout->addStretch();
mainLayout->addWidget( text ); mainLayout->addWidget( m_text );
mainLayout->addStretch(); mainLayout->addStretch();
retranslate();
} }
@ -101,7 +97,7 @@ GreetingPage::changeEvent( QEvent* e )
switch ( e->type() ) switch ( e->type() )
{ {
case QEvent::LanguageChange: case QEvent::LanguageChange:
//TODO: retranslate all widgets retranslate();
break; break;
default: default:
@ -117,3 +113,16 @@ GreetingPage::focusInEvent( QFocusEvent* e )
m_languageWidget->setFocus(); m_languageWidget->setFocus();
e->accept(); e->accept();
} }
void
GreetingPage::retranslate()
{
m_text->setText( tr( "<h1>Welcome to the %1 installer.</h1><br/>"
"This program will ask you some questions and "
"set up %2 on your computer." )
.arg( Calamares::Branding::instance()->
string( Calamares::Branding::VersionedName ) )
.arg( Calamares::Branding::instance()->
string( Calamares::Branding::ProductName ) ) );
}

@ -21,6 +21,7 @@
#include <QWidget> #include <QWidget>
class QLabel;
class QListWidget; class QListWidget;
class GreetingPage : public QWidget class GreetingPage : public QWidget
@ -34,7 +35,10 @@ protected:
void focusInEvent( QFocusEvent* e ) override; //choose the child widget to focus void focusInEvent( QFocusEvent* e ) override; //choose the child widget to focus
private: private:
void retranslate();
QListWidget* m_languageWidget; QListWidget* m_languageWidget;
QLabel* m_text;
}; };
#endif // GREETINGPAGE_H #endif // GREETINGPAGE_H

Loading…
Cancel
Save