From: Clément Stenac Date: Thu, 14 Sep 2006 21:19:34 +0000 (+0000) Subject: Fix a number of problems with interaction dialogs X-Git-Tag: 0.9.0-test0~10302 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=928454fad876fb8f5dc7b993dca4670460a008af;p=vlc Fix a number of problems with interaction dialogs Remove the "seeking too far" error, as it happens for broken AVI and is quite confusing --- diff --git a/modules/access/file.c b/modules/access/file.c index 0c876749e1..50e0c32281 100644 --- a/modules/access/file.c +++ b/modules/access/file.c @@ -516,10 +516,6 @@ static int Seek( access_t *p_access, int64_t i_pos ) if( p_access->info.i_size < p_access->info.i_pos ) { msg_Err( p_access, "seeking too far" ); - intf_UserFatal( p_access, VLC_FALSE, _("File reading failed"), - _("VLC seeked in the file too far. This usually means " - "that your file is broken and therefore cannot be " - "played." ) ); p_access->info.i_pos = p_access->info.i_size; } else if( p_access->info.i_pos < 0 ) diff --git a/modules/access/http.c b/modules/access/http.c index 82d9fefd6b..5558dd962b 100644 --- a/modules/access/http.c +++ b/modules/access/http.c @@ -285,7 +285,7 @@ connect: int i_ret; msg_Dbg( p_access, "authentication failed" ); i_ret = intf_UserLoginPassword( p_access, _("HTTP authentication"), - _("Please enter a valid login name and a password."), + _("Please enter a valid login name and a password."), &psz_login, &psz_password ); if( i_ret == DIALOG_OK_YES ) { diff --git a/modules/gui/qt4/dialogs/interaction.cpp b/modules/gui/qt4/dialogs/interaction.cpp index 8960afbfe6..2859a56ab3 100644 --- a/modules/gui/qt4/dialogs/interaction.cpp +++ b/modules/gui/qt4/dialogs/interaction.cpp @@ -34,16 +34,17 @@ #include InteractionDialog::InteractionDialog( intf_thread_t *_p_intf, - interaction_dialog_t *_p_dialog ) : QWidget( 0 ), + interaction_dialog_t *_p_dialog ) : QObject( 0 ), p_intf( _p_intf), p_dialog( _p_dialog ) { - QVBoxLayout *layout = new QVBoxLayout( this ); + QVBoxLayout *layout = NULL; int i_ret = -1; panel = NULL; + dialog = NULL; if( p_dialog->i_flags & DIALOG_BLOCKING_ERROR ) { - i_ret = QMessageBox::critical( this, qfu( p_dialog->psz_title ), + i_ret = QMessageBox::critical( NULL, qfu( p_dialog->psz_title ), qfu( p_dialog->psz_description ), QMessageBox::Ok, 0, 0 ); } @@ -64,7 +65,8 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf, } else if( p_dialog->i_flags & DIALOG_YES_NO_CANCEL ) { - i_ret = QMessageBox::question( this, + p_dialog->i_status = SENT_DIALOG; + i_ret = QMessageBox::question( NULL, qfu( p_dialog->psz_title), qfu( p_dialog->psz_description ), p_dialog->psz_default_button ? qfu( p_dialog->psz_default_button ) : QString::null, @@ -76,6 +78,8 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf, } else if( p_dialog->i_flags & DIALOG_LOGIN_PW_OK_CANCEL ) { + dialog = new QWidget( 0 ); layout = new QVBoxLayout( dialog ); + layout->setMargin( 2 ); panel = new QWidget( 0 ); QGridLayout *grid = new QGridLayout; @@ -93,8 +97,11 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf, panel->setLayout( grid ); layout->addWidget( panel ); } - else if( p_dialog->i_flags & DIALOG_USER_PROGRESS ) + else if( p_dialog->i_flags & DIALOG_USER_PROGRESS || + /* TEMPORARY ! */ p_dialog->i_flags & DIALOG_INTF_PROGRESS ) { + dialog = new QWidget( 0 );layout = new QVBoxLayout( dialog ); + layout->setMargin( 2 ); description = new QLabel( qfu( p_dialog->psz_description ) ); layout->addWidget( description ); @@ -106,6 +113,8 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf, } else if( p_dialog->i_flags & DIALOG_PSZ_INPUT_OK_CANCEL ) { + dialog = new QWidget( 0 );layout = new QVBoxLayout( dialog ); + layout->setMargin( 2 ); description = new QLabel( qfu( p_dialog->psz_description ) ); layout->addWidget( description ); @@ -113,7 +122,7 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf, layout->addWidget( inputEdit ); } else - msg_Err( p_intf, "unknown dialog type" ); + msg_Err( p_intf, "unknown dialog type %i", p_dialog->i_flags ); /* We used a message box */ if( i_ret != -1 ) @@ -125,33 +134,35 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf, else /* Custom box, finish it */ { - QVLCFrame::doButtons( this, layout, + QVLCFrame::doButtons( dialog, layout, &defaultButton, p_dialog->psz_default_button, &altButton, p_dialog->psz_alternate_button, &otherButton, p_dialog->psz_other_button ); if( p_dialog->psz_default_button ) - BUTTONACT( defaultButton, defaultB ); + BUTTONACT( defaultButton, defaultB() ); if( p_dialog->psz_alternate_button ) - BUTTONACT( altButton, altB ); + BUTTONACT( altButton, altB() ); if( p_dialog->psz_other_button ) - BUTTONACT( otherButton, otherB ); - setLayout( layout ); - setWindowTitle( qfu( p_dialog->psz_title ) ); + BUTTONACT( otherButton, otherB() ); + dialog->setLayout( layout ); + dialog->setWindowTitle( qfu( p_dialog->psz_title ) ); } } -void InteractionDialog::Update() +void InteractionDialog::update() { if( p_dialog->i_flags & DIALOG_USER_PROGRESS ) { assert( progressBar ); progressBar->setValue( (int)(p_dialog->val.f_float*1000) ); + fprintf (stderr, "Setting progress to %i\n", progressBar->value() ); } } InteractionDialog::~InteractionDialog() { - if( panel ) delete panel; +// if( panel ) delete panel; + if( dialog ) delete dialog; } void InteractionDialog::defaultB() diff --git a/modules/gui/qt4/dialogs/interaction.hpp b/modules/gui/qt4/dialogs/interaction.hpp index 9cf828a8e1..40a750376d 100644 --- a/modules/gui/qt4/dialogs/interaction.hpp +++ b/modules/gui/qt4/dialogs/interaction.hpp @@ -32,17 +32,20 @@ class QLabel; class QProgressBar; class QLineEdit; -class InteractionDialog : public QWidget +class InteractionDialog : public QObject { Q_OBJECT public: InteractionDialog( intf_thread_t *, interaction_dialog_t * ); virtual ~InteractionDialog(); - void Update(); + void update(); + void show() { if( dialog ) dialog->show(); } + void hide() { if( dialog ) dialog->hide(); } private: QWidget *panel; + QWidget *dialog; intf_thread_t *p_intf; interaction_dialog_t *p_dialog; diff --git a/modules/gui/qt4/dialogs_provider.cpp b/modules/gui/qt4/dialogs_provider.cpp index 7cd53e1b66..b4b414ed30 100644 --- a/modules/gui/qt4/dialogs_provider.cpp +++ b/modules/gui/qt4/dialogs_provider.cpp @@ -123,7 +123,7 @@ void DialogsProvider::doInteraction( intf_dialog_args_t *p_arg ) case INTERACT_UPDATE: qdialog = (InteractionDialog*)(p_dialog->p_private); if( qdialog) - qdialog->Update(); + qdialog->update(); break; case INTERACT_HIDE: qdialog = (InteractionDialog*)(p_dialog->p_private); @@ -133,7 +133,8 @@ void DialogsProvider::doInteraction( intf_dialog_args_t *p_arg ) break; case INTERACT_DESTROY: qdialog = (InteractionDialog*)(p_dialog->p_private); - delete qdialog; + if( !p_dialog->i_flags & DIALOG_NONBLOCKING_ERROR ) + delete qdialog; p_dialog->i_status = DESTROYED_DIALOG; break; } diff --git a/modules/gui/qt4/util/qvlcframe.hpp b/modules/gui/qt4/util/qvlcframe.hpp index 36a368fb01..f35fc97bea 100644 --- a/modules/gui/qt4/util/qvlcframe.hpp +++ b/modules/gui/qt4/util/qvlcframe.hpp @@ -65,6 +65,7 @@ public: QPushButton **other, char *psz_other ) { #ifdef QT42 + fprintf( stderr, "Gra\n" ); #else QHBoxLayout *buttons_layout = new QHBoxLayout; QSpacerItem *spacerItem = new QSpacerItem( 40, 20, @@ -75,6 +76,7 @@ public: { fprintf( stderr, "Creating default button %s\n", psz_default ); *defaul = new QPushButton(0); + (*defaul)->setFocus(); buttons_layout->addWidget( *defaul ); (*defaul)->setText( qfu( psz_default ) ); } diff --git a/src/interface/interaction.c b/src/interface/interaction.c index 395ecebf8a..09cbd2437c 100644 --- a/src/interface/interaction.c +++ b/src/interface/interaction.c @@ -367,16 +367,19 @@ int __intf_UserLoginPassword( vlc_object_t *p_this, p_new->i_type = INTERACT_DIALOG_TWOWAY; p_new->psz_title = strdup( psz_title ); p_new->psz_description = strdup( psz_description ); + p_new->psz_default_button = strdup( _("Ok" ) ); + p_new->psz_alternate_button = strdup( _("Cancel" ) ); p_new->i_flags = DIALOG_LOGIN_PW_OK_CANCEL; i_ret = DialogSend( p_this, p_new ); - if( i_ret != DIALOG_CANCELLED ) + if( i_ret != DIALOG_CANCELLED && i_ret != VLC_EGENERIC ) { - assert( p_new->psz_returned[0] && p_new->psz_returned[1] ); - *ppsz_login = strdup( p_new->psz_returned[0] ); - *ppsz_password = strdup( p_new->psz_returned[1] ); + *ppsz_login = p_new->psz_returned[0]? + strdup( p_new->psz_returned[0] ) : NULL; + *ppsz_password = p_new->psz_returned[1]? + strdup( p_new->psz_returned[1] ) : NULL; } return i_ret; } diff --git a/src/playlist/thread.c b/src/playlist/thread.c index 5bf33e45bd..34d127b2f6 100644 --- a/src/playlist/thread.c +++ b/src/playlist/thread.c @@ -211,6 +211,8 @@ static void DestroyInteraction( playlist_t *p_playlist ) if( p_playlist->p_interaction ) { intf_InteractionDestroy( p_playlist->p_interaction ); + fprintf( stderr, "NOW NULL ****\n" ); + p_playlist->p_interaction = NULL; } }