Changeset 3e3cfc168c553360607663517e82bfa3d2a85b76

Show
Ignore:
Timestamp:
04/05/07 03:13:05 (1 year ago)
Author:
Jean-Baptiste Kempf <jb@videolan.org>
git-committer:
Jean-Baptiste Kempf <jb@videolan.org> 1175735585 +0000
git-parent:

[a1f000698c2c5210a40a913133bcb45cdc72a442]

git-author:
Jean-Baptiste Kempf <jb@videolan.org> 1175735585 +0000
Message:

Qt4 - Open and Streaming Dialogs.
This commit should show the correct dialogs in the correct order. It keeps the previous behaviour of the "Streaming" from the "Media" menu.
/!\ The intelligence is surely not accurate and stream() may need to be redirected to playOrEnqueue as open() and enqueue() do in order to be correctly parsed before... Need a bit more knowledge on playlist to be sure.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/gui/qt4/dialogs/open.cpp

    r2d1e22b r3e3cfc1  
    3838OpenDialog *OpenDialog::instance = NULL; 
    3939 
    40 OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal ) : 
    41                                                 QVLCDialog( parent, _p_intf ) 
     40OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal, 
     41                        bool _stream_after ) :  QVLCDialog( parent, _p_intf ) 
    4242{ 
    4343    setModal( modal ); 
     44    b_stream_after = _stream_after; 
     45 
    4446    ui.setupUi( this ); 
    4547    setWindowTitle( qtr("Open" ) ); 
     
    5759 
    5860    ui.advancedFrame->hide(); 
    59  
    6061    QMenu * openButtonMenu = new QMenu( "Open" ); 
    61     openButtonMenu->addAction( qtr("&Enqueue"), this, SLOT( enqueue() ), 
    62                                 QKeySequence( "Alt+E") ); 
    63     openButtonMenu->addAction( qtr("&Stream"), this, SLOT( stream() ) , 
    64                                 QKeySequence( "Alt+T" ) ); 
    65  
    66     ui.playButton->setMenu( openButtonMenu ); 
     62 
    6763    /* Force MRL update on tab change */ 
    6864    CONNECT( ui.Tab, currentChanged(int), this, signalCurrent()); 
     
    7369    CONNECT( captureOpenPanel, mrlUpdated( QString ), this, 
    7470            updateMRL(QString) ); 
    75  
    7671 
    7772    CONNECT( fileOpenPanel, methodChanged( QString ), 
     
    8580    CONNECT( ui.cacheSpinBox, valueChanged(int), this, updateMRL()); 
    8681 
     82    openButtonMenu->addAction( qtr("&Enqueue"), this, SLOT( enqueue() ), 
     83                                    QKeySequence( "Alt+E") ); 
     84    openButtonMenu->addAction( qtr("&Play"), this, SLOT( play() ), 
     85                                    QKeySequence( "Alt+P" ) ); 
     86    openButtonMenu->addAction( qtr("&Stream"), this, SLOT( stream() ) , 
     87                                    QKeySequence( "Alt+S" ) ); 
     88 
     89    ui.playButton->setMenu( openButtonMenu ); 
     90 
    8791    BUTTONACT( ui.playButton, play()); 
     92 
     93    if ( b_stream_after ) setAfter(); 
     94 
    8895    BUTTONACT( ui.cancelButton, cancel()); 
    8996    BUTTONACT( ui.advancedCheckBox , toggleAdvancedPanel() ); 
     
    100107} 
    101108 
     109void OpenDialog::setAfter() 
     110{ 
     111    if (!b_stream_after ) 
     112    { 
     113        ui.playButton->setText( qtr("&Play") ); 
     114        BUTTONACT( ui.playButton, play() ); 
     115    } 
     116    else 
     117    { 
     118        ui.playButton->setText( qtr("&Stream") ); 
     119        BUTTONACT( ui.playButton, stream() ); 
     120    } 
     121} 
     122 
    102123void OpenDialog::showTab(int i_tab=0) 
    103124{ 
     
    112133} 
    113134 
     135/* Actions */ 
     136 
     137/* If Cancel is pressed or escaped */ 
    114138void OpenDialog::cancel() 
    115139{ 
     
    120144} 
    121145 
    122 void OpenDialog::close()  
    123 
    124     play(); 
    125 
     146/* If EnterKey is pressed */ 
     147void OpenDialog::close() 
     148
     149    if ( !b_stream_after ) 
     150    { 
     151        play(); 
     152    } 
     153    else 
     154    { 
     155        stream(); 
     156    } 
     157
     158 
     159/* Play button */ 
    126160void OpenDialog::play() 
    127161{ 
     
    133167    playOrEnqueue( true ); 
    134168} 
     169 
     170void OpenDialog::stream() 
     171{ 
     172    /* not finished FIXME */ 
     173    THEDP->streamingDialog( mrl ); 
     174} 
     175 
    135176 
    136177void OpenDialog::playOrEnqueue( bool b_enqueue = false ) 
     
    176217} 
    177218 
    178 void OpenDialog::stream() 
    179 { 
    180 //TODO. Policy not yet defined 
    181 } 
    182  
    183219void OpenDialog::toggleAdvancedPanel() 
    184220{ 
  • modules/gui/qt4/dialogs/open.hpp

    r1580eed r3e3cfc1  
    3939    Q_OBJECT; 
    4040public: 
    41     static OpenDialog * getInstance( QWidget *parent, intf_thread_t *p_intf ) 
     41    static OpenDialog * getInstance( QWidget *parent, intf_thread_t *p_intf, 
     42                                        bool _stream_after = false ) 
    4243    { 
    4344        if( !instance) 
    44             instance = new OpenDialog( parent, p_intf, false ); 
     45            instance = new OpenDialog( parent, p_intf, false, _stream_after ); 
     46        else 
     47        { 
     48            instance->b_stream_after = _stream_after; 
     49            instance->setAfter(); 
     50        } 
    4551        return instance; 
    4652    } 
    47     OpenDialog( QWidget *parent, intf_thread_t *, bool modal ); 
     53    OpenDialog( QWidget *parent, intf_thread_t *, bool modal,  
     54            bool stream_after = false); 
    4855    virtual ~OpenDialog(); 
    4956 
     
    5259    QString mrl; 
    5360    QString mainMRL; 
     61 
    5462public slots: 
    5563    void play(); 
    5664    void stream(); 
     65    void enqueue(); 
    5766private: 
    5867    static OpenDialog *instance; 
    5968    input_thread_t *p_input; 
    60     QString mrlSub; 
    6169 
    6270    Ui::Open ui; 
     
    6775 
    6876    QString storedMethod; 
     77    QString mrlSub; 
    6978    int advHeight, mainHeight; 
     79    bool b_stream_after; 
     80    QStringList SeparateEntries( QString ); 
    7081 
    7182    void playOrEnqueue( bool ); 
    72     QStringList SeparateEntries( QString ); 
     83 
    7384private slots: 
     85    void setAfter(); 
    7486    void cancel(); 
    7587    void close(); 
    76     void enqueue(); 
    7788    void toggleAdvancedPanel(); 
    7889    void updateMRL( QString ); 
  • modules/gui/qt4/dialogs_provider.cpp

    r46ad186 r3e3cfc1  
    347347 ****************************************************************************/ 
    348348 
     349void DialogsProvider::streamingDialog( QString mrl) 
     350{ 
     351    SoutDialog *s = new SoutDialog( p_intf->p_sys->p_mi, p_intf ); 
     352    if( s->exec() == QDialog::Accepted ) 
     353    { 
     354        msg_Err(p_intf, "mrl %s\n", qta(s->mrl)); 
     355        /* Just do it */ 
     356        int i_len = strlen( qtu(s->mrl) ) + 10; 
     357        char *psz_option = (char*)malloc(i_len); 
     358        snprintf( psz_option, i_len - 1, ":sout=%s", qtu(s->mrl)); 
     359 
     360        playlist_AddExt( THEPL, qtu( mrl ), "Streaming", 
     361                         PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END, 
     362                        -1, &psz_option, 1, VLC_TRUE, VLC_FALSE ); 
     363    } 
     364    delete s; 
     365} 
     366 
     367void DialogsProvider::openThenStreamingDialogs() 
     368{ 
     369    OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf, true )->showTab( 0 ); 
     370} 
     371/* 
    349372void DialogsProvider::streamingDialog() 
    350373{ 
     
    356379        { 
    357380            msg_Err(p_intf, "mrl %s\n", qta(s->mrl)); 
    358             /* Just do it */ 
     381            /* Just do it  
    359382            int i_len = strlen( qtu(s->mrl) ) + 10; 
    360383            char *psz_option = (char*)malloc(i_len); 
     
    368391    } 
    369392    delete o; 
    370 
     393}*/ 
     394 
     395 
    371396 
    372397/**************************************************************************** 
  • modules/gui/qt4/dialogs_provider.hpp

    rbe0f709 r3e3cfc1  
    138138    void menuUpdateAction( QObject *); 
    139139    void SDMenuAction( QString ); 
    140     void streamingDialog(); 
     140    void streamingDialog( QString mrl = ""); 
     141    void openThenStreamingDialogs(); 
    141142    void openPlaylist(); 
    142143    void savePlaylist(); 
  • modules/gui/qt4/menus.cpp

    r7dcb37a r3e3cfc1  
    203203            "Ctrl+C" ); 
    204204    menu->addSeparator(); 
    205     DP_SADD( qtr("&Streaming..."), "", "", streamingDialog(), "Ctrl+S" ); 
     205    DP_SADD( qtr("&Streaming..."), "", "", openThenStreamingDialogs(), "Ctrl+S" ); 
    206206    menu->addSeparator(); 
    207207    DP_SADD( qtr("&Quit") , "", "", quit(), "Ctrl+Q"); 
  • modules/gui/qt4/ui/open.ui

    ref3ddcb r3e3cfc1  
    3434    <widget class="QCheckBox" name="advancedCheckBox" > 
    3535     <property name="text" > 
    36       <string>&amp;Show more options</string> 
     36      <string>Show &amp;more options</string> 
    3737     </property> 
    3838    </widget> 
  • modules/gui/qt4/ui/open_file.ui

    r90cf677 r3e3cfc1  
    9595    <widget class="QCheckBox" name="subCheckBox" > 
    9696     <property name="text" > 
    97       <string>Use a subtitles file</string> 
     97      <string>Use a sub&amp;titles file</string> 
    9898     </property> 
    9999    </widget> 
     
    154154        </property> 
    155155        <property name="currentIndex" > 
    156          <number>0</number> 
     156         <number>-1</number> 
    157157        </property> 
    158158        <property name="insertPolicy" >