Commit 7afea915 authored by Ludovic Fauvet's avatar Ludovic Fauvet

Fix dock titles retranslation

parent f517006b
......@@ -22,6 +22,7 @@
#include <QtDebug>
#include <QApplication>
#include <QMap>
#include <QMapIterator>
#include <QDockWidget>
#include "DockWidgetManager.h"
......@@ -51,7 +52,7 @@ void DockWidgetManager::setMainWindow( MainWindow *mainWin )
}
QDockWidget* DockWidgetManager::addDockedWidget( QWidget *widget,
const QString &qs_name,
const char *qs_name,
Qt::DockWidgetAreas areas,
QDockWidget::DockWidgetFeature features,
Qt::DockWidgetArea startArea)
......@@ -59,15 +60,25 @@ QDockWidget* DockWidgetManager::addDockedWidget( QWidget *widget,
if ( m_dockWidgets.contains( qs_name ) )
return 0;
QDockWidget* dock = new QDockWidget( qs_name, m_mainWin );
QDockWidget* dock = new QDockWidget( tr( qs_name ), m_mainWin );
m_dockWidgets.insert( qs_name, dock );
dock->setWidget( widget );
dock->setAllowedAreas( areas );
dock->setFeatures( features );
dock->setObjectName( qs_name );
m_mainWin->addDockWidget( startArea, dock );
m_mainWin->registerWidgetInWindowMenu( dock );
widget->show();
return dock;
}
void DockWidgetManager::retranslateUi()
{
QMapIterator<const char*, QDockWidget*> i( m_dockWidgets );
while ( i.hasNext() )
{
i.next();
i.value()->setWindowTitle( tr( i.key() ) );
}
}
......@@ -41,10 +41,11 @@ class DockWidgetManager : public QObject, public QSingleton<DockWidgetManager>
static DockWidgetManager *instance( QObject *parent = 0 );
void setMainWindow( MainWindow *mainWin );
QDockWidget* addDockedWidget( QWidget *widget,
const QString &qs_name,
const char *qs_name,
Qt::DockWidgetAreas areas,
QDockWidget::DockWidgetFeature features,
Qt::DockWidgetArea startArea );
void retranslateUi();
private:
explicit DockWidgetManager( QObject *parent = 0 );
......@@ -53,7 +54,7 @@ class DockWidgetManager : public QObject, public QSingleton<DockWidgetManager>
DockWidgetManager & operator = ( const DockWidgetManager & );
MainWindow *m_mainWin;
QMap<QString, QDockWidget*> m_dockWidgets;
QMap<const char*, QDockWidget*> m_dockWidgets;
friend class QSingleton<DockWidgetManager>;
};
......
......@@ -156,6 +156,8 @@ void MainWindow::changeEvent( QEvent *e )
{
case QEvent::LanguageChange:
m_ui.retranslateUi( this );
DockWidgetManager::getInstance()->retranslateUi();
qDebug() << "Retranslation";
break;
default:
break;
......@@ -241,7 +243,7 @@ MainWindow::setupLibrary()
const ClipRenderer* clipRenderer = qobject_cast<const ClipRenderer*>( m_clipPreview->getGenericRenderer() );
Q_ASSERT( clipRenderer != NULL );
DockWidgetManager::getInstance()->addDockedWidget( libraryWidget, tr( "Media Library" ),
DockWidgetManager::getInstance()->addDockedWidget( libraryWidget, QT_TRANSLATE_NOOP( "DockWidgetManager", "Media Library" ),
Qt::AllDockWidgetAreas,
QDockWidget::AllDockWidgetFeatures,
Qt::LeftDockWidgetArea );
......@@ -346,7 +348,7 @@ void MainWindow::initializeDockWidgets( void )
m_clipPreview = new PreviewWidget( new ClipRenderer, this );
dockManager->addDockedWidget( m_clipPreview,
tr( "Clip Preview" ),
QT_TRANSLATE_NOOP( "DockWidgetManager", "Clip Preview" ),
Qt::AllDockWidgetAreas,
QDockWidget::AllDockWidgetFeatures,
Qt::TopDockWidgetArea );
......@@ -355,7 +357,7 @@ void MainWindow::initializeDockWidgets( void )
m_projectPreview = new PreviewWidget( m_renderer, this );
dockManager->addDockedWidget( m_projectPreview,
tr( "Project Preview" ),
QT_TRANSLATE_NOOP( "DockWidgetManager", "Project Preview" ),
Qt::AllDockWidgetAreas,
QDockWidget::AllDockWidgetFeatures,
Qt::TopDockWidgetArea );
......@@ -363,7 +365,7 @@ void MainWindow::initializeDockWidgets( void )
connect( renderShortcut, SIGNAL( activated() ), m_projectPreview, SLOT( on_pushButtonPlay_clicked() ) );
QDockWidget* dock = dockManager->addDockedWidget( UndoStack::getInstance( this ),
tr( "History" ),
QT_TRANSLATE_NOOP( "DockWidgetManager", "History" ),
Qt::AllDockWidgetAreas,
QDockWidget::AllDockWidgetFeatures,
Qt::LeftDockWidgetArea );
......
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