]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/controller.cpp
[Qt] Connect Faster button to FASTER!
[vlc] / modules / gui / qt4 / components / controller.cpp
index e6d8f9adb04f747e19f83140fc446551007ad8af..63814ed12a713655b1f46d025095ffe1b4c02f07 100644 (file)
@@ -172,7 +172,7 @@ QWidget *AbstractController::createWidget( buttonType_e button, bool b_flat,
     case FASTER_BUTTON:{
         QToolButton *fasterButton = new QToolButton;
         setupButton( fasterButton );
-        CONNECT_MAP_SET( fasterButton, SLOWER_ACTION );
+        CONNECT_MAP_SET( fasterButton, FASTER_ACTION );
         BUTTON_SET_BAR( fasterButton, faster, qtr( "Faster" ) );
         ENABLE_ON_INPUT( fasterButton );
         widget = fasterButton;
@@ -769,6 +769,7 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i )
     b_fullscreen        = false;
     i_hide_timeout      = 1;
     p_vout              = NULL;
+    i_screennumber      = -1;
 
     setWindowFlags( Qt::ToolTip );
     setMinimumWidth( 600 );
@@ -780,9 +781,9 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i )
     controlLayout->setLayoutMargins( 5, 2, 5, 2, 5 );
 
     /* First line */
-    controlLayout->addWidget( createWidget( SLOWER_BUTTON ), 0, 0 );
+    controlLayout->addWidget( createWidget( SLOWER_BUTTON, true ), 0, 0 );
     controlLayout->addWidget( createWidget( INPUT_SLIDER ), 0, 1, 1, 13 );
-    controlLayout->addWidget( createWidget( FASTER_BUTTON ), 0, 14 );
+    controlLayout->addWidget( createWidget( FASTER_BUTTON, true ), 0, 14 );
 
     /* Second line */
     controlLayout->addWidget( createWidget( PLAY_BUTTON, false, true ), 1, 0, 1, 2 );
@@ -818,17 +819,6 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i )
 
     adjustSize ();  /* need to get real width and height for moving */
 
-    /* center down */
-    QRect desktopRect = QApplication::desktop()->
-        screenGeometry( p_intf->p_sys->p_mi );
-
-    QPoint pos = QPoint( desktopRect.width() / 2 - width() / 2,
-          desktopRect.height() - height() );
-
-    getSettings()->beginGroup( "FullScreen" );
-    move( getSettings()->value( "pos", pos ).toPoint() );
-    getSettings()->endGroup();
-
 #ifdef WIN32TRICK
     setWindowOpacity( 0.0 );
     b_fscHidden = true;
@@ -854,11 +844,40 @@ FullscreenControllerWidget::~FullscreenControllerWidget()
 void FullscreenControllerWidget::showFSC()
 {
     adjustSize();
+    /* center down */
+    int number = QApplication::desktop()->screenNumber( p_intf->p_sys->p_mi );
+    if( number != i_screennumber )
+    {
+        msg_Dbg( p_intf, "Calculation fullscreen controllers center");
+        /* screen has changed, calculate new position */
+        i_screennumber = number;
+        int totalCount = QApplication::desktop()->numScreens();
+        QRect screenRes = QApplication::desktop()->screenGeometry(number);
+        int offset_x = 0;
+        int offset_y = 0;
+        /* Loop all screens to get needed offset_x/y for
+         * physical screen center.
+         */
+        for(int i=0; i <= totalCount ; i++)
+        {
+             QRect displayRect = QApplication::desktop()->screenGeometry(i);
+             if (displayRect.width()+offset_x <= screenRes.x())
+             {
+                  offset_x += displayRect.width();
+             }
+             if ( displayRect.height()+offset_y <= screenRes.y())
+             {
+                  offset_y += displayRect.height();
+             }
+        }
+        QPoint pos = QPoint( offset_x + (screenRes.width() / 2) - (width() / 2),
+                             offset_y + screenRes.height() - height());
+        move( pos );
+    }
 #ifdef WIN32TRICK
     // after quiting and going to fs, we need to call show()
     if( isHidden() )
         show();
-
     if( b_fscHidden )
     {
         b_fscHidden = false;