[vlc-commits] Qt: EPG: dialog: add no epg warning

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


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Mar 23 22:01:00 2011 +0100| [a5dcd1ee8646f8946d8d8a20cc824800128f832d] | committer: Francois Cartegnie

Qt: EPG: dialog: add no epg warning

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

 modules/gui/qt4/components/epg/EPGWidget.cpp |   15 +++++++++++++++
 modules/gui/qt4/components/epg/EPGWidget.hpp |    2 ++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/modules/gui/qt4/components/epg/EPGWidget.cpp b/modules/gui/qt4/components/epg/EPGWidget.cpp
index 5a997cc..c5ef9e8 100644
--- a/modules/gui/qt4/components/epg/EPGWidget.cpp
+++ b/modules/gui/qt4/components/epg/EPGWidget.cpp
@@ -27,6 +27,7 @@
 
 #include "EPGWidget.hpp"
 
+#include <QStackedWidget>
 #include <QVBoxLayout>
 #include <QScrollBar>
 #include <QLabel>
@@ -45,11 +46,24 @@ EPGWidget::EPGWidget( QWidget *parent ) : QWidget( parent )
     m_epgView->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
     setZoom( 1 );
 
+    rootWidget = new QStackedWidget( this );
+
+    QWidget *containerWidget = new QWidget( this );
     QGridLayout* layout = new QGridLayout( this );
     layout->addWidget( m_rulerWidget, 0, 1 );
     layout->addWidget( m_channelsWidget, 1, 0 );
     layout->addWidget( m_epgView, 1, 1 );
     layout->setSpacing( 0 );
+    containerWidget->setLayout( layout );
+    rootWidget->addWidget( containerWidget ); /* index 0 */
+
+    QLabel *noepgLabel = new QLabel( tr("No EPG Data Available"), this );
+    noepgLabel->setAlignment( Qt::AlignCenter );
+    rootWidget->addWidget( noepgLabel ); /* index 1 */
+
+    rootWidget->setCurrentIndex( 1 );
+    layout = new QGridLayout( this );
+    layout->addWidget( rootWidget );
     setLayout( layout );
 
     CONNECT( m_epgView, startTimeChanged(QDateTime),
@@ -88,6 +102,7 @@ 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 )
     {
diff --git a/modules/gui/qt4/components/epg/EPGWidget.hpp b/modules/gui/qt4/components/epg/EPGWidget.hpp
index 93a808d..73ae32f 100644
--- a/modules/gui/qt4/components/epg/EPGWidget.hpp
+++ b/modules/gui/qt4/components/epg/EPGWidget.hpp
@@ -33,6 +33,7 @@
 #include <vlc_epg.h>
 
 #include <QWidget>
+#include <QStackedWidget>
 
 class QDateTime;
 
@@ -51,6 +52,7 @@ private:
     EPGRuler* m_rulerWidget;
     EPGView* m_epgView;
     EPGChannels *m_channelsWidget;
+    QStackedWidget *rootWidget;
 
     uint8_t i_event_source_type;
     bool b_input_type_known;



More information about the vlc-commits mailing list