]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/dialogs/external.cpp
Qt: forgotten include
[vlc] / modules / gui / qt4 / dialogs / external.cpp
index 67c6f1c18b1d9ff9a9564d545c515c6d18de2f15..e78eaa048da908c4f9c40fcec09ade920d791eb0 100644 (file)
@@ -36,6 +36,7 @@
 #include <QProgressDialog>
 #include <QMutex>
 #include <QPushButton>
+#include <QTimer>
 
 DialogHandler::DialogHandler (intf_thread_t *intf, QObject *_parent)
     : QObject( _parent ), intf (intf),
@@ -134,8 +135,8 @@ void DialogHandler::requestLogin (vlc_object_t *, void *value)
     buttonBox->addButton( okButton, QDialogButtonBox::AcceptRole );
     buttonBox->addButton( cancelButton, QDialogButtonBox::RejectRole );
 
-    CONNECT( okButton, accepted(), dialog, accept() );
-    CONNECT( cancelButton, rejected(), dialog, reject() );
+    CONNECT( buttonBox, accepted(), dialog, accept() );
+    CONNECT( buttonBox, rejected(), dialog, reject() );
     layout->addWidget (buttonBox);
 
     /* Run the dialog */
@@ -183,15 +184,21 @@ void DialogHandler::requestAnswer (vlc_object_t *, void *value)
 
 QVLCProgressDialog::QVLCProgressDialog (DialogHandler *parent,
                                         struct dialog_progress_bar_t *data)
-    : QProgressDialog (qfu(data->message),
-                       data->cancel ? ("&" + qfu(data->cancel)) : 0, 0, 1000),
+    : QProgressDialog ( ),
       handler (parent),
       cancelled (false)
 {
+    setLabelText( qfu(data->message) );
+    setRange( 0, 0 );
+
+    if( data->cancel )
+        setCancelButton( new QPushButton( "&" + qfu(data->cancel) ) );
     if (data->title != NULL)
         setWindowTitle (qfu(data->title));
+
     setWindowRole ("vlc-progress");
-    setMinimumDuration (0);
+    setMinimumDuration (300);
+    setValue( 0 );
 
     connect (this, SIGNAL(progressed(int)), SLOT(setValue(int)));
     connect (this, SIGNAL(described(const QString&)),
@@ -204,14 +211,12 @@ QVLCProgressDialog::QVLCProgressDialog (DialogHandler *parent,
     data->p_sys = this;
 }
 
-QVLCProgressDialog::~QVLCProgressDialog (void)
-{
-}
 
 void QVLCProgressDialog::update (void *priv, const char *text, float value)
 {
     QVLCProgressDialog *self = static_cast<QVLCProgressDialog *>(priv);
-
+    if( value > 0 )
+        self->setRange( 0, 1000 );
     if (text != NULL)
         emit self->described (qfu(text));
     emit self->progressed ((int)(value * 1000.));
@@ -244,7 +249,8 @@ void DialogHandler::startProgressBar (vlc_object_t *, void *value)
     dialog_progress_bar_t *data = (dialog_progress_bar_t *)value;
     QWidget *dlg = new QVLCProgressDialog (this, data);
 
-    dlg->show ();
+    QTimer::singleShot( 300, dlg, SLOT( show() ) );
+//    dlg->show ();
 }
 
 void DialogHandler::stopProgressBar (QWidget *dlg)