Commit f9ff5b64 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - Use a main instance of Sout for VLM. Clean DP since all dialogs (except...

Qt4 - Use a main instance of Sout for VLM. Clean DP since all dialogs (except Bookmarks that won't be done...) are done.
parent 890b8c21
...@@ -339,7 +339,7 @@ void OpenDialog::stream( bool b_transcode_only ) ...@@ -339,7 +339,7 @@ void OpenDialog::stream( bool b_transcode_only )
{ {
mrl = ui.advancedLineInput->text(); mrl = ui.advancedLineInput->text();
toggleVisible(); toggleVisible();
THEDP->streamingDialog( mrl, b_transcode_only ); THEDP->streamingDialog( this, mrl, b_transcode_only );
} }
/* Update the MRL */ /* Update the MRL */
......
/***************************************************************************** /*****************************************************************************
* sout.cpp : Stream output dialog ( old-style ) * sout.cpp : Stream output dialog ( old-style )
**************************************************************************** ****************************************************************************
* Copyright ( C ) 2006 the VideoLAN team * Copyright (C) 2006 the VideoLAN team
* Copyright (C) 2007 Société des arts technologiques * Copyright (C) 2007 Société des arts technologiques
* Copyright (C) 2007 Savoir-faire Linux * Copyright (C) 2007 Savoir-faire Linux
* *
...@@ -135,11 +135,6 @@ SoutDialog::SoutDialog( QWidget *parent, intf_thread_t *_p_intf, ...@@ -135,11 +135,6 @@ SoutDialog::SoutDialog( QWidget *parent, intf_thread_t *_p_intf,
if( b_transcode_only ) toggleSout(); if( b_transcode_only ) toggleSout();
} }
QString SoutDialog::getMrl()
{
return mrl;
}
void SoutDialog::fileBrowse() void SoutDialog::fileBrowse()
{ {
ui.tabWidget->setTabEnabled( 0,false ); ui.tabWidget->setTabEnabled( 0,false );
......
...@@ -39,13 +39,33 @@ class SoutDialog : public QVLCDialog ...@@ -39,13 +39,33 @@ class SoutDialog : public QVLCDialog
{ {
Q_OBJECT; Q_OBJECT;
public: public:
static SoutDialog * getInstance( QWidget *parent,
intf_thread_t *p_intf,
bool transcode_only )
{
if( !instance )
instance = new SoutDialog( parent, p_intf, transcode_only );
else
{
instance->setParent( parent );
if( transcode_only != instance->b_transcode_only )
{
instance->toggleSout();
instance->b_transcode_only = transcode_only;
}
}
return instance;
};
virtual ~SoutDialog();
QString getMrl(){ return mrl; }
private:
SoutDialog( QWidget* parent, intf_thread_t *, SoutDialog( QWidget* parent, intf_thread_t *,
bool _transcode_only = false ); bool _transcode_only = false );
virtual ~SoutDialog() {} static SoutDialog *instance;
QString getMrl();
//sout_gui_descr_t *sout;
private:
Ui::Sout ui; Ui::Sout ui;
QPushButton *okButton; QPushButton *okButton;
QString mrl; QString mrl;
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "dialogs/vlm.hpp" #include "dialogs/vlm.hpp"
#include "dialogs/open.hpp" #include "dialogs/open.hpp"
#include "dialogs/sout.hpp"
#include <QString> #include <QString>
#include <QComboBox> #include <QComboBox>
...@@ -138,6 +139,7 @@ VLMDialog::VLMDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf ) ...@@ -138,6 +139,7 @@ VLMDialog::VLMDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
BUTTONACT( ui.clearButton, clearWidgets() ); BUTTONACT( ui.clearButton, clearWidgets() );
BUTTONACT( ui.saveButton, saveModifications() ); BUTTONACT( ui.saveButton, saveModifications() );
BUTTONACT( ui.inputButton, selectInput() ); BUTTONACT( ui.inputButton, selectInput() );
BUTTONACT( ui.outputButton, selectOutput() );
} }
VLMDialog::~VLMDialog() VLMDialog::~VLMDialog()
...@@ -248,6 +250,13 @@ void VLMDialog::selectInput() ...@@ -248,6 +250,13 @@ void VLMDialog::selectInput()
ui.inputLedit->setText( o->getMRL() ); ui.inputLedit->setText( o->getMRL() );
} }
void VLMDialog::selectOutput()
{
SoutDialog *s = SoutDialog::getInstance( this, p_intf, false );
if( s->exec() == QDialog::Accepted )
ui.outputLedit->setText( s->getMrl() );
}
/* Object Modification */ /* Object Modification */
void VLMDialog::removeVLMItem( VLMAWidget *vlmObj ) void VLMDialog::removeVLMItem( VLMAWidget *vlmObj )
{ {
......
...@@ -100,6 +100,7 @@ private slots: ...@@ -100,6 +100,7 @@ private slots:
void showScheduleWidget( int ); void showScheduleWidget( int );
void selectVLMItem( int ); void selectVLMItem( int );
void selectInput(); void selectInput();
void selectOutput();
}; };
class VLMWrapper class VLMWrapper
......
...@@ -133,6 +133,7 @@ void DialogsProvider::customEvent( QEvent *event ) ...@@ -133,6 +133,7 @@ void DialogsProvider::customEvent( QEvent *event )
updateDialog(); break; updateDialog(); break;
#endif #endif
case INTF_DIALOG_EXIT: case INTF_DIALOG_EXIT:
quit(); break;
default: default:
msg_Warn( p_intf, "unimplemented dialog" ); msg_Warn( p_intf, "unimplemented dialog" );
} }
...@@ -414,10 +415,11 @@ void DialogsProvider::saveAPlaylist() ...@@ -414,10 +415,11 @@ void DialogsProvider::saveAPlaylist()
* Sout emulation * Sout emulation
****************************************************************************/ ****************************************************************************/
void DialogsProvider::streamingDialog( QString mrl, bool b_transcode_only ) void DialogsProvider::streamingDialog( QWidget *parent, QString mrl,
bool b_transcode_only )
{ {
SoutDialog *s = new SoutDialog( p_intf->p_sys->p_mi, p_intf, SoutDialog *s = SoutDialog::getInstance( parent, p_intf, b_transcode_only );
b_transcode_only );
if( s->exec() == QDialog::Accepted ) if( s->exec() == QDialog::Accepted )
{ {
msg_Err( p_intf, "Sout mrl %s", qta( s->getMrl() ) ); msg_Err( p_intf, "Sout mrl %s", qta( s->getMrl() ) );
...@@ -430,7 +432,6 @@ void DialogsProvider::streamingDialog( QString mrl, bool b_transcode_only ) ...@@ -430,7 +432,6 @@ void DialogsProvider::streamingDialog( QString mrl, bool b_transcode_only )
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END, PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END,
-1, &psz_option, 1, VLC_TRUE, VLC_FALSE ); -1, &psz_option, 1, VLC_TRUE, VLC_FALSE );
} }
delete s;
} }
void DialogsProvider::openThenStreamingDialogs() void DialogsProvider::openThenStreamingDialogs()
...@@ -444,29 +445,6 @@ void DialogsProvider::openThenTranscodingDialogs() ...@@ -444,29 +445,6 @@ void DialogsProvider::openThenTranscodingDialogs()
OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf, OPEN_AND_SAVE ) OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf, OPEN_AND_SAVE )
->showTab( 0 ); ->showTab( 0 );
} }
/*
void DialogsProvider::streamingDialog()
{
OpenDialog *o = new OpenDialog( p_intf->p_sys->p_mi, p_intf, true );
if ( o->exec() == QDialog::Accepted )
{
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( o->mrl ), "Streaming",
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END,
-1, &psz_option, 1, VLC_TRUE, VLC_FALSE );
}
delete s;
}
delete o;
}*/
/**************************************************************************** /****************************************************************************
......
...@@ -95,6 +95,8 @@ class QVLCMenu; ...@@ -95,6 +95,8 @@ class QVLCMenu;
class DialogsProvider : public QObject class DialogsProvider : public QObject
{ {
Q_OBJECT; Q_OBJECT;
friend class QVLCMenu;
public: public:
static DialogsProvider *getInstance() static DialogsProvider *getInstance()
{ {
...@@ -121,11 +123,11 @@ public: ...@@ -121,11 +123,11 @@ public:
EXT_FILTER_PLAYLIST, EXT_FILTER_PLAYLIST,
QString path = QString() ); QString path = QString() );
protected: protected:
friend class QVLCMenu;
QSignalMapper *menusMapper; QSignalMapper *menusMapper;
QSignalMapper *menusUpdateMapper; QSignalMapper *menusUpdateMapper;
QSignalMapper *SDMapper; QSignalMapper *SDMapper;
void customEvent( QEvent *); void customEvent( QEvent *);
private: private:
DialogsProvider( intf_thread_t *); DialogsProvider( intf_thread_t *);
intf_thread_t *p_intf; intf_thread_t *p_intf;
...@@ -170,7 +172,8 @@ public slots: ...@@ -170,7 +172,8 @@ public slots:
void PLAppendDir(); void PLAppendDir();
void MLAppendDir(); void MLAppendDir();
void streamingDialog( QString mrl = "", bool b_stream = true ); void streamingDialog( QWidget *parent, QString mrl = "",
bool b_stream = true );
void openThenStreamingDialogs(); void openThenStreamingDialogs();
void openThenTranscodingDialogs(); void openThenTranscodingDialogs();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment