[vlc-devel] [PATCH 7/7] More decent show/quit of the qt4 main interface.

VlcVelope 1034-135 at online.de
Sun Apr 22 22:38:16 CEST 2012


Main widget is shown before playlist widget. When VLC quits, the main widget
stops playback and does not close at first. It is closed later when the
interface is dying. Settings (position/size) of the main widget are only saved
if the interface is not fullscreen.
---
 modules/gui/qt4/main_interface.cpp |   28 +++++++++++++++++++++-------
 1 files changed, 21 insertions(+), 7 deletions(-)
 mode change 100644 => 100755 modules/gui/qt4/main_interface.cpp

diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
old mode 100644
new mode 100755
index 8d952d2..da48bbd
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -237,16 +237,17 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     var_AddCallback( p_intf->p_libvlc, "intf-popupmenu", PopupMenuCB, p_intf );
 
 
-    /* Final Sizing, restoration and placement of the interface */
-    if( settings->value( "MainWindow/playlist-visible", false ).toBool() )
-        togglePlaylist();
-
     QVLCTools::restoreWidgetPosition( settings, this, QSize(600, 420) );
 
     b_interfaceFullScreen = isFullScreen();
 
     setVisible( !b_hideAfterCreation );
 
+    /* Final Sizing, restoration and placement of the interface */
+    if( settings->value( "MainWindow/playlist-visible", false ).toBool() )
+        togglePlaylist();
+
+    emitRaise();
     computeMinimumSize();
 
     /* Switch to minimal view if needed, must be called after the show() */
@@ -298,7 +299,8 @@ MainInterface::~MainInterface()
     settings->endGroup();
 
     /* Save this size */
-    QVLCTools::saveWidgetPosition(settings, this);
+    if(!isInterfaceFullScreen())
+        QVLCTools::saveWidgetPosition(settings, this);
 
     /* Save undocked playlist size */
     if( playlistWidget && !isPlDocked() )
@@ -1321,8 +1323,20 @@ void MainInterface::wheelEvent( QWheelEvent *e )
 
 void MainInterface::closeEvent( QCloseEvent *e )
 {
-//  hide();
-    emit askToQuit(); /* ask THEDP to quit, so we have a unique method */
+    bool dying = true;
+    if(THEDP)
+        dying = THEDP->isDying();
+
+    if( !dying )
+    {
+        THEMIM->stop();
+        emit askToQuit(); /* ask THEDP to quit, so we have a unique method */
+        if( fullscreenControls )
+            fullscreenControls->hide();
+        /* ignore for now, window will be closed later as the last one */
+        e->ignore();
+        return;
+    }
     /* Accept session quit. Otherwise we break the desktop mamager. */
     e->accept();
 }
-- 
1.7.5.4




More information about the vlc-devel mailing list