]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/dialogs/interaction.cpp
Various strings change and capitalisation changes to match the guidelines.
[vlc] / modules / gui / qt4 / dialogs / interaction.cpp
index 80f19ff438c8abffec1ae00ef6cb1071e98dbc5a..45e33516fff9020c2605fca84e4af9d101ee9381 100644 (file)
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
 
 #include "dialogs/errors.hpp"
 #include "dialogs/interaction.hpp"
+#include "main_interface.hpp"
 
 #include <QLabel>
 #include <QLineEdit>
@@ -98,8 +102,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 +115,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,19 +178,26 @@ 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();
+    if( ( p_dialog->i_flags & DIALOG_USER_PROGRESS ) &&
+        ( p_dialog->val.f_float >= 100.0 ) )
+        altButton->setText( qtr( "&Close" ) );
 }
 
 InteractionDialog::~InteractionDialog()
 {
-//    if( panel ) delete panel;
-    if( dialog ) delete dialog;
+//    delete panel;
+    delete dialog;
 }
 
 void InteractionDialog::defaultB()
@@ -200,7 +215,7 @@ void InteractionDialog::otherB()
 
 void InteractionDialog::Finish( int i_ret )
 {
-    vlc_mutex_lock( &p_dialog->p_interaction->object_lock );
+    vlc_object_lock( p_dialog->p_interaction );
 
     if( p_dialog->i_flags & DIALOG_LOGIN_PW_OK_CANCEL )
     {
@@ -213,7 +228,14 @@ void InteractionDialog::Finish( int i_ret )
     }
     p_dialog->i_status = ANSWERED_DIALOG;
     p_dialog->i_return = i_ret;
+
+    /* Alert the Dialog_*_Progress that the user had clicked on "cancel" */
+    if( p_dialog->i_flags & DIALOG_USER_PROGRESS ||
+        p_dialog->i_flags & DIALOG_INTF_PROGRESS )
+        p_dialog->b_cancelled = true;
+
     hide();
-    vlc_mutex_unlock( &p_dialog->p_interaction->object_lock );
+    vlc_object_unlock( p_dialog->p_interaction );
     playlist_Signal( THEPL );
 }
+