1 /*****************************************************************************
2 * Epg.cpp : Epg Viewer dialog
3 ****************************************************************************
4 * Copyright © 2010 VideoLAN and AUTHORS
6 * Authors: Jean-Baptiste Kempf <jb@videolan.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
27 #include "dialogs/epg.hpp"
29 #include "components/epg/EPGWidget.hpp"
31 #include <QVBoxLayout>
35 #include <QPushButton>
38 #include "input_manager.hpp"
40 EpgDialog::EpgDialog( intf_thread_t *_p_intf ): QVLCFrame( _p_intf )
42 setWindowTitle( qtr( "Program Guide" ) );
44 QVBoxLayout *layout = new QVBoxLayout( this );
45 layout->setMargin( 0 );
46 QSplitter *splitter = new QSplitter( this );
47 epg = new EPGWidget( this );
48 splitter->addWidget( epg );
49 splitter->setOrientation(Qt::Vertical);
51 QGroupBox *descBox = new QGroupBox( qtr( "Description" ), this );
53 QVBoxLayout *boxLayout = new QVBoxLayout( descBox );
55 description = new QLabel( this );
56 description->setFrameStyle( QFrame::Sunken | QFrame::StyledPanel );
57 description->setAutoFillBackground( true );
58 description->setWordWrap( true );
59 description->setAlignment( Qt::AlignLeft | Qt::AlignTop );
62 palette.setBrush(QPalette::Active, QPalette::Window, palette.brush( QPalette::Base ) );
63 description->setPalette( palette );
65 title = new QLabel( qtr( "Title" ), this );
67 boxLayout->addWidget( title );
68 boxLayout->addWidget( description, 10 );
70 splitter->addWidget( epg );
71 splitter->addWidget( descBox );
72 layout->addWidget( splitter );
74 CONNECT( epg, itemSelectionChanged( EPGEvent *), this, showEvent( EPGEvent *) );
76 QPushButton *update = new QPushButton( qtr( "Update" ) ); //Temporary to test
77 layout->addWidget( update, 0, Qt::AlignRight );
78 BUTTONACT( update, updateInfos() );
80 QPushButton *close = new QPushButton( qtr( "&Close" ) );
81 layout->addWidget( close, 0, Qt::AlignRight );
82 BUTTONACT( close, close() );
85 readSettings( "EPGDialog", QSize( 650, 450 ) );
88 EpgDialog::~EpgDialog()
90 writeSettings( "EPGDialog" );
93 void EpgDialog::showEvent( EPGEvent *event )
97 title->setText( event->name );
98 if( !event->description.isEmpty() )
99 description->setText( event->description );
101 description->setText( event->shortDescription );
104 void EpgDialog::updateInfos()
106 if( !THEMIM->getInput() ) return;
108 msg_Dbg( p_intf, "Found %i EPG items", input_GetItem( THEMIM->getInput())->i_epg);
109 epg->updateEPG( input_GetItem( THEMIM->getInput())->pp_epg, input_GetItem( THEMIM->getInput())->i_epg );