Fix some playlist start showing/non-showing bug.
authorJean-Baptiste Kempf <jb@videolan.org>
Mon, 25 Aug 2008 21:35:42 +0000 (14:35 -0700)
committerJean-Baptiste Kempf <jb@videolan.org>
Mon, 25 Aug 2008 21:36:25 +0000 (14:36 -0700)
Still errors present, but too latE.

modules/gui/qt4/components/playlist/playlist.cpp
modules/gui/qt4/components/playlist/playlist.hpp
modules/gui/qt4/dialogs_provider.cpp
modules/gui/qt4/dialogs_provider.hpp
modules/gui/qt4/main_interface.cpp

index 2ae4a44..7168d36 100644 (file)
@@ -156,3 +156,15 @@ void PlaylistWidget::dragEnterEvent(QDragEnterEvent *event)
     event->acceptProposedAction();
 }
 
+void PlaylistWidget::closeEvent( QCloseEvent *event )
+{
+    if( THEDP->isDying() )
+    {
+        close();
+    }
+    else
+    {
+        if( p_intf->p_sys->p_mi )
+            p_intf->p_sys->p_mi->togglePlaylist();
+    }
+}
index 5945176..701b913 100644 (file)
@@ -56,8 +56,9 @@ private:
     QWidget *parent;
 protected:
     intf_thread_t *p_intf;
-    void dropEvent( QDropEvent *);
-    void dragEnterEvent( QDragEnterEvent * );
+    virtual void dropEvent( QDropEvent *);
+    virtual void dragEnterEvent( QDragEnterEvent * );
+    virtual void closeEvent( QCloseEvent * );
 
 private slots:
     void setArt( QString );
index cf4207e..fe37d85 100644 (file)
@@ -57,6 +57,7 @@ DialogsProvider* DialogsProvider::instance = NULL;
 DialogsProvider::DialogsProvider( intf_thread_t *_p_intf ) :
                                   QObject( NULL ), p_intf( _p_intf )
 {
+    b_isDying = false;
     fixed_timer = new QTimer( this );
     fixed_timer->start( 150 /* milliseconds */ );
 
@@ -92,6 +93,7 @@ DialogsProvider::~DialogsProvider()
 
 void DialogsProvider::quit()
 {
+    b_isDying = true;
     vlc_object_kill( p_intf->p_libvlc );
     QApplication::closeAllWindows();
     QApplication::quit();
index d86e24e..d69e9f5 100644 (file)
@@ -116,6 +116,7 @@ public:
                                 EXT_FILTER_VIDEO | EXT_FILTER_AUDIO |
                                 EXT_FILTER_PLAYLIST,
                                 QString path = QString() );
+    bool isDying() { return b_isDying; }
 protected:
     QSignalMapper *menusMapper;
     QSignalMapper *menusUpdateMapper;
@@ -127,6 +128,7 @@ private:
     intf_thread_t *p_intf;
     static DialogsProvider *instance;
     void addFromSimple( bool, bool );
+    bool b_isDying;
 
 public slots:
     void doInteraction( intf_dialog_args_t * );
index 7a5b196..84a1883 100644 (file)
@@ -218,10 +218,12 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     QVLCTools::restoreWidgetPosition( settings, this, QSize(380, 60) );
 
 
-    /* Playlist */
-    if( settings->value( "playlist-visible", 0 ).toInt() ) togglePlaylist();
+    bool b_visible = settings->value( "playlist-visible", 0 ).toInt();
     settings->endGroup();
 
+    /* Playlist */
+    if( b_visible ) togglePlaylist();
+
     /* Final sizing and showing */
     setMinimumWidth( __MAX( controls->sizeHint().width(),
                             menuBar()->sizeHint().width() ) );
@@ -740,8 +742,10 @@ void MainInterface::togglePlaylist()
     {
         playlistWidget = new PlaylistWidget( p_intf, this );
 
-        i_pl_dock = (pl_dock_e)getSettings()
-                         ->value( "pl-dock-status", PL_UNDOCKED ).toInt();
+        i_pl_dock = PL_UNDOCKED;
+/*        i_pl_dock = (pl_dock_e)getSettings()
+                         ->value( "pl-dock-status", PL_UNDOCKED ).toInt(); */
+
         if( i_pl_dock == PL_UNDOCKED )
         {
             playlistWidget->setWindowFlags( Qt::Window );