]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/controller.cpp
Qt4: DVB-T and DVB-C should be in Hz on Windows.
[vlc] / modules / gui / qt4 / components / controller.cpp
index 319f169e7a4a80c43762af1c03c5e3221e516b73..af1da21c16c43c663f5e27d0660b4bed3f036203 100644 (file)
@@ -99,7 +99,7 @@ void AbstractController::setupButton( QAbstractButton *aButton )
 
 /* Open the generic config line for the toolbar, parse it
  * and create the widgets accordingly */
-void AbstractController::parseAndCreate( QString config,
+void AbstractController::parseAndCreate( const QString& config,
                                          QBoxLayout *controlLayout )
 {
     QStringList list = config.split( ";", QString::SkipEmptyParts ) ;
@@ -426,21 +426,37 @@ QWidget *AbstractController::createWidget( buttonType_e button, int options )
     /* Customize Buttons */
     if( b_flat || b_big )
     {
-        QToolButton *tmpButton = qobject_cast<QToolButton *>(widget);
-        if( tmpButton )
+        QFrame *frame = qobject_cast<QFrame *>(widget);
+        if( frame )
         {
-            if( b_flat )
-                tmpButton->setAutoRaise( b_flat );
-            if( b_big )
-            {
-                tmpButton->setFixedSize( QSize( 32, 32 ) );
-                tmpButton->setIconSize( QSize( 26, 26 ) );
-            }
+            QList<QToolButton *> allTButtons = frame->findChildren<QToolButton *>();
+            for( int i = 0; i < allTButtons.size(); i++ )
+                applyAttributes( allTButtons[i], b_flat, b_big );
+        }
+        else
+        {
+            QToolButton *tmpButton = qobject_cast<QToolButton *>(widget);
+            if( tmpButton )
+                applyAttributes( tmpButton, b_flat, b_big );
         }
     }
     return widget;
 }
 
+void AbstractController::applyAttributes( QToolButton *tmpButton, bool b_flat, bool b_big )
+{
+    if( tmpButton )
+    {
+        if( b_flat )
+            tmpButton->setAutoRaise( b_flat );
+        if( b_big )
+        {
+            tmpButton->setFixedSize( QSize( 32, 32 ) );
+            tmpButton->setIconSize( QSize( 26, 26 ) );
+        }
+    }
+}
+
 QFrame *AbstractController::discFrame()
 {
     /** Disc and Menus handling */
@@ -665,7 +681,7 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i )
     setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
 
     QVBoxLayout *controlLayout2 = new QVBoxLayout( this );
-    controlLayout2->setLayoutMargins( 5, 2, 5, 2, 5 );
+    controlLayout2->setLayoutMargins( 4, 6, 4, 2, 5 );
 
     /* First line */
     InputControlsWidget *inputC = new InputControlsWidget( p_intf, this );
@@ -698,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()
@@ -708,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()
@@ -873,8 +910,11 @@ void FullscreenControllerWidget::customEvent( QEvent *event )
  */
 void FullscreenControllerWidget::mouseMoveEvent( QMouseEvent *event )
 {
-    if ( event->buttons() == Qt::LeftButton )
+    if( event->buttons() == Qt::LeftButton )
     {
+        if( i_mouse_last_x == -1 || i_mouse_last_y == -1 )
+            return;
+
         int i_moveX = event->globalX() - i_mouse_last_x;
         int i_moveY = event->globalY() - i_mouse_last_y;
 
@@ -895,6 +935,12 @@ void FullscreenControllerWidget::mousePressEvent( QMouseEvent *event )
     i_mouse_last_y = event->globalY();
 }
 
+void FullscreenControllerWidget::mouseReleaseEvent( QMouseEvent *event )
+{
+    i_mouse_last_x = -1;
+    i_mouse_last_y = -1;
+}
+
 /**
  * On mouse go above FSC
  */
@@ -1058,6 +1104,7 @@ void FullscreenControllerWidget::fullscreenChanged( vout_thread_t *p_vout,
     }
     vlc_mutex_unlock( &lock );
 }
+
 /**
  * Mouse change callback (show/hide the controller on mouse movement)
  */