[vlmc-devel] commit: MediaContainer: Renamed removeClip to deleteClip ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Wed Apr 14 00:36:27 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Tue Apr 13 23:20:49 2010 +0200| [648a288958c5f3a4e866d73316550f2a6ae9010f] | committer: Hugo Beauzée-Luyssen 

MediaContainer: Renamed removeClip to deleteClip

It actually delete the removed clip. This is mainly used as a SLOT, therefore, returning something was stupid.

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

 src/Gui/import/ImportController.cpp |    2 +-
 src/Gui/library/MediaListView.cpp   |    2 +-
 src/Library/MediaContainer.cpp      |    8 ++++----
 src/Library/MediaContainer.h        |    7 ++++---
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/Gui/import/ImportController.cpp b/src/Gui/import/ImportController.cpp
index a650e5e..03d7c0b 100644
--- a/src/Gui/import/ImportController.cpp
+++ b/src/Gui/import/ImportController.cpp
@@ -328,7 +328,7 @@ ImportController::failedToLoad( Media *media )
     m_ui->errorLabelImg->show();
     m_ui->errorLabel->show();
     QTimer::singleShot( 3000, this, SLOT( hideErrors() ) );
-    delete m_temporaryMedias->removeClip( media->baseClip()->uuid() );
+    m_temporaryMedias->deleteClip( media->baseClip()->uuid() );
 }
 
 void
diff --git a/src/Gui/library/MediaListView.cpp b/src/Gui/library/MediaListView.cpp
index e62b7de..9d9dc3b 100644
--- a/src/Gui/library/MediaListView.cpp
+++ b/src/Gui/library/MediaListView.cpp
@@ -35,7 +35,7 @@ MediaListView::MediaListView( StackViewController* nav, MediaContainer* mc ) :
     connect( mc, SIGNAL( newClipLoaded(Clip*) ),
              this, SLOT( newClipLoaded( Clip* ) ) );
     connect( this, SIGNAL( clipRemoved( const QUuid& ) ),
-             mc, SLOT( removeClip( const QUuid& ) ) );
+             mc, SLOT( deleteClip( const QUuid& ) ) );
     connect( mc, SIGNAL( clipRemoved( const QUuid& ) ),
              this, SLOT( __clipRemoved( const QUuid& ) ) );
     connect( mc, SIGNAL( destroyed() ), this, SLOT( deleteLater() ) );
diff --git a/src/Library/MediaContainer.cpp b/src/Library/MediaContainer.cpp
index de3d492..dc708d2 100644
--- a/src/Library/MediaContainer.cpp
+++ b/src/Library/MediaContainer.cpp
@@ -25,6 +25,7 @@
 #include <QUuid>
 
 #include "Clip.h"
+#include "Library.h"
 #include "MediaContainer.h"
 #include "Media.h"
 #include "MetaDataManager.h"
@@ -149,8 +150,8 @@ MediaContainer::removeAll()
     m_clips.clear();
 }
 
-Clip*
-MediaContainer::removeClip( const QUuid &uuid )
+void
+MediaContainer::deleteClip( const QUuid &uuid )
 {
     QHash<QUuid, Clip*>::iterator  it = m_clips.find( uuid );
     if ( it != m_clips.end() )
@@ -158,9 +159,8 @@ MediaContainer::removeClip( const QUuid &uuid )
         Clip* clip = it.value();
         m_clips.remove( uuid );
         emit clipRemoved( uuid );
-        return clip;
+        delete clip;
     }
-    return NULL;
 }
 
 const QHash<QUuid, Clip*>&
diff --git a/src/Library/MediaContainer.h b/src/Library/MediaContainer.h
index e503041..367a6af 100644
--- a/src/Library/MediaContainer.h
+++ b/src/Library/MediaContainer.h
@@ -91,7 +91,7 @@ public:
      *  \param  clip    The clip to be added.
      *  \return true if the Clip has been added.
      */
-    bool        addClip( Clip* clip );
+    virtual bool    addClip( Clip* clip );
 
     /**
      *  \brief  Save the contained media to the given XML stream
@@ -131,10 +131,11 @@ protected:
 
 public slots:
     /**
-     *  \brief  Delete a Clip from the container
+     *  \brief  Removes a Clip from the container and delete it
+     *
      *  \param  uuid    The clip to remove's uuid.
      */
-    Clip    *removeClip( const QUuid& uuid );
+    void    deleteClip( const QUuid& uuid );
     /**
      *  \brief  Clear the library (remove all the loaded Clip, delete their subclips, and
      *          delete them)



More information about the Vlmc-devel mailing list