[vlc-commits] Qt: EPGWidget: use time reference from epg stream, or ignore

Francois Cartegnie git at videolan.org
Sat Mar 5 16:25:47 CET 2011


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Mar  4 23:44:22 2011 +0100| [6c75bad6fdb589a33217e07bacc20cfeb19bf61c] | committer: Francois Cartegnie

Qt: EPGWidget: use time reference from epg stream, or ignore

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

 modules/gui/qt4/components/epg/EPGWidget.cpp |    8 ++++++--
 modules/gui/qt4/components/epg/EPGWidget.hpp |    1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt4/components/epg/EPGWidget.cpp b/modules/gui/qt4/components/epg/EPGWidget.cpp
index 311e29c..4265b2f 100644
--- a/modules/gui/qt4/components/epg/EPGWidget.cpp
+++ b/modules/gui/qt4/components/epg/EPGWidget.cpp
@@ -40,6 +40,7 @@ EPGWidget::EPGWidget( QWidget *parent ) : QWidget( parent )
     m_rulerWidget = new EPGRuler( this );
     m_epgView = new EPGView( this );
     m_channelsWidget = new EPGChannels( this, m_epgView );
+    timeReference = QDateTime::currentDateTime().addDays( 1 );
 
     m_channelsWidget->setMinimumWidth( 100 );
 
@@ -97,8 +98,10 @@ void EPGWidget::updateEPG( vlc_epg_t **pp_epg, int i_epg, uint8_t i_input_type )
 {
     QStringList channelsList;
     EPGEvent* item;
-    /* FIXME: dvb time might be from the next timezone */
-    QDateTime timeReference = QDateTime::currentDateTime();
+
+    /* if we have epg time available take new minimum time */
+    if ( i_epg > 0 && pp_epg[0]->i_event > 0 )
+        timeReference = QDateTime::fromTime_t( pp_epg[0]->pp_event[0]->i_start );
 
     /* flush our EPG data if input type has changed */
     if ( b_input_type_known && i_input_type != i_event_source_type ) reset();
@@ -123,6 +126,7 @@ void EPGWidget::updateEPG( vlc_epg_t **pp_epg, int i_epg, uint8_t i_input_type )
             QDateTime eventStart = QDateTime::fromTime_t( p_event->i_start );
             /* ensure we display ongoing item */
             if ( eventStart < timeReference ) timeReference = eventStart;
+            /* FIXME: EPGView timechanged signal is duplicate */
             QList<EPGEvent*> events = m_events.values( channelName );
 
             item = new EPGEvent( eventName );
diff --git a/modules/gui/qt4/components/epg/EPGWidget.hpp b/modules/gui/qt4/components/epg/EPGWidget.hpp
index 445dc19..52ea382 100644
--- a/modules/gui/qt4/components/epg/EPGWidget.hpp
+++ b/modules/gui/qt4/components/epg/EPGWidget.hpp
@@ -57,6 +57,7 @@ private:
     QMultiMap<QString, EPGEvent*> m_events;
     uint8_t i_event_source_type;
     bool b_input_type_known;
+    QDateTime timeReference;
 
 signals:
     void itemSelectionChanged( EPGEvent * );



More information about the vlc-commits mailing list