Changeset 928454fad876fb8f5dc7b993dca4670460a008af
- Timestamp:
- 14/09/06 23:19:34
(2 years ago)
- Author:
- Clément Stenac <zorglub@videolan.org>
- git-committer:
- Clément Stenac <zorglub@videolan.org> 1158268774 +0000
- git-parent:
[6cdb3e2829ba401c9781e1532479db658d87c69b]
- git-author:
- Clément Stenac <zorglub@videolan.org> 1158268774 +0000
- Message:
Fix a number of problems with interaction dialogs
Remove the "seeking too far" error, as it happens for broken AVI and is quite confusing
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r89298c1 |
r928454f |
|
| 517 | 517 | { |
|---|
| 518 | 518 | msg_Err( p_access, "seeking too far" ); |
|---|
| 519 | | intf_UserFatal( p_access, VLC_FALSE, _("File reading failed"), |
|---|
| 520 | | _("VLC seeked in the file too far. This usually means " |
|---|
| 521 | | "that your file is broken and therefore cannot be " |
|---|
| 522 | | "played." ) ); |
|---|
| 523 | 519 | p_access->info.i_pos = p_access->info.i_size; |
|---|
| 524 | 520 | } |
|---|
| r8ce6877 |
r928454f |
|
| 286 | 286 | msg_Dbg( p_access, "authentication failed" ); |
|---|
| 287 | 287 | i_ret = intf_UserLoginPassword( p_access, _("HTTP authentication"), |
|---|
| 288 | | _("Please enter a valid login name and a password."), |
|---|
| | 288 | _("Please enter a valid login name and a password."), |
|---|
| 289 | 289 | &psz_login, &psz_password ); |
|---|
| 290 | 290 | if( i_ret == DIALOG_OK_YES ) |
|---|
| r6523dc2 |
r928454f |
|
| 35 | 35 | |
|---|
| 36 | 36 | InteractionDialog::InteractionDialog( intf_thread_t *_p_intf, |
|---|
| 37 | | interaction_dialog_t *_p_dialog ) : QWidget( 0 ), |
|---|
| | 37 | interaction_dialog_t *_p_dialog ) : QObject( 0 ), |
|---|
| 38 | 38 | p_intf( _p_intf), p_dialog( _p_dialog ) |
|---|
| 39 | 39 | { |
|---|
| 40 | | QVBoxLayout *layout = new QVBoxLayout( this ); |
|---|
| | 40 | QVBoxLayout *layout = NULL; |
|---|
| 41 | 41 | int i_ret = -1; |
|---|
| 42 | 42 | panel = NULL; |
|---|
| | 43 | dialog = NULL; |
|---|
| 43 | 44 | |
|---|
| 44 | 45 | if( p_dialog->i_flags & DIALOG_BLOCKING_ERROR ) |
|---|
| 45 | 46 | { |
|---|
| 46 | | i_ret = QMessageBox::critical( this, qfu( p_dialog->psz_title ), |
|---|
| | 47 | i_ret = QMessageBox::critical( NULL, qfu( p_dialog->psz_title ), |
|---|
| 47 | 48 | qfu( p_dialog->psz_description ), |
|---|
| 48 | 49 | QMessageBox::Ok, 0, 0 ); |
|---|
| … | … | |
| 65 | 66 | else if( p_dialog->i_flags & DIALOG_YES_NO_CANCEL ) |
|---|
| 66 | 67 | { |
|---|
| 67 | | i_ret = QMessageBox::question( this, |
|---|
| | 68 | p_dialog->i_status = SENT_DIALOG; |
|---|
| | 69 | i_ret = QMessageBox::question( NULL, |
|---|
| 68 | 70 | qfu( p_dialog->psz_title), qfu( p_dialog->psz_description ), |
|---|
| 69 | 71 | p_dialog->psz_default_button ? |
|---|
| … | … | |
| 77 | 79 | else if( p_dialog->i_flags & DIALOG_LOGIN_PW_OK_CANCEL ) |
|---|
| 78 | 80 | { |
|---|
| | 81 | dialog = new QWidget( 0 ); layout = new QVBoxLayout( dialog ); |
|---|
| | 82 | layout->setMargin( 2 ); |
|---|
| 79 | 83 | panel = new QWidget( 0 ); |
|---|
| 80 | 84 | QGridLayout *grid = new QGridLayout; |
|---|
| … | … | |
| 94 | 98 | layout->addWidget( panel ); |
|---|
| 95 | 99 | } |
|---|
| 96 | | else if( p_dialog->i_flags & DIALOG_USER_PROGRESS ) |
|---|
| | 100 | else if( p_dialog->i_flags & DIALOG_USER_PROGRESS || |
|---|
| | 101 | /* TEMPORARY ! */ p_dialog->i_flags & DIALOG_INTF_PROGRESS ) |
|---|
| 97 | 102 | { |
|---|
| | 103 | dialog = new QWidget( 0 );layout = new QVBoxLayout( dialog ); |
|---|
| | 104 | layout->setMargin( 2 ); |
|---|
| 98 | 105 | description = new QLabel( qfu( p_dialog->psz_description ) ); |
|---|
| 99 | 106 | layout->addWidget( description ); |
|---|
| … | … | |
| 107 | 114 | else if( p_dialog->i_flags & DIALOG_PSZ_INPUT_OK_CANCEL ) |
|---|
| 108 | 115 | { |
|---|
| | 116 | dialog = new QWidget( 0 );layout = new QVBoxLayout( dialog ); |
|---|
| | 117 | layout->setMargin( 2 ); |
|---|
| 109 | 118 | description = new QLabel( qfu( p_dialog->psz_description ) ); |
|---|
| 110 | 119 | layout->addWidget( description ); |
|---|
| … | … | |
| 114 | 123 | } |
|---|
| 115 | 124 | else |
|---|
| 116 | | msg_Err( p_intf, "unknown dialog type" ); |
|---|
| | 125 | msg_Err( p_intf, "unknown dialog type %i", p_dialog->i_flags ); |
|---|
| 117 | 126 | |
|---|
| 118 | 127 | /* We used a message box */ |
|---|
| … | … | |
| 126 | 135 | /* Custom box, finish it */ |
|---|
| 127 | 136 | { |
|---|
| 128 | | QVLCFrame::doButtons( this, layout, |
|---|
| | 137 | QVLCFrame::doButtons( dialog, layout, |
|---|
| 129 | 138 | &defaultButton, p_dialog->psz_default_button, |
|---|
| 130 | 139 | &altButton, p_dialog->psz_alternate_button, |
|---|
| 131 | 140 | &otherButton, p_dialog->psz_other_button ); |
|---|
| 132 | 141 | if( p_dialog->psz_default_button ) |
|---|
| 133 | | BUTTONACT( defaultButton, defaultB ); |
|---|
| | 142 | BUTTONACT( defaultButton, defaultB() ); |
|---|
| 134 | 143 | if( p_dialog->psz_alternate_button ) |
|---|
| 135 | | BUTTONACT( altButton, altB ); |
|---|
| | 144 | BUTTONACT( altButton, altB() ); |
|---|
| 136 | 145 | if( p_dialog->psz_other_button ) |
|---|
| 137 | | BUTTONACT( otherButton, otherB ); |
|---|
| 138 | | setLayout( layout ); |
|---|
| 139 | | setWindowTitle( qfu( p_dialog->psz_title ) ); |
|---|
| | 146 | BUTTONACT( otherButton, otherB() ); |
|---|
| | 147 | dialog->setLayout( layout ); |
|---|
| | 148 | dialog->setWindowTitle( qfu( p_dialog->psz_title ) ); |
|---|
| 140 | 149 | } |
|---|
| 141 | 150 | } |
|---|
| 142 | 151 | |
|---|
| 143 | | void InteractionDialog::Update() |
|---|
| | 152 | void InteractionDialog::update() |
|---|
| 144 | 153 | { |
|---|
| 145 | 154 | if( p_dialog->i_flags & DIALOG_USER_PROGRESS ) |
|---|
| … | … | |
| 147 | 156 | assert( progressBar ); |
|---|
| 148 | 157 | progressBar->setValue( (int)(p_dialog->val.f_float*1000) ); |
|---|
| | 158 | fprintf (stderr, "Setting progress to %i\n", progressBar->value() ); |
|---|
| 149 | 159 | } |
|---|
| 150 | 160 | } |
|---|
| … | … | |
| 152 | 162 | InteractionDialog::~InteractionDialog() |
|---|
| 153 | 163 | { |
|---|
| 154 | | if( panel ) delete panel; |
|---|
| | 164 | // if( panel ) delete panel; |
|---|
| | 165 | if( dialog ) delete dialog; |
|---|
| 155 | 166 | } |
|---|
| 156 | 167 | |
|---|
| rc5ee72d |
r928454f |
|
| 33 | 33 | class QLineEdit; |
|---|
| 34 | 34 | |
|---|
| 35 | | class InteractionDialog : public QWidget |
|---|
| | 35 | class InteractionDialog : public QObject |
|---|
| 36 | 36 | { |
|---|
| 37 | 37 | Q_OBJECT |
|---|
| … | … | |
| 40 | 40 | virtual ~InteractionDialog(); |
|---|
| 41 | 41 | |
|---|
| 42 | | void Update(); |
|---|
| | 42 | void update(); |
|---|
| | 43 | void show() { if( dialog ) dialog->show(); } |
|---|
| | 44 | void hide() { if( dialog ) dialog->hide(); } |
|---|
| 43 | 45 | |
|---|
| 44 | 46 | private: |
|---|
| 45 | 47 | QWidget *panel; |
|---|
| | 48 | QWidget *dialog; |
|---|
| 46 | 49 | intf_thread_t *p_intf; |
|---|
| 47 | 50 | interaction_dialog_t *p_dialog; |
|---|
| r897144d |
r928454f |
|
| 124 | 124 | qdialog = (InteractionDialog*)(p_dialog->p_private); |
|---|
| 125 | 125 | if( qdialog) |
|---|
| 126 | | qdialog->Update(); |
|---|
| | 126 | qdialog->update(); |
|---|
| 127 | 127 | break; |
|---|
| 128 | 128 | case INTERACT_HIDE: |
|---|
| … | … | |
| 134 | 134 | case INTERACT_DESTROY: |
|---|
| 135 | 135 | qdialog = (InteractionDialog*)(p_dialog->p_private); |
|---|
| 136 | | delete qdialog; |
|---|
| | 136 | if( !p_dialog->i_flags & DIALOG_NONBLOCKING_ERROR ) |
|---|
| | 137 | delete qdialog; |
|---|
| 137 | 138 | p_dialog->i_status = DESTROYED_DIALOG; |
|---|
| 138 | 139 | break; |
|---|
| r4717c1a |
r928454f |
|
| 66 | 66 | { |
|---|
| 67 | 67 | #ifdef QT42 |
|---|
| | 68 | fprintf( stderr, "Gra\n" ); |
|---|
| 68 | 69 | #else |
|---|
| 69 | 70 | QHBoxLayout *buttons_layout = new QHBoxLayout; |
|---|
| … | … | |
| 76 | 77 | fprintf( stderr, "Creating default button %s\n", psz_default ); |
|---|
| 77 | 78 | *defaul = new QPushButton(0); |
|---|
| | 79 | (*defaul)->setFocus(); |
|---|
| 78 | 80 | buttons_layout->addWidget( *defaul ); |
|---|
| 79 | 81 | (*defaul)->setText( qfu( psz_default ) ); |
|---|
| r7a57427 |
r928454f |
|
| 368 | 368 | p_new->psz_title = strdup( psz_title ); |
|---|
| 369 | 369 | p_new->psz_description = strdup( psz_description ); |
|---|
| | 370 | p_new->psz_default_button = strdup( _("Ok" ) ); |
|---|
| | 371 | p_new->psz_alternate_button = strdup( _("Cancel" ) ); |
|---|
| 370 | 372 | |
|---|
| 371 | 373 | p_new->i_flags = DIALOG_LOGIN_PW_OK_CANCEL; |
|---|
| … | … | |
| 373 | 375 | i_ret = DialogSend( p_this, p_new ); |
|---|
| 374 | 376 | |
|---|
| 375 | | if( i_ret != DIALOG_CANCELLED ) |
|---|
| 376 | | { |
|---|
| 377 | | assert( p_new->psz_returned[0] && p_new->psz_returned[1] ); |
|---|
| 378 | | *ppsz_login = strdup( p_new->psz_returned[0] ); |
|---|
| 379 | | *ppsz_password = strdup( p_new->psz_returned[1] ); |
|---|
| | 377 | if( i_ret != DIALOG_CANCELLED && i_ret != VLC_EGENERIC ) |
|---|
| | 378 | { |
|---|
| | 379 | *ppsz_login = p_new->psz_returned[0]? |
|---|
| | 380 | strdup( p_new->psz_returned[0] ) : NULL; |
|---|
| | 381 | *ppsz_password = p_new->psz_returned[1]? |
|---|
| | 382 | strdup( p_new->psz_returned[1] ) : NULL; |
|---|
| 380 | 383 | } |
|---|
| 381 | 384 | return i_ret; |
|---|
| r315069b |
r928454f |
|
| 212 | 212 | { |
|---|
| 213 | 213 | intf_InteractionDestroy( p_playlist->p_interaction ); |
|---|
| | 214 | fprintf( stderr, "NOW NULL ****\n" ); |
|---|
| | 215 | p_playlist->p_interaction = NULL; |
|---|
| 214 | 216 | } |
|---|
| 215 | 217 | } |
|---|