[vlmc-devel] commit: ImportController: Now using the new ClipMetadataDisplayer ( Hugo Beauzée-Luyssen )

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


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Fri May 14 17:21:36 2010 +0200| [a551b3dafae5711e5e4c710fef65117b34999010] | committer: Hugo Beauzée-Luyssen 

ImportController: Now using the new ClipMetadataDisplayer

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

 src/Gui/import/ImportController.cpp   |   42 ++-------------
 src/Gui/import/ImportController.h     |    6 +-
 src/Gui/import/ui/ImportController.ui |   94 +++------------------------------
 3 files changed, 14 insertions(+), 128 deletions(-)

diff --git a/src/Gui/import/ImportController.cpp b/src/Gui/import/ImportController.cpp
index 0bd4b5c..723ec48 100644
--- a/src/Gui/import/ImportController.cpp
+++ b/src/Gui/import/ImportController.cpp
@@ -22,11 +22,12 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#include "ImportController.h"
 #include "ui_ImportController.h"
 
 #include "Clip.h"
+#include "ClipMetadataDisplayer.h"
 #include "ClipRenderer.h"
-#include "ImportController.h"
 #include "Library.h"
 #include "Media.h"
 #include "MediaCellView.h"
@@ -56,6 +57,7 @@ ImportController::ImportController(QWidget *parent) :
     m_mediaListView = new MediaListView( m_stackNav, m_temporaryMedias );
     m_tag = new TagWidget( m_ui->tagContainer, 6 );
     m_filesModel = new QFileSystemModel( this );
+    m_metadataDisplayer = new ClipMetadataDisplayer( NULL, m_ui->metadataContainer );
     m_stackNav->pushViewController( m_mediaListView );
 
     m_nameFilters << Media::AudioExtensions.split(' ', QString::SkipEmptyParts)
@@ -132,7 +134,7 @@ ImportController::clipSelection( Clip* clip )
     const QUuid& uuid = clip->uuid();
     if ( m_currentUuid == uuid )
         return ;
-    setUIMetaData( clip->rootClip() );
+    m_metadataDisplayer->setWatchedClip( clip );
     m_preview->stop();
     m_currentUuid = uuid;
     m_tag->clipSelected( clip );
@@ -140,34 +142,6 @@ ImportController::clipSelection( Clip* clip )
 }
 
 void
-ImportController::setUIMetaData( const Clip* clip )
-{
-    if ( clip != NULL )
-    {
-        //Duration
-        QTime   duration;
-        duration = duration.addSecs( clip->lengthSecond() );
-        m_ui->durationValueLabel->setText( duration.toString( "hh:mm:ss" ) );
-        //Filename || title
-        m_ui->nameValueLabel->setText( clip->getMedia()->fileInfo()->fileName() );
-        m_ui->nameValueLabel->setWordWrap( true );
-        setWindowTitle( clip->getMedia()->fileInfo()->fileName() + " " + tr( "properties" ) );
-        //Resolution
-        m_ui->resolutionValueLabel->setText( QString::number( clip->getMedia()->width() )
-                                        + " x " + QString::number( clip->getMedia()->height() ) );
-        //FPS
-        m_ui->fpsValueLabel->setText( QString::number( clip->getMedia()->fps() ) );
-    }
-    else
-    {
-        m_ui->durationValueLabel->setText( "--:--:--" );
-        m_ui->nameValueLabel->setText( "none" );
-        m_ui->resolutionValueLabel->setText( "-- x --" );
-        m_ui->fpsValueLabel->setText( "--" );
-    }
-}
-
-void
 ImportController::importMedia( const QString &filePath )
 {
     if ( Library::getInstance()->mediaAlreadyLoaded( filePath ) == true ||
@@ -185,8 +159,6 @@ ImportController::importMedia( const QString &filePath )
     m_temporaryMedias->addClip( clip );
     ++m_nbMediaToLoad;
     m_ui->progressBar->setMaximum( m_nbMediaToLoad );
-    connect( media, SIGNAL( metaDataComputed( const Media* ) ),
-             this, SLOT( metaDataComputed( const Media* ) ) );
 }
 
 void
@@ -327,9 +299,3 @@ ImportController::hideErrors()
     m_ui->errorLabelImg->hide();
     m_ui->errorLabel->hide();
 }
-
-void
-ImportController::metaDataComputed( const Media *media )
-{
-    setUIMetaData( media->baseClip() );
-}
diff --git a/src/Gui/import/ImportController.h b/src/Gui/import/ImportController.h
index 6d8c761..dd9437a 100644
--- a/src/Gui/import/ImportController.h
+++ b/src/Gui/import/ImportController.h
@@ -36,8 +36,9 @@
 #include <QUuid>
 
 class   Clip;
-class   Media;
+class   ClipMetadataDisplayer;
 class   ClipRenderer;
+class   Media;
 class   MediaContainer;
 class   MediaListView;
 class   PreviewWidget;
@@ -62,7 +63,6 @@ class ImportController : public QDialog
     public:
         ImportController(QWidget *parent = 0);
         ~ImportController();
-        void    setUIMetaData( const Clip *clip );
 
     protected:
         void changeEvent( QEvent *e );
@@ -86,6 +86,7 @@ class ImportController : public QDialog
         quint32                     m_nbMediaLoaded;
         ClipRenderer*               m_clipRenderer;
         QStringList                 m_nameFilters;
+        ClipMetadataDisplayer       *m_metadataDisplayer;
 
     public slots:
         void        accept();
@@ -99,7 +100,6 @@ class ImportController : public QDialog
         void        mediaLoaded();
         void        failedToLoad( Media* media );
         void        hideErrors();
-        void        metaDataComputed( const Media* media );
 
     signals:
         void        clipSelected( Clip* );
diff --git a/src/Gui/import/ui/ImportController.ui b/src/Gui/import/ui/ImportController.ui
index 6e5829b..123cdac 100644
--- a/src/Gui/import/ui/ImportController.ui
+++ b/src/Gui/import/ui/ImportController.ui
@@ -14,7 +14,7 @@
    <string>Import</string>
   </property>
   <property name="windowIcon">
-   <iconset>
+   <iconset resource="../../../../ressources.qrc">
     <normaloff>:/images/images/vlmc.png</normaloff>:/images/images/vlmc.png</iconset>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout_11">
@@ -31,7 +31,7 @@
           <string/>
          </property>
          <property name="icon">
-          <iconset>
+          <iconset resource="../../../../ressources.qrc">
            <normaloff>:/images/forward</normaloff>:/images/forward</iconset>
          </property>
         </widget>
@@ -55,7 +55,7 @@
               <string/>
              </property>
              <property name="pixmap">
-              <pixmap>:/images/error</pixmap>
+              <pixmap resource="../../../../ressources.qrc">:/images/error</pixmap>
              </property>
             </widget>
            </item>
@@ -127,87 +127,7 @@
           </widget>
          </item>
          <item>
-          <widget class="QGroupBox" name="groupBox">
-           <property name="title">
-            <string>Media Properties</string>
-           </property>
-           <layout class="QGridLayout" name="gridLayout">
-            <item row="0" column="0">
-             <widget class="QLabel" name="nameLabel">
-              <property name="text">
-               <string>Name</string>
-              </property>
-             </widget>
-            </item>
-            <item row="0" column="1">
-             <widget class="QLabel" name="nameValueLabel">
-              <property name="text">
-               <string>unnamed</string>
-              </property>
-             </widget>
-            </item>
-            <item row="1" column="0">
-             <widget class="QLabel" name="durationLabel">
-              <property name="text">
-               <string>Duration</string>
-              </property>
-             </widget>
-            </item>
-            <item row="1" column="1">
-             <widget class="QLabel" name="durationValueLabel">
-              <property name="text">
-               <string>0s</string>
-              </property>
-             </widget>
-            </item>
-            <item row="2" column="0">
-             <widget class="QLabel" name="resolutionLabel">
-              <property name="sizePolicy">
-               <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
-                <horstretch>0</horstretch>
-                <verstretch>0</verstretch>
-               </sizepolicy>
-              </property>
-              <property name="text">
-               <string>Resolution</string>
-              </property>
-             </widget>
-            </item>
-            <item row="2" column="1">
-             <widget class="QLabel" name="resolutionValueLabel">
-              <property name="sizePolicy">
-               <sizepolicy hsizetype="Maximum" vsizetype="Minimum">
-                <horstretch>0</horstretch>
-                <verstretch>0</verstretch>
-               </sizepolicy>
-              </property>
-              <property name="text">
-               <string>0px. x 0px.</string>
-              </property>
-             </widget>
-            </item>
-            <item row="3" column="0">
-             <widget class="QLabel" name="fpsLabel">
-              <property name="sizePolicy">
-               <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
-                <horstretch>0</horstretch>
-                <verstretch>0</verstretch>
-               </sizepolicy>
-              </property>
-              <property name="text">
-               <string>FPS</string>
-              </property>
-             </widget>
-            </item>
-            <item row="3" column="1">
-             <widget class="QLabel" name="fpsValueLabel">
-              <property name="text">
-               <string>0</string>
-              </property>
-             </widget>
-            </item>
-           </layout>
-          </widget>
+          <widget class="QWidget" name="metadataContainer" native="true"/>
          </item>
          <item>
           <widget class="QWidget" name="tagContainer" native="true"/>
@@ -229,10 +149,10 @@
     </widget>
    </item>
   </layout>
-  <zorder>buttonBox</zorder>
-  <zorder>stackViewContainer</zorder>
  </widget>
- <resources/>
+ <resources>
+  <include location="../../../../ressources.qrc"/>
+ </resources>
  <connections>
   <connection>
    <sender>buttonBox</sender>



More information about the Vlmc-devel mailing list