* Video Widget. A simple frame on which video is drawn
* This class handles resize issues
**********************************************************************/
-static void *DoRequest( intf_thread_t *, vout_thread_t *, int*,int*,
- unsigned int *, unsigned int * );
-static void DoRelease( intf_thread_t *, void * );
-static int DoControl( intf_thread_t *, void *, int, va_list );
VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QFrame( NULL ), p_intf( _p_i )
{
plt.setColor( QPalette::Inactive, QPalette::Window , Qt::black );
setPalette( plt );
- /* The core can ask through a callback to show the video */
- CONNECT( this, askVideoWidgetToShow(), this, show() );
+ /* The core can ask through a callback to show the video.
+ * NOTE: We need to block the video output core until the window handle
+ * is ready for use (otherwise an X11 invalid handle failure may occur).
+ * As a side effect, it is illegal to emit askVideoWidgetToShow from
+ * the same thread as the Qt4 thread that owns this. */
+ QObject::connect( this, SIGNAL(askVideoWidgetToShow()), this, SLOT(show()),
+ Qt::BlockingQueuedConnection );
+
/* The core can ask through a callback to resize the video */
// CONNECT( this, askResize( int, int ), this, SetSizing( int, int ) );
}
return NULL;
}
p_vout = p_nvout;
+ msg_Dbg( p_intf, "embedded video handle %p", winId() );
return ( void* )winId();
}
controlLayout = new QGridLayout( );
controlLayout->setSpacing( 0 );
-#if QT43
- controlLayout->setContentsMargins( 9, 6, 9, 6 );
-#else
- controlLayout->setMargin( 6 );
-#endif
+ controlLayout->setLayoutMargins( 7, 5, 7, 3, 6 );
if( !b_fsCreation )
setLayout( controlLayout );
sectionNext() );
CONNECT( menuButton, clicked(), THEMIM->getIM(),
sectionMenu() );
+
/**
* Telextext QFrame
* TODO: Merge with upper menu in a StackLayout
**/
-#ifdef ZVBI_COMPILED
telexFrame = new QWidget( this );
QHBoxLayout *telexLayout = new QHBoxLayout( telexFrame );
telexLayout->setSpacing( 0 );
telexLayout->setMargin( 0 );
- QToolButton *telexOn = new QToolButton;
- telexOn->setText( qtr( "On" ) );
+ QPushButton *telexOn = new QPushButton;
setupSmallButton( telexOn );
telexLayout->addWidget( telexOn );
- QToolButton *telexTransparent = new QToolButton;
- telexTransparent->setText( qtr( "Transparent" ) );
+ telexTransparent = new QPushButton;
setupSmallButton( telexTransparent );
telexLayout->addWidget( telexTransparent );
+ b_telexTransparent = false;
- QSpinBox *telexPage = new QSpinBox;
+ telexPage = new QSpinBox;
telexPage->setRange( 0, 999 );
telexPage->setValue( 100 );
telexPage->setAccelerated( true );
telexLayout->addWidget( telexPage );
controlLayout->addWidget( telexFrame, 1, 10, 2, 3, Qt::AlignBottom );
- telexFrame->hide();
+ telexFrame->hide(); /* default hidden */
CONNECT( telexPage, valueChanged( int ), THEMIM->getIM(),
telexGotoPage( int ) );
+
+ BUTTON_SET_ACT_I( telexOn, "", tv.png, qtr( "Teletext on" ),
+ toggleTeletext() );
CONNECT( telexOn, clicked( bool ), THEMIM->getIM(),
telexToggle( bool ) );
+ telexTransparent->setEnabled( false );
+ telexPage->setEnabled( false );
+
+ BUTTON_SET_ACT_I( telexTransparent, "", tvtelx.png, qtr( "Teletext" ),
+ toggleTeletextTransparency() );
CONNECT( telexTransparent, clicked( bool ),
- THEMIM->getIM(), telexSetTransparency( bool ) );
+ THEMIM->getIM(), telexSetTransparency() );
CONNECT( THEMIM->getIM(), teletextEnabled( bool ),
telexFrame, setVisible( bool ) );
-#endif
/** Play Buttons **/
QSizePolicy sizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
ControlsWidget::~ControlsWidget()
{}
+void ControlsWidget::toggleTeletext()
+{
+ bool b_enabled = THEMIM->teletextState();
+ if( b_telexEnabled )
+ {
+ telexTransparent->setEnabled( false );
+ telexPage->setEnabled( false );
+ b_telexEnabled = false;
+ }
+ else if( b_enabled )
+ {
+ telexTransparent->setEnabled( true );
+ telexPage->setEnabled( true );
+ b_telexEnabled = true;
+ }
+}
+
+void ControlsWidget::toggleTeletextTransparency()
+{
+ if( b_telexTransparent )
+ {
+ telexTransparent->setIcon( QIcon( ":/pixmaps/tvtelx.png" ) );
+ telexTransparent->setToolTip( qtr( "Teletext" ) );
+ b_telexTransparent = false;
+ }
+ else
+ {
+ telexTransparent->setIcon( QIcon( ":/pixmaps/tvtelx-transparent.png" ) );
+ telexTransparent->setToolTip( qtr( "Transparent" ) );
+ b_telexTransparent = true;
+ }
+}
+
void ControlsWidget::stop()
{
THEMIM->stop();
QGridLayout *fsLayout = new QGridLayout( this );
controlLayout->setSpacing( 0 );
- #if QT43
- controlLayout->setContentsMargins( 5, 1, 5, 1 );
- #else
- controlLayout->setMargin( 5 );
- #endif
+ controlLayout->setLayoutMargins( 5, 1, 5, 1, 5 );
fsLayout->addWidget( slowerButton, 0, 0 );
slider->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum);
fsLayout->addWidget( discFrame, 1, 4 );
- #ifdef ZVBI_COMPILED
fsLayout->addWidget( telexFrame, 1, 5 );
- #endif
fsLayout->addWidget( advControls, 1, 6, Qt::AlignVCenter );
#endif
#if HAVE_TRANSPARENCY
- setWindowOpacity( 0.75 );
+ setWindowOpacity( DEFAULT_OPACITY );
#endif
}
else if ( type == FullscreenControlHide_Type )
{
FullscreenControllerWidget *p_fs = (FullscreenControllerWidget *) data;
- if ( p_fs->isFSCHidden() )
+ if ( p_fs->isFSCHidden() || p_fs->windowOpacity() < DEFAULT_OPACITY )
{
IMEvent *event = new IMEvent( FullscreenControlShow_Type, 0 );
QApplication::postEvent( p_fs, static_cast<QEvent *>(event) );