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 );
{
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()
}
void OpenDialog::updateMRL() {
- QString mrl = mainMRL;
+ mrl = mainMRL;
if( ui.slaveCheckbox->isChecked() ) {
mrl += " :input-slave=" + ui.slaveText->text();
}
#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;
private slots:
void cancel();
void ok();
- void changedTab();
void toggleAdvancedPanel();
void updateMRL(QString);
void updateMRL();
#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 ) );
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()
void SoutDialog::ok()
{
+ mrl = ui.mrlEdit->text();
+ accept();
}
void SoutDialog::cancel()
{
+ mrl = ui.mrlEdit->text();
+ reject();
}
void SoutDialog::updateMRL()
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 );
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:
#include "qt4.hpp"
#include "dialogs_provider.hpp"
+#include "main_interface.hpp"
#include "menus.hpp"
#include <vlc_intf_strings.h>
}
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::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()
#define _QVLCFRAME_H_
#include <QWidget>
+#include <QDialog>
#include <QSpacerItem>
#include <QHBoxLayout>
#include <QApplication>
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,
};
QVLCFrame( intf_thread_t *_p_intf ) : QWidget( NULL ), p_intf( _p_intf )
- {
- fixStyle( this );
- };
+ { };
virtual ~QVLCFrame() {};
void toggleVisible()
}
};
-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()
{