[vlc-commits] Qt: epg: updateduration: simplify.

Francois Cartegnie git at videolan.org
Wed Mar 23 22:10:58 CET 2011


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Mar 23 20:55:09 2011 +0100| [0bf8724d4a2f8f3f3094d64a4b5ed0d271119b36] | committer: Francois Cartegnie

Qt: epg: updateduration: simplify.

(there was no guarantee that each graphic item could be safely casted to
epgitem)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0bf8724d4a2f8f3f3094d64a4b5ed0d271119b36
---

 modules/gui/qt4/components/epg/EPGView.cpp |   18 +++++-------------
 1 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/modules/gui/qt4/components/epg/EPGView.cpp b/modules/gui/qt4/components/epg/EPGView.cpp
index de74957..15edd62 100644
--- a/modules/gui/qt4/components/epg/EPGView.cpp
+++ b/modules/gui/qt4/components/epg/EPGView.cpp
@@ -276,21 +276,13 @@ EPGView::~EPGView()
 
 void EPGView::updateDuration()
 {
-    QDateTime lastItem;
+    QDateTime maxItemTime;
     mutex.lock();
-    QList<QGraphicsItem*> list = items();
-
-    for ( int i = 0; i < list.count(); ++i )
-    {
-        EPGItem* item = qgraphicsitem_cast<EPGItem*>( list.at( i ) );
-        if ( !item ) continue;
-        QDateTime itemEnd = item->start().addSecs( item->duration() );
-
-        if ( itemEnd > lastItem )
-            lastItem = itemEnd;
-    }
+    foreach( EPGEventByTimeQMap *epgItemByTime, epgitemsByChannel.values() )
+        foreach( EPGItem *epgItem, epgItemByTime->values() )
+            if ( epgItem->end() > maxItemTime ) maxItemTime = epgItem->end();
     mutex.unlock();
-    m_duration = m_startTime.secsTo( lastItem );
+    m_duration = m_startTime.secsTo( maxItemTime );
     emit durationChanged( m_duration );
 }
 



More information about the vlc-commits mailing list