]> git.sesse.net Git - vlc/commitdiff
Qt4 - make the difference between DIALOG_USER_PROGRESS && DIALOG_INTF_PROGRESS, like...
authorJean-Baptiste Kempf <jb@videolan.org>
Sat, 12 Jan 2008 07:42:13 +0000 (07:42 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Sat, 12 Jan 2008 07:42:13 +0000 (07:42 +0000)
modules/gui/qt4/dialogs/interaction.cpp
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.hpp
modules/gui/qt4/qt4.cpp

index 1dc6bbf9400ca15ec304f6a07508683fc69f012e..63252b323c11f592c7a70519a6fd31cb5f322724 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "dialogs/errors.hpp"
 #include "dialogs/interaction.hpp"
+#include "main_interface.hpp"
 
 #include <QLabel>
 #include <QLineEdit>
@@ -98,8 +99,7 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf,
         panel->setLayout( grid );
         layout->addWidget( panel );
     }
-    else if( p_dialog->i_flags & DIALOG_USER_PROGRESS ||
-             /* TEMPORARY ! */ p_dialog->i_flags & DIALOG_INTF_PROGRESS )
+    else if( p_dialog->i_flags & DIALOG_USER_PROGRESS )
     {
         dialog = new QWidget( 0 );layout = new QVBoxLayout( dialog );
         layout->setMargin( 2 );
@@ -112,6 +112,11 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf,
         progressBar->setOrientation( Qt::Horizontal );
         layout->addWidget( progressBar );
     }
+    else if( p_dialog->i_flags & DIALOG_INTF_PROGRESS )
+    {
+        progressBar = p_intf->p_sys->p_mi->pgBar;
+        progressBar->show();
+    }
     else if( p_dialog->i_flags & DIALOG_PSZ_INPUT_OK_CANCEL )
     {
         dialog = new QWidget( 0 );layout = new QVBoxLayout( dialog );
@@ -170,13 +175,18 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf,
 
 void InteractionDialog::update()
 {
-    if( p_dialog->i_flags & DIALOG_USER_PROGRESS )
+    if( p_dialog->i_flags & DIALOG_USER_PROGRESS ||
+        p_dialog->i_flags & DIALOG_INTF_PROGRESS )
     {
         assert( progressBar );
-        progressBar->setValue( (int)(p_dialog->val.f_float*10) );
+        progressBar->setValue( (int)( p_dialog->val.f_float * 10 ) );
         description->setText( qfu( p_dialog->psz_description ) );
         msg_Dbg( p_intf, "Setting progress to %i", progressBar->value() );
     }
+
+    if( ( p_dialog->i_flags & DIALOG_INTF_PROGRESS ) &&
+        ( p_dialog->val.f_float >= 100.0 ) )
+        progressBar->hide();
 }
 
 InteractionDialog::~InteractionDialog()
@@ -223,3 +233,4 @@ void InteractionDialog::Finish( int i_ret )
     vlc_mutex_unlock( &p_dialog->p_interaction->object_lock );
     playlist_Signal( THEPL );
 }
+
index de17c43d3a83dd381191eea71778d42759a804c5..5675a59b5383442fbd795215f989cf13a19b394a 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:
index 8f37b020be9171f8059b85d6fa28ef4e10c22e02..85911e1ec8b2ca37e6f0acd9f61931522d63b8ac 100644 (file)
@@ -49,6 +49,7 @@ class SpeedControlWidget;
 class QMenu;
 class QSize;
 class QDockWidet;
+class QProgressBar;
 
 enum{
     CONTROLS_HIDDEN = 0x0,
@@ -59,6 +60,10 @@ enum{
 class MainInterface : public QVLCMW
 {
     Q_OBJECT;
+
+    friend class VolumeClickHandler;
+    friend class InteractionDialog;
+
 public:
     MainInterface( intf_thread_t *);
     virtual ~MainInterface();
@@ -85,7 +90,6 @@ protected:
     void dragLeaveEvent( QDragLeaveEvent * );
     void closeEvent( QCloseEvent *);
 
-    friend class VolumeClickHandler;
 private:
     QSettings           *settings;
     QSystemTrayIcon     *sysTray;
@@ -95,6 +99,7 @@ private:
     ControlsWidget      *controls;
     QMenu               *speedControlMenu;
     SpeedControlWidget  *speedControl;
+    QProgressBar        *pgBar;
 
     void handleMainUi( QSettings* );
     void privacy();
index 3148a9b346e176c129d7e96a49eb4031e54b60b5..1f7e4fe55b480e2c487879afb12cd76fbe5533e8 100644 (file)
@@ -283,6 +283,7 @@ static void Init( intf_thread_t *p_intf )
     else
     /*if( p_intf->pf_show_dialog )*/
         vlc_thread_ready( p_intf );
+
 #ifdef ENABLE_NLS
     // Translation - get locale
     QLocale ql = QLocale::system();