Commit 45956533 authored by Clément Stenac's avatar Clément Stenac

* Made open and sout QDialogs

* Added a minimal streaming feature
parent 0f360817
......@@ -35,9 +35,11 @@
OpenDialog *OpenDialog::instance = NULL;
OpenDialog::OpenDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal ) :
QVLCDialog( parent, _p_intf )
{
setWindowTitle( qtr("Open" ) );
setModal( modal );
ui.setupUi( this );
fileOpenPanel = new FileOpenPanel(this , p_intf );
diskOpenPanel = new DiskOpenPanel(this , p_intf );
......@@ -96,27 +98,30 @@ void OpenDialog::cancel()
{
fileOpenPanel->clear();
this->toggleVisible();
if( isModal() )
reject();
}
void OpenDialog::ok()
{
QString mrl = ui.advancedLineInput->text();
this->toggleVisible();
mrl = ui.advancedLineInput->text();
QStringList tempMRL = mrl.split(" ");
for( size_t i = 0 ; i< tempMRL.size(); i++ )
if( !isModal() )
{
const char * psz_utf8 = qtu( tempMRL[i] );
/* Play the first one, parse and enqueue the other ones */
playlist_Add( THEPL, psz_utf8, NULL,
PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO) |
( i ? PLAYLIST_PREPARSE : 0 ),
PLAYLIST_END, VLC_TRUE );
}
this->toggleVisible();
}
for( size_t i = 0 ; i< tempMRL.size(); i++ )
{
const char * psz_utf8 = qtu( tempMRL[i] );
/* Play the first one, parse and enqueue the other ones */
playlist_Add( THEPL, psz_utf8, NULL,
PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO) |
( i ? PLAYLIST_PREPARSE : 0 ),
PLAYLIST_END, VLC_TRUE );
}
void OpenDialog::changedTab()
{
}
else
accept();
}
void OpenDialog::toggleAdvancedPanel()
......@@ -139,7 +144,7 @@ void OpenDialog::toggleAdvancedPanel()
}
void OpenDialog::updateMRL() {
QString mrl = mainMRL;
mrl = mainMRL;
if( ui.slaveCheckbox->isChecked() ) {
mrl += " :input-slave=" + ui.slaveText->text();
}
......
......@@ -34,23 +34,24 @@
#include <QBoxLayout>
#include <QString>
class OpenDialog : public QVLCFrame
class OpenDialog : public QVLCDialog
{
Q_OBJECT;
public:
static OpenDialog * getInstance( intf_thread_t *p_intf )
static OpenDialog * getInstance( QWidget *parent, intf_thread_t *p_intf )
{
if( !instance)
instance = new OpenDialog( p_intf);
instance = new OpenDialog( parent, p_intf, false );
return instance;
}
OpenDialog( QWidget *parent, intf_thread_t *, bool modal );
virtual ~OpenDialog();
void showTab( int );
QString mrl;
QString mainMRL;
private:
OpenDialog( intf_thread_t * );
static OpenDialog *instance;
input_thread_t *p_input;
QString mrlSub;
......@@ -65,7 +66,6 @@ private:
private slots:
void cancel();
void ok();
void changedTab();
void toggleAdvancedPanel();
void updateMRL(QString);
void updateMRL();
......
......@@ -27,10 +27,11 @@
#include <QFileDialog>
SoutDialog::SoutDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
SoutDialog::SoutDialog( QWidget *parent, intf_thread_t *_p_intf ) :
QVLCDialog( parent, _p_intf )
{
//setWindowTitle( qtr( "Stream output") );
setModal( true );
/* UI stuff */
ui.setupUi( this );
#define ADD_VCODEC( name, fcc) ui.vCodec->addItem( name, QVariant( fcc ) );
......@@ -88,6 +89,9 @@ SoutDialog::SoutDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
CB( soutAll ); CS( ttl ); CT( sapName ); CT( sapGroup );
CONNECT( ui.fileSelectButton, clicked(), this, fileBrowse() );
BUTTONACT( ui.okButton, ok());
BUTTONACT( ui.cancelButton, cancel());
}
void SoutDialog::fileBrowse()
......@@ -99,9 +103,13 @@ void SoutDialog::fileBrowse()
void SoutDialog::ok()
{
mrl = ui.mrlEdit->text();
accept();
}
void SoutDialog::cancel()
{
mrl = ui.mrlEdit->text();
reject();
}
void SoutDialog::updateMRL()
......@@ -169,6 +177,7 @@ end:
sout_chain_t* p_chain = streaming_ChainNew();
streaming_GuiDescToChain( VLC_OBJECT(p_intf), p_chain, &pd );
char *psz_mrl = streaming_ChainToPsz( p_chain );
ui.mrlEdit->setText( qfu( strdup(psz_mrl) ) );
free( pd.psz_acodec ); free( pd.psz_vcodec ); free( pd.psz_scodec );
free( pd.psz_file );free( pd.psz_http ); free( pd.psz_mms );
......
......@@ -31,11 +31,14 @@ class QCheckBox;
class QGridLayout;
class QTextEdit;
class SoutDialog : public QVLCFrame
class SoutDialog : public QVLCDialog
{
Q_OBJECT;
public:
SoutDialog( intf_thread_t * );
SoutDialog( QWidget* parent, intf_thread_t * );
virtual ~SoutDialog() {}
QString mrl;
private:
Ui::Sout ui;
public slots:
......
......@@ -27,6 +27,7 @@
#include "qt4.hpp"
#include "dialogs_provider.hpp"
#include "main_interface.hpp"
#include "menus.hpp"
#include <vlc_intf_strings.h>
......@@ -119,7 +120,7 @@ void DialogsProvider::MLAppendDialog()
}
void DialogsProvider::openDialog( int i_tab )
{
OpenDialog::getInstance( p_intf )->showTab( i_tab );
OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf )->showTab( i_tab );
}
void DialogsProvider::doInteraction( intf_dialog_args_t *p_arg )
......@@ -167,7 +168,25 @@ void DialogsProvider::MediaInfoDialog()
void DialogsProvider::streamingDialog()
{
(new SoutDialog( p_intf ))->show();
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 );
}
delete s;
}
delete o;
}
void DialogsProvider::prefsDialog()
......
......@@ -24,6 +24,7 @@
#define _QVLCFRAME_H_
#include <QWidget>
#include <QDialog>
#include <QSpacerItem>
#include <QHBoxLayout>
#include <QApplication>
......@@ -38,28 +39,6 @@
class QVLCFrame : public QWidget
{
public:
static void fixStyle( QWidget *w)
{
QStyle *style = qApp->style();
#if 0
// Plastique is too dark.
/// theming ? getting KDE data ? ?
if( qobject_cast<QPlastiqueStyle *>(style) )
{
QPalette plt( w->palette() );
plt.setColor( QPalette::Active, QPalette::Highlight, Qt::gray );
QColor vlg = (Qt::lightGray);
vlg = vlg.toHsv();
vlg.setHsv( vlg.hue(), vlg.saturation(), 235 );
plt.setColor( QPalette::Active, QPalette::Window, vlg );
plt.setColor( QPalette::Inactive, QPalette::Window, vlg );
plt.setColor( QPalette::Inactive, QPalette::Button, vlg );
plt.setColor( QPalette::Active, QPalette::Button, vlg );
plt.setColor( QPalette::Active, QPalette::Text, Qt::yellow );
w->setPalette( plt );
}
#endif
}
static QHBoxLayout* doButtons( QWidget *w, QBoxLayout *l,
QPushButton **defaul, char *psz_default,
QPushButton **alt, char *psz_alt,
......@@ -98,9 +77,7 @@ public:
};
QVLCFrame( intf_thread_t *_p_intf ) : QWidget( NULL ), p_intf( _p_intf )
{
fixStyle( this );
};
{ };
virtual ~QVLCFrame() {};
void toggleVisible()
......@@ -129,13 +106,28 @@ protected:
}
};
class QVLCMW : public QMainWindow
class QVLCDialog : public QDialog
{
public:
QVLCMW( intf_thread_t *_p_intf ) : QMainWindow( NULL ), p_intf( _p_intf )
QVLCDialog( QWidget* parent, intf_thread_t *_p_intf ) :
QDialog( parent ), p_intf( _p_intf )
{}
virtual ~QVLCDialog() {};
void toggleVisible()
{
QVLCFrame::fixStyle( this );
if( isVisible() ) hide();
else show();
}
protected:
intf_thread_t *p_intf;
};
class QVLCMW : public QMainWindow
{
public:
QVLCMW( intf_thread_t *_p_intf ) : QMainWindow( NULL ), p_intf( _p_intf )
{ }
virtual ~QVLCMW() {};
void toggleVisible()
{
......
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