Use Retranslator in GreetingPage.

main
Teo Mrnjavac 10 years ago
parent e5c3888be2
commit 1d9535053a

@ -21,6 +21,7 @@
#include "CalamaresVersion.h" #include "CalamaresVersion.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/CalamaresUtils.h" #include "utils/CalamaresUtils.h"
#include "utils/Retranslator.h"
#include "ViewManager.h" #include "ViewManager.h"
#include <QApplication> #include <QApplication>
@ -86,23 +87,15 @@ GreetingPage::GreetingPage( QWidget* parent )
mainLayout->addWidget( m_text ); mainLayout->addWidget( m_text );
mainLayout->addStretch(); mainLayout->addStretch();
retranslate(); CALAMARES_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." )
void .arg( Calamares::Branding::instance()->
GreetingPage::changeEvent( QEvent* e ) string( Calamares::Branding::VersionedName ) )
{ .arg( Calamares::Branding::instance()->
QWidget::changeEvent( e ); string( Calamares::Branding::ProductName ) ) );
switch ( e->type() ) )
{
case QEvent::LanguageChange:
retranslate();
break;
default:
break;
}
} }
@ -114,15 +107,3 @@ GreetingPage::focusInEvent( QFocusEvent* e )
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 ) ) );
}

@ -31,12 +31,9 @@ public:
explicit GreetingPage( QWidget* parent = nullptr ); explicit GreetingPage( QWidget* parent = nullptr );
protected: protected:
void changeEvent( QEvent* e ) override;
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; QLabel* m_text;
}; };

Loading…
Cancel
Save