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 )
vlc_object_release( p_input );
}
void MediaInfoDialog::updateOnTimeOut()
void MediaInfoDialog::updateOnTimeOut()
{
/* Timer runs at 150 ms, dont' update more than 2 times per second */
i_runs++;
if( i_runs % 4 != 0 ) return;
/* Timer runs at 150 ms, dont' update more than 2 times per second */
i_runs++;
if( i_runs % 4 != 0 ) return;
/* Get Input and clear if non-existant */
input_thread_t *p_input = THEMIM->getInput();
/* Get Input and clear if non-existant */
input_thread_t *p_input = THEMIM->getInput();
if( p_input && !p_input->b_dead )
{
......
......@@ -339,7 +339,7 @@ void OpenDialog::stream( bool b_transcode_only )
{
mrl = ui.advancedLineInput->text();
toggleVisible();
THEDP->streamingDialog( mrl, b_transcode_only );
THEDP->streamingDialog( this, mrl, b_transcode_only );
}
/* Update the MRL */
......
/*****************************************************************************
* 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 Savoir-faire Linux
*
......@@ -135,11 +135,6 @@ SoutDialog::SoutDialog( QWidget *parent, intf_thread_t *_p_intf,
if( b_transcode_only ) toggleSout();
}
QString SoutDialog::getMrl()
{
return mrl;
}
void SoutDialog::fileBrowse()
{
ui.tabWidget->setTabEnabled( 0,false );
......
......@@ -39,13 +39,33 @@ class SoutDialog : public QVLCDialog
{
Q_OBJECT;
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 *,
bool _transcode_only = false );
virtual ~SoutDialog() {}
static SoutDialog *instance;
QString getMrl();
//sout_gui_descr_t *sout;
private:
Ui::Sout ui;
QPushButton *okButton;
QString mrl;
......
......@@ -25,6 +25,7 @@
#include "dialogs/vlm.hpp"
#include "dialogs/open.hpp"
#include "dialogs/sout.hpp"
#include <QString>
#include <QComboBox>
......@@ -49,13 +50,13 @@ static const char *psz_type[] = { "Broadcast", "Schedule", "VOD" };
VLMDialog *VLMDialog::instance = NULL;
VLMDialog::VLMDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
{
{
p_vlm = vlm_New( p_intf );
if( !p_vlm )
{
msg_Warn( p_intf, "Couldn't build VLM object ");
return;
return;
}
vlmWrapper = new VLMWrapper( p_vlm );
......@@ -138,6 +139,7 @@ VLMDialog::VLMDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
BUTTONACT( ui.clearButton, clearWidgets() );
BUTTONACT( ui.saveButton, saveModifications() );
BUTTONACT( ui.inputButton, selectInput() );
BUTTONACT( ui.outputButton, selectOutput() );
}
VLMDialog::~VLMDialog()
......@@ -198,7 +200,7 @@ void VLMDialog::addVLMItem()
typeShortName = "Bcast";
vlmAwidget = new VLMBroadcast( name, inputText, outputText,
b_checked, b_looped, this );
VLMWrapper::AddBroadcast( name, inputText, outputText, b_checked, b_looped );
VLMWrapper::AddBroadcast( name, inputText, outputText, b_checked, b_looped );
break;
case QVLM_VOD:
typeShortName = "VOD";
......@@ -248,6 +250,13 @@ void VLMDialog::selectInput()
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 */
void VLMDialog::removeVLMItem( VLMAWidget *vlmObj )
{
......@@ -385,7 +394,7 @@ void VLMAWidget::toggleEnabled( bool b_enable )
}
/****************
* VLMBroadcast
* VLMBroadcast
****************/
VLMBroadcast::VLMBroadcast( QString _name, QString _input, QString _output,
bool _enabled, bool _looped, VLMDialog *_parent)
......@@ -411,7 +420,7 @@ VLMBroadcast::VLMBroadcast( QString _name, QString _input, QString _output,
BUTTONACT( playButton, togglePlayPause() );
BUTTONACT( stopButton, stop() );
BUTTONACT( loopButton, toggleLoop() );
update();
}
......@@ -455,7 +464,7 @@ void VLMBroadcast::stop()
* VLMSchedule
****************/
VLMSchedule::VLMSchedule( QString name, QString input, QString output,
bool enabled, VLMDialog *parent)
bool enabled, VLMDialog *parent)
: VLMAWidget( name, input, output, enabled, parent, QVLM_Schedule )
{
nameLabel->setText( "Schedule: " + name );
......@@ -477,7 +486,7 @@ VLMVod::VLMVod( QString name, QString input, QString output,
mux = _mux;
muxLabel = new QLabel;
objLayout->addWidget( muxLabel, 1, 0 );
update();
}
......@@ -518,7 +527,7 @@ void VLMWrapper::EditBroadcast( const QString name, const QString input,
{
vlm_message_t *message;
QString command;
command = "setup \"" + name + "\" inputdel all";
vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
vlm_MessageDelete( message );
......@@ -551,7 +560,7 @@ void VLMWrapper::EnableItem( const QString name, bool b_enable )
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 )
{
vlm_message_t *message;
......@@ -588,7 +597,7 @@ void VLMWrapper::AddVod( const QString name, const QString input,
}
void VLMWrapper::EditVod( const QString name, const QString input,
const QString output,
const QString output,
bool b_enabled,
const QString mux )
{
......
......@@ -85,7 +85,7 @@ private:
QVBoxLayout *vlmItemLayout;
QWidget *vlmItemWidget;
QComboBox *mediatype;
QDateTimeEdit *time, *date, *repeatTime;
QSpinBox *scherepeatnumber, *repeatDays;
......@@ -100,6 +100,7 @@ private slots:
void showScheduleWidget( int );
void selectVLMItem( int );
void selectInput();
void selectOutput();
};
class VLMWrapper
......@@ -131,7 +132,7 @@ private:
static vlm_t *p_vlm;
};
class VLMAWidget : public QGroupBox
class VLMAWidget : public QGroupBox
{
Q_OBJECT
friend class VLMDialog;
......@@ -193,7 +194,7 @@ public:
VLMSchedule( QString name, QString input, QString output, bool _enable, VLMDialog *parent );
void update();
private:
};
#endif
......@@ -133,6 +133,7 @@ void DialogsProvider::customEvent( QEvent *event )
updateDialog(); break;
#endif
case INTF_DIALOG_EXIT:
quit(); break;
default:
msg_Warn( p_intf, "unimplemented dialog" );
}
......@@ -414,10 +415,11 @@ void DialogsProvider::saveAPlaylist()
* 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,
b_transcode_only );
SoutDialog *s = SoutDialog::getInstance( parent, p_intf, b_transcode_only );
if( s->exec() == QDialog::Accepted )
{
msg_Err( p_intf, "Sout mrl %s", qta( s->getMrl() ) );
......@@ -430,7 +432,6 @@ void DialogsProvider::streamingDialog( QString mrl, bool b_transcode_only )
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END,
-1, &psz_option, 1, VLC_TRUE, VLC_FALSE );
}
delete s;
}
void DialogsProvider::openThenStreamingDialogs()
......@@ -444,29 +445,6 @@ void DialogsProvider::openThenTranscodingDialogs()
OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf, OPEN_AND_SAVE )
->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;
class DialogsProvider : public QObject
{
Q_OBJECT;
friend class QVLCMenu;
public:
static DialogsProvider *getInstance()
{
......@@ -121,11 +123,11 @@ public:
EXT_FILTER_PLAYLIST,
QString path = QString() );
protected:
friend class QVLCMenu;
QSignalMapper *menusMapper;
QSignalMapper *menusUpdateMapper;
QSignalMapper *SDMapper;
void customEvent( QEvent *);
private:
DialogsProvider( intf_thread_t *);
intf_thread_t *p_intf;
......@@ -170,7 +172,8 @@ public slots:
void PLAppendDir();
void MLAppendDir();
void streamingDialog( QString mrl = "", bool b_stream = true );
void streamingDialog( QWidget *parent, QString mrl = "",
bool b_stream = true );
void openThenStreamingDialogs();
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