[vlmc-devel] commit: MainWindow: Reworked default layout ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Thu Oct 7 18:42:15 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu Oct  7 17:59:09 2010 +0200| [e8cf379bd9ccc2621c062de951d6f4cec4eca615] | committer: Hugo Beauzée-Luyssen 

MainWindow: Reworked default layout

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=e8cf379bd9ccc2621c062de951d6f4cec4eca615
---

 src/Gui/MainWindow.cpp |   76 ++++++++++++++++++++++++------------------------
 src/Gui/MainWindow.h   |   22 ++++++++------
 2 files changed, 51 insertions(+), 47 deletions(-)

diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index c86fcfd..ffc06e3 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -343,27 +343,6 @@ MainWindow::loadVlmcPreferences( const QString &subPart )
 #undef CREATE_MENU_SHORTCUT
 
 void
-MainWindow::setupLibrary()
-{
-    m_importController = new ImportController();
-    const ClipRenderer* clipRenderer = qobject_cast<const ClipRenderer*>( m_clipPreview->getGenericRenderer() );
-    Q_ASSERT( clipRenderer != NULL );
-
-    MediaLibrary    *mediaLibrary = new MediaLibrary();
-
-    DockWidgetManager::getInstance()->addDockedWidget( mediaLibrary, QT_TRANSLATE_NOOP( "DockWidgetManager", "Media Library" ),
-                                                    Qt::AllDockWidgetAreas,
-                                                    QDockWidget::AllDockWidgetFeatures,
-                                                    Qt::LeftDockWidgetArea );
-    connect( mediaLibrary, SIGNAL( clipSelected( Clip* ) ),
-             clipRenderer, SLOT( setClip( Clip* ) ) );
-    connect( mediaLibrary, SIGNAL( importRequired() ),
-             this, SLOT( on_actionImport_triggered() ) );
-    connect( Library::getInstance(), SIGNAL( clipRemoved( const QUuid& ) ),
-             clipRenderer, SLOT( clipUnloaded( const QUuid& ) ) );
-}
-
-void
 MainWindow::on_actionSave_triggered()
 {
     GUIProjectManager::getInstance()->saveProject();
@@ -435,14 +414,8 @@ MainWindow::createStatusBar()
 void
 MainWindow::initializeDockWidgets( void )
 {
-    DockWidgetManager *dockManager = DockWidgetManager::getInstance();
-
-    EffectsListView *effectsList = new EffectsListView( this );
-    effectsList->setType( Effect::Filter );
-    dockManager->addDockedWidget( effectsList,
-                                  QT_TRANSLATE_NOOP( "DockWidgetManager", "Effects List" ),
-                                  Qt::AllDockWidgetAreas, QDockWidget::AllDockWidgetFeatures,
-                                  Qt::LeftDockWidgetArea );
+    m_effectsList = new EffectsListView( this );
+    m_effectsList->setType( Effect::Filter );
     EffectsEngine::getInstance()->loadEffects();
 
     m_renderer = new WorkflowRenderer();
@@ -454,30 +427,57 @@ MainWindow::initializeDockWidgets( void )
 
     m_clipPreview = new PreviewWidget( this );
     m_clipPreview->setRenderer( new ClipRenderer );
-    dockManager->addDockedWidget( m_clipPreview,
-                                  QT_TRANSLATE_NOOP( "DockWidgetManager", "Clip Preview" ),
-                                  Qt::AllDockWidgetAreas,
-                                  QDockWidget::AllDockWidgetFeatures,
-                                  Qt::TopDockWidgetArea );
+
     KeyboardShortcutHelper* clipShortcut = new KeyboardShortcutHelper( "keyboard/mediapreview", this );
     connect( clipShortcut, SIGNAL( activated() ), m_clipPreview, SLOT( on_pushButtonPlay_clicked() ) );
 
     m_projectPreview = new PreviewWidget( this );
     m_projectPreview->setRenderer( m_renderer );
+    KeyboardShortcutHelper* renderShortcut = new KeyboardShortcutHelper( "keyboard/renderpreview", this );
+    connect( renderShortcut, SIGNAL( activated() ), m_projectPreview, SLOT( on_pushButtonPlay_clicked() ) );
+
+    m_importController = new ImportController();
+    const ClipRenderer* clipRenderer = qobject_cast<const ClipRenderer*>( m_clipPreview->getGenericRenderer() );
+    Q_ASSERT( clipRenderer != NULL );
+
+    m_mediaLibrary = new MediaLibrary( this );
+    connect( m_mediaLibrary, SIGNAL( clipSelected( Clip* ) ),
+             clipRenderer, SLOT( setClip( Clip* ) ) );
+    connect( m_mediaLibrary, SIGNAL( importRequired() ),
+             this, SLOT( on_actionImport_triggered() ) );
+    connect( Library::getInstance(), SIGNAL( clipRemoved( const QUuid& ) ),
+             clipRenderer, SLOT( clipUnloaded( const QUuid& ) ) );
+    setupDockedWidgets();
+}
+
+void
+MainWindow::setupDockedWidgets()
+{
+    DockWidgetManager *dockManager = DockWidgetManager::getInstance();
+
+    dockManager->addDockedWidget( m_mediaLibrary, QT_TRANSLATE_NOOP( "DockWidgetManager", "Media Library" ),
+                                                    Qt::AllDockWidgetAreas,
+                                                    QDockWidget::AllDockWidgetFeatures,
+                                                    Qt::TopDockWidgetArea );
+    dockManager->addDockedWidget( m_clipPreview,
+                                  QT_TRANSLATE_NOOP( "DockWidgetManager", "Clip Preview" ),
+                                  Qt::AllDockWidgetAreas,
+                                  QDockWidget::AllDockWidgetFeatures,
+                                  Qt::TopDockWidgetArea );
     dockManager->addDockedWidget( m_projectPreview,
                                   QT_TRANSLATE_NOOP( "DockWidgetManager", "Project Preview" ),
                                   Qt::AllDockWidgetAreas,
                                   QDockWidget::AllDockWidgetFeatures,
                                   Qt::TopDockWidgetArea );
-    KeyboardShortcutHelper* renderShortcut = new KeyboardShortcutHelper( "keyboard/renderpreview", this );
-    connect( renderShortcut, SIGNAL( activated() ), m_projectPreview, SLOT( on_pushButtonPlay_clicked() ) );
-
+    dockManager->addDockedWidget( m_effectsList,
+                                  QT_TRANSLATE_NOOP( "DockWidgetManager", "Effects List" ),
+                                  Qt::AllDockWidgetAreas, QDockWidget::AllDockWidgetFeatures,
+                                  Qt::LeftDockWidgetArea );
     dockManager->addDockedWidget( UndoStack::getInstance( this ),
                                   QT_TRANSLATE_NOOP( "DockWidgetManager", "History" ),
                                   Qt::AllDockWidgetAreas,
                                   QDockWidget::AllDockWidgetFeatures,
                                   Qt::LeftDockWidgetArea );
-    setupLibrary();
 }
 
 void
diff --git a/src/Gui/MainWindow.h b/src/Gui/MainWindow.h
index e7956d0..2d32c4e 100644
--- a/src/Gui/MainWindow.h
+++ b/src/Gui/MainWindow.h
@@ -32,13 +32,15 @@
 #include "config.h"
 #include "ui_MainWindow.h"
 
-class Timeline;
-class PreviewWidget;
-class Settings;
-class ProjectWizard;
-class ImportController;
-class WorkflowFileRenderer;
-class WorkflowRenderer;
+class   EffectsListView;
+class   ImportController;
+class   MediaLibrary;
+class   PreviewWidget;
+class   ProjectWizard;
+class   Settings;
+class   Timeline;
+class   WorkflowFileRenderer;
+class   WorkflowRenderer;
 
 class MainWindow : public QMainWindow
 {
@@ -61,8 +63,8 @@ protected:
 
 private:
     void        initializeDockWidgets( void );
-    void        setupLibrary();
     void        checkFolders();
+    void        setupDockedWidgets();
     void        createStatusBar();
     void        createNotificationZone();
     void        createGlobalPreferences();
@@ -102,7 +104,7 @@ private:
      *  \brief  Gets video parameters from RendererSettings Dialog
      *          exportType when set to true, renders video to user defined location
      *          and when set to false, renders video to temporary folder.
-     *  \return same as renderVideo(), 
+     *  \return same as renderVideo(),
      *          true if video renders well or not cancelled by the user.
      */
     bool        renderVideoSettings( bool exportType );
@@ -119,6 +121,8 @@ private:
     Settings*               m_projectPreferences;
     ProjectWizard*          m_pWizard;
     ImportController*       m_importController;
+    MediaLibrary            *m_mediaLibrary;
+    EffectsListView         *m_effectsList;
 
 private slots:
     void                    on_actionFullscreen_triggered( bool checked );



More information about the Vlmc-devel mailing list