]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/dialogs/interaction.cpp
ncurses: various bugfixes
[vlc] / modules / gui / qt4 / dialogs / interaction.cpp
index 2859a56ab30095f70c078886b48cf943d7f8f26a..359cdfef23cfdc3f5e01f481b2e04b242452c428 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
 
-#include "qt4.hpp"
 #include "dialogs/errors.hpp"
 #include "dialogs/interaction.hpp"
-#include "util/qvlcframe.hpp"
 
 #include <QLabel>
 #include <QLineEdit>
 #include <QPushButton>
 #include <QProgressBar>
 #include <QMessageBox>
+#include <QDialogButtonBox>
 
 #include <assert.h>
 
@@ -50,7 +50,7 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf,
     }
     else if( p_dialog->i_flags & DIALOG_NONBLOCKING_ERROR )
     {
-        if( config_GetInt( p_intf, "errors-dialog" ) != 0 )
+        if( config_GetInt( p_intf, "qt-error-dialogs" ) != 0 )
             ErrorsDialog::getInstance( p_intf )->addError(
                  qfu( p_dialog->psz_title ), qfu( p_dialog->psz_description ) );
         i_ret = 0;
@@ -58,7 +58,7 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf,
     }
     else if( p_dialog->i_flags & DIALOG_WARNING )
     {
-        if( config_GetInt( p_intf, "errors-dialog" ) != 0 )
+        if( config_GetInt( p_intf, "qt-error-dialogs" ) != 0 )
             ErrorsDialog::getInstance( p_intf )->addWarning(
                 qfu( p_dialog->psz_title ),qfu( p_dialog->psz_description ) );
         i_ret = 0;
@@ -92,6 +92,7 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf,
 
         grid->addWidget( new QLabel( qtr("Password") ), 2, 0);
         passwordEdit = new QLineEdit;
+        passwordEdit->setEchoMode( QLineEdit::Password );
         grid->addWidget( passwordEdit, 2, 1 );
 
         panel->setLayout( grid );
@@ -134,10 +135,28 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf,
     else
     /* Custom box, finish it */
     {
-        QVLCFrame::doButtons( dialog, layout,
-                              &defaultButton, p_dialog->psz_default_button,
-                              &altButton, p_dialog->psz_alternate_button,
-                              &otherButton, p_dialog->psz_other_button );
+        QDialogButtonBox *buttonBox = new QDialogButtonBox;
+
+        if( p_dialog->psz_default_button )
+        {
+            defaultButton = new QPushButton;
+            defaultButton->setFocus();
+            defaultButton->setText( qfu( p_dialog->psz_default_button ) );
+            buttonBox->addButton( defaultButton, QDialogButtonBox::AcceptRole );
+        }
+        if( p_dialog->psz_alternate_button )
+        {
+            altButton = new QPushButton;
+            altButton->setText( qfu( p_dialog->psz_alternate_button ) );
+            buttonBox->addButton( altButton, QDialogButtonBox::RejectRole );
+        }
+        if( p_dialog->psz_other_button )
+        {
+            otherButton = new QPushButton;
+            otherButton->setText( qfu( p_dialog->psz_other_button ) );
+            buttonBox->addButton( otherButton, QDialogButtonBox::ActionRole );
+        }
+        layout->addWidget( buttonBox );
         if( p_dialog->psz_default_button )
             BUTTONACT( defaultButton, defaultB() );
         if( p_dialog->psz_alternate_button )
@@ -155,7 +174,7 @@ void InteractionDialog::update()
     {
         assert( progressBar );
         progressBar->setValue( (int)(p_dialog->val.f_float*1000) );
-        fprintf (stderr, "Setting progress to %i\n", progressBar->value() );
+        msg_Err( p_intf, "Setting progress to %i\n", progressBar->value() );
     }
 }
 
@@ -195,4 +214,5 @@ void InteractionDialog::Finish( int i_ret )
     p_dialog->i_return = i_ret;
     hide();
     vlc_mutex_unlock( &p_dialog->p_interaction->object_lock );
+    playlist_Signal( THEPL );
 }