]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/main_interface.cpp
Qt: speed and time button actionable visual feedback
[vlc] / modules / gui / qt4 / main_interface.cpp
index c3fa016e3447dca7b392347c412b5ecbc330b64c..99e1409e1f7ed549550385b87c0f0de4b8e0ebb7 100644 (file)
@@ -34,7 +34,7 @@
 #include "actions_manager.hpp"                  // killInstance
 #include "extensions_manager.hpp"               // killInstance
 
-#include "util/customwidgets.hpp"               // qtEventToVLCKey
+#include "util/customwidgets.hpp"               // qtEventToVLCKey, QVLCStackedWidget
 #include "util/qt_dirs.hpp"                     // toNativeSeparators
 
 #include "components/interface_widgets.hpp"     // bgWidget, videoWidget
@@ -75,6 +75,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     bgWidget             = NULL;
     videoWidget          = NULL;
     playlistWidget       = NULL;
+    stackCentralOldWidget= NULL;
 #ifndef HAVE_MAEMO
     sysTray              = NULL;
 #endif
@@ -86,7 +87,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     b_hideAfterCreation  = false; // --qt-start-minimized
     playlistVisible      = false;
     input_name           = "";
-    i_bg_height          = 0;
 
 
     /* Ask for Privacy */
@@ -226,7 +226,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
                  this, handleKeyPress( QKeyEvent * ) );
     }
 
-    CONNECT( this, askUpdate(), this, doComponentsUpdate() );
     CONNECT( THEDP, toolBarConfUpdated(), this, recreateToolbars() );
 
     /** END of CONNECTS**/
@@ -341,9 +340,9 @@ void MainInterface::recreateToolbars()
 
     controls = new ControlsWidget( p_intf, false, this ); /* FIXME */
     CONNECT( controls, advancedControlsToggled( bool ),
-             this, doComponentsUpdate() );
+             this, adaptGeometry() );
     CONNECT( controls, sizeChanged(),
-             this, doComponentsUpdate() );
+             this, adaptGeometry() );
 
     inputC = new InputControlsWidget( p_intf, this );
 
@@ -363,7 +362,7 @@ void MainInterface::createMainWidget( QSettings *settings )
     mainLayout->setSpacing( 0 ); mainLayout->setMargin( 0 );
 
     /* */
-    stackCentralW = new QStackedWidget( main );
+    stackCentralW = new QVLCStackedWidget( main );
 
     /* Bg Cone */
     bgWidget = new BackgroundWidget( p_intf );
@@ -381,9 +380,9 @@ void MainInterface::createMainWidget( QSettings *settings )
     controls = new ControlsWidget( p_intf,
                    settings->value( "adv-controls", false ).toBool(), this );
     CONNECT( controls, advancedControlsToggled( bool ),
-             this, doComponentsUpdate() );
+             this, adaptGeometry() );
     CONNECT( controls, sizeChanged(),
-             this, doComponentsUpdate() );
+             this, adaptGeometry() );
     inputC = new InputControlsWidget( p_intf, this );
 
     mainLayout->insertWidget( 2, inputC );
@@ -454,6 +453,10 @@ inline void MainInterface::createStatusBar()
     timeLabel->setFrameStyle( QFrame::Sunken | QFrame::Panel );
     speedLabel->setFrameStyle( QFrame::Sunken | QFrame::Panel );
     nameLabel->setFrameStyle( QFrame::Sunken | QFrame::StyledPanel);
+    timeLabel->setStyleSheet(
+            "QLabel:hover { background-color: rgba(255, 255, 255, 50%) }" );
+    speedLabel->setStyleSheet(
+            "QLabel:hover { background-color: rgba(255, 255, 255, 50%) }" );
 
     /* and adding those */
     statusBarr->addWidget( nameLabel, 8 );
@@ -478,27 +481,15 @@ inline void MainInterface::createStatusBar()
  **********************************************************************/
 
 /* This function is called:
-   - toggling of minimal View
-   - through askUpdate() by Vout thread request video and resize video (zoom)
    - Advanced buttons toggled
+   - Toolbar geom changed
  */
-void MainInterface::doComponentsUpdate()
+void MainInterface::adaptGeometry()
 {
-#if 0
-    if( isFullScreen() || isMaximized() ) return;
-
-//    msg_Warn( p_intf, "Updating the geometry" );
-    /* Here we resize to sizeHint() and not adjustsize because we want
-       the videoWidget to be exactly the correctSize */
+  resize( sizeHint() );
 
 #ifdef DEBUG_INTF
     debug();
-#endif
-    /* This is WRONG, but I believe there is a Qt bug here */
-    setMinimumSize( 0, 0 );
-    //resize( sizeHint() );
-
-    //adjustSize() ; /* This is not needed, but might help in the future */
 #endif
 }
 
@@ -621,26 +612,21 @@ void MainInterface::getVideoSlot( WId *p_id, int *pi_x, int *pi_y,
     }
 }
 
-
-
 /* Asynchronous call from the WindowClose function */
 void MainInterface::releaseVideo( void )
 {
-    emit askReleaseVideo( );
+    emit askReleaseVideo();
 }
 
 /* Function that is CONNECTED to the previous emit */
 void MainInterface::releaseVideoSlot( void )
 {
-    videoWidget->release( );
+    videoWidget->release();
 
     restoreStackOldWidget();
 
     /* We don't want to have a blank video to popup */
     stackCentralOldWidget = bgWidget;
-
-    /* Try to resize, except when you are in Fullscreen mode */
-//    doComponentsUpdate();
 }
 
 /* Asynchronous call from WindowControl function */
@@ -709,15 +695,11 @@ void MainInterface::togglePlaylist()
         /* Playlist is not visible, show it */
         if( stackCentralW->currentWidget() != playlistWidget )
         {
-            playlistWidget->forceShow();
             showTab( playlistWidget );
         }
         else /* Hide it! */
         {
             restoreStackOldWidget();
-            stackCentralW->updateGeometry();
-            // HACK: So it doesn't limit the stackWidget minimumSize
-            playlistWidget->forceHide();
         }
         playlistVisible = ( stackCentralW->currentWidget() == playlistWidget );
     }
@@ -779,20 +761,16 @@ void MainInterface::toggleMinimalView( bool b_switch )
         }
     }
 
-    i_bg_height = stackCentralW->height();
-
     menuBar()->setVisible( !b_switch );
     controls->setVisible( !b_switch );
     statusBar()->setVisible( !b_switch );
     inputC->setVisible( !b_switch );
 
-    doComponentsUpdate();
-
     emit minimalViewToggled( b_switch );
 }
 
 /* toggling advanced controls buttons */
-void MainInterface::toggleAdvanced()
+void MainInterface::toggleAdvancedButtons()
 {
     controls->toggleAdvanced();
 //    if( fullscreenControls ) fullscreenControls->toggleAdvanced();
@@ -823,7 +801,6 @@ void MainInterface::visual()
         visualSelector->hide();
         visualSelectorEnabled = false;
     }
-    doComponentsUpdate();
 }
 #endif