[vlmc-devel] commit: MediaLibrary: Applying some new HACKING rules, and avoiding some copies ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Fri Oct 8 11:07:15 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Fri Oct  8 11:04:40 2010 +0200| [eee4398b2529b7babf12ae526aa88560f11341e6] | committer: Hugo Beauzée-Luyssen 

MediaLibrary: Applying some new HACKING rules, and avoiding some copies

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

 src/Gui/library/MediaLibrary.cpp |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/Gui/library/MediaLibrary.cpp b/src/Gui/library/MediaLibrary.cpp
index a913b6b..e9a00a8 100644
--- a/src/Gui/library/MediaLibrary.cpp
+++ b/src/Gui/library/MediaLibrary.cpp
@@ -58,9 +58,9 @@ MediaLibrary::MediaLibrary(QWidget *parent) : QWidget(parent),
 void
 MediaLibrary::filterUpdated( const QString &filter )
 {
-    const MediaListView::MediaList  &medias = m_mediaListView->mediaList();
-    MediaListView::MediaList::const_iterator it = medias.begin();
-    MediaListView::MediaList::const_iterator ite = medias.end();
+    const MediaListView::MediaList              &medias = m_mediaListView->mediaList();
+    MediaListView::MediaList::const_iterator    it = medias.begin();
+    MediaListView::MediaList::const_iterator    ite = medias.end();
 
     while ( it != ite )
     {
@@ -88,7 +88,7 @@ MediaLibrary::currentFilter()
 void
 MediaLibrary::viewChanged( ViewController *view )
 {
-    MediaListView *mlv = qobject_cast<MediaListView*>( view );
+    MediaListView       *mlv = qobject_cast<MediaListView*>( view );
 
     if ( mlv == NULL )
         return ;
@@ -142,7 +142,7 @@ MediaLibrary::dragLeaveEvent( QDragLeaveEvent *event )
 void
 MediaLibrary::dropEvent( QDropEvent *event )
 {
-    QList<QUrl> fileList = event->mimeData()->urls();
+    const QList<QUrl>         &fileList = event->mimeData()->urls();
 
     if ( fileList.isEmpty() )
     {
@@ -152,25 +152,24 @@ MediaLibrary::dropEvent( QDropEvent *event )
 
     Q_ASSERT( Library::getInstance() != NULL );
 
-    foreach ( QUrl url, fileList )
+    foreach ( const QUrl &url, fileList )
     {
-        const QString &fileName = url.toLocalFile();
+        const QString       &fileName = url.toLocalFile();
 
         if ( fileName.isEmpty() )
             continue;
 
-        Media *media = Library::getInstance()->addMedia( fileName );
+        Media       *media = Library::getInstance()->addMedia( fileName );
 
         if ( media != NULL )
         {
-            Clip* clip = new Clip( media );
+            Clip*       clip = new Clip( media );
             media->setBaseClip( clip );
             Library::getInstance()->addClip( clip );
             event->accept();
         }
         else
             qCritical() << "Clip already present in library or an error occurred while loading media:" << fileName;
-
     }
     event->accept();
 }



More information about the Vlmc-devel mailing list