#include <QPalette>
#include <QResizeEvent>
#include <QDate>
+#ifdef Q_WS_X11
+# include <X11/Xlib.h>
+# include <qx11info_x11.h>
+#endif
/**********************************************************************
* 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 )
{
hide(); setMinimumSize( 16, 16 );
videoSize.rwidth() = -1;
videoSize.rheight() = -1;
+ setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
/* Black background is more coherent for a Video Widget IMVHO */
QPalette plt = palette();
plt.setColor( QPalette::Active, QPalette::Window , Qt::black );
plt.setColor( QPalette::Inactive, QPalette::Window , Qt::black );
setPalette( plt );
+ setAttribute( Qt::WA_PaintOnScreen, true );
+
+ /* The core can ask through a callback to show the video. */
+ connect( this, SIGNAL(askVideoWidgetToShow( unsigned int, unsigned int)),
+ this, SLOT(SetSizing(unsigned int, unsigned int )),
+ Qt::BlockingQueuedConnection );
+}
- /* The core can ask through a callback to show the video */
- CONNECT( this, askVideoWidgetToShow(), this, show() );
- /* The core can ask through a callback to resize the video */
- // CONNECT( this, askResize( int, int ), this, SetSizing( int, int ) );
+void VideoWidget::paintEvent(QPaintEvent *ev)
+{
+ QFrame::paintEvent(ev);
+#ifdef Q_WS_X11
+ XFlush( QX11Info::display() );
+#endif
}
VideoWidget::~VideoWidget()
unsigned int *pi_width, unsigned int *pi_height )
{
msg_Dbg( p_intf, "Video was requested %i, %i", *pi_x, *pi_y );
- emit askVideoWidgetToShow();
+ emit askVideoWidgetToShow( *pi_width, *pi_height );
if( p_vout )
{
msg_Dbg( p_intf, "embedded video already in use" );
return NULL;
}
p_vout = p_nvout;
+ msg_Dbg( p_intf, "embedded video ready (handle %p)", winId() );
return ( void* )winId();
}
msg_Dbg( p_intf, "Video is resizing to: %i %i", w, h );
videoSize.rwidth() = w;
videoSize.rheight() = h;
+ if( isHidden() ) show();
updateGeometry(); // Needed for deinterlace
}
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" ) );
+ 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 );
telexPage->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
telexLayout->addWidget( telexPage );
- controlLayout->addWidget( telexFrame, 1, 10, 2, 3, Qt::AlignBottom );
- telexFrame->hide();
+ if( !b_fsCreation )
+ controlLayout->addWidget( telexFrame, 1, 10, 2, 4, Qt::AlignBottom );
+ telexFrame->hide(); /* default hidden */
CONNECT( telexPage, valueChanged( int ), THEMIM->getIM(),
telexGotoPage( int ) );
+ CONNECT( THEMIM->getIM(), setNewTelexPage( int ),
+ telexPage, setValue( int ) );
+
+ BUTTON_SET_IMG( telexOn, "", tv.png, qtr( "Teletext on" ) );
+
+ CONNECT( telexOn, clicked(), THEMIM->getIM(),
+ telexToggleButtons() );
CONNECT( telexOn, clicked( bool ), THEMIM->getIM(),
telexToggle( bool ) );
+ CONNECT( THEMIM->getIM(), toggleTelexButtons(),
+ this, toggleTeletext() );
+ b_telexEnabled = false;
+ telexTransparent->setEnabled( false );
+ telexPage->setEnabled( false );
+
+ BUTTON_SET_IMG( telexTransparent, "", tvtelx.png, qtr( "Teletext" ) );
CONNECT( telexTransparent, clicked( bool ),
- THEMIM->getIM(), telexSetTransparency( bool ) );
+ THEMIM->getIM(), telexSetTransparency() );
+ CONNECT( THEMIM->getIM(), toggleTelexTransparency(),
+ this, toggleTeletextTransparency() );
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 )
var_DelCallback( p_vout, "mouse-moved",
showFullscreenControllCallback, (void *) p_fs );
b_registered = false;
- p_fs->hide();
}
+ if ( !var_GetBool( p_vout, "fullscreen" ) )
+ p_fs->hide();
+
return VLC_SUCCESS;
}
{
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) );