Commit aad09b89 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - threads assertions fixes, docking playlist and size of main interfaces fixes.

parent d7a496b7
......@@ -238,12 +238,6 @@ AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i ) :
advLayout->addWidget( ABButton );
BUTTON_SET_ACT( ABButton, "AB", qtr( "A to B" ), fromAtoB() );
snapshotButton = new QPushButton( "S" );
snapshotButton->setMaximumSize( QSize( 26, 26 ) );
snapshotButton->setIconSize( QSize( 20, 20 ) );
advLayout->addWidget( snapshotButton );
BUTTON_SET_ACT( snapshotButton, "S", qtr( "Take a snapshot" ), snapshot() );
//FIXME Frame by frame function
frameButton = new QPushButton( "Fr" );
frameButton->setMaximumSize( QSize( 26, 26 ) );
......@@ -259,11 +253,11 @@ AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i ) :
BUTTON_SET_ACT_I( recordButton, "", record_16px.png,
qtr( "Record" ), record() );
normalButton = new QPushButton( "N" );
normalButton->setMaximumSize( QSize( 26, 26 ) );
normalButton->setIconSize( QSize( 20, 20 ) );
advLayout->addWidget( normalButton );
BUTTON_SET_ACT( normalButton, "N", qtr( "Normal rate" ), normal() );
snapshotButton = new QPushButton( "S" );
snapshotButton->setMaximumSize( QSize( 26, 26 ) );
snapshotButton->setIconSize( QSize( 20, 20 ) );
advLayout->addWidget( snapshotButton );
BUTTON_SET_ACT( snapshotButton, "S", qtr( "Take a snapshot" ), snapshot() );
}
......@@ -275,7 +269,6 @@ void AdvControlsWidget::enableInput( bool enable )
{
ABButton->setEnabled( enable );
recordButton->setEnabled( enable );
normalButton->setEnabled( enable );
}
void AdvControlsWidget::enableVideo( bool enable )
{
......@@ -283,11 +276,6 @@ void AdvControlsWidget::enableVideo( bool enable )
frameButton->setEnabled( enable );
}
void AdvControlsWidget::normal()
{
THEMIM->getIM()->normalRate();
}
void AdvControlsWidget::snapshot()
{
vout_thread_t *p_vout = (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
......@@ -304,18 +292,10 @@ void AdvControlsWidget::record(){}
ControlsWidget::ControlsWidget( intf_thread_t *_p_i, bool b_advControls ) :
QFrame( NULL ), p_intf( _p_i )
{
//QSize size( 500, 200 );
//resize( size );
controlLayout = new QGridLayout( this );
controlLayout->setSpacing( 0 );
setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
#if DEBUG_COLOR
QPalette palette2;
palette2.setColor(this->backgroundRole(), Qt::magenta);
setPalette(palette2);
#endif
/** The main Slider **/
slider = new InputSlider( Qt::Horizontal, NULL );
controlLayout->addWidget( slider, 0, 1, 1, 16 );
......@@ -327,27 +307,26 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, bool b_advControls ) :
THEMIM->getIM(), sliderUpdate( float ) );
/** Slower and faster Buttons **/
slowerButton = new QPushButton( "S" );
slowerButton = new QPushButton;
slowerButton->setFlat( true );
slowerButton->setMaximumSize( QSize( 26, 20 ) );
BUTTON_SET_ACT( slowerButton, "S", qtr( "Slower" ), slower() );
BUTTON_SET_ACT( slowerButton, "-", qtr( "Slower" ), slower() );
controlLayout->addWidget( slowerButton, 0, 0 );
slowerButton->setMaximumSize( QSize( 26, 20 ) );
fasterButton = new QPushButton( "F" );
fasterButton = new QPushButton;
fasterButton->setFlat( true );
fasterButton->setMaximumSize( QSize( 26, 20 ) );
BUTTON_SET_ACT( fasterButton, "F", qtr( "Faster" ), faster() );
BUTTON_SET_ACT( fasterButton, "+", qtr( "Faster" ), faster() );
controlLayout->addWidget( fasterButton, 0, 17 );
fasterButton->setMaximumSize( QSize( 26, 20 ) );
/* advanced Controls handling */
b_advancedVisible = b_advControls;
advControls = new AdvControlsWidget( p_intf );
controlLayout->addWidget( advControls, 1, 3, 2, 5, Qt::AlignBottom );
controlLayout->addWidget( advControls, 1, 3, 2, 4, Qt::AlignBottom );
if( !b_advancedVisible ) advControls->hide();
// FIXME THIS should be removed. need_components_update = true;
/** Disc and Menus handling */
discFrame = new QFrame( this );
......@@ -389,6 +368,7 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, bool b_advControls ) :
/** TODO
* Telextext QFrame
* Merge with upper menu in a StackLayout
**/
/** Play Buttons **/
......@@ -481,7 +461,6 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, bool b_advControls ) :
/** TODO:
* Change this slider to use a nice Amarok-like one
* Add a Context menu to change to the most useful %
* **/
/** FIXME
* THis percerntage thing has to be handled correctly
......@@ -744,11 +723,6 @@ PlaylistWidget::~PlaylistWidget()
{
}
QSize PlaylistWidget::sizeHint() const
{
return widgetSize;
}
/**********************************************************************
* Speed control widget
**********************************************************************/
......
......@@ -91,6 +91,7 @@ private:
intf_thread_t *p_intf;
public slots:
void setArt( QString );
void toggle(){ TOGGLEV( this ); }
};
class VisualSelector : public QFrame
......@@ -107,6 +108,7 @@ private slots:
void next();
};
/* Advanced Button Bar */
class QPushButton;
class AdvControlsWidget : public QFrame
{
......@@ -114,22 +116,23 @@ class AdvControlsWidget : public QFrame
public:
AdvControlsWidget( intf_thread_t *);
virtual ~AdvControlsWidget();
void enableInput( bool );
void enableVideo( bool );
private:
intf_thread_t *p_intf;
QPushButton *normalButton, *recordButton, *ABButton;
QPushButton *recordButton, *ABButton;
QPushButton *snapshotButton, *frameButton;
private slots:
void normal();
void snapshot();
void frame();
void fromAtoB();
void record();
};
/* Button Bar */
class InputSlider;
class QSlider;
class QGridLayout;
......@@ -234,7 +237,6 @@ class PlaylistWidget : public QSplitter
public:
PlaylistWidget( intf_thread_t *_p_i ) ;
virtual ~PlaylistWidget();
QSize widgetSize;
virtual QSize sizeHint() const;
private:
PLSelector *selector;
......
......@@ -44,8 +44,6 @@ PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
setWindowTitle( qtr( "Playlist" ) );
setWindowOpacity( config_GetFloat( p_intf, "qt-opacity" ) );
createPlMenuBar( menuBar(), p_intf );
QHBoxLayout *l = new QHBoxLayout( centralWidget() );
PlaylistWidget *plw = new PlaylistWidget( p_intf );
l->addWidget( plw );
......@@ -58,27 +56,6 @@ PlaylistDialog::~PlaylistDialog()
writeSettings( "playlist" );
}
void PlaylistDialog::createPlMenuBar( QMenuBar *bar, intf_thread_t *p_intf )
{
QMenu *manageMenu = new QMenu();
manageMenu->setTitle( qtr("Manage") );
manageMenu->addAction( qtr("Open playlist file"), THEDP,
SLOT( openPlaylist() ), qtr( "Ctrl+X") );
manageMenu->addSeparator();
manageMenu->addAction( qtr("Dock playlist"), this, SLOT( dock() ),
qtr( "Ctrl+U" ) );
bar->addMenu( manageMenu );
bar->addMenu( QVLCMenu::SDMenu( p_intf ) );
}
void PlaylistDialog::dock()
{
hide();
QEvent *event = new QEvent( (QEvent::Type)(PLDockEvent_Type) );
QApplication::postEvent( p_intf->p_sys->p_mi, event );
}
void PlaylistDialog::dropEvent(QDropEvent *event)
{
const QMimeData *mimeData = event->mimeData();
......@@ -104,4 +81,3 @@ void PlaylistDialog::dragLeaveEvent(QDragLeaveEvent *event)
event->accept();
}
......@@ -48,8 +48,6 @@ public:
}
virtual ~PlaylistDialog();
private:
void createPlMenuBar( QMenuBar *bar, intf_thread_t *p_intf );
PlaylistDialog( intf_thread_t * );
void dropEvent( QDropEvent *);
......@@ -58,11 +56,6 @@ private:
void dragLeaveEvent( QDragLeaveEvent * );
static PlaylistDialog *instance;
PLSelector *selector;
PLPanel *rightPanel;
private slots:
void dock();
};
......
......@@ -258,6 +258,9 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
var_AddCallback( p_playlist, "intf-show", IntfShowCB, p_intf );
vlc_object_release( p_playlist );
}
CONNECT( this, askReleaseVideo( void * ), this, releaseVideoSlot( void * ) );
// DEBUG FIXME
hide();
}
......@@ -355,6 +358,7 @@ void MainInterface::handleMainUi( QSettings *settings )
bgWidget->resize( bgWidget->widgetSize );
bgWidget->updateGeometry();
mainLayout->insertWidget( 0, bgWidget );
CONNECT( this, askBgWidgetToToggle(), bgWidget, toggle() );
}
if( videoEmbeddedFlag )
......@@ -367,8 +371,6 @@ void MainInterface::handleMainUi( QSettings *settings )
p_intf->pf_request_window = ::DoRequest;
p_intf->pf_release_window = ::DoRelease;
p_intf->pf_control_window = ::DoControl;
CONNECT( this, askVideoToHide(), videoWidget, hide() );
}
/* Finish the sizing */
......@@ -390,12 +392,6 @@ void MainInterface::calculateInterfaceSize()
{
width = bgWidget->widgetSize.width();
height = bgWidget->widgetSize.height();
// assert( !(playlistWidget));// && playlistWidget->isVisible() ) );
}
else if( VISIBLE( playlistWidget ) )
{
width = playlistWidget->widgetSize.width();
height = playlistWidget->widgetSize.height();
}
else if( videoIsActive )
{
......@@ -407,12 +403,13 @@ void MainInterface::calculateInterfaceSize()
width = PREF_W - addSize.width();
height = PREF_H - addSize.height();
}
if( !dockPL->isFloating() )
{
width += dockPL->widget()->width();
height += dockPL->widget()->height();
}
if( VISIBLE( visualSelector ) )
height += visualSelector->height();
/* if( VISIBLE( advControls) )
{
height += advControls->sizeHint().height();
}*/
mainSize = QSize( width + addSize.width(), height + addSize.height() );
}
......@@ -428,18 +425,20 @@ void MainInterface::resizeEvent( QResizeEvent *e )
}
if( VISIBLE( playlistWidget ) )
{
SET_WH( playlistWidget , e->size().width() - addSize.width(),
e->size().height() - addSize.height() );
//FIXME
// SET_WH( playlistWidget , e->size().width() - addSize.width(),
// e->size().height() - addSize.height() );
playlistWidget->updateGeometry();
}
}
/****************************************************************************
* Small right-click menus
* Small right-click menu for rate control
****************************************************************************/
void MainInterface::showSpeedMenu( QPoint pos )
{
speedControlMenu->exec( QCursor::pos() - pos + QPoint( 0, speedLabel->height() ) );
speedControlMenu->exec( QCursor::pos() - pos
+ QPoint( 0, speedLabel->height() ) );
}
/****************************************************************************
......@@ -467,22 +466,18 @@ void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x,
int *pi_y, unsigned int *pi_width,
unsigned int *pi_height )
{
msg_Dbg( p_intf, "I was here" );
void *ret = videoWidget->request( p_nvout,pi_x, pi_y, pi_width, pi_height );
if( ret )
{
videoIsActive = true;
if( VISIBLE( playlistWidget ) )
{
embeddedPlaylistWasActive = true;
// playlistWidget->hide();
}
bool bgWasVisible = false;
if( VISIBLE( bgWidget) )
{
bgWasVisible = true;
bgWidget->hide();
emit askBgWidgetToToggle();
}
if( THEMIM->getIM()->hasVideo() || !bgWasVisible )
{
videoWidget->widgetSize = QSize( *pi_width, *pi_height );
......@@ -501,9 +496,14 @@ void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x,
}
void MainInterface::releaseVideo( void *p_win )
{
emit askReleaseVideo( p_win );
}
void MainInterface::releaseVideoSlot( void *p_win )
{
videoWidget->release( p_win );
emit askVideoToHide();
videoWidget->hide();
if( bgWidget )
bgWidget->show();
......@@ -515,7 +515,6 @@ void MainInterface::releaseVideo( void *p_win )
int MainInterface::controlVideo( void *p_window, int i_query, va_list args )
{
int i_ret = VLC_EGENERIC;
msg_Dbg( p_intf, "I was there" );
switch( i_query )
{
case VOUT_GET_SIZE:
......@@ -567,8 +566,9 @@ void MainInterface::togglePlaylist()
if(bgWidget)
CONNECT( playlistWidget, artSet( QString ), bgWidget, setArt(QString) );
playlistWidget->widgetSize = settings->value( "playlistSize",
QSize( 650, 310 ) ).toSize();
//FIXME
/* playlistWidget->widgetSize = settings->value( "playlistSize",
QSize( 650, 310 ) ).toSize();*/
/* Add it to the parent DockWidget */
dockPL->setWidget( playlistWidget );
......@@ -590,80 +590,13 @@ void MainInterface::togglePlaylist()
/* toggle the display */
TOGGLEV( dockPL );
}
#if 0 // Toggle the playlist dialog if not embedded and return
if( !playlistEmbeddedFlag )
{
if( playlistWidget )
{
/// \todo Destroy it
}
return;
}
// Create the playlist Widget and destroy the existing dialog
if( !playlistWidget )
{
PlaylistDialog::killInstance();
mainLayout->insertWidget( 0, playlistWidget );
playlistWidget->hide();
}
// And toggle visibility
if( VISIBLE( playlistWidget ) )
{
playlistWidget->hide();
if( bgWidget ) bgWidget->show();
if( videoIsActive )
{
videoWidget->widgetSize = savedVideoSize;
videoWidget->resize( videoWidget->widgetSize );
videoWidget->updateGeometry();
if( bgWidget ) bgWidget->hide();
}
}
else
{
playlistWidget->show();
if( videoIsActive )
{
savedVideoSize = videoWidget->widgetSize;
videoWidget->widgetSize.setHeight( 0 );
videoWidget->resize( videoWidget->widgetSize );
videoWidget->updateGeometry();
}
if( VISIBLE( bgWidget ) ) bgWidget->hide();
}
#endif
doComponentsUpdate();
}
void MainInterface::undockPlaylist()
{
dockPL->setFloating( true );
#if 0
if( playlistWidget )
{
playlistWidget->hide();
playlistWidget->deleteLater();
mainLayout->removeWidget( playlistWidget );
playlistWidget = NULL;
playlistEmbeddedFlag = false;
menuBar()->clear();
QVLCMenu::createMenuBar( this, p_intf, false, visualSelectorEnabled);
if( videoIsActive )
{
videoWidget->widgetSize = savedVideoSize;
videoWidget->resize( videoWidget->widgetSize );
videoWidget->updateGeometry();
}
doComponentsUpdate();
THEDP->playlistDialog();
}
#endif
}
#if 0
......
......@@ -135,6 +135,10 @@ public slots:
void togglePlaylist();
void toggleUpdateSystrayMenu();
void toggleAdvanced();
/* Manage the Video Functions from the vout threads */
void releaseVideoSlot( void * );
private slots:
void debug();
void updateOnTimer();
......@@ -153,7 +157,9 @@ private slots:
void updateSystrayTooltipStatus( int );
void showSpeedMenu( QPoint );
signals:
void askVideoToHide();
void askReleaseVideo( void * );
void askVideoToToggle();
void askBgWidgetToToggle();
};
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment