]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/main_interface.cpp
Do not check file size coherency on multi-parts rar.
[vlc] / modules / gui / qt4 / main_interface.cpp
index fc3544d8e7cb1abc107bdc9e8ebe003df27a28d8..a45bf4d91ba42b10e81b561f72be57f7881761c9 100644 (file)
@@ -87,6 +87,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     b_hideAfterCreation  = false; // --qt-start-minimized
     playlistVisible      = false;
     input_name           = "";
+    b_interfaceFullScreen= false;
 
 
     /* Ask for Privacy */
@@ -132,10 +133,10 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
 
     settings->endGroup( );
 
-    /**************
-     * Status Bar *
-     **************/
-    createStatusBar();
+    /*********************************
+     * Create the Systray Management *
+     *********************************/
+    initSystray();
 
     /**************************
      *  UI and Widgets design
@@ -150,10 +151,12 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
              this, destroyPopupMenu() );
 
     createMainWidget( settings );
-    /*********************************
-     * Create the Systray Management *
-     *********************************/
-    initSystray();
+
+    /**************
+     * Status Bar *
+     **************/
+    createStatusBar();
+    setStatusBarVisibility( getSettings()->value( "MainWindow/status-bar-visible", false ).toBool() );
 
     /********************
      * Input Manager    *
@@ -207,7 +210,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
 
     /* VideoWidget connects for asynchronous calls */
     b_videoFullScreen = false;
-    b_videoOnTop = false;
     connect( this, SIGNAL(askGetVideo(WId*,int*,int*,unsigned*,unsigned *)),
              this, SLOT(getVideoSlot(WId*,int*,int*,unsigned*,unsigned*)),
              Qt::BlockingQueuedConnection );
@@ -251,7 +253,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
 
     /**** FINAL SIZING and placement of interface */
     settings->beginGroup( "MainWindow" );
-    QVLCTools::restoreWidgetPosition( settings, this, QSize(400, 100) );
+    QVLCTools::restoreWidgetPosition( settings, this, QSize(600, 420) );
     settings->endGroup();
 
     b_interfaceFullScreen = isFullScreen();
@@ -304,6 +306,7 @@ MainInterface::~MainInterface()
 
     settings->setValue( "adv-controls",
                         getControlsVisibilityStatus() & CONTROLS_ADVANCED );
+    settings->setValue( "status-bar-visible", b_statusbarVisible );
 
     /* Save the stackCentralW sizes */
     settings->setValue( "bgSize", stackWidgetsSizes[bgWidget] );
@@ -395,7 +398,7 @@ void MainInterface::createMainWidget( QSettings *settings )
     mainLayout->insertWidget( 1, stackCentralW );
 
     settings->beginGroup( "MainWindow" );
-    stackWidgetsSizes[bgWidget] = settings->value( "bgSize", QSize( 400, 0 ) ).toSize();
+    stackWidgetsSizes[bgWidget] = settings->value( "bgSize", QSize( 600, 0 ) ).toSize();
     /* Resize even if no-auto-resize, because we are at creation */
     resizeStack( stackWidgetsSizes[bgWidget].width(), stackWidgetsSizes[bgWidget].height() );
 
@@ -550,7 +553,7 @@ void MainInterface::destroyPopupMenu()
     QVLCMenu::PopupMenu( p_intf, false );
 }
 
-void MainInterface::popupMenu( const QPoint &p )
+void MainInterface::popupMenu( const QPoint & )
 {
     QVLCMenu::PopupMenu( p_intf, true );
 }
@@ -559,7 +562,7 @@ void MainInterface::toggleFSC()
 {
    if( !fullscreenControls ) return;
 
-   IMEvent *eShow = new IMEvent( FullscreenControlToggle_Type, 0 );
+   IMEvent *eShow = new IMEvent( FullscreenControlToggle_Type );
    QApplication::postEvent( fullscreenControls, eShow );
 }
 
@@ -590,6 +593,10 @@ WId MainInterface::getVideo( int *pi_x, int *pi_y,
 void MainInterface::getVideoSlot( WId *p_id, int *pi_x, int *pi_y,
                                   unsigned *pi_width, unsigned *pi_height )
 {
+    /* Hidden or minimized, activate */
+    if( isHidden() || isMinimized() )
+        toggleUpdateSystrayMenu();
+
     /* Request the videoWidget */
     WId ret = videoWidget->request( pi_x, pi_y,
                                     pi_width, pi_height, !b_autoresize );
@@ -673,16 +680,14 @@ void MainInterface::setVideoFullScreen( bool fs )
  * Emit askVideoOnTop() to invoke this from other thread. */
 void MainInterface::setVideoOnTop( bool on_top )
 {
-    b_videoOnTop = on_top;
-
     Qt::WindowFlags oldflags = windowFlags(), newflags;
 
-    if( b_videoOnTop )
+    if( on_top )
         newflags = oldflags | Qt::WindowStaysOnTopHint;
     else
         newflags = oldflags & ~Qt::WindowStaysOnTopHint;
+    if( newflags != oldflags && !b_videoFullScreen )
 
-    if( newflags != oldflags )
     {
         setWindowFlags( newflags );
         show(); /* necessary to apply window flags */
@@ -736,7 +741,7 @@ void MainInterface::createPlaylist()
     if( b_plDocked )
     {
         stackCentralW->addWidget( playlistWidget );
-        stackWidgetsSizes[playlistWidget] = settings->value( "playlistSize", QSize( 500, 250 ) ).toSize();
+        stackWidgetsSizes[playlistWidget] = settings->value( "playlistSize", QSize( 600, 300 ) ).toSize();
     }
     else
     {
@@ -821,7 +826,7 @@ void MainInterface::setMinimalView( bool b_minimal )
 {
     menuBar()->setVisible( !b_minimal );
     controls->setVisible( !b_minimal );
-    statusBar()->setVisible( !b_minimal );
+    statusBar()->setVisible( !b_minimal && b_statusbarVisible );
     inputC->setVisible( !b_minimal );
 }
 
@@ -867,6 +872,13 @@ int MainInterface::getControlsVisibilityStatus()
                 + CONTROLS_ADVANCED * controls->b_advancedVisible );
 }
 
+void MainInterface::setStatusBarVisibility( bool b_visible )
+{
+    statusBar()->setVisible( b_visible );
+    b_statusbarVisible = b_visible;
+    if( controls ) controls->setGripVisible( !b_statusbarVisible );
+}
+
 #if 0
 void MainInterface::visual()
 {
@@ -961,7 +973,7 @@ void MainInterface::createSystray()
     sysTray->show();
 
     CONNECT( sysTray, activated( QSystemTrayIcon::ActivationReason ),
-            this, handleSystrayClick( QSystemTrayIcon::ActivationReason ) );
+             this, handleSystrayClick( QSystemTrayIcon::ActivationReason ) );
 }
 
 /**
@@ -1234,9 +1246,10 @@ void MainInterface::wheelEvent( QWheelEvent *e )
 
 void MainInterface::closeEvent( QCloseEvent *e )
 {
-    e->ignore();      /* Do not quit */
 //  hide();
     emit askToQuit(); /* ask THEDP to quit, so we have a unique method */
+    /* Accept session quit. Otherwise we break the desktop mamager. */
+    e->accept();
 }
 
 void MainInterface::setInterfaceFullScreen( bool fs )
@@ -1262,6 +1275,8 @@ void MainInterface::toggleInterfaceFullScreen()
 static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
                         vlc_value_t old_val, vlc_value_t new_val, void *param )
 {
+    VLC_UNUSED( p_this ); VLC_UNUSED( psz_variable ); VLC_UNUSED( old_val );
+
     intf_thread_t *p_intf = (intf_thread_t *)param;
 
     if( p_intf->pf_show_dialog )
@@ -1279,6 +1294,9 @@ static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
 static int IntfShowCB( vlc_object_t *p_this, const char *psz_variable,
                        vlc_value_t old_val, vlc_value_t new_val, void *param )
 {
+    VLC_UNUSED( p_this ); VLC_UNUSED( psz_variable ); VLC_UNUSED( old_val );
+    VLC_UNUSED( new_val );
+
     intf_thread_t *p_intf = (intf_thread_t *)param;
     p_intf->p_sys->p_mi->toggleFSC();