videoIsActive = false;
input_name = "";
- /**
- * Ask for the network policy on FIRST STARTUP
- **/
- if( config_GetInt( p_intf, "privacy-ask") )
- {
- QList<ConfigControl *> controls;
- if( privacyDialog( controls ) == QDialog::Accepted )
- {
- QList<ConfigControl *>::Iterator i;
- for( i = controls.begin() ; i != controls.end() ; i++ )
- {
- ConfigControl *c = qobject_cast<ConfigControl *>(*i);
- c->doApply( p_intf );
- }
-
- config_PutInt( p_intf, "privacy-ask" , 0 );
- config_SaveConfigFile( p_intf, NULL );
- }
- }
+ /* Ask for privacy */
+ privacy();
/**
* Configuration and settings
/* Create a Dock to get the playlist */
dockPL = new QDockWidget( qtr( "Playlist" ), this );
dockPL->setSizePolicy( QSizePolicy::Preferred,
- QSizePolicy::MinimumExpanding );
+ QSizePolicy::Expanding );
dockPL->setFeatures( QDockWidget::AllDockWidgetFeatures );
dockPL->setAllowedAreas( Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
| Qt::BottomDockWidgetArea );
+ dockPL->hide();
/************
* Menu Bar
/****************
* Status Bar *
****************/
-
/* Widgets Creation*/
b_remainingTime = false;
timeLabel = new TimeLabel;
if( config_GetInt( p_intf, "qt-minimal-view" ) )
toggleMinimalView();
- /* Init input manager */
+ /********************
+ * Input Manager *
+ ********************/
MainInputManager::getInstance( p_intf );
- ON_TIMEOUT( updateOnTimer() );
- //ON_TIMEOUT( debug() ):;
/********************
* Various CONNECTs *
********************/
-
/* Connect the input manager to the GUI elements it manages */
+
/* It is also connected to the control->slider, see the ControlsWidget */
CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
this, setDisplayPosition( float, int, int ) );
-
+ /* Change the SpeedRate in the Status */
CONNECT( THEMIM->getIM(), rateChanged( int ), this, setRate( int ) );
/**
* Connects on nameChanged()
+ * Those connects are not merged because different options can trigger
+ * them down.
*/
/* Naming in the controller statusbar */
CONNECT( THEMIM->getIM(), nameChanged( QString ), this,
setVLCWindowsTitle( QString ) );
}
- /** CONNECTS on PLAY_STATUS **/
+ /**
+ * CONNECTS on PLAY_STATUS
+ **/
/* Status on the main controller */
CONNECT( THEMIM->getIM(), statusChanged( int ), this, setStatus( int ) );
/* and in the systray */
updateSystrayTooltipStatus( int ) );
}
+ /** OnTimeOut **/
+ // TODO
+ ON_TIMEOUT( updateOnTimer() );
+ //ON_TIMEOUT( debug() );
+
/**
* Callbacks
**/
vlc_object_release( p_playlist );
}
+ /* VideoWidget connect mess to avoid different threads speaking to each other */
CONNECT( this, askReleaseVideo( void * ), this, releaseVideoSlot( void * ) );
+ CONNECT( this, askVideoToResize( unsigned int, unsigned int ),
+ videoWidget, SetSizing( unsigned int, unsigned int ) );
+ CONNECT( this, askUpdate(), this, doComponentsUpdate() );
CONNECT( dockPL, topLevelChanged( bool ), this, doComponentsUpdate() );
- CONNECT( controls, advancedControlsToggled( bool ),
+ CONNECT( controls, advancedControlsToggled( bool ),
this, doComponentsUpdate() );
+ resize( settings->value( "size", QSize( 350, 60 ) ).toSize() );
updateGeometry();
settings->endGroup();
}
settings->beginGroup( "MainWindow" );
settings->setValue( "playlist-floats", dockPL->isFloating() );
- settings->setValue( "adv-controls",
+ settings->setValue( "adv-controls",
getControlsVisibilityStatus() & CONTROLS_ADVANCED );
settings->setValue( "pos", pos() );
+ settings->setValue( "size", size() );
settings->endGroup();
delete settings;
/* Margins, spacing */
main->setContentsMargins( 0, 0, 0, 0 );
+ // main->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum );
mainLayout->setMargin( 0 );
/* Create the CONTROLS Widget */
if( videoEmbeddedFlag )
{
videoWidget = new VideoWidget( p_intf );
- videoWidget->widgetSize = QSize( 1, 1 );
+ //videoWidget->widgetSize = QSize( 16, 16 );
+ //videoWidget->hide();
//videoWidget->resize( videoWidget->widgetSize );
mainLayout->insertWidget( 0, videoWidget );
updateGeometry();
}
+inline void MainInterface::privacy()
+{
+ /**
+ * Ask for the network policy on FIRST STARTUP
+ **/
+ if( config_GetInt( p_intf, "privacy-ask") )
+ {
+ QList<ConfigControl *> controls;
+ if( privacyDialog( controls ) == QDialog::Accepted )
+ {
+ QList<ConfigControl *>::Iterator i;
+ for( i = controls.begin() ; i != controls.end() ; i++ )
+ {
+ ConfigControl *c = qobject_cast<ConfigControl *>(*i);
+ c->doApply( p_intf );
+ }
+
+ config_PutInt( p_intf, "privacy-ask" , 0 );
+ config_SaveConfigFile( p_intf, NULL );
+ }
+ }
+}
+
int MainInterface::privacyDialog( QList<ConfigControl *> controls )
{
QDialog *privacy = new QDialog( this );
*/
QSize MainInterface::sizeHint() const
{
- QSize tempSize = controls->sizeHint() +
- QSize( 100, menuBar()->size().height() + statusBar()->size().height() );
+ int nwidth = controls->sizeHint().width();
+ int nheight = controls->sizeHint().height();
+ + menuBar()->size().height()
+ + statusBar()->size().height();
+ msg_Dbg( p_intf, "1 %i %i", nheight, nwidth );
if( VISIBLE( bgWidget ) )
- tempSize += bgWidget->sizeHint();
+ {
+ nheight += bgWidget->size().height();
+ nwidth = bgWidget->size().width();
+ }
else if( videoIsActive )
- tempSize += videoWidget->size();
-
+ {
+ nheight += videoWidget->size().height();
+ nwidth = videoWidget->size().width();
+ msg_Dbg( p_intf, "2 %i %i", nheight, nwidth );
+ }
if( !dockPL->isFloating() && dockPL->widget() )
- tempSize += dockPL->widget()->size();
-
- return tempSize;
+ {
+ nheight += dockPL->size().height();
+ nwidth = MAX( nwidth, dockPL->size().width() );
+ msg_Dbg( p_intf, "3 %i %i", nheight, nwidth );
+ }
+ msg_Dbg( p_intf, "4 %i %i", nheight, nwidth );
+ return QSize( nwidth, nheight );
}
#if 0
bool onTop;
};
+/* function called from ::DoRequest in order to show a nice VideoWidget
+ at the good size */
void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x,
int *pi_y, unsigned int *pi_width,
unsigned int *pi_height )
{
+ bool bgWasVisible = false;
+
+ /* Request the videoWidget */
void *ret = videoWidget->request( p_nvout,pi_x, pi_y, pi_width, pi_height );
- if( ret )
+ if( ret ) /* The videoWidget is available */
{
- videoIsActive = true;
- bool bgWasVisible = false;
-
- /* Did we have a bg ? */
+ /* Did we have a bg ? Hide it! */
if( VISIBLE( bgWidget) )
{
bgWasVisible = true;
emit askBgWidgetToToggle();
}
- if( THEMIM->getIM()->hasVideo() || !bgWasVisible )
+ /*if( THEMIM->getIM()->hasVideo() || !bgWasVisible )
{
videoWidget->widgetSize = QSize( *pi_width, *pi_height );
}
else /* Background widget available, use its size */
- {
+ /*{
/* Ok, our visualizations are bad, so don't do this for the moment
* use the requested size anyway */
// videoWidget->widgetSize = bgWidget->widgeTSize;
- videoWidget->widgetSize = QSize( *pi_width, *pi_height );
- }
- videoWidget->updateGeometry(); // Needed for deinterlace
- updateGeometry();
+ /* videoWidget->widgetSize = QSize( *pi_width, *pi_height );
+ }*/
+
+ videoIsActive = true;
+
+ emit askVideoToResize( *pi_width, *pi_height );
+ emit askUpdate();
}
return ret;
}
videoWidget->release( p_win );
videoWidget->hide();
- if( bgWidget )
+ if( bgWidget )// WORONG
bgWidget->show();
videoIsActive = false;
- updateGeometry();
+ emit askUpdate();
}
int MainInterface::controlVideo( void *p_window, int i_query, va_list args )
{
unsigned int i_width = va_arg( args, unsigned int );
unsigned int i_height = va_arg( args, unsigned int );
- videoWidget->widgetSize = QSize( i_width, i_height );
- videoWidget->updateGeometry();
+ emit askVideoToResize( i_width, i_height );
+ emit askUpdate();
updateGeometry();
i_ret = VLC_SUCCESS;
break;
/* Well, could it, actually ? Probably dangerous ... */
void MainInterface::doComponentsUpdate()
{
+ msg_Dbg( p_intf, "coi " );
updateGeometry();
+ resize( sizeHint() );
}
/* toggling advanced controls buttons */
void MainInterface::toggleTimeDisplay()
{
b_remainingTime = !b_remainingTime;
- //b_remainingTime = ( b_remainingTime ? false : true );
}
void MainInterface::setName( QString name )