[vlc-commits] Qt: epgwidget: use anon enum for indexes

Francois Cartegnie git at videolan.org
Fri Apr 1 23:40:00 CEST 2011


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Apr  1 22:57:32 2011 +0200| [a791fc94a66889d974a9da972230251c3fe1d457] | committer: Francois Cartegnie

Qt: epgwidget: use anon enum for indexes

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

 modules/gui/qt4/components/epg/EPGWidget.cpp |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/modules/gui/qt4/components/epg/EPGWidget.cpp b/modules/gui/qt4/components/epg/EPGWidget.cpp
index d059de2..c3a8432 100644
--- a/modules/gui/qt4/components/epg/EPGWidget.cpp
+++ b/modules/gui/qt4/components/epg/EPGWidget.cpp
@@ -37,6 +37,12 @@
 #include <vlc_common.h>
 #include <vlc_epg.h>
 
+enum
+{
+    EPGVIEW_WIDGET = 0,
+    NOEPG_WIDGET = 1
+};
+
 EPGWidget::EPGWidget( QWidget *parent ) : QWidget( parent )
 {
     b_input_type_known = false;
@@ -58,11 +64,11 @@ EPGWidget::EPGWidget( QWidget *parent ) : QWidget( parent )
     layout->addWidget( m_epgView, 1, 1 );
     layout->setSpacing( 0 );
     containerWidget->setLayout( layout );
-    rootWidget->addWidget( containerWidget ); /* index 0 */
+    rootWidget->insertWidget( EPGVIEW_WIDGET, containerWidget );
 
     QLabel *noepgLabel = new QLabel( qtr("No EPG Data Available"), this );
     noepgLabel->setAlignment( Qt::AlignCenter );
-    rootWidget->addWidget( noepgLabel ); /* index 1 */
+    rootWidget->insertWidget( NOEPG_WIDGET, noepgLabel );
 
     rootWidget->setCurrentIndex( 1 );
     layout = new QGridLayout( this );
@@ -125,7 +131,8 @@ void EPGWidget::updateEPG( input_item_t *p_input_item )
     vlc_mutex_unlock( & p_input_item->lock );
 
     /* toggle our widget view */
-    rootWidget->setCurrentIndex( m_epgView->hasValidData() ? 0 : 1 );
+    rootWidget->setCurrentIndex(
+            m_epgView->hasValidData() ? EPGVIEW_WIDGET : NOEPG_WIDGET );
 
     // Update the global duration and start time.
     m_epgView->updateDuration();



More information about the vlc-commits mailing list