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.
OpenDialog *OpenDialog::instance = NULL;
-OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal ) :
- QVLCDialog( parent, _p_intf )
+OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal,
+ bool _stream_after ) : QVLCDialog( parent, _p_intf )
{
setModal( modal );
+ b_stream_after = _stream_after;
+
ui.setupUi( this );
setWindowTitle( qtr("Open" ) );
resize( 500, 300);
ui.Tab->addTab( captureOpenPanel, qtr( "Capture &Device" ) );
ui.advancedFrame->hide();
-
QMenu * openButtonMenu = new QMenu( "Open" );
- openButtonMenu->addAction( qtr("&Enqueue"), this, SLOT( enqueue() ),
- QKeySequence( "Alt+E") );
- openButtonMenu->addAction( qtr("&Stream"), this, SLOT( stream() ) ,
- QKeySequence( "Alt+T" ) );
- ui.playButton->setMenu( openButtonMenu );
/* Force MRL update on tab change */
CONNECT( ui.Tab, currentChanged(int), this, signalCurrent());
CONNECT( captureOpenPanel, mrlUpdated( QString ), this,
updateMRL(QString) );
-
CONNECT( fileOpenPanel, methodChanged( QString ),
this, newMethod(QString) );
CONNECT( netOpenPanel, methodChanged( QString ),
CONNECT( ui.slaveText, textChanged(QString), this, updateMRL());
CONNECT( ui.cacheSpinBox, valueChanged(int), this, updateMRL());
+ openButtonMenu->addAction( qtr("&Enqueue"), this, SLOT( enqueue() ),
+ QKeySequence( "Alt+E") );
+ openButtonMenu->addAction( qtr("&Play"), this, SLOT( play() ),
+ QKeySequence( "Alt+P" ) );
+ openButtonMenu->addAction( qtr("&Stream"), this, SLOT( stream() ) ,
+ QKeySequence( "Alt+S" ) );
+
+ ui.playButton->setMenu( openButtonMenu );
+
BUTTONACT( ui.playButton, play());
+
+ if ( b_stream_after ) setAfter();
+
BUTTONACT( ui.cancelButton, cancel());
BUTTONACT( ui.advancedCheckBox , toggleAdvancedPanel() );
{
}
+void OpenDialog::setAfter()
+{
+ if (!b_stream_after )
+ {
+ ui.playButton->setText( qtr("&Play") );
+ BUTTONACT( ui.playButton, play() );
+ }
+ else
+ {
+ ui.playButton->setText( qtr("&Stream") );
+ BUTTONACT( ui.playButton, stream() );
+ }
+}
+
void OpenDialog::showTab(int i_tab=0)
{
this->show();
}
}
+/* Actions */
+
+/* If Cancel is pressed or escaped */
void OpenDialog::cancel()
{
fileOpenPanel->clear();
reject();
}
-void OpenDialog::close()
+/* If EnterKey is pressed */
+void OpenDialog::close()
{
- play();
+ if ( !b_stream_after )
+ {
+ play();
+ }
+ else
+ {
+ stream();
+ }
}
+
+/* Play button */
void OpenDialog::play()
{
playOrEnqueue( false );
playOrEnqueue( true );
}
+void OpenDialog::stream()
+{
+ /* not finished FIXME */
+ THEDP->streamingDialog( mrl );
+}
+
+
void OpenDialog::playOrEnqueue( bool b_enqueue = false )
{
this->toggleVisible();
accept();
}
-void OpenDialog::stream()
-{
-//TODO. Policy not yet defined
-}
-
void OpenDialog::toggleAdvancedPanel()
{
//FIXME does not work under Windows
{
Q_OBJECT;
public:
- static OpenDialog * getInstance( QWidget *parent, intf_thread_t *p_intf )
+ static OpenDialog * getInstance( QWidget *parent, intf_thread_t *p_intf,
+ bool _stream_after = false )
{
if( !instance)
- instance = new OpenDialog( parent, p_intf, false );
+ instance = new OpenDialog( parent, p_intf, false, _stream_after );
+ else
+ {
+ instance->b_stream_after = _stream_after;
+ instance->setAfter();
+ }
return instance;
}
- OpenDialog( QWidget *parent, intf_thread_t *, bool modal );
+ OpenDialog( QWidget *parent, intf_thread_t *, bool modal,
+ bool stream_after = false);
virtual ~OpenDialog();
void showTab( int );
QString mrl;
QString mainMRL;
+
public slots:
void play();
void stream();
+ void enqueue();
private:
static OpenDialog *instance;
input_thread_t *p_input;
- QString mrlSub;
Ui::Open ui;
FileOpenPanel *fileOpenPanel;
CaptureOpenPanel *captureOpenPanel;
QString storedMethod;
+ QString mrlSub;
int advHeight, mainHeight;
+ bool b_stream_after;
+ QStringList SeparateEntries( QString );
void playOrEnqueue( bool );
- QStringList SeparateEntries( QString );
+
private slots:
+ void setAfter();
void cancel();
void close();
- void enqueue();
void toggleAdvancedPanel();
void updateMRL( QString );
void updateMRL();
* Sout emulation
****************************************************************************/
+void DialogsProvider::streamingDialog( QString mrl)
+{
+ SoutDialog *s = new SoutDialog( p_intf->p_sys->p_mi, p_intf );
+ if( s->exec() == QDialog::Accepted )
+ {
+ msg_Err(p_intf, "mrl %s\n", qta(s->mrl));
+ /* Just do it */
+ int i_len = strlen( qtu(s->mrl) ) + 10;
+ char *psz_option = (char*)malloc(i_len);
+ snprintf( psz_option, i_len - 1, ":sout=%s", qtu(s->mrl));
+
+ playlist_AddExt( THEPL, qtu( mrl ), "Streaming",
+ PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END,
+ -1, &psz_option, 1, VLC_TRUE, VLC_FALSE );
+ }
+ delete s;
+}
+
+void DialogsProvider::openThenStreamingDialogs()
+{
+ OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf, true )->showTab( 0 );
+}
+/*
void DialogsProvider::streamingDialog()
{
OpenDialog *o = new OpenDialog( p_intf->p_sys->p_mi, p_intf, true );
if( s->exec() == QDialog::Accepted )
{
msg_Err(p_intf, "mrl %s\n", qta(s->mrl));
- /* Just do it */
+ /* Just do it
int i_len = strlen( qtu(s->mrl) ) + 10;
char *psz_option = (char*)malloc(i_len);
snprintf( psz_option, i_len - 1, ":sout=%s", qtu(s->mrl));
delete s;
}
delete o;
-}
+}*/
+
+
/****************************************************************************
* Menus / Interaction
void menuAction( QObject *);
void menuUpdateAction( QObject *);
void SDMenuAction( QString );
- void streamingDialog();
+ void streamingDialog( QString mrl = "");
+ void openThenStreamingDialogs();
void openPlaylist();
void savePlaylist();
void PLAppendDir();
DP_SADD( qtr("Open &Capture Device..." ), "", "", openCaptureDialog(),
"Ctrl+C" );
menu->addSeparator();
- DP_SADD( qtr("&Streaming..."), "", "", streamingDialog(), "Ctrl+S" );
+ DP_SADD( qtr("&Streaming..."), "", "", openThenStreamingDialogs(), "Ctrl+S" );
menu->addSeparator();
DP_SADD( qtr("&Quit") , "", "", quit(), "Ctrl+Q");
return menu;
<item>
<widget class="QCheckBox" name="advancedCheckBox" >
<property name="text" >
- <string>&Show more options</string>
+ <string>Show &more options</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<widget class="QCheckBox" name="subCheckBox" >
<property name="text" >
- <string>Use a subtitles file</string>
+ <string>Use a sub&titles file</string>
</property>
</widget>
</item>
</size>
</property>
<property name="currentIndex" >
- <number>0</number>
+ <number>-1</number>
</property>
<property name="insertPolicy" >
<enum>QComboBox::NoInsert</enum>