[vlc-commits] Qt: epg: don't hide EPG when there's still data.

Francois Cartegnie git at videolan.org
Wed Mar 30 18:39:15 CEST 2011


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Mar 30 18:38:51 2011 +0200| [02651e289dec38820a9b1cb290b80f12dd11e936] | committer: Francois Cartegnie

Qt: epg: don't hide EPG when there's still data.

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

 modules/gui/qt4/components/epg/EPGView.cpp   |    5 +++++
 modules/gui/qt4/components/epg/EPGView.hpp   |    1 +
 modules/gui/qt4/components/epg/EPGWidget.cpp |    4 +++-
 3 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/modules/gui/qt4/components/epg/EPGView.cpp b/modules/gui/qt4/components/epg/EPGView.cpp
index cddd58d..4e7e3dd 100644
--- a/modules/gui/qt4/components/epg/EPGView.cpp
+++ b/modules/gui/qt4/components/epg/EPGView.cpp
@@ -104,6 +104,11 @@ const QDateTime& EPGView::baseTime()
     return m_baseTime;
 }
 
+bool EPGView::hasValidData()
+{
+    return !epgitemsByChannel.empty();
+}
+
 static void cleanOverlapped( EPGEventByTimeQMap *epgItemByTime, EPGItem *epgItem, QGraphicsScene *scene )
 {
     /* Clean overlapped programs */
diff --git a/modules/gui/qt4/components/epg/EPGView.hpp b/modules/gui/qt4/components/epg/EPGView.hpp
index e49a6e2..ed5b44d 100644
--- a/modules/gui/qt4/components/epg/EPGView.hpp
+++ b/modules/gui/qt4/components/epg/EPGView.hpp
@@ -66,6 +66,7 @@ public:
     void            updateDuration();
     void            reset();
     void            cleanup();
+    bool            hasValidData();
 
 signals:
     void            startTimeChanged( const QDateTime& startTime );
diff --git a/modules/gui/qt4/components/epg/EPGWidget.cpp b/modules/gui/qt4/components/epg/EPGWidget.cpp
index d32c181..cc1391c 100644
--- a/modules/gui/qt4/components/epg/EPGWidget.cpp
+++ b/modules/gui/qt4/components/epg/EPGWidget.cpp
@@ -102,7 +102,6 @@ void EPGWidget::updateEPG( vlc_epg_t **pp_epg, int i_epg, uint8_t i_input_type )
     b_input_type_known = true;
 
     m_epgView->cleanup(); /* expire items and flags */
-    rootWidget->setCurrentIndex( ( i_epg > 0 ) ? 0 : 1 );
 
     for ( int i = 0; i < i_epg; ++i )
     {
@@ -117,6 +116,9 @@ void EPGWidget::updateEPG( vlc_epg_t **pp_epg, int i_epg, uint8_t i_input_type )
         }
     }
 
+    /* toggle our widget view */
+    rootWidget->setCurrentIndex( m_epgView->hasValidData() ? 0 : 1 );
+
     // Update the global duration and start time.
     m_epgView->updateDuration();
     m_epgView->updateStartTime();



More information about the vlc-commits mailing list