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

Qt4: Center the Fullscreen controller on One screen, and remember pos.

Well, of course, X11/DirectX being so easy, there are n-1/n changes of being on the wrong screen (if you have n screen).
But at least, you can move and it will remember the position.
(cherry picked from commit 29b82ab8d1fb740b4be0d6a0d142a107ffe7be19)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 936a35d9
...@@ -1012,6 +1012,7 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, ...@@ -1012,6 +1012,7 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i,
i_mouse_last_move_y = -1; i_mouse_last_move_y = -1;
setWindowFlags( Qt::ToolTip ); setWindowFlags( Qt::ToolTip );
setMinimumWidth( 600 );
setFrameShape( QFrame::StyledPanel ); setFrameShape( QFrame::StyledPanel );
setFrameStyle( QFrame::Sunken ); setFrameStyle( QFrame::Sunken );
...@@ -1057,11 +1058,16 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, ...@@ -1057,11 +1058,16 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i,
adjustSize (); /* need to get real width and height for moving */ adjustSize (); /* need to get real width and height for moving */
/* center down */ /* center down */
QDesktopWidget * p_desktop = QApplication::desktop(); QWidget * p_desktop = QApplication::desktop()->screen(
QApplication::desktop()->screenNumber( _p_mi ) );
move( p_desktop->width() / 2 - width() / 2, QPoint pos = QPoint( p_desktop->width() / 2 - width() / 2,
p_desktop->height() - height() ); p_desktop->height() - height() );
getSettings()->beginGroup( "FullScreen" );
move( getSettings()->value( "pos", pos ).toPoint() );
getSettings()->endGroup();
#ifdef WIN32TRICK #ifdef WIN32TRICK
setWindowOpacity( 0.0 ); setWindowOpacity( 0.0 );
b_fscHidden = true; b_fscHidden = true;
...@@ -1072,11 +1078,13 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, ...@@ -1072,11 +1078,13 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i,
fullscreenButton->setIcon( QIcon( ":/defullscreen" ) ); fullscreenButton->setIcon( QIcon( ":/defullscreen" ) );
vlc_mutex_init_recursive( &lock ); vlc_mutex_init_recursive( &lock );
setMinimumWidth( 600 );
} }
FullscreenControllerWidget::~FullscreenControllerWidget() FullscreenControllerWidget::~FullscreenControllerWidget()
{ {
getSettings()->beginGroup( "FullScreen" );
getSettings()->setValue( "pos", pos() );
getSettings()->endGroup();
detachVout(); detachVout();
vlc_mutex_destroy( &lock ); vlc_mutex_destroy( &lock );
} }
......
...@@ -213,9 +213,9 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -213,9 +213,9 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
CONNECT( this, askUpdate(), this, doComponentsUpdate() ); CONNECT( this, askUpdate(), this, doComponentsUpdate() );
/* Size and placement of interface */ /* Size and placement of interface */
settings->beginGroup( "MainWindow" );
QVLCTools::restoreWidgetPosition( settings, this, QSize(380, 60) ); QVLCTools::restoreWidgetPosition( settings, this, QSize(380, 60) );
bool b_visible = settings->value( "playlist-visible", 0 ).toInt(); bool b_visible = settings->value( "playlist-visible", 0 ).toInt();
settings->endGroup(); settings->endGroup();
...@@ -378,19 +378,6 @@ void MainInterface::handleMainUi( QSettings *settings ) ...@@ -378,19 +378,6 @@ void MainInterface::handleMainUi( QSettings *settings )
CONNECT( controls, advancedControlsToggled( bool ), CONNECT( controls, advancedControlsToggled( bool ),
this, doComponentsUpdate() ); this, doComponentsUpdate() );
#ifdef WIN32
if ( depth() > 8 )
#endif
/* Create the FULLSCREEN CONTROLS Widget */
if( config_GetInt( p_intf, "qt-fs-controller" ) )
{
fullscreenControls = new FullscreenControllerWidget( p_intf, this,
settings->value( "adv-controls", false ).toBool(),
b_shiny );
CONNECT( fullscreenControls, advancedControlsToggled( bool ),
this, doComponentsUpdate() );
}
/* Add the controls Widget to the main Widget */ /* Add the controls Widget to the main Widget */
mainLayout->insertWidget( 0, controls, 0, Qt::AlignBottom ); mainLayout->insertWidget( 0, controls, 0, Qt::AlignBottom );
...@@ -433,6 +420,20 @@ void MainInterface::handleMainUi( QSettings *settings ) ...@@ -433,6 +420,20 @@ void MainInterface::handleMainUi( QSettings *settings )
/* Finish the sizing */ /* Finish the sizing */
main->updateGeometry(); main->updateGeometry();
getSettings()->endGroup();
#ifdef WIN32
if ( depth() > 8 )
#endif
/* Create the FULLSCREEN CONTROLS Widget */
if( config_GetInt( p_intf, "qt-fs-controller" ) )
{
fullscreenControls = new FullscreenControllerWidget( p_intf, this,
settings->value( "adv-controls", false ).toBool(),
b_shiny );
CONNECT( fullscreenControls, advancedControlsToggled( bool ),
this, doComponentsUpdate() );
}
} }
inline void MainInterface::askForPrivacy() inline void MainInterface::askForPrivacy()
......
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