Changeset 3e3cfc168c553360607663517e82bfa3d2a85b76
- 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
| r2d1e22b |
r3e3cfc1 |
|
| 38 | 38 | OpenDialog *OpenDialog::instance = NULL; |
|---|
| 39 | 39 | |
|---|
| 40 | | OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal ) : |
|---|
| 41 | | QVLCDialog( parent, _p_intf ) |
|---|
| | 40 | OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal, |
|---|
| | 41 | bool _stream_after ) : QVLCDialog( parent, _p_intf ) |
|---|
| 42 | 42 | { |
|---|
| 43 | 43 | setModal( modal ); |
|---|
| | 44 | b_stream_after = _stream_after; |
|---|
| | 45 | |
|---|
| 44 | 46 | ui.setupUi( this ); |
|---|
| 45 | 47 | setWindowTitle( qtr("Open" ) ); |
|---|
| … | … | |
| 57 | 59 | |
|---|
| 58 | 60 | ui.advancedFrame->hide(); |
|---|
| 59 | | |
|---|
| 60 | 61 | 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 | |
|---|
| 67 | 63 | /* Force MRL update on tab change */ |
|---|
| 68 | 64 | CONNECT( ui.Tab, currentChanged(int), this, signalCurrent()); |
|---|
| … | … | |
| 73 | 69 | CONNECT( captureOpenPanel, mrlUpdated( QString ), this, |
|---|
| 74 | 70 | updateMRL(QString) ); |
|---|
| 75 | | |
|---|
| 76 | 71 | |
|---|
| 77 | 72 | CONNECT( fileOpenPanel, methodChanged( QString ), |
|---|
| … | … | |
| 85 | 80 | CONNECT( ui.cacheSpinBox, valueChanged(int), this, updateMRL()); |
|---|
| 86 | 81 | |
|---|
| | 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 | |
|---|
| 87 | 91 | BUTTONACT( ui.playButton, play()); |
|---|
| | 92 | |
|---|
| | 93 | if ( b_stream_after ) setAfter(); |
|---|
| | 94 | |
|---|
| 88 | 95 | BUTTONACT( ui.cancelButton, cancel()); |
|---|
| 89 | 96 | BUTTONACT( ui.advancedCheckBox , toggleAdvancedPanel() ); |
|---|
| … | … | |
| 100 | 107 | } |
|---|
| 101 | 108 | |
|---|
| | 109 | void 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 | |
|---|
| 102 | 123 | void OpenDialog::showTab(int i_tab=0) |
|---|
| 103 | 124 | { |
|---|
| … | … | |
| 112 | 133 | } |
|---|
| 113 | 134 | |
|---|
| | 135 | /* Actions */ |
|---|
| | 136 | |
|---|
| | 137 | /* If Cancel is pressed or escaped */ |
|---|
| 114 | 138 | void OpenDialog::cancel() |
|---|
| 115 | 139 | { |
|---|
| … | … | |
| 120 | 144 | } |
|---|
| 121 | 145 | |
|---|
| 122 | | void OpenDialog::close() |
|---|
| 123 | | { |
|---|
| 124 | | play(); |
|---|
| 125 | | } |
|---|
| | 146 | /* If EnterKey is pressed */ |
|---|
| | 147 | void OpenDialog::close() |
|---|
| | 148 | { |
|---|
| | 149 | if ( !b_stream_after ) |
|---|
| | 150 | { |
|---|
| | 151 | play(); |
|---|
| | 152 | } |
|---|
| | 153 | else |
|---|
| | 154 | { |
|---|
| | 155 | stream(); |
|---|
| | 156 | } |
|---|
| | 157 | } |
|---|
| | 158 | |
|---|
| | 159 | /* Play button */ |
|---|
| 126 | 160 | void OpenDialog::play() |
|---|
| 127 | 161 | { |
|---|
| … | … | |
| 133 | 167 | playOrEnqueue( true ); |
|---|
| 134 | 168 | } |
|---|
| | 169 | |
|---|
| | 170 | void OpenDialog::stream() |
|---|
| | 171 | { |
|---|
| | 172 | /* not finished FIXME */ |
|---|
| | 173 | THEDP->streamingDialog( mrl ); |
|---|
| | 174 | } |
|---|
| | 175 | |
|---|
| 135 | 176 | |
|---|
| 136 | 177 | void OpenDialog::playOrEnqueue( bool b_enqueue = false ) |
|---|
| … | … | |
| 176 | 217 | } |
|---|
| 177 | 218 | |
|---|
| 178 | | void OpenDialog::stream() |
|---|
| 179 | | { |
|---|
| 180 | | //TODO. Policy not yet defined |
|---|
| 181 | | } |
|---|
| 182 | | |
|---|
| 183 | 219 | void OpenDialog::toggleAdvancedPanel() |
|---|
| 184 | 220 | { |
|---|
| r1580eed |
r3e3cfc1 |
|
| 39 | 39 | Q_OBJECT; |
|---|
| 40 | 40 | public: |
|---|
| 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 ) |
|---|
| 42 | 43 | { |
|---|
| 43 | 44 | 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 | } |
|---|
| 45 | 51 | return instance; |
|---|
| 46 | 52 | } |
|---|
| 47 | | OpenDialog( QWidget *parent, intf_thread_t *, bool modal ); |
|---|
| | 53 | OpenDialog( QWidget *parent, intf_thread_t *, bool modal, |
|---|
| | 54 | bool stream_after = false); |
|---|
| 48 | 55 | virtual ~OpenDialog(); |
|---|
| 49 | 56 | |
|---|
| … | … | |
| 52 | 59 | QString mrl; |
|---|
| 53 | 60 | QString mainMRL; |
|---|
| | 61 | |
|---|
| 54 | 62 | public slots: |
|---|
| 55 | 63 | void play(); |
|---|
| 56 | 64 | void stream(); |
|---|
| | 65 | void enqueue(); |
|---|
| 57 | 66 | private: |
|---|
| 58 | 67 | static OpenDialog *instance; |
|---|
| 59 | 68 | input_thread_t *p_input; |
|---|
| 60 | | QString mrlSub; |
|---|
| 61 | 69 | |
|---|
| 62 | 70 | Ui::Open ui; |
|---|
| … | … | |
| 67 | 75 | |
|---|
| 68 | 76 | QString storedMethod; |
|---|
| | 77 | QString mrlSub; |
|---|
| 69 | 78 | int advHeight, mainHeight; |
|---|
| | 79 | bool b_stream_after; |
|---|
| | 80 | QStringList SeparateEntries( QString ); |
|---|
| 70 | 81 | |
|---|
| 71 | 82 | void playOrEnqueue( bool ); |
|---|
| 72 | | QStringList SeparateEntries( QString ); |
|---|
| | 83 | |
|---|
| 73 | 84 | private slots: |
|---|
| | 85 | void setAfter(); |
|---|
| 74 | 86 | void cancel(); |
|---|
| 75 | 87 | void close(); |
|---|
| 76 | | void enqueue(); |
|---|
| 77 | 88 | void toggleAdvancedPanel(); |
|---|
| 78 | 89 | void updateMRL( QString ); |
|---|
| r46ad186 |
r3e3cfc1 |
|
| 347 | 347 | ****************************************************************************/ |
|---|
| 348 | 348 | |
|---|
| | 349 | void 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 | |
|---|
| | 367 | void DialogsProvider::openThenStreamingDialogs() |
|---|
| | 368 | { |
|---|
| | 369 | OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf, true )->showTab( 0 ); |
|---|
| | 370 | } |
|---|
| | 371 | /* |
|---|
| 349 | 372 | void DialogsProvider::streamingDialog() |
|---|
| 350 | 373 | { |
|---|
| … | … | |
| 356 | 379 | { |
|---|
| 357 | 380 | msg_Err(p_intf, "mrl %s\n", qta(s->mrl)); |
|---|
| 358 | | /* Just do it */ |
|---|
| | 381 | /* Just do it |
|---|
| 359 | 382 | int i_len = strlen( qtu(s->mrl) ) + 10; |
|---|
| 360 | 383 | char *psz_option = (char*)malloc(i_len); |
|---|
| … | … | |
| 368 | 391 | } |
|---|
| 369 | 392 | delete o; |
|---|
| 370 | | } |
|---|
| | 393 | }*/ |
|---|
| | 394 | |
|---|
| | 395 | |
|---|
| 371 | 396 | |
|---|
| 372 | 397 | /**************************************************************************** |
|---|
| rbe0f709 |
r3e3cfc1 |
|
| 138 | 138 | void menuUpdateAction( QObject *); |
|---|
| 139 | 139 | void SDMenuAction( QString ); |
|---|
| 140 | | void streamingDialog(); |
|---|
| | 140 | void streamingDialog( QString mrl = ""); |
|---|
| | 141 | void openThenStreamingDialogs(); |
|---|
| 141 | 142 | void openPlaylist(); |
|---|
| 142 | 143 | void savePlaylist(); |
|---|
| r7dcb37a |
r3e3cfc1 |
|
| 203 | 203 | "Ctrl+C" ); |
|---|
| 204 | 204 | menu->addSeparator(); |
|---|
| 205 | | DP_SADD( qtr("&Streaming..."), "", "", streamingDialog(), "Ctrl+S" ); |
|---|
| | 205 | DP_SADD( qtr("&Streaming..."), "", "", openThenStreamingDialogs(), "Ctrl+S" ); |
|---|
| 206 | 206 | menu->addSeparator(); |
|---|
| 207 | 207 | DP_SADD( qtr("&Quit") , "", "", quit(), "Ctrl+Q"); |
|---|
| ref3ddcb |
r3e3cfc1 |
|
| 34 | 34 | <widget class="QCheckBox" name="advancedCheckBox" > |
|---|
| 35 | 35 | <property name="text" > |
|---|
| 36 | | <string>&Show more options</string> |
|---|
| | 36 | <string>Show &more options</string> |
|---|
| 37 | 37 | </property> |
|---|
| 38 | 38 | </widget> |
|---|
| r90cf677 |
r3e3cfc1 |
|
| 95 | 95 | <widget class="QCheckBox" name="subCheckBox" > |
|---|
| 96 | 96 | <property name="text" > |
|---|
| 97 | | <string>Use a subtitles file</string> |
|---|
| | 97 | <string>Use a sub&titles file</string> |
|---|
| 98 | 98 | </property> |
|---|
| 99 | 99 | </widget> |
|---|
| … | … | |
| 154 | 154 | </property> |
|---|
| 155 | 155 | <property name="currentIndex" > |
|---|
| 156 | | <number>0</number> |
|---|
| | 156 | <number>-1</number> |
|---|
| 157 | 157 | </property> |
|---|
| 158 | 158 | <property name="insertPolicy" > |
|---|