]> git.sesse.net Git - vlc/commitdiff
Qt: Fixing main Interface, phase 1.
authorJean-Baptiste Kempf <jb@videolan.org>
Sat, 6 Mar 2010 16:22:02 +0000 (17:22 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 11 Mar 2010 14:40:15 +0000 (15:40 +0100)
Removes a lot of hacks, especially around manipulating size (no more sizeHint(), very limited use of doComponentsUpdate and updateGeometry() ),
Simplify the number of starting options of the interface
Fixes crashes due to QStackWidget limitations
Still a lot of debug around, but mostly commented out, that will go in future commits
Close #3401
Close #3210
Close #3332
Close #1717

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/playlist/playlist.cpp
modules/gui/qt4/components/playlist/playlist.hpp
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.hpp
modules/gui/qt4/menus.cpp
modules/gui/qt4/qt4.cpp
modules/gui/qt4/qt4.hpp

index fc868539f29c62b78bfcf01f72fe88dda42e2439..7537959459980cdbd925b938c2fabe1810ae85c5 100644 (file)
@@ -314,6 +314,9 @@ BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i )
 
     CONNECT( THEMIM->getIM(), artChanged( QString ),
              this, updateArt( const QString& ) );
+
+    /* Start Hidden */
+    label->hide();
 }
 
 void BackgroundWidget::resizeEvent( QResizeEvent * event )
index 2d3ab03cf8d1af1e9303054b6487514b366d7084..d233a01dd449277969e9c5c5de9133edc631d6e7 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * playlist.cpp : Custom widgets for the playlist
  ****************************************************************************
- * Copyright © 2007-2008 the VideoLAN team
+ * Copyright © 2007-2010 the VideoLAN team
  * $Id$
  *
  * Authors: Clément Stenac <zorglub@videolan.org>
@@ -117,7 +117,6 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
     /* In case we want to keep the splitter informations */
     // components shall never write there setting to a fixed location, may infer
     // with other uses of the same component...
-    // getSettings()->beginGroup( "playlist" );
     getSettings()->beginGroup("Playlist");
     restoreState( getSettings()->value("splitterSizes").toByteArray());
     leftSplitter->restoreState( getSettings()->value("leftSplitterGeometry").toByteArray() );
@@ -161,3 +160,17 @@ void PlaylistWidget::closeEvent( QCloseEvent *event )
         event->ignore();
     }
 }
+
+void PlaylistWidget::forceHide()
+{
+    leftSplitter->hide();
+    rightPanel->hide();
+    updateGeometry();
+}
+
+void PlaylistWidget::forceShow()
+{
+    leftSplitter->show();
+    rightPanel->show();
+    updateGeometry();
+}
index 228a9c17d6fc616184e205d9ea0f5b3157f2e86b..2b793b76d2c5e73dbfdd7c7421cd0ea7faa92eb8 100644 (file)
@@ -46,7 +46,7 @@ class ArtLabel : public CoverArtLabel
 {
 public:
     ArtLabel( QWidget *parent, intf_thread_t *intf )
-            : CoverArtLabel( parent, intf ) {};
+            : CoverArtLabel( parent, intf ) {}
 
     virtual void mouseDoubleClickEvent( QMouseEvent *event )
     {
@@ -61,6 +61,8 @@ class PlaylistWidget : public QSplitter
 public:
     PlaylistWidget( intf_thread_t *_p_i, QWidget * );
     virtual ~PlaylistWidget();
+    void forceHide();
+    void forceShow();
 private:
     PLSelector      *selector;
     ArtLabel        *art;
@@ -72,6 +74,7 @@ protected:
     virtual void dropEvent( QDropEvent *);
     virtual void dragEnterEvent( QDragEnterEvent * );
     virtual void closeEvent( QCloseEvent * );
+
 };
 
 #endif
index 1b17f94eee8315a6e0abda6cdae37db244bb529c..89a62b322aa7de2a5110bc2c3de7b93908a2da96 100644 (file)
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+/* TODO:
+   - playlist minimumSize applies to all stackWidgets
+ */
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 #include "qt4.hpp"
 
 #include "main_interface.hpp"
-#include "input_manager.hpp"
-#include "actions_manager.hpp"
-#include "extensions_manager.hpp" // killInstance
+#include "input_manager.hpp"        // Creation
+#include "actions_manager.hpp"      // killInstance
+#include "extensions_manager.hpp"   // killInstance
 
-#include "util/customwidgets.hpp"
-#include "util/qt_dirs.hpp"
+#include "util/customwidgets.hpp"   // qtEventToVLCKey
+#include "util/qt_dirs.hpp"         // toNativeSeparators
 
-#include "components/interface_widgets.hpp"
-#include "components/controller.hpp"
-#include "components/playlist/playlist.hpp"
-#include "dialogs/external.hpp"
-#include "dialogs/firstrun.hpp"
+#include "components/interface_widgets.hpp" // bgWidget, videoWidget
+#include "components/controller.hpp"        // controllers
+#include "components/playlist/playlist.hpp" // plWidget
+#include "dialogs/firstrun.hpp"             // First Run
 
-#include "menus.hpp"
-#include "recents.hpp"
+#include "menus.hpp"                // Menu creation
+#include "recents.hpp"              // RecentItems when DnD
 
 #include <QCloseEvent>
 #include <QKeyEvent>
 #include <QMenuBar>
 #include <QStatusBar>
 #include <QLabel>
-#include <QGroupBox>
-#include <QPushButton>
 #include <QStackedWidget>
 
-#ifdef WIN32
+#include <vlc_keys.h>            /* Wheel event */
+#include <vlc_vout_display.h>    /* vout_thread_t and VOUT_ events */
+
+#ifdef WIN32 /* Win7 taskbar */
  #include <vlc_windows_interfaces.h>
  #include <QBitmap>
 #endif
 
-#include <assert.h>
-
-#include <vlc_keys.h> /* Wheel event */
-#include <vlc_vout_window.h>
-#include <vlc_vout_display.h>
-
-//#define DEBUG_INTF
+// #define DEBUG_INTF
 
 /* Callback prototypes */
 static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
@@ -121,7 +118,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     b_keep_size = !var_InheritBool( p_intf, "qt-video-autoresize" );
 
     /* Are we in the enhanced always-video mode or not ? */
-    i_visualmode = var_InheritInteger( p_intf, "qt-display-mode" );
+    i_visualmode = var_InheritInteger( p_intf, "qt-minimal-view" );
 
     /* Do we want anoying popups or not */
     b_notificationEnabled = var_InheritBool( p_intf, "qt-notification" );
@@ -238,7 +235,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     CONNECT( this, askUpdate(), this, doComponentsUpdate() );
     CONNECT( THEDP, toolBarConfUpdated(), this, recreateToolbars() );
 
-        /* Enable the popup menu in the MI */
+    /* Enable the popup menu in the MI */
     setContextMenuPolicy( Qt::CustomContextMenu );
     CONNECT( this, customContextMenuRequested( const QPoint& ),
              this, popupMenu( const QPoint& ) );
@@ -257,24 +254,18 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
 
     /**** FINAL SIZING and placement of interface */
     settings->beginGroup( "MainWindow" );
-    QVLCTools::restoreWidgetPosition( settings, this, QSize(380, 60) );
+    QVLCTools::restoreWidgetPosition( settings, this, QSize(400, 100) );
 
     /* resize to previously saved main window size if appicable */
+    //FIXME remove.
     if( b_keep_size )
     {
-       if( i_visualmode == QT_ALWAYS_VIDEO_MODE ||
-           i_visualmode == QT_MINIMAL_MODE )
-       {
+       if( i_visualmode )
            resize( mainVideoSize );
-       }
        else
-       {
            resize( mainBasedSize );
-       }
     }
 
-    msg_Dbg( p_intf, "%i", stackCentralOldState );
-
     /* Playlist */
     int i_plVis = settings->value( "playlist-visible", 0 ).toInt();
 
@@ -284,26 +275,19 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
 
     /* Final sizing and showing */
     setVisible( !b_hideAfterCreation );
-    //setMinimumSize( QSize( 0, 0 ) );
-    //    setMinimumWidth( __MAX( controls->sizeHint().width(),
-    //                          menuBar()->sizeHint().width() ) );
 
-    debug();
-    /* And switch to minimal view if needed
-       Must be called after the show() */
-    if( i_visualmode == QT_MINIMAL_MODE )
-        toggleMinimalView( true );
+    setMinimumWidth( __MAX( controls->sizeHint().width(),
+                            menuBar()->sizeHint().width() ) + 30 );
 
-    /* Update the geometry : It is useful if you switch between
-       qt-display-modes */
-    updateGeometry();
-    resize( sizeHint() );
+    /* Switch to minimal view if needed, must be called after the show() */
+    if( i_visualmode )
+        toggleMinimalView( true );
 }
 
 MainInterface::~MainInterface()
 {
     /* Unsure we hide the videoWidget before destroying it */
-    if( stackCentralOldState == VIDEO_TAB )
+    if( stackCentralOldWidget == playlistWidget )
         showBg();
 
     /* Save playlist state */
@@ -388,8 +372,6 @@ void MainInterface::createMainWidget( QSettings *settings )
     QWidget *main = new QWidget;
     setCentralWidget( main );
     mainLayout = new QVBoxLayout( main );
-
-    /* Margins, spacing */
     main->setContentsMargins( 0, 0, 0, 0 );
     mainLayout->setSpacing( 0 ); mainLayout->setMargin( 0 );
 
@@ -398,20 +380,15 @@ void MainInterface::createMainWidget( QSettings *settings )
 
     /* Bg Cone */
     bgWidget = new BackgroundWidget( p_intf );
-    bgWidget->resize(
-            settings->value( "backgroundSize", QSize( 300, 200 ) ).toSize() );
-    bgWidget->updateGeometry();
-    stackCentralW->insertWidget( BACKG_TAB, bgWidget );
-
+    stackCentralW->addWidget( bgWidget );
 
     /* And video Outputs */
     if( b_videoEmbedded )
     {
         videoWidget = new VideoWidget( p_intf );
-        stackCentralW->insertWidget( VIDEO_TAB, videoWidget );
+        stackCentralW->addWidget( videoWidget );
     }
-    mainLayout->insertWidget( 1, stackCentralW, 100 );
-
+    mainLayout->insertWidget( 1, stackCentralW );
 
     /* Create the CONTROLS Widget */
     controls = new ControlsWidget( p_intf,
@@ -422,46 +399,27 @@ void MainInterface::createMainWidget( QSettings *settings )
              this, doComponentsUpdate() );
     inputC = new InputControlsWidget( p_intf, this );
 
-    if( i_visualmode != QT_ALWAYS_VIDEO_MODE &&
-        i_visualmode != QT_MINIMAL_MODE )
-    {
-        hideStackWidget();
-        stackCentralOldState = HIDDEN_TAB;
-    }
-    else
-    {
-        showTab( BACKG_TAB );
-        stackCentralOldState = BACKG_TAB;
-    }
-
-
-    //mainLayout->setRowStretch( 1, 10 );
     mainLayout->insertWidget( 2, inputC );
     mainLayout->insertWidget( settings->value( "ToolbarPos", 0 ).toInt() ? 0: 3,
                               controls );
 
-    /* Visualisation */
-    /* Disabled for now, they SUCK */
+    /* Visualisation, disabled for now, they SUCK */
     #if 0
     visualSelector = new VisualSelector( p_intf );
     mainLayout->insertWidget( 0, visualSelector );
     visualSelector->hide();
     #endif
 
-    /* Finish the sizing */
-    main->updateGeometry();
-
     getSettings()->endGroup();
-#ifdef WIN32
-    if ( depth() > 8 )
-#endif
-    /* Create the FULLSCREEN CONTROLS Widget */
-    if( var_InheritBool( p_intf, "qt-fs-controller" ) )
-    {
-        fullscreenControls = new FullscreenControllerWidget( p_intf, this );
-        CONNECT( fullscreenControls, keyPressed( QKeyEvent * ),
-                 this, handleKeyPress( QKeyEvent * ) );
-    }
+
+    if ( depth() > 8 ) /* 8bit depth has too many issues with opacity */
+        /* Create the FULLSCREEN CONTROLS Widget */
+        if( var_InheritBool( p_intf, "qt-fs-controller" ) )
+        {
+            fullscreenControls = new FullscreenControllerWidget( p_intf, this );
+            CONNECT( fullscreenControls, keyPressed( QKeyEvent * ),
+                     this, handleKeyPress( QKeyEvent * ) );
+        }
 }
 
 inline void MainInterface::initSystray()
@@ -519,8 +477,8 @@ inline void MainInterface::createStatusBar()
     CONNECT( THEMIM->getIM(), encryptionChanged( bool ),
              this, showCryptedLabel( bool ) );
 
-    connect( THEMIM->getIM(), SIGNAL(seekRequested(float)),
-             timeLabel, SLOT(setDisplayPosition(float)) );
+    CONNECT( THEMIM->getIM(), seekRequested( float ),
+             timeLabel, setDisplayPosition( float ) );
 }
 
 #ifdef WIN32
@@ -687,14 +645,14 @@ bool MainInterface::winEvent ( MSG * msg, long * result )
    ask _parent->isFloating()...
    If you think this would be better, please FIXME it...
 */
+#if 0
 
 QSize MainInterface::sizeHint() const
 {
 #if 0
     if( b_keep_size )
     {
-        if( i_visualmode == QT_ALWAYS_VIDEO_MODE ||
-            i_visualmode == QT_MINIMAL_MODE )
+        if( i_visualmode )
         {
                 return mainVideoSize;
         }
@@ -720,11 +678,11 @@ QSize MainInterface::sizeHint() const
                   + statusBar()->size().height()
                   : 0 ;
 
-    if( stackCentralW->isVisible() )
+  /*  if( stackCentralW->isVisible() )
     {
         nheight += stackCentralW->height();
         nwidth  = __MAX( nwidth, stackCentralW->width() );
-    }
+    }*/
 
 /*    if( VISIBLE( bgWidget ) )
     {
@@ -751,7 +709,7 @@ QSize MainInterface::sizeHint() const
 #endif
     return QSize( nwidth, nheight );
 }
-
+#endif
 
 /* Video widget cannot do this synchronously as it runs in another thread */
 /* Well, could it, actually ? Probably dangerous ... */
@@ -774,7 +732,7 @@ void MainInterface::doComponentsUpdate()
 #endif
     /* This is WRONG, but I believe there is a Qt bug here */
     setMinimumSize( 0, 0 );
-    resize( sizeHint() );
+    //resize( sizeHint() );
 
     //adjustSize() ; /* This is not needed, but might help in the future */
 }
@@ -783,10 +741,10 @@ void MainInterface::debug()
 {
 #ifdef DEBUG_INTF
     msg_Dbg( p_intf, "Stack Size: %i - %i", stackCentralW->size().height(), size().width() );
-    if( b_videoEmbedded )
+    if( videoWidget )
         msg_Dbg( p_intf, "Stack Size: %i - %i",
-                 stackCentralW->widget( VIDEO_TAB )->size().height(),
-                 stackCentralW->widget( VIDEO_TAB )->size().width() );
+                 videoWidget->size().height(),
+                 videoWidget->size().width() );
     else
         msg_Dbg( p_intf, "no embedded video" );
 
@@ -794,13 +752,15 @@ void MainInterface::debug()
     msg_Dbg( p_intf, "sizeHint: %i - %i", sizeHint().height(), sizeHint().width() );
     //msg_Dbg( p_intf, "maximumsize: %i - %i", maximumSize().height(), maximumSize().width() );
 
-    msg_Dbg( p_intf, "Stack minimumsize: %i - %i", stackCentralW->minimumSize().height(), stackCentralW->minimumSize().width() );
-    msg_Dbg( p_intf, "Controls minimumsize: %i - %i", controls->minimumSize().height(), controls->minimumSize().width() );
+    msg_Dbg( p_intf, "Stack size: %i - %i", stackCentralW->size().height(), stackCentralW->size().width() );
+    msg_Dbg( p_intf, "Stack minimumSize(): %i - %i", stackCentralW->minimumHeight(), stackCentralW->minimumWidth() );
     msg_Dbg( p_intf, "Central minimumsize: %i - %i", centralWidget()->minimumSize().height(), centralWidget()->minimumSize().width() );
+    msg_Dbg( p_intf, "Central size: %i - %i", centralWidget()->size().height(), centralWidget()->size().width() );
     msg_Dbg( p_intf, "Menu minimumsize: %i - %i", menuBar()->minimumSize().height(), menuBar()->minimumSize().width() );
-    msg_Dbg( p_intf, "Input minimuSize: %i - %i", inputC->minimumSize().height(), inputC->minimumSize().width() );
+    msg_Dbg( p_intf, "Input size: %i - %i", inputC->size().height(), inputC->size().width() );
     msg_Dbg( p_intf, "Status minimumsize: %i - %i", statusBar()->minimumSize().height(), statusBar()->minimumSize().width() );
     msg_Dbg( p_intf, "minimumsize: %i - %i", minimumSize().height(), minimumSize().width() );
+    msg_Dbg( p_intf, "bg Size: %i - %i", bgWidget->size().height(), bgWidget->size().width() );
 
     /*if( videoWidget && videoWidget->isVisible() )
     {
@@ -810,50 +770,35 @@ void MainInterface::debug()
 #endif
 }
 
-inline void MainInterface::showTab( int i_tab )
+inline void MainInterface::showVideo() { showTab( videoWidget ); }
+inline void MainInterface::showBg() { showTab( bgWidget ); }
+
+inline void MainInterface::showTab( QWidget *widget )
 {
 #ifdef DEBUG_INTF
-    msg_Err( p_intf, "showTab %i", i_tab );
-    msg_Warn( p_intf, "Old stackCentralOldState %i", stackCentralOldState );
-#endif
-    stackCentralOldState = stackCentralW->isVisible() ? stackCentralW->currentIndex()
-                                          : HIDDEN_TAB;
-#ifdef DEBUG_INTF
-    msg_Warn( p_intf, "State change %i %i",  stackCentralW->currentIndex(), i_tab );
+    msg_Warn( p_intf, "Old stackCentralOldWidget %i", stackCentralW->indexOf( stackCentralOldWidget ) );
 #endif
-
-    if( i_visualmode == QT_NORMAL_MODE )
-    {
-        stackCentralW->setVisible( i_tab != HIDDEN_TAB );
-        doComponentsUpdate(); // resize the player
-    }
-    else
-        if( i_tab == HIDDEN_TAB ) i_tab = BACKG_TAB;
-
-    stackCentralW->setCurrentIndex( i_tab );
+    stackCentralOldWidget = stackCentralW->currentWidget();
+    stackCentralW->setCurrentWidget( widget );
 
 #ifdef DEBUG_INTF
-    msg_Warn( p_intf, "New stackCentralOldState %i", stackCentralOldState );
+    msg_Warn( p_intf, "State change %i",  stackCentralW->currentIndex() );
+    msg_Warn( p_intf, "New stackCentralOldWidget %i", stackCentralW->indexOf( stackCentralOldWidget ) );
 #endif
 }
 
 inline void MainInterface::restoreStackOldWidget()
 {
 #ifdef DEBUG_INTF
-    msg_Warn( p_intf, "Old stackCentralOldState %i", stackCentralOldState );
+    msg_Warn( p_intf, "New stackCentralOldWidget %i", stackCentralW->indexOf( stackCentralOldWidget ) );
 #endif
-    int temp = stackCentralW->isVisible() ? stackCentralW->currentIndex()
-                                          : HIDDEN_TAB;
-    stackCentralW->setCurrentIndex( stackCentralOldState );
-    if( i_visualmode == QT_NORMAL_MODE )
-    {
-        stackCentralW->setVisible( stackCentralOldState != HIDDEN_TAB );
-        doComponentsUpdate(); // resize the player
-    }
+    QWidget *wTemp = stackCentralW->currentWidget();
 
-    stackCentralOldState = temp;
+    stackCentralW->setCurrentWidget( stackCentralOldWidget );
+
+    stackCentralOldWidget = wTemp;
 #ifdef DEBUG_INTF
-    msg_Warn( p_intf, "Debug %i %i", temp, stackCentralW->currentIndex() );
+    msg_Warn( p_intf, "Debug %i %i",stackCentralW->indexOf( wTemp ), stackCentralW->indexOf( stackCentralW->currentWidget() ) );
 #endif
 }
 
@@ -955,6 +900,9 @@ void MainInterface::releaseVideoSlot( void )
 
     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();
 }
@@ -1017,7 +965,7 @@ void MainInterface::createPlaylist()
 #ifdef DEBUG_INTF
         msg_Warn( p_intf, "Here 1 %i", stackCentralW->currentIndex() );
 #endif
-        stackCentralW->insertWidget( PLAYL_TAB, playlistWidget );
+        stackCentralW->addWidget( playlistWidget );
 #ifdef DEBUG_INTF
         msg_Warn( p_intf, "Here 2 %i", stackCentralW->currentIndex() );
 #endif
@@ -1026,30 +974,25 @@ void MainInterface::createPlaylist()
 
 void MainInterface::togglePlaylist()
 {
-#ifdef DEBUG_INTF
-    msg_Warn( p_intf, "Here toggling 1 %i %i", stackCentralW->currentIndex(), stackCentralOldState );
-#endif
     if( !playlistWidget )
         createPlaylist();
 
-#ifdef DEBUG_INTF
-    msg_Warn( p_intf, "Here toggling 2 %i %i", stackCentralW->currentIndex(), stackCentralOldState );
-
-#endif
     if( b_plDocked )
     {
-        /* Playlist not visible */
-        if( stackCentralW->currentIndex() != PLAYL_TAB )
+        /* Playlist is not visible, show it */
+        if( stackCentralW->currentWidget() != playlistWidget )
         {
-            showTab( PLAYL_TAB );
-            stackCentralW->show();
+            playlistWidget->forceShow();
+            showTab( playlistWidget );
         }
-        else
+        else /* Hide it! */
         {
             restoreStackOldWidget();
+            stackCentralW->updateGeometry();
+            // HACK: So it doesn't limit the stackWidget minimumSize
+            playlistWidget->forceHide();
         }
-        playlistVisible = ( stackCentralW->currentIndex() == PLAYL_TAB );
-        //doComponentsUpdate(); //resize( sizeHint() );
+        playlistVisible = ( stackCentralW->currentWidget() == playlistWidget );
     }
     else
     {
@@ -1057,11 +1000,14 @@ void MainInterface::togglePlaylist()
         playlistVisible = !playlistVisible;
         playlistWidget->setVisible( playlistVisible );
     }
+    debug();
 }
 
 void MainInterface::dockPlaylist( bool p_docked )
 {
+    if( b_plDocked == p_docked ) return;
     b_plDocked = p_docked;
+
     if( !playlistWidget ) return; /* Playlist wasn't created yet */
     if( !p_docked )
     {
@@ -1070,41 +1016,36 @@ void MainInterface::dockPlaylist( bool p_docked )
         QVLCTools::restoreWidgetPosition( p_intf, "Playlist",
                 playlistWidget, QSize( 600, 300 ) );
         playlistWidget->show();
-        stackCentralW->hide();
-        doComponentsUpdate();
+        restoreStackOldWidget();
     }
     else
     {
-        stackCentralW->insertWidget( PLAYL_TAB, playlistWidget );
+        playlistWidget->setWindowFlags( Qt::Widget ); // Probably a Qt bug here
+        // It would be logical that QStackWidget::addWidget reset the flags...
+        stackCentralW->addWidget( playlistWidget );
         stackCentralW->setCurrentWidget( playlistWidget );
-        stackCentralW->show();
     }
 }
 
-/* Function called from the menu to undock the playlist */
-void MainInterface::undockPlaylist()
-{
-    dockPlaylist( false );
-}
-
 void MainInterface::toggleMinimalView( bool b_switch )
 {
-    if( i_visualmode != QT_ALWAYS_VIDEO_MODE &&
-        i_visualmode != QT_MINIMAL_MODE )
+    if( i_visualmode == 0 )
     { /* NORMAL MODE then */
-        stackCentralW->show();
-        if( !videoWidget || stackCentralW->currentIndex() != VIDEO_TAB )
+        if( !videoWidget || stackCentralW->currentWidget() != videoWidget )
         {
             showBg();
         }
         else
         {
             /* If video is visible, then toggle the status of bgWidget */
+            //FIXME
             //bgWasVisible = !bgWasVisible;
-            if( stackCentralOldState == BACKG_TAB )
-                stackCentralOldState = HIDDEN_TAB;
+            /* if( stackCentralOldState == BACK G_TAB )
+                stackCentralOldState = HID DEN_TAB;
             else
-                stackCentralOldState = BACKG_TAB;
+                stackCentralOldState = BACK G_TAB;
+
+                */
         }
     }
 
@@ -1466,8 +1407,7 @@ void MainInterface::resizeEvent( QResizeEvent * event )
 #if 0
     if( b_keep_size )
     {
-        if( i_visualmode == QT_ALWAYS_VIDEO_MODE ||
-            i_visualmode == QT_MINIMAL_MODE )
+        if( i_visualmode )
         {
                 mainVideoSize = size();
         }
@@ -1484,6 +1424,7 @@ void MainInterface::resizeEvent( QResizeEvent * event )
 #endif
     QVLCMW::resizeEvent( event );
     msg_Dbg( p_intf, "Resize Event, height: %i", size().height() );
+    debug();
 }
 
 void MainInterface::wheelEvent( QWheelEvent *e )
index a7d8b7427d7873333415f53992949f51c75f9e04..2dab21ee7f4f1085c30211bcfc38c91997675b17 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "util/qvlcframe.hpp"
 #include "components/preferences_widgets.hpp" /* First Start */
+
 #ifdef WIN32
  #include <vlc_windows_interfaces.h>
 #endif
@@ -87,7 +88,7 @@ public:
     bool isPlDocked() { return ( b_plDocked != false ); }
 
     /* Sizehint() */
-    virtual QSize sizeHint() const;
+//    virtual QSize sizeHint() const;
 
 protected:
     void dropEventPlay( QDropEvent *, bool);
@@ -116,11 +117,10 @@ private:
     void initSystray();
 
     /* Mess about stackWidget */
-    void showTab( int i_tab );
+    void showTab( QWidget *);
+    void showVideo();
+    void showBg();
     void restoreStackOldWidget();
-    void showVideo() { showTab( VIDEO_TAB ); }
-    void showBg() { showTab( BACKG_TAB ); }
-    void hideStackWidget() { showTab( HIDDEN_TAB ); }
 
     /* */
     QSettings           *settings;
@@ -133,27 +133,21 @@ private:
     ControlsWidget      *controls;
     InputControlsWidget *inputC;
     FullscreenControllerWidget *fullscreenControls;
+
+    /* Widgets */
     QStackedWidget      *stackCentralW;
 
-    /* Video */
     VideoWidget         *videoWidget;
-
     BackgroundWidget    *bgWidget;
-    VisualSelector      *visualSelector;
     PlaylistWidget      *playlistWidget;
+    //VisualSelector      *visualSelector;
 
     /* Status Bar */
     QLabel              *nameLabel;
     QLabel              *cryptedLabel;
 
     /* Status and flags */
-    enum {
-        HIDDEN_TAB = -1,
-        BACKG_TAB  =  0,
-        VIDEO_TAB  = 1,
-        PLAYL_TAB  = 2,
-    };
-    int                  stackCentralOldState;
+    QWidget             *stackCentralOldWidget;
 
     /* Flags */
     bool                 b_notificationEnabled; /// Systray Notifications
@@ -180,7 +174,6 @@ private:
 #endif
 
 public slots:
-    void undockPlaylist();
     void dockPlaylist( bool b_docked = true );
     void toggleMinimalView( bool );
     void togglePlaylist();
index 648e321d49ef3ca97ee6c9e29fc588cb8ca5c772..0adb14c162f2f7b16cb615db9e9f5a8043aaf7e5 100644 (file)
@@ -437,10 +437,6 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf,
             qtr( "Play&list" ), mi,
             SLOT( togglePlaylist() ), qtr( "Ctrl+L" ) );
 
-    /*menu->addSeparator();
-    menu->addAction( qtr( "Undock from Interface" ), mi,
-                     SLOT( undockPlaylist() ), qtr( "Ctrl+U" ) );*/
-
     menu->addSeparator();
 
     if( with_intf )
index 14b6473afca413e019a1bd0981ecfaf70b188b53..bfd30abf683a93da342d17118f4323f6ce3a1d3c 100644 (file)
@@ -150,10 +150,6 @@ static void ShowDialog   ( intf_thread_t *, int, int, intf_dialog_args_t * );
                                   "as lyrics, album arts...\n" \
                              " - minimal mode with limited controls" )
 
-#define QT_NORMAL_MODE_TEXT N_( "Classic" )
-#define QT_ALWAYS_VIDEO_MODE_TEXT N_( "Complete (with information area)" )
-#define QT_MINIMAL_MODE_TEXT N_( "Minimal (without menu)" )
-
 #define QT_FULLSCREEN_TEXT N_( "Show a controller in fullscreen mode" )
 #define QT_NATIVEOPEN_TEXT N_( "Embed the file browser in open dialog" )
 
@@ -165,12 +161,7 @@ static void ShowDialog   ( intf_thread_t *, int, int, intf_dialog_args_t * );
 #define QT_AUTOLOAD_EXTENSIONS_LONGTEXT N_( "Automatically load the "\
                                             "extensions module on startup" )
 
-/* Various modes definition */
-static const int i_mode_list[] =
-    { QT_NORMAL_MODE, QT_ALWAYS_VIDEO_MODE, QT_MINIMAL_MODE };
-static const char *const psz_mode_list_text[] =
-    { QT_NORMAL_MODE_TEXT, QT_ALWAYS_VIDEO_MODE_TEXT, QT_MINIMAL_MODE_TEXT };
-
+#define QT_MINIMAL_MODE_TEXT N_("Start in minimal view (without menus)" )
 
 /**********************************************************************/
 vlc_module_begin ()
@@ -182,9 +173,9 @@ vlc_module_begin ()
     set_callbacks( OpenIntf, Close )
 
     add_shortcut("qt")
-    add_integer( "qt-display-mode", QT_NORMAL_MODE, NULL,
-                 QT_MODE_TEXT, QT_MODE_LONGTEXT, false )
-        change_integer_list( i_mode_list, psz_mode_list_text, NULL )
+
+    add_bool( "qt-minimal-view", false, NULL, QT_MINIMAL_MODE_TEXT,
+              QT_MINIMAL_MODE_TEXT, false );
 
     add_bool( "qt-notification", true, NULL, NOTIFICATION_TEXT,
               NOTIFICATION_LONGTEXT, false )
@@ -245,6 +236,7 @@ vlc_module_begin ()
               false )
 
     add_obsolete_bool( "qt-blingbling" ) /* Suppressed since 1.0.0 */
+    add_obsolete_integer( "qt-display-mode" ) /* Suppressed since 1.1.0 */
 
 #ifdef WIN32
     linked_with_a_crap_library_which_uses_atexit()
index 022765a3b2cf5f974e960b8858f3aac22c85878b..15c0a34a276ba8d863af739f2215982d0fdca32d 100644 (file)
 
 #define HAS_QT45 ( QT_VERSION >= 0x040500 )
 
-enum {
-    QT_NORMAL_MODE = 0,
-    QT_ALWAYS_VIDEO_MODE,
-    QT_MINIMAL_MODE
-};
-
 enum {
     DialogEventType = 0,
     IMEventType     = 100,