Make LocalePage retranslatable.

main
Teo Mrnjavac 10 years ago
parent 2617ef369e
commit dec452f9b5

@ -43,23 +43,23 @@ LocalePage::LocalePage( QWidget* parent )
QBoxLayout* bottomLayout = new QHBoxLayout; QBoxLayout* bottomLayout = new QHBoxLayout;
mainLayout->addLayout( bottomLayout ); mainLayout->addLayout( bottomLayout );
QLabel* cityLabel = new QLabel( tr( "Region:" ), this ); m_cityLabel = new QLabel( this );
bottomLayout->addWidget( cityLabel ); bottomLayout->addWidget( m_cityLabel );
m_regionCombo = new QComboBox( this ); m_regionCombo = new QComboBox( this );
bottomLayout->addWidget( m_regionCombo ); bottomLayout->addWidget( m_regionCombo );
m_regionCombo->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); m_regionCombo->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
cityLabel->setBuddy( m_regionCombo ); m_cityLabel->setBuddy( m_regionCombo );
bottomLayout->addSpacing( 20 ); bottomLayout->addSpacing( 20 );
QLabel* timezoneLabel = new QLabel( tr( "Zone:" ), this ); m_timezoneLabel = new QLabel( this );
bottomLayout->addWidget( timezoneLabel ); bottomLayout->addWidget( m_timezoneLabel );
m_timezoneCombo = new QComboBox( this ); m_timezoneCombo = new QComboBox( this );
m_timezoneCombo->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); m_timezoneCombo->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
bottomLayout->addWidget( m_timezoneCombo ); bottomLayout->addWidget( m_timezoneCombo );
timezoneLabel->setBuddy( m_timezoneCombo ); m_timezoneLabel->setBuddy( m_timezoneCombo );
mainLayout->addStretch(); mainLayout->addStretch();
@ -192,3 +192,27 @@ LocalePage::createJobs()
return list; return list;
} }
void
LocalePage::changeEvent( QEvent* e )
{
QWidget::changeEvent( e );
switch ( e->type() )
{
case QEvent::LanguageChange:
retranslate();
break;
default:
break;
}
}
void
LocalePage::retranslate()
{
m_cityLabel->setText( tr( "Region:" ) );
m_timezoneLabel->setText( tr( "Zone:" ) );
}

@ -24,6 +24,7 @@
#include <QWidget> #include <QWidget>
class QComboBox; class QComboBox;
class QLabel;
class TimeZoneWidget; class TimeZoneWidget;
class LocalePage : public QWidget class LocalePage : public QWidget
@ -38,11 +39,19 @@ public:
QList< Calamares::job_ptr > createJobs(); QList< Calamares::job_ptr > createJobs();
protected:
void changeEvent( QEvent* e ) override;
private: private:
void retranslate();
TimeZoneWidget* m_tzWidget; TimeZoneWidget* m_tzWidget;
QComboBox* m_regionCombo; QComboBox* m_regionCombo;
QComboBox* m_timezoneCombo; QComboBox* m_timezoneCombo;
QLabel* m_cityLabel;
QLabel* m_timezoneLabel;
bool m_blockTzWidgetSet; bool m_blockTzWidgetSet;
}; };

Loading…
Cancel
Save