]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/main_interface.cpp
Qt4 - make the difference between DIALOG_USER_PROGRESS && DIALOG_INTF_PROGRESS, like...
[vlc] / modules / gui / qt4 / main_interface.cpp
index 9731e993132aaa9acb9a6e3248296346d45ff500..5675a59b5383442fbd795215f989cf13a19b394a 100644 (file)
@@ -51,6 +51,7 @@
 #include <QToolBar>
 #include <QGroupBox>
 #include <QDate>
+#include <QProgressBar>
 
 #include <assert.h>
 #include <vlc_keys.h>
@@ -150,6 +151,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     /* Widgets Creation*/
     b_remainingTime = false;
     timeLabel = new TimeLabel;
+    timeLabel->setText( " --:--/--:-- " );
     timeLabel->setAlignment( Qt::AlignRight );
     nameLabel = new QLabel;
     nameLabel->setTextInteractionFlags( Qt::TextSelectableByMouse
@@ -162,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:
@@ -314,6 +320,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;
@@ -397,9 +405,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() );
@@ -454,7 +461,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"
@@ -528,16 +535,19 @@ void MainInterface::debug()
 */
 QSize MainInterface::sizeHint() const
 {
-    int nwidth = controls->sizeHint().width();
-    int nheight = controls->sizeHint().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 )
     {
@@ -548,7 +558,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 );
@@ -669,8 +679,8 @@ int MainInterface::controlVideo( void *p_window, int i_query, va_list args )
         {
             unsigned int *pi_width  = va_arg( args, unsigned int * );
             unsigned int *pi_height = va_arg( args, unsigned int * );
-            *pi_width = videoWidget->widgetSize.width();
-            *pi_height = videoWidget->widgetSize.height();
+            *pi_width = videoWidget->width();
+            *pi_height = videoWidget->height();
             i_ret = VLC_SUCCESS;
             break;
         }
@@ -754,7 +764,7 @@ void MainInterface::toggleMinimalView()
     TOGGLEV( menuBar() );
     TOGGLEV( controls );
     TOGGLEV( statusBar() );
-    updateGeometry();
+    doComponentsUpdate();
 }
 
 /* Video widget cannot do this synchronously as it runs in another thread */
@@ -811,13 +821,13 @@ void MainInterface::setDisplayPosition( float pos, int time, int length )
     secstotimestr( psz_time, ( b_remainingTime && length ) ? length - time
                                                            : time );
 
-    QString title;
-    title.sprintf( "%s/%s", psz_time,
+    QString timestr;
+    timestr.sprintf( "%s/%s", psz_time,
                             ( !length && time ) ? "--:--" : psz_length );
 
     /* Add a minus to remaining time*/
-    if( b_remainingTime && length ) timeLabel->setText( " -"+title+" " );
-    else timeLabel->setText( " "+title+" " );
+    if( b_remainingTime && length ) timeLabel->setText( " -"+timestr+" " );
+    else timeLabel->setText( " "+timestr+" " );
 }
 
 void MainInterface::toggleTimeDisplay()
@@ -1138,6 +1148,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 )
     {
@@ -1155,6 +1166,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;