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
...@@ -156,14 +156,14 @@ void MediaInfoDialog::update( input_thread_t *p_input ) ...@@ -156,14 +156,14 @@ void MediaInfoDialog::update( input_thread_t *p_input )
vlc_object_release( p_input ); vlc_object_release( p_input );
} }
void MediaInfoDialog::updateOnTimeOut() void MediaInfoDialog::updateOnTimeOut()
{ {
/* Timer runs at 150 ms, dont' update more than 2 times per second */ /* Timer runs at 150 ms, dont' update more than 2 times per second */
i_runs++; i_runs++;
if( i_runs % 4 != 0 ) return; if( i_runs % 4 != 0 ) return;
/* Get Input and clear if non-existant */ /* Get Input and clear if non-existant */
input_thread_t *p_input = THEMIM->getInput(); input_thread_t *p_input = THEMIM->getInput();
if( p_input && !p_input->b_dead ) if( p_input && !p_input->b_dead )
{ {
......
...@@ -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>
...@@ -49,13 +50,13 @@ static const char *psz_type[] = { "Broadcast", "Schedule", "VOD" }; ...@@ -49,13 +50,13 @@ static const char *psz_type[] = { "Broadcast", "Schedule", "VOD" };
VLMDialog *VLMDialog::instance = NULL; VLMDialog *VLMDialog::instance = NULL;
VLMDialog::VLMDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf ) VLMDialog::VLMDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
{ {
p_vlm = vlm_New( p_intf ); p_vlm = vlm_New( p_intf );
if( !p_vlm ) if( !p_vlm )
{ {
msg_Warn( p_intf, "Couldn't build VLM object "); msg_Warn( p_intf, "Couldn't build VLM object ");
return; return;
} }
vlmWrapper = new VLMWrapper( p_vlm ); vlmWrapper = new VLMWrapper( p_vlm );
...@@ -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()
...@@ -198,7 +200,7 @@ void VLMDialog::addVLMItem() ...@@ -198,7 +200,7 @@ void VLMDialog::addVLMItem()
typeShortName = "Bcast"; typeShortName = "Bcast";
vlmAwidget = new VLMBroadcast( name, inputText, outputText, vlmAwidget = new VLMBroadcast( name, inputText, outputText,
b_checked, b_looped, this ); b_checked, b_looped, this );
VLMWrapper::AddBroadcast( name, inputText, outputText, b_checked, b_looped ); VLMWrapper::AddBroadcast( name, inputText, outputText, b_checked, b_looped );
break; break;
case QVLM_VOD: case QVLM_VOD:
typeShortName = "VOD"; typeShortName = "VOD";
...@@ -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 )
{ {
...@@ -385,7 +394,7 @@ void VLMAWidget::toggleEnabled( bool b_enable ) ...@@ -385,7 +394,7 @@ void VLMAWidget::toggleEnabled( bool b_enable )
} }
/**************** /****************
* VLMBroadcast * VLMBroadcast
****************/ ****************/
VLMBroadcast::VLMBroadcast( QString _name, QString _input, QString _output, VLMBroadcast::VLMBroadcast( QString _name, QString _input, QString _output,
bool _enabled, bool _looped, VLMDialog *_parent) bool _enabled, bool _looped, VLMDialog *_parent)
...@@ -411,7 +420,7 @@ VLMBroadcast::VLMBroadcast( QString _name, QString _input, QString _output, ...@@ -411,7 +420,7 @@ VLMBroadcast::VLMBroadcast( QString _name, QString _input, QString _output,
BUTTONACT( playButton, togglePlayPause() ); BUTTONACT( playButton, togglePlayPause() );
BUTTONACT( stopButton, stop() ); BUTTONACT( stopButton, stop() );
BUTTONACT( loopButton, toggleLoop() ); BUTTONACT( loopButton, toggleLoop() );
update(); update();
} }
...@@ -455,7 +464,7 @@ void VLMBroadcast::stop() ...@@ -455,7 +464,7 @@ void VLMBroadcast::stop()
* VLMSchedule * VLMSchedule
****************/ ****************/
VLMSchedule::VLMSchedule( QString name, QString input, QString output, VLMSchedule::VLMSchedule( QString name, QString input, QString output,
bool enabled, VLMDialog *parent) bool enabled, VLMDialog *parent)
: VLMAWidget( name, input, output, enabled, parent, QVLM_Schedule ) : VLMAWidget( name, input, output, enabled, parent, QVLM_Schedule )
{ {
nameLabel->setText( "Schedule: " + name ); nameLabel->setText( "Schedule: " + name );
...@@ -477,7 +486,7 @@ VLMVod::VLMVod( QString name, QString input, QString output, ...@@ -477,7 +486,7 @@ VLMVod::VLMVod( QString name, QString input, QString output,
mux = _mux; mux = _mux;
muxLabel = new QLabel; muxLabel = new QLabel;
objLayout->addWidget( muxLabel, 1, 0 ); objLayout->addWidget( muxLabel, 1, 0 );
update(); update();
} }
...@@ -518,7 +527,7 @@ void VLMWrapper::EditBroadcast( const QString name, const QString input, ...@@ -518,7 +527,7 @@ void VLMWrapper::EditBroadcast( const QString name, const QString input,
{ {
vlm_message_t *message; vlm_message_t *message;
QString command; QString command;
command = "setup \"" + name + "\" inputdel all"; command = "setup \"" + name + "\" inputdel all";
vlm_ExecuteCommand( p_vlm, qtu( command ), &message ); vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
vlm_MessageDelete( message ); vlm_MessageDelete( message );
...@@ -551,7 +560,7 @@ void VLMWrapper::EnableItem( const QString name, bool b_enable ) ...@@ -551,7 +560,7 @@ void VLMWrapper::EnableItem( const QString name, bool b_enable )
QString command = "setup \"" + name + ( b_enable ? " enable" : " disable" ); QString command = "setup \"" + name + ( b_enable ? " enable" : " disable" );
} }
void VLMWrapper::ControlBroadcast( const QString name, int BroadcastStatus, void VLMWrapper::ControlBroadcast( const QString name, int BroadcastStatus,
unsigned int seek ) unsigned int seek )
{ {
vlm_message_t *message; vlm_message_t *message;
...@@ -588,7 +597,7 @@ void VLMWrapper::AddVod( const QString name, const QString input, ...@@ -588,7 +597,7 @@ void VLMWrapper::AddVod( const QString name, const QString input,
} }
void VLMWrapper::EditVod( const QString name, const QString input, void VLMWrapper::EditVod( const QString name, const QString input,
const QString output, const QString output,
bool b_enabled, bool b_enabled,
const QString mux ) const QString mux )
{ {
......
...@@ -85,7 +85,7 @@ private: ...@@ -85,7 +85,7 @@ private:
QVBoxLayout *vlmItemLayout; QVBoxLayout *vlmItemLayout;
QWidget *vlmItemWidget; QWidget *vlmItemWidget;
QComboBox *mediatype; QComboBox *mediatype;
QDateTimeEdit *time, *date, *repeatTime; QDateTimeEdit *time, *date, *repeatTime;
QSpinBox *scherepeatnumber, *repeatDays; QSpinBox *scherepeatnumber, *repeatDays;
...@@ -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
...@@ -131,7 +132,7 @@ private: ...@@ -131,7 +132,7 @@ private:
static vlm_t *p_vlm; static vlm_t *p_vlm;
}; };
class VLMAWidget : public QGroupBox class VLMAWidget : public QGroupBox
{ {
Q_OBJECT Q_OBJECT
friend class VLMDialog; friend class VLMDialog;
...@@ -193,7 +194,7 @@ public: ...@@ -193,7 +194,7 @@ public:
VLMSchedule( QString name, QString input, QString output, bool _enable, VLMDialog *parent ); VLMSchedule( QString name, QString input, QString output, bool _enable, VLMDialog *parent );
void update(); void update();
private: private:
}; };
#endif #endif
...@@ -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