Changeset 16bf241c0ef8cb5ad5905817233af703080ed654

Show
Ignore:
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
  • modules/gui/qt4/components/open_panels.cpp

    r8e756ce r16bf241  
    411411 
    412412    /* CONNECTs */ 
    413     CONNECT( ui.protocolCombo, currentIndexChanged( int ), 
     413    CONNECT( ui.protocolCombo, activated( int ), 
    414414             this, updateProtocol( int ) ); 
    415415    CONNECT( ui.portSpin, valueChanged( int ), this, updateMRL() ); 
     
    418418    CONNECT( ui.ipv6, clicked(), this, updateMRL()); 
    419419 
     420    ui.protocolCombo->addItem( "" ); 
    420421    ui.protocolCombo->addItem("HTTP", QVariant("http")); 
    421422    ui.protocolCombo->addItem("HTTPS", QVariant("https")); 
     
    434435 
    435436/* update the widgets according the type of protocol */ 
    436 void NetOpenPanel::updateProtocol( int idx ) { 
     437void NetOpenPanel::updateProtocol( int idx_proto ) { 
    437438    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; 
    444447 
    445448    /* 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 + "://@"); 
    449455        ui.addressText->setText( addr ); 
    450456    } 
     
    456462    QString addr = ui.addressText->text(); 
    457463    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( "://")
    461467    { 
    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; 
    463474    } 
    464475    else 
    465476    { 
    466         switch( proto ) { 
    467         case 0
     477        switch( idx_proto ) { 
     478        case HTTP_PROTO
    468479            mrl = "http://" + addr; 
    469480            emit methodChanged("http-caching"); 
    470481            break; 
    471         case 1
     482        case HTTPS_PROTO
    472483            mrl = "https://" + addr; 
    473484            emit methodChanged("http-caching"); 
    474485            break; 
    475         case 3
     486        case MMS_PROTO
    476487            mrl = "mms://" + addr; 
    477488            emit methodChanged("mms-caching"); 
    478489            break; 
    479         case 2
     490        case FTP_PROTO
    480491            mrl = "ftp://" + addr; 
    481492            emit methodChanged("ftp-caching"); 
    482493            break; 
    483         case 4: /* RTSP */ 
     494        case RTSP_PROTO: 
    484495            mrl = "rtsp://" + addr; 
    485496            emit methodChanged("rtsp-caching"); 
    486497            break; 
    487         case 5
     498        case UDP_PROTO
    488499            mrl = "udp://@"; 
    489500            if( ui.ipv6->isEnabled() && ui.ipv6->isChecked() ) 
     
    494505            emit methodChanged("udp-caching"); 
    495506            break; 
    496         case 6: /* UDP multicast */ 
     507        case UDPM_PROTO: /* UDP multicast */ 
    497508            mrl = "udp://@"; 
    498509            /* Add [] to IPv6 */ 
  • modules/gui/qt4/components/open_panels.hpp

    r3561b9b r16bf241  
    4848#define setSpinBoxFreq( spinbox ){ spinbox->setRange ( 0, INT_MAX ); \ 
    4949    spinbox->setAccelerated( true ); } 
     50 
     51enum 
     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 
    5063 
    5164enum