#include "components/epg/EPGWidget.hpp"
-#include <QHBoxLayout>
+#include <QVBoxLayout>
#include <QSplitter>
#include <QLabel>
#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" ) );
- QHBoxLayout *layout = new QHBoxLayout( this );
+ 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);
QGroupBox *descBox = new QGroupBox( qtr( "Description" ), this );
- QHBoxLayout *boxLayout = new QHBoxLayout( descBox );
+ QVBoxLayout *boxLayout = new QVBoxLayout( descBox );
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 ) );
description->setPalette( palette );
- boxLayout->addWidget( description );
+ title = new QLabel( qtr( "Title" ), this );
+
+ boxLayout->addWidget( title );
+ boxLayout->addWidget( description, 10 );
splitter->addWidget( epg );
splitter->addWidget( descBox );
layout->addWidget( splitter );
- CONNECT( epg, descriptionChanged( const QString & ), description, setText( const QString & ) );
+ CONNECT( epg, itemSelectionChanged( EPGEvent *), this, showEvent( EPGEvent *) );
+
+ 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() );
+
+ updateInfos();
+ readSettings( "EPGDialog", QSize( 650, 450 ) );
}
EpgDialog::~EpgDialog()
{
+ writeSettings( "EPGDialog" );
}
+void EpgDialog::showEvent( EPGEvent *event )
+{
+ if( !event ) return;
+
+ title->setText( event->name );
+ 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 );
+
+}