]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/main_interface.cpp
Qt4 - revert the revertion :D
[vlc] / modules / gui / qt4 / main_interface.cpp
index 12cce9832dd90dcb75188d9f47f905cc65d28fa1..de9f8e2f1e32bbf860c3ee2095a2bd277871c31b 100644 (file)
@@ -51,6 +51,7 @@
 #include <QToolBar>
 #include <QGroupBox>
 #include <QDate>
+#include <QProgressBar>
 
 #include <assert.h>
 #include <vlc_keys.h>
@@ -163,9 +164,13 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     speedLabel->setFrameStyle( QFrame::Sunken | QFrame::Panel );
     nameLabel->setFrameStyle( QFrame::Sunken | QFrame::StyledPanel);
 
+    pgBar = new QProgressBar;
+    pgBar->hide();
+
     /* and adding those */
     statusBar()->addWidget( nameLabel, 8 );
     statusBar()->addPermanentWidget( speedLabel, 0 );
+    statusBar()->addPermanentWidget( pgBar, 0 );
     statusBar()->addPermanentWidget( timeLabel, 0 );
 
     /* timeLabel behaviour:
@@ -288,7 +293,15 @@ 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() );
+    QSize newSize = settings->value( "size", QSize( 350, 60 ) ).toSize();
+    if( newSize.isValid() )
+    {
+        resize( newSize );
+    }
+    else
+    {
+        msg_Warn( p_intf, "Invalid size in constructor" );
+    }
 
     int tgPlay = settings->value( "playlist-visible", 0 ).toInt();
     settings->endGroup();
@@ -304,6 +317,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
 
 MainInterface::~MainInterface()
 {
+    msg_Dbg( p_intf, "Destroying the main interface" );
+
     if( playlistWidget ) playlistWidget->savingSettings( settings );
     if( ExtendedDialog::exists() )
         ExtendedDialog::getInstance( p_intf )->savingSettings();
@@ -315,6 +330,8 @@ MainInterface::~MainInterface()
                         getControlsVisibilityStatus() & CONTROLS_ADVANCED );
     settings->setValue( "pos", pos() );
     settings->setValue( "size", size() );
+    if( bgWidget )
+        settings->setValue( "backgroundSize", bgWidget->size() );
 
     settings->endGroup();
     delete settings;
@@ -335,6 +352,7 @@ MainInterface::~MainInterface()
     p_intf->pf_request_window = NULL;
     p_intf->pf_release_window = NULL;
     p_intf->pf_control_window = NULL;
+    p_intf->p_sys->p_mi = NULL;
 }
 
 /*****************************
@@ -398,9 +416,8 @@ void MainInterface::handleMainUi( QSettings *settings )
     if( alwaysVideoFlag )
     {
         bgWidget = new BackgroundWidget( p_intf );
-        bgWidget->widgetSize = settings->value( "backgroundSize",
-                                           QSize( 300, 200 ) ).toSize();
-        bgWidget->resize( bgWidget->widgetSize );
+        bgWidget->resize(
+             settings->value( "backgroundSize", QSize( 300, 150 ) ).toSize() );
         bgWidget->updateGeometry();
         mainLayout->insertWidget( 0, bgWidget );
         CONNECT( this, askBgWidgetToToggle(), bgWidget, toggle() );
@@ -455,7 +472,7 @@ int MainInterface::privacyDialog( QList<ConfigControl *> controls )
     QGridLayout *blablaLayout = new QGridLayout( blabla );
     QLabel *text = new QLabel( qtr(
         "<p>The <i>VideoLAN Team</i> doesn't like when an application goes "
-        "online without authorisation.</p>\n "
+        "online without authorization.</p>\n "
         "<p><i>VLC media player</i> can request limited information on "
         "Internet, espically to get CD Covers and songs metadata or to know "
         "if updates are available.</p>\n"
@@ -529,16 +546,19 @@ void MainInterface::debug()
 */
 QSize MainInterface::sizeHint() const
 {
-    int nwidth  = controls->size().width();
-    int nheight = controls->size().height()
-                + menuBar()->size().height()
-                + statusBar()->size().height();
+    int nwidth  = controls->sizeHint().width();
+    int nheight = controls->isVisible() ?
+                  controls->size().height()
+                  + menuBar()->size().height()
+                  + statusBar()->size().height()
+                  : 0 ;
 
     msg_Dbg( p_intf, "1 %i %i", nheight, nwidth );
     if( VISIBLE( bgWidget ) )
     {
         nheight += bgWidget->size().height();
         nwidth  = bgWidget->size().width();
+        msg_Dbg( p_intf, "1b %i %i", nheight, nwidth );
     }
     else if( videoIsActive )
     {
@@ -549,7 +569,7 @@ QSize MainInterface::sizeHint() const
     if( !dockPL->isFloating() && dockPL->isVisible() && dockPL->widget()  )
     {
         nheight += dockPL->size().height();
-        nwidth = MAX( nwidth, dockPL->size().width() );
+        nwidth = __MAX( nwidth, dockPL->size().width() );
         msg_Dbg( p_intf, "3 %i %i", nheight, nwidth );
     }
     msg_Dbg( p_intf, "4 %i %i", nheight, nwidth );
@@ -729,8 +749,11 @@ void MainInterface::togglePlaylist()
         settings->endGroup();
         settings->beginGroup( "playlist" );
         dockPL->move( settings->value( "pos", QPoint( 0,0 ) ).toPoint() );
-        dockPL->resize( settings->value( "size", QSize( 400, 300 ) ).toSize() );
+        QSize newSize = settings->value( "size", QSize( 400, 300 ) ).toSize();
+        if( newSize.isValid() )
+            dockPL->resize( newSize );
         settings->endGroup();
+
         dockPL->show();
         playlistVisible = true;
     }
@@ -755,7 +778,7 @@ void MainInterface::toggleMinimalView()
     TOGGLEV( menuBar() );
     TOGGLEV( controls );
     TOGGLEV( statusBar() );
-    updateGeometry();
+    doComponentsUpdate();
 }
 
 /* Video widget cannot do this synchronously as it runs in another thread */
@@ -867,8 +890,6 @@ void MainInterface::updateOnTimer()
         need_components_update = false;
     }
 #endif
-
-    controls->updateOnTimer();
 }
 
 /*****************************************************************************
@@ -1139,6 +1160,7 @@ static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
                         vlc_value_t old_val, vlc_value_t new_val, void *param )
 {
     intf_thread_t *p_intf = (intf_thread_t *)param;
+    msg_Dbg( p_this, "Menu Requested" ); // DEBUG to track the non disparition of the menu...
 
     if( p_intf->pf_show_dialog )
     {
@@ -1156,6 +1178,7 @@ static int IntfShowCB( vlc_object_t *p_this, const char *psz_variable,
                        vlc_value_t old_val, vlc_value_t new_val, void *param )
 {
     intf_thread_t *p_intf = (intf_thread_t *)param;
+    msg_Dbg( p_this, "Intf Show Requested" ); // DEBUG to track the non disparition of the menu...
     //p_intf->p_sys->b_intf_show = VLC_TRUE;
 
     return VLC_SUCCESS;