[vlmc-devel] commit: PathWidget: Handle language changes. ( Hugo Beauzée-Luyssen )
git at videolan.org
git at videolan.org
Sat Oct 30 17:26:34 CEST 2010
vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Tue Oct 26 21:37:52 2010 +0200| [d507252d572c0e1cf405d20d500f309fe1f762b4] | committer: Hugo Beauzée-Luyssen
PathWidget: Handle language changes.
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=d507252d572c0e1cf405d20d500f309fe1f762b4
---
src/Gui/settings/PathWidget.cpp | 17 ++++++++++++++++-
src/Gui/settings/PathWidget.h | 4 ++++
2 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/src/Gui/settings/PathWidget.cpp b/src/Gui/settings/PathWidget.cpp
index 80b215a..826b351 100644
--- a/src/Gui/settings/PathWidget.cpp
+++ b/src/Gui/settings/PathWidget.cpp
@@ -23,6 +23,7 @@
#include "PathWidget.h"
#include "SettingValue.h"
+#include <QEvent>
#include <QFileDialog>
#include <QLineEdit>
#include <QPushButton>
@@ -32,7 +33,7 @@ PathWidget::PathWidget( SettingValue *s, QWidget *parent /*= NULL*/ ) :
{
m_lineEdit = new QLineEdit( this );
m_pushButton = new QPushButton( this );
- m_pushButton->setText( tr( "Select a path" ) );
+ retranslate();
layout()->addWidget( m_lineEdit );
layout()->addWidget( m_pushButton );
@@ -41,10 +42,24 @@ PathWidget::PathWidget( SettingValue *s, QWidget *parent /*= NULL*/ ) :
}
void
+PathWidget::retranslate()
+{
+ m_pushButton->setText( tr( "Select a path" ) );
+}
+
+void
+PathWidget::changeEvent( QEvent *event )
+{
+ if ( event->type() == QEvent::LanguageChange )
+ retranslate();
+}
+
+void
PathWidget::save()
{
m_setting->set( m_lineEdit->text() );
}
+
void
PathWidget::changed( const QVariant &val )
{
diff --git a/src/Gui/settings/PathWidget.h b/src/Gui/settings/PathWidget.h
index 146c2df..d8c76ca 100644
--- a/src/Gui/settings/PathWidget.h
+++ b/src/Gui/settings/PathWidget.h
@@ -39,6 +39,10 @@ class PathWidget : public ISettingsCategoryWidget
PathWidget( SettingValue *s, QWidget *parent = NULL );
void save();
+ protected:
+ void changeEvent( QEvent *event );
+ void retranslate();
+
private slots:
virtual void changed( const QVariant& );
void selectPathButtonPressed();
More information about the Vlmc-devel
mailing list