[vlc-devel] commit: Qt: fullscreen controller first position. (Jean-Baptiste Kempf )

git version control git at videolan.org
Fri Apr 24 21:31:33 CEST 2009


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Apr 24 21:31:09 2009 +0200| [63216006d20a335881ee55f8a8fd4cbf9978c745] | committer: Jean-Baptiste Kempf 

Qt: fullscreen controller first position.

Close #2283.

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

 modules/gui/qt4/components/controller.cpp |   39 ++++++++++++++++++++++------
 modules/gui/qt4/components/controller.hpp |    1 +
 2 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/modules/gui/qt4/components/controller.cpp b/modules/gui/qt4/components/controller.cpp
index b078d94..56ac3d8 100644
--- a/modules/gui/qt4/components/controller.cpp
+++ b/modules/gui/qt4/components/controller.cpp
@@ -714,7 +714,23 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i )
 
     vlc_mutex_init_recursive( &lock );
 
-    CONNECT( THEMIM->getIM(), voutListChanged( vout_thread_t **, int ), this, setVoutList( vout_thread_t **, int ) );
+    CONNECT( THEMIM->getIM(), voutListChanged( vout_thread_t **, int ),
+             this, setVoutList( vout_thread_t **, int ) );
+
+    /* First Move */
+    QPoint pos1 = getSettings()->value( "FullScreen/pos" ).toPoint();
+    int number = QApplication::desktop()->screenNumber( p_intf->p_sys->p_mi );
+    if( QApplication::desktop()->screenGeometry( number ).contains( pos1, true ) )
+    {
+        move( pos1 );
+        i_screennumber = number;
+        screenRes = QApplication::desktop()->screenGeometry(number);
+    }
+    else
+    {
+        centerFSC( number );
+    }
+
 }
 
 FullscreenControllerWidget::~FullscreenControllerWidget()
@@ -724,24 +740,29 @@ FullscreenControllerWidget::~FullscreenControllerWidget()
     vlc_mutex_destroy( &lock );
 }
 
+void FullscreenControllerWidget::centerFSC( int number )
+{
+    screenRes = QApplication::desktop()->screenGeometry(number);
+    /* screen has changed, calculate new position */
+    QPoint pos = QPoint( screenRes.x() + (screenRes.width() / 2) - (width() / 2),
+            screenRes.y() + screenRes.height() - height());
+    move( pos );
+    i_screennumber = number;
+}
+
 /**
  * Show fullscreen controller
  */
 void FullscreenControllerWidget::showFSC()
 {
     adjustSize();
-    /* center down */
+
     int number = QApplication::desktop()->screenNumber( p_intf->p_sys->p_mi );
+
     if( number != i_screennumber ||
         screenRes != QApplication::desktop()->screenGeometry(number) )
     {
-        screenRes = QApplication::desktop()->screenGeometry(number);
-        msg_Dbg( p_intf, "Calculation fullscreen controllers center");
-        /* screen has changed, calculate new position */
-        QPoint pos = QPoint( screenRes.x() + (screenRes.width() / 2) - (width() / 2),
-                             screenRes.y() + screenRes.height() - height());
-        move( pos );
-        i_screennumber = number;
+        centerFSC( number );
     }
 #ifdef WIN32TRICK
     // after quiting and going to fs, we need to call show()
diff --git a/modules/gui/qt4/components/controller.hpp b/modules/gui/qt4/components/controller.hpp
index bf3fe8c..8d33768 100644
--- a/modules/gui/qt4/components/controller.hpp
+++ b/modules/gui/qt4/components/controller.hpp
@@ -253,6 +253,7 @@ private slots:
     void planHideFSC();
     void hideFSC();
     void slowHideFSC();
+    void centerFSC( int );
 
 private:
     virtual void customEvent( QEvent *event );




More information about the vlc-devel mailing list