[vlmc-devel] commit: MediaLibrary: Creating a new Widget to display the media library. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Fri May 14 18:51:24 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu May 13 18:32:06 2010 +0200| [4e97bdad072902d8c84280a89277aa6b2a8b1101] | committer: Hugo Beauzée-Luyssen 

MediaLibrary: Creating a new Widget to display the media library.

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

 src/CMakeLists.txt                 |    3 ++
 src/Gui/MainWindow.cpp             |   25 ++++++-------------
 src/Gui/library/MediaLibrary.cpp   |   41 +++++++++++++++++++++++++++++++
 src/Gui/library/MediaLibrary.h     |   47 ++++++++++++++++++++++++++++++++++++
 src/Gui/library/ui/MediaLibrary.ui |   37 ++++++++++++++++++++++++++++
 5 files changed, 136 insertions(+), 17 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3a4f076..bd3601a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -157,6 +157,7 @@ ELSE(NOT WITH_GUI)
         Gui/import/ImportController.cpp
         Gui/library/ListViewController.cpp
         Gui/library/MediaCellView.cpp
+        Gui/library/MediaLibrary.cpp
         Gui/library/MediaListView.cpp
         Gui/library/StackViewController.cpp
         Gui/library/StackViewNavController.cpp
@@ -205,6 +206,7 @@ ELSE(NOT WITH_GUI)
         Gui/import/TagWidget.h
         Gui/library/ListViewController.h
         Gui/library/MediaCellView.h
+        Gui/library/MediaLibrary.h
         Gui/library/MediaListView.h
         Gui/library/StackViewController.h
         Gui/library/StackViewNavController.h
@@ -252,6 +254,7 @@ ELSE(NOT WITH_GUI)
         Gui/import/ui/ImportController.ui
         Gui/library/StackViewNavController.ui
         Gui/library/ui/MediaCellView.ui
+        Gui/library/ui/MediaLibrary.ui
         Gui/library/ui/StackViewNavController.ui
         Gui/ui/About.ui
         Gui/ui/ClipProperty.ui
diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index 76a4847..315ea9d 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -4,7 +4,7 @@
  * Copyright (C) 2008-2010 VideoLAN
  *
  * Authors: Ludovic Fauvet <etix at l0cal.com>
- *          Hugo Beauzee-Luyssen <beauze.h at gmail.com>
+ *          Hugo Beauzée-Luyssen <beauze.h at gmail.com>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -46,7 +46,7 @@
 /* Widgets */
 #include "DockWidgetManager.h"
 #include "ImportController.h"
-#include "MediaListView.h"
+#include "MediaLibrary.h"
 #include "PreviewWidget.h"
 #include "timeline/Timeline.h"
 #include "timeline/TracksView.h"
@@ -272,29 +272,20 @@ MainWindow::loadVlmcPreferences( const QString &subPart )
 void
 MainWindow::setupLibrary()
 {
-    //GUI part :
-    QWidget     *libraryWidget = new QWidget( this );
-    libraryWidget->setMinimumWidth( 280 );
-
-    QPushButton *button = new QPushButton( tr( "Import" ), this );
-    connect( button, SIGNAL( clicked() ), this, SLOT( on_actionImport_triggered() ) );
-
-    StackViewController *nav = new StackViewController( libraryWidget );
-    MediaListView   *mediaView = new MediaListView( nav, Library::getInstance() );
-    nav->pushViewController( mediaView );
-    libraryWidget->layout()->addWidget( button );
-
     m_importController = new ImportController();
     const ClipRenderer* clipRenderer = qobject_cast<const ClipRenderer*>( m_clipPreview->getGenericRenderer() );
     Q_ASSERT( clipRenderer != NULL );
 
-    DockWidgetManager::getInstance()->addDockedWidget( libraryWidget, QT_TRANSLATE_NOOP( "DockWidgetManager", "Media Library" ),
+    MediaLibrary    *mediaLibrary = new MediaLibrary();
+
+    DockWidgetManager::getInstance()->addDockedWidget( mediaLibrary, QT_TRANSLATE_NOOP( "DockWidgetManager", "Media Library" ),
                                                     Qt::AllDockWidgetAreas,
                                                     QDockWidget::AllDockWidgetFeatures,
                                                     Qt::LeftDockWidgetArea );
-    connect( mediaView, SIGNAL( clipSelected( Clip* ) ),
+    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& ) ) );
 }
diff --git a/src/Gui/library/MediaLibrary.cpp b/src/Gui/library/MediaLibrary.cpp
new file mode 100644
index 0000000..c1ca804
--- /dev/null
+++ b/src/Gui/library/MediaLibrary.cpp
@@ -0,0 +1,41 @@
+/*****************************************************************************
+ * MediaLibrary.cpp: VLMC media library's ui
+ *****************************************************************************
+ * Copyright (C) 2008-2010 VideoLAN
+ *
+ * Authors: Hugo Beauzée-Luyssen <beauze.h at gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#include "MediaLibrary.h"
+
+#include "Library.h"
+#include "MediaListView.h"
+#include "StackViewController.h"
+
+MediaLibrary::MediaLibrary(QWidget *parent) : QWidget(parent),
+    m_ui( new Ui::MediaLibrary() )
+{
+    m_ui->setupUi( this );
+    StackViewController *nav = new StackViewController( m_ui->mediaListContainer );
+    MediaListView       *mediaListView = new MediaListView( nav, Library::getInstance() );
+    nav->pushViewController( mediaListView );
+
+    connect( m_ui->importButton, SIGNAL( clicked() ),
+             this, SIGNAL( importRequired() ) );
+    connect( mediaListView, SIGNAL( clipSelected( Clip* ) ),
+             this, SIGNAL( clipSelected( Clip* ) ) );
+}
diff --git a/src/Gui/library/MediaLibrary.h b/src/Gui/library/MediaLibrary.h
new file mode 100644
index 0000000..c8dc0d4
--- /dev/null
+++ b/src/Gui/library/MediaLibrary.h
@@ -0,0 +1,47 @@
+/*****************************************************************************
+ * MediaLibrary.h: VLMC media library's ui
+ *****************************************************************************
+ * Copyright (C) 2008-2010 VideoLAN
+ *
+ * Authors: Hugo Beauzee-Luyssen <beauze.h at gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef MEDIALIBRARY_H
+#define MEDIALIBRARY_H
+
+#include <QWidget>
+
+#include "ui_MediaLibrary.h"
+class   Clip;
+
+class MediaLibrary : public QWidget
+{
+    Q_OBJECT
+    Q_DISABLE_COPY( MediaLibrary );
+
+    public:
+        explicit MediaLibrary( QWidget *parent = 0);
+
+    private:
+        Ui::MediaLibrary    *m_ui;
+
+    signals:
+        void                importRequired();
+        void                clipSelected( Clip* );
+};
+
+#endif // MEDIALIBRARY_H
diff --git a/src/Gui/library/ui/MediaLibrary.ui b/src/Gui/library/ui/MediaLibrary.ui
new file mode 100644
index 0000000..45de2b0
--- /dev/null
+++ b/src/Gui/library/ui/MediaLibrary.ui
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MediaLibrary</class>
+ <widget class="QWidget" name="MediaLibrary">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="minimumSize">
+   <size>
+    <width>280</width>
+    <height>0</height>
+   </size>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QWidget" name="mediaListContainer" native="true"/>
+   </item>
+   <item>
+    <widget class="QPushButton" name="importButton">
+     <property name="text">
+      <string>Import</string>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>



More information about the Vlmc-devel mailing list