Commit f92be62a authored by Clement CHAVANCE's avatar Clement CHAVANCE

Docked widget titles are now translated

parent 540fedc1
/*****************************************************************************
* main.cpp: VLMC main
* DockWidgetManager.cpp: Object managing the application docked widget
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
......@@ -19,15 +19,18 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <QtDebug>
#include <QApplication>
#include <QMap>
#include "DockWidgetManager.h"
DockWidgetManager *DockWidgetManager::m_instance = 0;
DockWidgetManager *DockWidgetManager::instance()
DockWidgetManager *DockWidgetManager::instance( QObject *parent )
{
if (m_instance == 0)
m_instance = new DockWidgetManager();
m_instance = new DockWidgetManager( parent );
return (m_instance);
}
......@@ -43,8 +46,12 @@ void DockWidgetManager::addDockedWidget( QWidget *widget,
QDockWidget::DockWidgetFeature features,
Qt::DockWidgetArea startArea)
{
if ( m_dockWidgets.contains( qs_name ) )
return ;
QDockWidget* dock = new QDockWidget( tr( qs_name.toStdString().c_str() ), m_mainWin );
m_dockWidgets.insert(qs_name, dock);
dock->setWidget( widget );
dock->setAllowedAreas( areas );
dock->setFeatures( features );
......@@ -52,6 +59,36 @@ void DockWidgetManager::addDockedWidget( QWidget *widget,
widget->show();
}
DockWidgetManager::DockWidgetManager()
DockWidgetManager::DockWidgetManager( QObject *parent )
: QObject( parent )
{
QObject::connect( qApp,
SIGNAL( aboutToQuit() ),
this,
SLOT( deleteLater() ) );
}
DockWidgetManager::~DockWidgetManager()
{
QList<QDockWidget*> widgets = m_dockWidgets.values();
QDockWidget* widget;
foreach(widget, widgets)
{
delete widget;
}
}
void DockWidgetManager::transLateWidgetTitle()
{
QMap<QString, QDockWidget*>::iterator ed = m_dockWidgets.end();
QMap<QString, QDockWidget*>::iterator it;
for ( it = m_dockWidgets.begin() ; it != ed ; ++it )
{
QDockWidget *widget = it.value();
widget->setWindowTitle( QApplication::translate( "MainWindow",
it.key().toStdString().c_str() ) );
}
}
/*****************************************************************************
* main.cpp: VLMC main
* DockWidgetManager.h: Object managing the application docked widget
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
......@@ -28,13 +28,14 @@
#include <QWidget>
#include <QDockWidget>
#include <QString>
#include <QMap>
class DockWidgetManager : public QObject
{
Q_OBJECT
public:
static DockWidgetManager *instance();
static DockWidgetManager *instance( QObject *parent = 0 );
void setMainWindow( QMainWindow *mainWin );
void addDockedWidget( QWidget *widget,
const QString &qs_name,
......@@ -42,13 +43,21 @@ class DockWidgetManager : public QObject
QDockWidget::DockWidgetFeature features,
Qt::DockWidgetArea startArea );
protected:
//virtual void changeEvent( QEvent *e );
private:
explicit DockWidgetManager();
virtual ~DockWidgetManager() { delete m_instance; }
explicit DockWidgetManager( QObject *parent = 0 );
virtual ~DockWidgetManager();
DockWidgetManager(const DockWidgetManager &);
DockWidgetManager & operator = ( const DockWidgetManager & );
QMainWindow *m_mainWin;
QMap<QString, QDockWidget*> m_dockWidgets;
static DockWidgetManager *m_instance;
public slots:
void transLateWidgetTitle();
};
#endif
......@@ -32,8 +32,13 @@ MainWindow::MainWindow( QWidget *parent ) :
QMainWindow( parent )
{
m_ui.setupUi( this );
DockWidgetManager::instance()->setMainWindow( this );
DockWidgetManager::instance( this )->setMainWindow( this );
m_initializeDockWidgets();
QObject::connect( this,
SIGNAL( translateDockWidgetTitle() ),
DockWidgetManager::instance(),
SLOT(transLateWidgetTitle() ) );
}
void MainWindow::changeEvent( QEvent *e )
......@@ -42,6 +47,7 @@ void MainWindow::changeEvent( QEvent *e )
{
case QEvent::LanguageChange:
m_ui.retranslateUi( this );
emit translateDockWidgetTitle();
break;
default:
break;
......
......@@ -50,9 +50,11 @@ private:
private slots:
void on_actionQuit_triggered();
void on_actionAbout_triggered();
void on_actionPreferences_triggered();
}
;
void on_actionAbout_triggered();
void on_actionPreferences_triggered();
signals:
void translateDockWidgetTitle();
};
#endif // MAINWINDOW_H
......@@ -2,65 +2,98 @@
<!DOCTYPE TS>
<TS version="2.0" language="es" sourcelanguage="en">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>About</name>
<message>
<location filename="../src/gui/ui/About.ui" line="20"/>
<source>Dialog</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/ui/About.ui" line="48"/>
<source>VideoLAN Movie Creator</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/ui/About.ui" line="59"/>
<source>About</source>
<translation type="unfinished">A propósito de</translation>
</message>
<message>
<location filename="../src/gui/ui/About.ui" line="65"/>
<source>Authors</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/ui/About.ui" line="79"/>
<source>Translators</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/ui/About.ui" line="93"/>
<source>License</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LibraryWidget</name>
<message>
<location filename="src/gui/LibraryWidget.cpp" line="99"/>
<location filename="../src/gui/LibraryWidget.cpp" line="109"/>
<source>Open Audios</source>
<translation>Abrir un sonido</translation>
</message>
<message>
<location filename="src/gui/LibraryWidget.cpp" line="100"/>
<location filename="../src/gui/LibraryWidget.cpp" line="110"/>
<source>Audio Files</source>
<translation>archivo de audio</translation>
</message>
<message>
<location filename="src/gui/LibraryWidget.cpp" line="105"/>
<location filename="../src/gui/LibraryWidget.cpp" line="115"/>
<source>Video Files</source>
<translation>archivo de vídeo</translation>
</message>
<message>
<location filename="src/gui/LibraryWidget.cpp" line="110"/>
<location filename="../src/gui/LibraryWidget.cpp" line="120"/>
<source>Images Files</source>
<translation>Imágenes</translation>
</message>
<message>
<location filename="src/gui/LibraryWidget.cpp" line="104"/>
<location filename="../src/gui/LibraryWidget.cpp" line="114"/>
<source>Open Videos</source>
<translation>Abrir un archivo de vídeo</translation>
</message>
<message>
<location filename="src/gui/LibraryWidget.cpp" line="109"/>
<location filename="../src/gui/LibraryWidget.cpp" line="119"/>
<source>Open Images</source>
<translation>Abrir una imagen</translation>
</message>
<message>
<location filename="src/gui/ui/LibraryWidget.ui" line="14"/>
<location filename="../src/gui/ui/LibraryWidget.ui" line="14"/>
<source>Form</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/gui/ui/LibraryWidget.ui" line="33"/>
<location filename="../src/gui/ui/LibraryWidget.ui" line="33"/>
<source>Audio</source>
<translation>Audio</translation>
</message>
<message>
<location filename="src/gui/ui/LibraryWidget.ui" line="59"/>
<location filename="../src/gui/ui/LibraryWidget.ui" line="59"/>
<source>Videos</source>
<translation>Vídeos</translation>
</message>
<message>
<location filename="src/gui/ui/LibraryWidget.ui" line="85"/>
<location filename="../src/gui/ui/LibraryWidget.ui" line="85"/>
<source>Images</source>
<translation>Imágenes</translation>
</message>
<message>
<location filename="src/gui/ui/LibraryWidget.ui" line="114"/>
<location filename="../src/gui/ui/LibraryWidget.ui" line="114"/>
<source>Add Media</source>
<translation>añadir media</translation>
</message>
<message>
<location filename="src/gui/ui/LibraryWidget.ui" line="130"/>
<location filename="../src/gui/ui/LibraryWidget.ui" line="130"/>
<source>Remove Media</source>
<translation>suprimir media</translation>
</message>
......@@ -68,68 +101,68 @@
<context>
<name>MainWindow</name>
<message>
<location filename="src/gui/MainWindow.cpp" line="61"/>
<location filename="../src/gui/MainWindow.cpp" line="67"/>
<source>Media Library</source>
<translation type="unfinished">Biblioteca multimedia</translation>
</message>
<message>
<location filename="src/gui/MainWindow.cpp" line="67"/>
<location filename="../src/gui/MainWindow.cpp" line="73"/>
<source>Preview</source>
<translation type="unfinished">Vista previa</translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="14"/>
<location filename="../src/gui/ui/MainWindow.ui" line="14"/>
<source>VideoLAN Movie Creator</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="31"/>
<location filename="../src/gui/ui/MainWindow.ui" line="35"/>
<source>File</source>
<translation>Archivo</translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="37"/>
<location filename="../src/gui/ui/MainWindow.ui" line="41"/>
<source>Edit</source>
<translation>Edición</translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="43"/>
<location filename="../src/gui/ui/MainWindow.ui" line="47"/>
<source>View</source>
<translation type="unfinished">Vista</translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="48"/>
<location filename="../src/gui/ui/MainWindow.ui" line="52"/>
<source>Effects</source>
<translation>Efectos</translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="53"/>
<location filename="../src/gui/ui/MainWindow.ui" line="57"/>
<source>Tools</source>
<translation type="unfinished">Herramientas</translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="58"/>
<location filename="../src/gui/ui/MainWindow.ui" line="62"/>
<source>Window</source>
<translation type="unfinished">Ventana</translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="63"/>
<location filename="src/gui/ui/MainWindow.ui" line="90"/>
<location filename="../src/gui/ui/MainWindow.ui" line="67"/>
<location filename="../src/gui/ui/MainWindow.ui" line="94"/>
<source>Help</source>
<translation>Ayuda</translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="80"/>
<location filename="../src/gui/ui/MainWindow.ui" line="84"/>
<source>Quit</source>
<translation>Salir</translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="85"/>
<location filename="../src/gui/ui/MainWindow.ui" line="89"/>
<source>About</source>
<translation>A propósito de</translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="95"/>
<location filename="../src/gui/ui/MainWindow.ui" line="99"/>
<source>Preferences</source>
<translation>Preferencias</translation>
</message>
......@@ -137,50 +170,55 @@
<context>
<name>Preferences</name>
<message>
<location filename="src/gui/ui/Preferences.ui" line="17"/>
<location filename="../src/gui/ui/Preferences.ui" line="14"/>
<source>Preferences</source>
<translation type="unfinished">Preferencias</translation>
</message>
<message>
<location filename="src/gui/ui/Preferences.ui" line="30"/>
<location filename="../src/gui/ui/Preferences.ui" line="27"/>
<source>General</source>
<translation type="unfinished">General</translation>
</message>
<message>
<location filename="src/gui/ui/Preferences.ui" line="42"/>
<location filename="../src/gui/ui/Preferences.ui" line="39"/>
<source>Language</source>
<translation type="unfinished">Idioma</translation>
</message>
<message>
<location filename="src/gui/ui/Preferences.ui" line="74"/>
<location filename="../src/gui/ui/Preferences.ui" line="71"/>
<source>Apply</source>
<translation type="unfinished">Aplicar</translation>
</message>
<message>
<location filename="src/gui/ui/Preferences.ui" line="81"/>
<location filename="../src/gui/ui/Preferences.ui" line="78"/>
<source>Cancel</source>
<translation type="unfinished">Cancelar</translation>
</message>
<message>
<location filename="src/gui/Preferences.cpp" line="9"/>
<location filename="../src/gui/Preferences.cpp" line="32"/>
<source>English</source>
<translation>Inglés</translation>
</message>
<message>
<location filename="src/gui/Preferences.cpp" line="10"/>
<location filename="../src/gui/Preferences.cpp" line="33"/>
<source>French</source>
<translation>Francés</translation>
</message>
<message>
<location filename="src/gui/Preferences.cpp" line="11"/>
<location filename="../src/gui/Preferences.cpp" line="34"/>
<source>Spanish</source>
<translation>Español</translation>
</message>
<message>
<location filename="../src/gui/Preferences.cpp" line="35"/>
<source>Swedish</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PreviewWidget</name>
<message>
<location filename="src/gui/ui/PreviewWidget.ui" line="17"/>
<location filename="../src/gui/ui/PreviewWidget.ui" line="17"/>
<source>Dialog</source>
<translation type="unfinished"></translation>
</message>
......@@ -188,7 +226,7 @@
<context>
<name>Timeline</name>
<message>
<location filename="src/gui/ui/Timeline.ui" line="20"/>
<location filename="../src/gui/ui/Timeline.ui" line="20"/>
<source>Form</source>
<translation type="unfinished"></translation>
</message>
......
......@@ -2,65 +2,98 @@
<!DOCTYPE TS>
<TS version="2.0" language="fr" sourcelanguage="en">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>About</name>
<message>
<location filename="../src/gui/ui/About.ui" line="20"/>
<source>Dialog</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/ui/About.ui" line="48"/>
<source>VideoLAN Movie Creator</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/ui/About.ui" line="59"/>
<source>About</source>
<translation type="unfinished">À Propos</translation>
</message>
<message>
<location filename="../src/gui/ui/About.ui" line="65"/>
<source>Authors</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/ui/About.ui" line="79"/>
<source>Translators</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/ui/About.ui" line="93"/>
<source>License</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LibraryWidget</name>
<message>
<location filename="src/gui/LibraryWidget.cpp" line="99"/>
<location filename="../src/gui/LibraryWidget.cpp" line="109"/>
<source>Open Audios</source>
<translation>Ouvrir un fichier audio</translation>
</message>
<message>
<location filename="src/gui/LibraryWidget.cpp" line="100"/>
<location filename="../src/gui/LibraryWidget.cpp" line="110"/>
<source>Audio Files</source>
<translation>Fichiers audio</translation>
</message>
<message>
<location filename="src/gui/LibraryWidget.cpp" line="105"/>
<location filename="../src/gui/LibraryWidget.cpp" line="115"/>
<source>Video Files</source>
<translation>Fichiers video</translation>
</message>
<message>
<location filename="src/gui/LibraryWidget.cpp" line="110"/>
<location filename="../src/gui/LibraryWidget.cpp" line="120"/>
<source>Images Files</source>
<translation>Images</translation>
</message>
<message>
<location filename="src/gui/LibraryWidget.cpp" line="104"/>
<location filename="../src/gui/LibraryWidget.cpp" line="114"/>
<source>Open Videos</source>
<translation>Ouvrir un fichier vidéo</translation>
</message>
<message>
<location filename="src/gui/LibraryWidget.cpp" line="109"/>
<location filename="../src/gui/LibraryWidget.cpp" line="119"/>
<source>Open Images</source>
<translation>Ouvrir une image</translation>
</message>
<message>
<location filename="src/gui/ui/LibraryWidget.ui" line="14"/>
<location filename="../src/gui/ui/LibraryWidget.ui" line="14"/>
<source>Form</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/gui/ui/LibraryWidget.ui" line="33"/>
<location filename="../src/gui/ui/LibraryWidget.ui" line="33"/>
<source>Audio</source>
<translation>Sons</translation>
</message>
<message>
<location filename="src/gui/ui/LibraryWidget.ui" line="59"/>
<location filename="../src/gui/ui/LibraryWidget.ui" line="59"/>
<source>Videos</source>
<translation>Videos</translation>
</message>
<message>
<location filename="src/gui/ui/LibraryWidget.ui" line="85"/>
<location filename="../src/gui/ui/LibraryWidget.ui" line="85"/>
<source>Images</source>
<translation>Images</translation>
</message>
<message>
<location filename="src/gui/ui/LibraryWidget.ui" line="114"/>
<location filename="../src/gui/ui/LibraryWidget.ui" line="114"/>
<source>Add Media</source>
<translation>Ajouter un média</translation>
</message>
<message>
<location filename="src/gui/ui/LibraryWidget.ui" line="130"/>
<location filename="../src/gui/ui/LibraryWidget.ui" line="130"/>
<source>Remove Media</source>
<translation>Supprimer un média</translation>
</message>
......@@ -68,68 +101,68 @@
<context>
<name>MainWindow</name>
<message>
<location filename="src/gui/MainWindow.cpp" line="61"/>
<location filename="../src/gui/MainWindow.cpp" line="67"/>
<source>Media Library</source>
<translation>Bibliothèque de médias</translation>
</message>
<message>
<location filename="src/gui/MainWindow.cpp" line="67"/>
<location filename="../src/gui/MainWindow.cpp" line="73"/>
<source>Preview</source>
<translation>Prévisualisation</translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="14"/>
<location filename="../src/gui/ui/MainWindow.ui" line="14"/>
<source>VideoLAN Movie Creator</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="31"/>
<location filename="../src/gui/ui/MainWindow.ui" line="35"/>
<source>File</source>
<translation>Fichier</translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="37"/>
<location filename="../src/gui/ui/MainWindow.ui" line="41"/>
<source>Edit</source>
<translation>Edition</translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="43"/>
<location filename="../src/gui/ui/MainWindow.ui" line="47"/>
<source>View</source>
<translation>Affichage</translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="48"/>
<location filename="../src/gui/ui/MainWindow.ui" line="52"/>
<source>Effects</source>
<translation>Effets</translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="53"/>
<location filename="../src/gui/ui/MainWindow.ui" line="57"/>
<source>Tools</source>
<translation>Outils</translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="58"/>
<location filename="../src/gui/ui/MainWindow.ui" line="62"/>
<source>Window</source>
<translation>Fenêtre</translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="63"/>
<location filename="src/gui/ui/MainWindow.ui" line="90"/>
<location filename="../src/gui/ui/MainWindow.ui" line="67"/>
<location filename="../src/gui/ui/MainWindow.ui" line="94"/>
<source>Help</source>
<translation>Aide</translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="80"/>
<location filename="../src/gui/ui/MainWindow.ui" line="84"/>
<source>Quit</source>
<translation>Quitter</translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="85"/>
<location filename="../src/gui/ui/MainWindow.ui" line="89"/>
<source>About</source>
<translation>À Propos</translation>
</message>
<message>
<location filename="src/gui/ui/MainWindow.ui" line="95"/>
<location filename="../src/gui/ui/MainWindow.ui" line="99"/>
<source>Preferences</source>
<translation>Préférences</translation>
</message>
......@@ -137,50 +170,55 @@
<context>
<name>Preferences</name>
<message>
<location filename="src/gui/ui/Preferences.ui" line="17"/>
<location filename="../src/gui/ui/Preferences.ui" line="14"/>
<source>Preferences</source>
<translation>Préférences</translation>
</message>
<message>
<location filename="src/gui/ui/Preferences.ui" line="30"/>
<location filename="../src/gui/ui/Preferences.ui" line="27"/>
<source>General</source>
<translation>Général</translation>
</message>
<message>
<location filename="src/gui/ui/Preferences.ui" line="42"/>
<location filename="../src/gui/ui/Preferences.ui" line="39"/>
<source>Language</source>
<translation>Langue</translation>
</message>
<message>
<location filename="src/gui/ui/Preferences.ui" line="74"/>
<location filename="../src/gui/ui/Preferences.ui" line="71"/>
<source>Apply</source>
<translation>Appliquer</translation>
</message>
<message>
<location filename="src/gui/ui/Preferences.ui" line="81"/>
<location filename="../src/gui/ui/Preferences.ui" line="78"/>
<source>Cancel</source>
<translation>Annuler</translation>
</message>
<message>
<location filename="src/gui/Preferences.cpp" line="9"/>
<location filename="../src/gui/Preferences.cpp" line="32"/>
<source>English</source>
<translation>Anglais</translation>
</message>
<message>
<location filename="src/gui/Preferences.cpp" line="10"/>
<location filename="../src/gui/Preferences.cpp" line="33"/>
<source>French</source>
<translation>Français</translation>
</message>
<message>
<location filename="src/gui/Preferences.cpp" line="11"/>
<location filename="../src/gui/Preferences.cpp" line="34"/>
<source>Spanish</source>
<translation>Espagnol</translation>
</message>
<message>
<location filename="../src/gui/Preferences.cpp" line="35"/>
<source>Swedish</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PreviewWidget</name>
<message>
<location filename="src/gui/ui/PreviewWidget.ui" line="17"/>
<location filename="../src/gui/ui/PreviewWidget.ui" line="17"/>
<source>Dialog</source>
<translation type="unfinished"></translation>
</message>
......@@ -188,7 +226,7 @@
<context>
<name>Timeline</name>
<message>
<location filename="src/gui/ui/Timeline.ui" line="20"/>
<location filename="../src/gui/ui/Timeline.ui" line="20"/>
<source>Form</source>
<translation type="unfinished"></translation>
</message>
......