[vlc-devel] commit: Qt4: Center the Fullscreen controller on One screen, and remember pos. (Jean-Baptiste Kempf )

git version control git at videolan.org
Tue Sep 23 02:17:24 CEST 2008


vlc | branch: 0.9-bugfix | Jean-Baptiste Kempf <jb at videolan.org> | Mon Sep 22 17:17:57 2008 -0700| [29b82ab8d1fb740b4be0d6a0d142a107ffe7be19] | committer: 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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=29b82ab8d1fb740b4be0d6a0d142a107ffe7be19
---

 modules/gui/qt4/components/interface_widgets.cpp |   14 ++++++++--
 modules/gui/qt4/main_interface.cpp               |   29 +++++++++++----------
 2 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/modules/gui/qt4/components/interface_widgets.cpp b/modules/gui/qt4/components/interface_widgets.cpp
index fce9c91..5270fc5 100644
--- a/modules/gui/qt4/components/interface_widgets.cpp
+++ b/modules/gui/qt4/components/interface_widgets.cpp
@@ -1025,6 +1025,7 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i,
     i_mouse_last_move_y = -1;
 
     setWindowFlags( Qt::ToolTip );
+    setMinimumWidth( 600 );
 
     setFrameShape( QFrame::StyledPanel );
     setFrameStyle( QFrame::Sunken );
@@ -1070,11 +1071,16 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i,
     adjustSize ();  /* need to get real width and height for moving */
 
     /* 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() );
 
+    getSettings()->beginGroup( "FullScreen" );
+    move( getSettings()->value( "pos", pos ).toPoint() );
+    getSettings()->endGroup();
+
 #ifdef WIN32TRICK
     setWindowOpacity( 0.0 );
     b_fscHidden = true;
@@ -1085,11 +1091,13 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i,
     fullscreenButton->setIcon( QIcon( ":/defullscreen" ) );
 
     vlc_mutex_init_recursive( &lock );
-    setMinimumWidth( 600 );
 }
 
 FullscreenControllerWidget::~FullscreenControllerWidget()
 {
+    getSettings()->beginGroup( "FullScreen" );
+    getSettings()->setValue( "pos", pos() );
+    getSettings()->endGroup();
     detachVout();
     vlc_mutex_destroy( &lock );
 }
diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index d629c0d..711cbc7 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -213,9 +213,9 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     CONNECT( this, askUpdate(), this, doComponentsUpdate() );
 
     /* Size and placement of interface */
+    settings->beginGroup( "MainWindow" );
     QVLCTools::restoreWidgetPosition( settings, this, QSize(380, 60) );
 
-
     bool b_visible = settings->value( "playlist-visible", 0 ).toInt();
     settings->endGroup();
 
@@ -387,19 +387,6 @@ void MainInterface::handleMainUi( QSettings *settings )
     CONNECT( controls, advancedControlsToggled( bool ),
              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 */
     mainLayout->insertWidget( 0, controls, 0, Qt::AlignBottom );
 
@@ -442,6 +429,20 @@ void MainInterface::handleMainUi( QSettings *settings )
 
     /* Finish the sizing */
     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()




More information about the vlc-devel mailing list