Commit be8dd28d authored by Christophe Courtaut's avatar Christophe Courtaut

Translation now working. Use lrelease to gen .qm

parent a5643863
......@@ -97,17 +97,17 @@ void LibraryWidget::on_pushButtonAddMedia_clicked()
{
case 0:
insertNewMediaFromFileDialog( tr( "Open Audios" ),
tr( "Audio Files (*.mp3 *.oga *.flac *.aac *.wav)" ),
tr( "Audio Files" ) + " (*.mp3 *.oga *.flac *.aac *.wav)" ,
ListViewMediaItem::Audio);
break;
case 1:
insertNewMediaFromFileDialog( tr( "Open Videos" ),
tr( "Video Files (*.mov *.avi *.mkv)" ),
tr( "Video Files" ) + " (*.mov *.avi *.mkv)" ,
ListViewMediaItem::Video );
break;
case 2:
insertNewMediaFromFileDialog( tr( "Open Images" ),
tr( "Images Files (*.gif *.png *.jpg)" ),
tr( "Images Files" ) + " (*.gif *.png *.jpg)" ,
ListViewMediaItem::Image);
break;
}
......@@ -135,3 +135,15 @@ void LibraryWidget::on_pushButtonRemoveMedia_clicked()
ListViewMediaItem* item = ( ListViewMediaItem* ) mediaList->currentItem();
this->removeMedia( item );
}
void LibraryWidget::changeEvent( QEvent *e )
{
switch ( e->type() )
{
case QEvent::LanguageChange:
m_ui.retranslateUi( this );
break;
default:
break;
}
}
......@@ -63,6 +63,8 @@ public:
ListViewMediaItem* addMedia( QFileInfo* fileInfo, ListViewMediaItem::fType fileType );
bool removeMedia( ListViewMediaItem* item );
int getIndex( ListViewMediaItem* media );
protected:
virtual void changeEvent( QEvent *e );
private:
QString getNewMediaFileName( QString title, QString filter, ListViewMediaItem::fType );
ListViewMediaItem* insertNewMediaFromFileDialog(QString title, QString filter, ListViewMediaItem::fType fileType);
......
#include "Preferences.h"
#include "ui_Preferences.h"
Preferences::Preferences(QWidget *parent) :
QWidget(parent),
m_ui(new Ui::Preferences)
QTranslator* Preferences::m_currentLang = NULL;
Preferences::Preferences( QWidget *parent ) : QWidget( parent ), m_ui( new Ui::Preferences )
{
m_ui->setupUi(this);
m_ui->comboBoxLanguage->addItem(tr( "English" ), "");
m_ui->comboBoxLanguage->addItem(tr( "French" ), "fr");
m_ui->comboBoxLanguage->addItem(tr( "Spanish" ), "es");
m_ui->setupUi( this );
m_ui->comboBoxLanguage->addItem( tr( "English" ), "" );
m_ui->comboBoxLanguage->addItem( tr( "French" ), "fr" );
m_ui->comboBoxLanguage->addItem( tr( "Spanish" ), "es" );
}
Preferences::~Preferences()
......@@ -16,12 +16,13 @@ Preferences::~Preferences()
delete m_ui;
}
void Preferences::changeEvent(QEvent *e)
void Preferences::changeEvent( QEvent *e )
{
QWidget::changeEvent(e);
switch (e->type()) {
QWidget::changeEvent( e );
switch ( e->type() )
{
case QEvent::LanguageChange:
m_ui->retranslateUi(this);
m_ui->retranslateUi( this );
break;
default:
break;
......@@ -35,9 +36,20 @@ void Preferences::on_pushButtonCancel_clicked()
void Preferences::on_pushButtonApply_clicked()
{
QTranslator translator;
qDebug() << QApplication::applicationDirPath() + "/../" << "vlmc_" + (this->m_ui->comboBoxLanguage->itemData(this->m_ui->comboBoxLanguage->currentIndex())).toString();
qDebug() << translator.load("vlmc_" + (this->m_ui->comboBoxLanguage->itemData(this->m_ui->comboBoxLanguage->currentIndex())).toString(), QApplication::applicationDirPath() + "/../");
QApplication::installTranslator(&translator);
QSettings settings;
QString lang = settings.value( "Lang" ).toString();
QString langValue = this->m_ui->comboBoxLanguage->itemData( this->m_ui->comboBoxLanguage->currentIndex() ).toString();
if (this->m_currentLang != NULL )
{
qApp->removeTranslator( this->m_currentLang );
delete this->m_currentLang;
this->m_currentLang = NULL;
}
if ( langValue != "" )
{
m_currentLang = new QTranslator();
m_currentLang->load( "vlmc_" + langValue, QApplication::applicationDirPath() + "/../" );
qApp->installTranslator( m_currentLang );
}
this->close();
}
......@@ -3,29 +3,32 @@
#include <QtGui/QWidget>
#include <QTranslator>
#include <QApplication>
#include <QSettings>
#include <QtDebug>
namespace Ui {
class Preferences;
}
class Preferences : public QWidget {
class Preferences : public QWidget
{
Q_OBJECT
Q_DISABLE_COPY(Preferences)
Q_DISABLE_COPY( Preferences )
public:
explicit Preferences(QWidget *parent = 0);
explicit Preferences( QWidget *parent = 0 );
virtual ~Preferences();
protected:
virtual void changeEvent(QEvent *e);
virtual void changeEvent( QEvent *e );
private:
Ui::Preferences *m_ui;
static QTranslator* m_currentLang;
private slots:
void on_pushButtonCancel_clicked();
void on_pushButtonApply_clicked();
}
;
};
#endif // PREFERENCES_H
#include "PreviewWidget.h"
#include "ui_PreviewWidget.h"
PreviewWidget::PreviewWidget(QWidget *parent) :
QDialog(parent),
m_ui(new Ui::PreviewWidget)
PreviewWidget::PreviewWidget( QWidget *parent ) :
QDialog( parent ),
m_ui( new Ui::PreviewWidget )
{
m_ui->setupUi(this);
m_ui->setupUi( this );
}
PreviewWidget::~PreviewWidget()
......@@ -13,11 +13,12 @@ PreviewWidget::~PreviewWidget()
delete m_ui;
}
void PreviewWidget::changeEvent(QEvent *e)
void PreviewWidget::changeEvent( QEvent *e )
{
switch (e->type()) {
switch ( e->type() )
{
case QEvent::LanguageChange:
m_ui->retranslateUi(this);
m_ui->retranslateUi( this );
break;
default:
break;
......
......@@ -7,15 +7,16 @@ namespace Ui {
class PreviewWidget;
}
class PreviewWidget : public QDialog {
class PreviewWidget : public QDialog
{
Q_OBJECT
Q_DISABLE_COPY(PreviewWidget)
Q_DISABLE_COPY( PreviewWidget )
public:
explicit PreviewWidget(QWidget *parent = 0);
explicit PreviewWidget( QWidget *parent = 0 );
virtual ~PreviewWidget();
protected:
virtual void changeEvent(QEvent *e);
virtual void changeEvent( QEvent *e );
private:
Ui::PreviewWidget *m_ui;
......
......@@ -26,7 +26,11 @@
int main( int argc, char **argv )
{
QApplication app( argc, argv );
MainWindow w;
w.show();
app.setApplicationName( "vlmc" );
app.setOrganizationName( "vlmc" );
app.setOrganizationDomain( "vlmc.org" );
QSettings::setDefaultFormat(QSettings::IniFormat);
MainWindow w;
w.show();
return app.exec();
}
......@@ -70,12 +70,12 @@
<message>
<location filename="src/gui/MainWindow.cpp" line="61"/>
<source>Media Library</source>
<translation>biblioteca multimedia</translation>
<translation type="unfinished">Biblioteca multimedia</translation>
</message>
<message>
<location filename="src/gui/MainWindow.cpp" line="67"/>
<source>Preview</source>
<translation>vista previa</translation>
<translation type="unfinished">Vista previa</translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="14"/>
......@@ -95,7 +95,7 @@
<message>
<location filename="src/gui/ui/MainWindow.ui" line="43"/>
<source>View</source>
<translation>Vista</translation>
<translation type="unfinished">Vista</translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="48"/>
......@@ -105,12 +105,12 @@
<message>
<location filename="src/gui/ui/MainWindow.ui" line="53"/>
<source>Tools</source>
<translation>herramientas</translation>
<translation type="unfinished">Herramientas</translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="58"/>
<source>Window</source>
<translation>ventana</translation>
<translation type="unfinished">Ventana</translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="63"/>
......@@ -131,7 +131,7 @@
<message>
<location filename="src/gui/ui/MainWindow.ui" line="95"/>
<source>Preferences</source>
<translation type="unfinished"></translation>
<translation>Preferencias</translation>
</message>
</context>
<context>
......@@ -139,42 +139,42 @@
<message>
<location filename="src/gui/ui/Preferences.ui" line="17"/>
<source>Preferences</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Preferencias</translation>
</message>
<message>
<location filename="src/gui/ui/Preferences.ui" line="30"/>
<source>General</source>
<translation type="unfinished"></translation>
<translation type="unfinished">General</translation>
</message>
<message>
<location filename="src/gui/ui/Preferences.ui" line="42"/>
<source>Language</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Idioma</translation>
</message>
<message>
<location filename="src/gui/ui/Preferences.ui" line="74"/>
<source>Apply</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Aplicar</translation>
</message>
<message>
<location filename="src/gui/ui/Preferences.ui" line="81"/>
<source>Cancel</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Cancelar</translation>
</message>
<message>
<location filename="src/gui/Preferences.cpp" line="9"/>
<source>English</source>
<translation type="unfinished"></translation>
<translation>Inglés</translation>
</message>
<message>
<location filename="src/gui/Preferences.cpp" line="10"/>
<source>French</source>
<translation type="unfinished"></translation>
<translation>Francés</translation>
</message>
<message>
<location filename="src/gui/Preferences.cpp" line="11"/>
<source>Spanish</source>
<translation type="unfinished"></translation>
<translation>Español</translation>
</message>
</context>
<context>
......
......@@ -131,7 +131,7 @@
<message>
<location filename="src/gui/ui/MainWindow.ui" line="95"/>
<source>Preferences</source>
<translation type="unfinished">Préférences</translation>
<translation>Préférences</translation>
</message>
</context>
<context>
......@@ -164,17 +164,17 @@
<message>
<location filename="src/gui/Preferences.cpp" line="9"/>
<source>English</source>
<translation type="unfinished"></translation>
<translation>Anglais</translation>
</message>
<message>
<location filename="src/gui/Preferences.cpp" line="10"/>
<source>French</source>
<translation type="unfinished"></translation>
<translation>Français</translation>
</message>
<message>
<location filename="src/gui/Preferences.cpp" line="11"/>
<source>Spanish</source>
<translation type="unfinished"></translation>
<translation>Espagnol</translation>
</message>
</context>
<context>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment