Qt4 - remember if the playlist was inside or not. Clean.
authorJean-Baptiste Kempf <jb@videolan.org>
Sat, 22 Dec 2007 07:19:01 +0000 (07:19 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Sat, 22 Dec 2007 07:19:01 +0000 (07:19 +0000)
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.hpp

index 06194ac..f5bc042 100644 (file)
@@ -58,7 +58,7 @@ VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QFrame( NULL ), p_intf( _p_i )
     vlc_mutex_init( p_intf, &lock );
     p_vout = NULL;
     hide(); setMinimumSize( 16, 16 );
+
    // CONNECT( this, askResize( int, int ), this, SetSizing( int, int ) );
     CONNECT( this, askVideoWidgetToShow(), this, show() );
     setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
@@ -160,7 +160,8 @@ BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i ) :
 
     resize( 300, 150 );
     updateGeometry();
-    CONNECT( THEMIM, inputChanged( input_thread_t *), this, update( input_thread_t * ) );
+    CONNECT( THEMIM, inputChanged( input_thread_t *),
+             this, update( input_thread_t * ) );
 }
 
 BackgroundWidget::~BackgroundWidget()
index c21e59f..07f5a92 100644 (file)
@@ -91,6 +91,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     bgWidget = NULL; videoWidget = NULL; playlistWidget = NULL;
     videoIsActive = false;
     input_name = "";
+    playlistVisible = false;
 
     /* Ask for privacy */
     privacy();
@@ -286,9 +287,17 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     move( settings->value( "pos", QPoint( 0, 0 ) ).toPoint() );
 
     resize( settings->value( "size", QSize( 350, 60 ) ).toSize() );
-    updateGeometry();
 
+    int tgPlay = settings->value( "playlist-visible", 0 ).toInt();
     settings->endGroup();
+
+    if( tgPlay )
+    {
+        togglePlaylist();
+    }
+
+    updateGeometry();
+
 }
 
 MainInterface::~MainInterface()
@@ -299,6 +308,7 @@ MainInterface::~MainInterface()
 
     settings->beginGroup( "MainWindow" );
     settings->setValue( "playlist-floats", (int)(dockPL->isFloating()) );
+    settings->setValue( "playlist-visible", (int)playlistVisible );
     settings->setValue( "adv-controls",
                         getControlsVisibilityStatus() & CONTROLS_ADVANCED );
     settings->setValue( "pos", pos() );
@@ -720,12 +730,14 @@ void MainInterface::togglePlaylist()
         dockPL->resize( settings->value( "size", QSize( 400, 300 ) ).toSize() );
         settings->endGroup();
         dockPL->show();
+        playlistVisible = true;
     }
     else
     {
     /* toggle the visibility of the playlist */
        TOGGLEV( dockPL );
        resize( sizeHint() );
+       playlistVisible = !playlistVisible;
     }
 }
 
index ecf166e..8f37b02 100644 (file)
@@ -63,15 +63,19 @@ public:
     MainInterface( intf_thread_t *);
     virtual ~MainInterface();
 
+    /* Video requests from core */
     void *requestVideo( vout_thread_t *p_nvout, int *pi_x,
                         int *pi_y, unsigned int *pi_width,
                         unsigned int *pi_height );
     void releaseVideo( void * );
     int controlVideo( void *p_window, int i_query, va_list args );
 
+    /* Getters */
     QSystemTrayIcon *getSysTray() { return sysTray; };
     QMenu *getSysTrayMenu() { return systrayMenu; };
     int getControlsVisibilityStatus();
+
+    /* Sizehint() */
     QSize sizeHint() const;
 protected:
 //    void resizeEvent( QResizeEvent * );
@@ -84,44 +88,39 @@ protected:
     friend class VolumeClickHandler;
 private:
     QSettings           *settings;
-    QSize                mainSize, addSize;
     QSystemTrayIcon     *sysTray;
     QMenu               *systrayMenu;
     QString              input_name;
     QVBoxLayout         *mainLayout;
     ControlsWidget      *controls;
-    QMenu                *speedControlMenu;
+    QMenu               *speedControlMenu;
     SpeedControlWidget  *speedControl;
 
-    bool                 need_components_update;
-
     void handleMainUi( QSettings* );
     void privacy();
-    void handleSystray();
-    //void buildStatus();
+    int  privacyDialog( QList<ConfigControl *> controls );
 
+    /* Systray */
+    void handleSystray();
     void createSystray();
-    int privacyDialog( QList<ConfigControl *> controls );
 
     /* Video */
     VideoWidget         *videoWidget;
-    virtual void keyPressEvent( QKeyEvent *);
-    virtual void wheelEvent( QWheelEvent * );
-
-    bool                 videoIsActive;
-    QSize                savedVideoSize;
+    //    QSize                savedVideoSize;
 
     BackgroundWidget    *bgWidget;
     VisualSelector      *visualSelector;
     PlaylistWidget      *playlistWidget;
     QDockWidget         *dockPL;
 
-    bool                 videoEmbeddedFlag;
-    bool                 alwaysVideoFlag;
+    bool                 videoIsActive; ///< Having a video now / THEMIM->hasV
+    bool                 videoEmbeddedFlag; ///< Want an external Video Window
+    bool                 playlistVisible; ///< Is the playlist visible ?
+    bool                 alwaysVideoFlag; ///< Always show the background
     bool                 visualSelectorEnabled;
-    bool                 notificationEnabled;
+    bool                 notificationEnabled; /// Systray Notifications
+    bool                 b_remainingTime; /* showing elapsed or remaining time */
 
-    InputManager        *main_input_manager;
     input_thread_t      *p_input;    ///< Main input associated to the playlist
 
     /* Status Bar */
@@ -129,9 +128,10 @@ private:
     QLabel              *speedLabel;
     QLabel              *nameLabel;
 
-    bool                 b_remainingTime; /* showing elapsed or remaining time */
+    virtual void customEvent( QEvent *);
+    virtual void keyPressEvent( QKeyEvent *);
+    virtual void wheelEvent( QWheelEvent * );
 
-    void customEvent( QEvent *);
 public slots:
     void undockPlaylist();
     void toggleMinimalView();