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 @@ ...@@ -35,9 +35,11 @@
OpenDialog *OpenDialog::instance = NULL; 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" ) ); setWindowTitle( qtr("Open" ) );
setModal( modal );
ui.setupUi( this ); ui.setupUi( this );
fileOpenPanel = new FileOpenPanel(this , p_intf ); fileOpenPanel = new FileOpenPanel(this , p_intf );
diskOpenPanel = new DiskOpenPanel(this , p_intf ); diskOpenPanel = new DiskOpenPanel(this , p_intf );
...@@ -96,12 +98,17 @@ void OpenDialog::cancel() ...@@ -96,12 +98,17 @@ void OpenDialog::cancel()
{ {
fileOpenPanel->clear(); fileOpenPanel->clear();
this->toggleVisible(); this->toggleVisible();
if( isModal() )
reject();
} }
void OpenDialog::ok() void OpenDialog::ok()
{ {
QString mrl = ui.advancedLineInput->text(); this->toggleVisible();
mrl = ui.advancedLineInput->text();
QStringList tempMRL = mrl.split(" "); QStringList tempMRL = mrl.split(" ");
if( !isModal() )
{
for( size_t i = 0 ; i< tempMRL.size(); i++ ) for( size_t i = 0 ; i< tempMRL.size(); i++ )
{ {
const char * psz_utf8 = qtu( tempMRL[i] ); const char * psz_utf8 = qtu( tempMRL[i] );
...@@ -112,11 +119,9 @@ void OpenDialog::ok() ...@@ -112,11 +119,9 @@ void OpenDialog::ok()
PLAYLIST_END, VLC_TRUE ); PLAYLIST_END, VLC_TRUE );
} }
this->toggleVisible(); }
} else
accept();
void OpenDialog::changedTab()
{
} }
void OpenDialog::toggleAdvancedPanel() void OpenDialog::toggleAdvancedPanel()
...@@ -139,7 +144,7 @@ void OpenDialog::toggleAdvancedPanel() ...@@ -139,7 +144,7 @@ void OpenDialog::toggleAdvancedPanel()
} }
void OpenDialog::updateMRL() { void OpenDialog::updateMRL() {
QString mrl = mainMRL; mrl = mainMRL;
if( ui.slaveCheckbox->isChecked() ) { if( ui.slaveCheckbox->isChecked() ) {
mrl += " :input-slave=" + ui.slaveText->text(); mrl += " :input-slave=" + ui.slaveText->text();
} }
......
...@@ -34,23 +34,24 @@ ...@@ -34,23 +34,24 @@
#include <QBoxLayout> #include <QBoxLayout>
#include <QString> #include <QString>
class OpenDialog : public QVLCFrame class OpenDialog : public QVLCDialog
{ {
Q_OBJECT; Q_OBJECT;
public: public:
static OpenDialog * getInstance( intf_thread_t *p_intf ) static OpenDialog * getInstance( QWidget *parent, intf_thread_t *p_intf )
{ {
if( !instance) if( !instance)
instance = new OpenDialog( p_intf); instance = new OpenDialog( parent, p_intf, false );
return instance; return instance;
} }
OpenDialog( QWidget *parent, intf_thread_t *, bool modal );
virtual ~OpenDialog(); virtual ~OpenDialog();
void showTab( int ); void showTab( int );
QString mrl;
QString mainMRL; QString mainMRL;
private: private:
OpenDialog( intf_thread_t * );
static OpenDialog *instance; static OpenDialog *instance;
input_thread_t *p_input; input_thread_t *p_input;
QString mrlSub; QString mrlSub;
...@@ -65,7 +66,6 @@ private: ...@@ -65,7 +66,6 @@ private:
private slots: private slots:
void cancel(); void cancel();
void ok(); void ok();
void changedTab();
void toggleAdvancedPanel(); void toggleAdvancedPanel();
void updateMRL(QString); void updateMRL(QString);
void updateMRL(); void updateMRL();
......
...@@ -27,10 +27,11 @@ ...@@ -27,10 +27,11 @@
#include <QFileDialog> #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") ); //setWindowTitle( qtr( "Stream output") );
setModal( true );
/* UI stuff */ /* UI stuff */
ui.setupUi( this ); ui.setupUi( this );
#define ADD_VCODEC( name, fcc) ui.vCodec->addItem( name, QVariant( fcc ) ); #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 ) ...@@ -88,6 +89,9 @@ SoutDialog::SoutDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
CB( soutAll ); CS( ttl ); CT( sapName ); CT( sapGroup ); CB( soutAll ); CS( ttl ); CT( sapName ); CT( sapGroup );
CONNECT( ui.fileSelectButton, clicked(), this, fileBrowse() ); CONNECT( ui.fileSelectButton, clicked(), this, fileBrowse() );
BUTTONACT( ui.okButton, ok());
BUTTONACT( ui.cancelButton, cancel());
} }
void SoutDialog::fileBrowse() void SoutDialog::fileBrowse()
...@@ -99,9 +103,13 @@ void SoutDialog::fileBrowse() ...@@ -99,9 +103,13 @@ void SoutDialog::fileBrowse()
void SoutDialog::ok() void SoutDialog::ok()
{ {
mrl = ui.mrlEdit->text();
accept();
} }
void SoutDialog::cancel() void SoutDialog::cancel()
{ {
mrl = ui.mrlEdit->text();
reject();
} }
void SoutDialog::updateMRL() void SoutDialog::updateMRL()
...@@ -169,6 +177,7 @@ end: ...@@ -169,6 +177,7 @@ end:
sout_chain_t* p_chain = streaming_ChainNew(); sout_chain_t* p_chain = streaming_ChainNew();
streaming_GuiDescToChain( VLC_OBJECT(p_intf), p_chain, &pd ); streaming_GuiDescToChain( VLC_OBJECT(p_intf), p_chain, &pd );
char *psz_mrl = streaming_ChainToPsz( p_chain ); char *psz_mrl = streaming_ChainToPsz( p_chain );
ui.mrlEdit->setText( qfu( strdup(psz_mrl) ) ); ui.mrlEdit->setText( qfu( strdup(psz_mrl) ) );
free( pd.psz_acodec ); free( pd.psz_vcodec ); free( pd.psz_scodec ); free( pd.psz_acodec ); free( pd.psz_vcodec ); free( pd.psz_scodec );
free( pd.psz_file );free( pd.psz_http ); free( pd.psz_mms ); free( pd.psz_file );free( pd.psz_http ); free( pd.psz_mms );
......
...@@ -31,11 +31,14 @@ class QCheckBox; ...@@ -31,11 +31,14 @@ class QCheckBox;
class QGridLayout; class QGridLayout;
class QTextEdit; class QTextEdit;
class SoutDialog : public QVLCFrame class SoutDialog : public QVLCDialog
{ {
Q_OBJECT; Q_OBJECT;
public: public:
SoutDialog( intf_thread_t * ); SoutDialog( QWidget* parent, intf_thread_t * );
virtual ~SoutDialog() {}
QString mrl;
private: private:
Ui::Sout ui; Ui::Sout ui;
public slots: public slots:
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "qt4.hpp" #include "qt4.hpp"
#include "dialogs_provider.hpp" #include "dialogs_provider.hpp"
#include "main_interface.hpp"
#include "menus.hpp" #include "menus.hpp"
#include <vlc_intf_strings.h> #include <vlc_intf_strings.h>
...@@ -119,7 +120,7 @@ void DialogsProvider::MLAppendDialog() ...@@ -119,7 +120,7 @@ void DialogsProvider::MLAppendDialog()
} }
void DialogsProvider::openDialog( int i_tab ) 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 ) void DialogsProvider::doInteraction( intf_dialog_args_t *p_arg )
...@@ -167,7 +168,25 @@ void DialogsProvider::MediaInfoDialog() ...@@ -167,7 +168,25 @@ void DialogsProvider::MediaInfoDialog()
void DialogsProvider::streamingDialog() 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() void DialogsProvider::prefsDialog()
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#define _QVLCFRAME_H_ #define _QVLCFRAME_H_
#include <QWidget> #include <QWidget>
#include <QDialog>
#include <QSpacerItem> #include <QSpacerItem>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QApplication> #include <QApplication>
...@@ -38,28 +39,6 @@ ...@@ -38,28 +39,6 @@
class QVLCFrame : public QWidget class QVLCFrame : public QWidget
{ {
public: 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, static QHBoxLayout* doButtons( QWidget *w, QBoxLayout *l,
QPushButton **defaul, char *psz_default, QPushButton **defaul, char *psz_default,
QPushButton **alt, char *psz_alt, QPushButton **alt, char *psz_alt,
...@@ -98,9 +77,7 @@ public: ...@@ -98,9 +77,7 @@ public:
}; };
QVLCFrame( intf_thread_t *_p_intf ) : QWidget( NULL ), p_intf( _p_intf ) QVLCFrame( intf_thread_t *_p_intf ) : QWidget( NULL ), p_intf( _p_intf )
{ { };
fixStyle( this );
};
virtual ~QVLCFrame() {}; virtual ~QVLCFrame() {};
void toggleVisible() void toggleVisible()
...@@ -129,13 +106,28 @@ protected: ...@@ -129,13 +106,28 @@ protected:
} }
}; };
class QVLCMW : public QMainWindow class QVLCDialog : public QDialog
{ {
public: 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() {}; virtual ~QVLCMW() {};
void toggleVisible() 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