From 02651e289dec38820a9b1cb290b80f12dd11e936 Mon Sep 17 00:00:00 2001 From: Francois Cartegnie Date: Wed, 30 Mar 2011 18:38:51 +0200 Subject: [PATCH] Qt: epg: don't hide EPG when there's still data. --- 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 deletion(-) diff --git a/modules/gui/qt4/components/epg/EPGView.cpp b/modules/gui/qt4/components/epg/EPGView.cpp index cddd58dff1..4e7e3dd239 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 e49a6e238b..ed5b44d77d 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 d32c181e2f..cc1391ca16 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(); -- 2.11.4.GIT