Changeset 16bf241c0ef8cb5ad5905817233af703080ed654
- Timestamp:
- 06/25/08 03:38:33
(2 months ago)
- Author:
- Jean-Baptiste Kempf <jb@videolan.org>
- git-committer:
- Jean-Baptiste Kempf <jb@videolan.org> 1214357913 -0700
- git-parent:
[d79d5b339afb1310571a14579d66954dc12fb06d]
- git-author:
- Jean-Baptiste Kempf <jb@videolan.org> 1214357646 -0700
- Message:
Fix network panel behaviour (comboBox and adress generation especially )
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r8e756ce |
r16bf241 |
|
| 411 | 411 | |
|---|
| 412 | 412 | /* CONNECTs */ |
|---|
| 413 | | CONNECT( ui.protocolCombo, currentIndexChanged( int ), |
|---|
| | 413 | CONNECT( ui.protocolCombo, activated( int ), |
|---|
| 414 | 414 | this, updateProtocol( int ) ); |
|---|
| 415 | 415 | CONNECT( ui.portSpin, valueChanged( int ), this, updateMRL() ); |
|---|
| … | … | |
| 418 | 418 | CONNECT( ui.ipv6, clicked(), this, updateMRL()); |
|---|
| 419 | 419 | |
|---|
| | 420 | ui.protocolCombo->addItem( "" ); |
|---|
| 420 | 421 | ui.protocolCombo->addItem("HTTP", QVariant("http")); |
|---|
| 421 | 422 | ui.protocolCombo->addItem("HTTPS", QVariant("https")); |
|---|
| … | … | |
| 434 | 435 | |
|---|
| 435 | 436 | /* update the widgets according the type of protocol */ |
|---|
| 436 | | void NetOpenPanel::updateProtocol( int idx ) { |
|---|
| | 437 | void NetOpenPanel::updateProtocol( int idx_proto ) { |
|---|
| 437 | 438 | QString addr = ui.addressText->text(); |
|---|
| 438 | | QString proto = ui.protocolCombo->itemData( idx ).toString(); |
|---|
| 439 | | |
|---|
| 440 | | ui.timeShift->setEnabled( idx >= 5 ); |
|---|
| 441 | | ui.ipv6->setEnabled( idx == 5 ); |
|---|
| 442 | | ui.addressText->setEnabled( idx != 5 ); |
|---|
| 443 | | ui.portSpin->setEnabled( idx >= 5 ); |
|---|
| | 439 | QString proto = ui.protocolCombo->itemData( idx_proto ).toString(); |
|---|
| | 440 | |
|---|
| | 441 | ui.timeShift->setEnabled( idx_proto >= UDP_PROTO ); |
|---|
| | 442 | ui.ipv6->setEnabled( idx_proto == UDP_PROTO ); |
|---|
| | 443 | ui.addressText->setEnabled( idx_proto != UDP_PROTO ); |
|---|
| | 444 | ui.portSpin->setEnabled( idx_proto >= UDP_PROTO ); |
|---|
| | 445 | |
|---|
| | 446 | if( idx_proto == NO_PROTO ) return; |
|---|
| 444 | 447 | |
|---|
| 445 | 448 | /* If we already have a protocol in the address, replace it */ |
|---|
| 446 | | if( addr.contains( "://")) { |
|---|
| 447 | | msg_Err( p_intf, "replace"); |
|---|
| 448 | | addr.replace( QRegExp("^.*://"), proto + "://"); |
|---|
| | 449 | if( addr.contains( "://")) |
|---|
| | 450 | { |
|---|
| | 451 | if( idx_proto != UDPM_PROTO ) |
|---|
| | 452 | addr.replace( QRegExp("^.*://@*"), proto + "://"); |
|---|
| | 453 | else |
|---|
| | 454 | addr.replace( QRegExp("^.*://"), proto + "://@"); |
|---|
| 449 | 455 | ui.addressText->setText( addr ); |
|---|
| 450 | 456 | } |
|---|
| … | … | |
| 456 | 462 | QString addr = ui.addressText->text(); |
|---|
| 457 | 463 | addr = QUrl::toPercentEncoding( addr, ":/?#@!$&'()*+,;=" ); |
|---|
| 458 | | int proto = ui.protocolCombo->currentIndex(); |
|---|
| 459 | | |
|---|
| 460 | | if( addr.contains( "://") && ( proto != 5 || proto != 6 ) ) |
|---|
| | 464 | int idx_proto = ui.protocolCombo->currentIndex(); |
|---|
| | 465 | |
|---|
| | 466 | if( addr.contains( "://")) |
|---|
| 461 | 467 | { |
|---|
| 462 | | mrl = addr; |
|---|
| | 468 | /* Match the correct item in the comboBox */ |
|---|
| | 469 | ui.protocolCombo->setCurrentIndex( |
|---|
| | 470 | ui.protocolCombo->findData( addr.section( ':', 0, 0 ) ) ); |
|---|
| | 471 | |
|---|
| | 472 | if( idx_proto != UDP_PROTO || idx_proto != UDPM_PROTO ) |
|---|
| | 473 | mrl = addr; |
|---|
| 463 | 474 | } |
|---|
| 464 | 475 | else |
|---|
| 465 | 476 | { |
|---|
| 466 | | switch( proto ) { |
|---|
| 467 | | case 0: |
|---|
| | 477 | switch( idx_proto ) { |
|---|
| | 478 | case HTTP_PROTO: |
|---|
| 468 | 479 | mrl = "http://" + addr; |
|---|
| 469 | 480 | emit methodChanged("http-caching"); |
|---|
| 470 | 481 | break; |
|---|
| 471 | | case 1: |
|---|
| | 482 | case HTTPS_PROTO: |
|---|
| 472 | 483 | mrl = "https://" + addr; |
|---|
| 473 | 484 | emit methodChanged("http-caching"); |
|---|
| 474 | 485 | break; |
|---|
| 475 | | case 3: |
|---|
| | 486 | case MMS_PROTO: |
|---|
| 476 | 487 | mrl = "mms://" + addr; |
|---|
| 477 | 488 | emit methodChanged("mms-caching"); |
|---|
| 478 | 489 | break; |
|---|
| 479 | | case 2: |
|---|
| | 490 | case FTP_PROTO: |
|---|
| 480 | 491 | mrl = "ftp://" + addr; |
|---|
| 481 | 492 | emit methodChanged("ftp-caching"); |
|---|
| 482 | 493 | break; |
|---|
| 483 | | case 4: /* RTSP */ |
|---|
| | 494 | case RTSP_PROTO: |
|---|
| 484 | 495 | mrl = "rtsp://" + addr; |
|---|
| 485 | 496 | emit methodChanged("rtsp-caching"); |
|---|
| 486 | 497 | break; |
|---|
| 487 | | case 5: |
|---|
| | 498 | case UDP_PROTO: |
|---|
| 488 | 499 | mrl = "udp://@"; |
|---|
| 489 | 500 | if( ui.ipv6->isEnabled() && ui.ipv6->isChecked() ) |
|---|
| … | … | |
| 494 | 505 | emit methodChanged("udp-caching"); |
|---|
| 495 | 506 | break; |
|---|
| 496 | | case 6: /* UDP multicast */ |
|---|
| | 507 | case UDPM_PROTO: /* UDP multicast */ |
|---|
| 497 | 508 | mrl = "udp://@"; |
|---|
| 498 | 509 | /* Add [] to IPv6 */ |
|---|
| r3561b9b |
r16bf241 |
|
| 48 | 48 | #define setSpinBoxFreq( spinbox ){ spinbox->setRange ( 0, INT_MAX ); \ |
|---|
| 49 | 49 | spinbox->setAccelerated( true ); } |
|---|
| | 50 | |
|---|
| | 51 | enum |
|---|
| | 52 | { |
|---|
| | 53 | NO_PROTO, |
|---|
| | 54 | HTTP_PROTO, |
|---|
| | 55 | HTTPS_PROTO, |
|---|
| | 56 | MMS_PROTO, |
|---|
| | 57 | FTP_PROTO, |
|---|
| | 58 | RTSP_PROTO, |
|---|
| | 59 | UDP_PROTO, |
|---|
| | 60 | UDPM_PROTO |
|---|
| | 61 | }; |
|---|
| | 62 | |
|---|
| 50 | 63 | |
|---|
| 51 | 64 | enum |
|---|