]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/dialogs/epg.cpp
QT4: Connect INPUT_EVENT_ITEM_EPG to update epg-widget via inputmanager
[vlc] / modules / gui / qt4 / dialogs / epg.cpp
index 85222fbad02b7c30f22981740b2ed03e05ee16c7..d54da54c0d1ae2ac29024dd0505a42301e531a4c 100644 (file)
 #include <QGroupBox>
 #include <QPushButton>
 
+#include "qt4.hpp"
+#include "input_manager.hpp"
+
 EpgDialog::EpgDialog( intf_thread_t *_p_intf ): QVLCFrame( _p_intf )
 {
-    setWindowTitle( "Program Guide" );
+    setWindowTitle( qtr( "Program Guide" ) );
 
     QVBoxLayout *layout = new QVBoxLayout( this );
     layout->setMargin( 0 );
     QSplitter *splitter = new QSplitter( this );
-    EPGWidget *epg = new EPGWidget( this );
+    epg = new EPGWidget( this );
     splitter->addWidget( epg );
     splitter->setOrientation(Qt::Vertical);
 
@@ -52,6 +55,8 @@ EpgDialog::EpgDialog( intf_thread_t *_p_intf ): QVLCFrame( _p_intf )
     description = new QLabel( this );
     description->setFrameStyle( QFrame::Sunken | QFrame::StyledPanel );
     description->setAutoFillBackground( true );
+    description->setWordWrap( true );
+    description->setAlignment( Qt::AlignLeft | Qt::AlignTop );
 
     QPalette palette;
     palette.setBrush(QPalette::Active, QPalette::Window, palette.brush( QPalette::Base ) );
@@ -67,16 +72,23 @@ EpgDialog::EpgDialog( intf_thread_t *_p_intf ): QVLCFrame( _p_intf )
     layout->addWidget( splitter );
 
     CONNECT( epg, itemSelectionChanged( EPGEvent *), this, showEvent( EPGEvent *) );
+    CONNECT( THEMIM->getIM(), epgChanged(), this, updateInfos() );
+
+    QPushButton *update = new QPushButton( qtr( "Update" ) ); //Temporary to test
+    layout->addWidget( update, 0, Qt::AlignRight );
+    BUTTONACT( update, updateInfos() );
 
     QPushButton *close = new QPushButton( qtr( "&Close" ) );
     layout->addWidget( close, 0, Qt::AlignRight );
     BUTTONACT( close, close() );
 
-    resize( 650, 400 );
+    updateInfos();
+    readSettings( "EPGDialog", QSize( 650, 450 ) );
 }
 
 EpgDialog::~EpgDialog()
 {
+    writeSettings( "EPGDialog" );
 }
 
 void EpgDialog::showEvent( EPGEvent *event )
@@ -84,6 +96,17 @@ void EpgDialog::showEvent( EPGEvent *event )
     if( !event ) return;
 
     title->setText( event->name );
-    description->setText( event->description );
+    if( !event->description.isEmpty() )
+        description->setText( event->description );
+    else
+        description->setText( event->shortDescription );
 }
 
+void EpgDialog::updateInfos()
+{
+    if( !THEMIM->getInput() ) return;
+
+    msg_Dbg( p_intf, "Found %i EPG items", input_GetItem( THEMIM->getInput())->i_epg);
+    epg->updateEPG( input_GetItem( THEMIM->getInput())->pp_epg, input_GetItem( THEMIM->getInput())->i_epg );
+
+}