Commit 45264e5f authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - Open Dialog and related. Change on the actions to stream out. Lots of...

Qt4 - Open Dialog and related. Change on the actions to stream out. Lots of corrections. Add a few new menu entries. Check some sizes.

parent 603b805d
......@@ -33,15 +33,14 @@
#include "util/qvlcframe.hpp"
#include "input_manager.hpp"
#include "dialogs_provider.hpp"
OpenDialog *OpenDialog::instance = NULL;
OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal,
bool _stream_after ) : QVLCDialog( parent, _p_intf )
int _action_flag ) : QVLCDialog( parent, _p_intf )
{
setModal( modal );
b_stream_after = _stream_after;
i_action_flag = _action_flag;
ui.setupUi( this );
setWindowTitle( qtr("Open" ) );
......@@ -68,13 +67,12 @@ OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal,
buttonSizePolicy.setHorizontalStretch(0);
buttonSizePolicy.setVerticalStretch(0);
playButton = new QToolButton();
playButton = new QToolButton( this );
playButton->setText( qtr( "&Play" ) );
playButton->setSizePolicy( buttonSizePolicy );
playButton->setMinimumSize( QSize(90, 0) );
playButton->setPopupMode( QToolButton::MenuButtonPopup );
playButton->setToolButtonStyle( Qt::ToolButtonTextOnly );
playButton->setAutoRaise( false );
cancelButton = new QToolButton();
cancelButton->setText( qtr( "&Cancel" ) );
......@@ -87,13 +85,14 @@ OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal,
QKeySequence( "Alt+P" ) );
openButtonMenu->addAction( qtr("&Stream"), this, SLOT( stream() ) ,
QKeySequence( "Alt+S" ) );
openButtonMenu->addAction( qtr("&Convert"), this, SLOT( transcode( ) ) ,
QKeySequence( "Alt+C" ) );
playButton->setMenu( openButtonMenu );
ui.buttonsBox->addButton( playButton, QDialogButtonBox::AcceptRole );
ui.buttonsBox->addButton( cancelButton, QDialogButtonBox::RejectRole );
/* Force MRL update on tab change */
CONNECT( ui.Tab, currentChanged(int), this, signalCurrent());
......@@ -101,26 +100,29 @@ OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal,
CONNECT( netOpenPanel, mrlUpdated( QString ), this, updateMRL(QString) );
CONNECT( discOpenPanel, mrlUpdated( QString ), this, updateMRL(QString) );
CONNECT( captureOpenPanel, mrlUpdated( QString ), this,
updateMRL(QString) );
updateMRL(QString) );
CONNECT( fileOpenPanel, methodChanged( QString ),
this, newMethod(QString) );
this, newMethod(QString) );
CONNECT( netOpenPanel, methodChanged( QString ),
this, newMethod(QString) );
this, newMethod(QString) );
CONNECT( discOpenPanel, methodChanged( QString ),
this, newMethod(QString) );
this, newMethod(QString) );
/* FIXME CAPTURE */
/* Advanced frame Connects */
CONNECT( ui.slaveText, textChanged(QString), this, updateMRL());
CONNECT( ui.cacheSpinBox, valueChanged(int), this, updateMRL());
CONNECT( ui.startTimeSpinBox, valueChanged(int), this, updateMRL());
BUTTONACT( ui.advancedCheckBox , toggleAdvancedPanel() );
/* Buttons action */
BUTTONACT( playButton, play());
BUTTONACT( cancelButton, cancel());
if ( b_stream_after ) setAfter();
/* At creation time, modify the default buttons */
if ( i_action_flag ) setMenuAction();
BUTTONACT( ui.advancedCheckBox , toggleAdvancedPanel() );
/* Initialize caching */
storedMethod = "";
......@@ -133,18 +135,24 @@ OpenDialog::~OpenDialog()
{
}
void OpenDialog::setAfter()
/* Finish the dialog and decide if you open another one after */
void OpenDialog::setMenuAction()
{
if (!b_stream_after )
{
playButton->setText( qtr("&Play") );
BUTTONACT( playButton, play() );
}
else
switch ( i_action_flag )
{
playButton->setText( qtr("&Stream") );
BUTTONACT( playButton, stream() );
}
case OPEN_AND_STREAM:
playButton->setText( qtr("&Stream") );
BUTTONACT( playButton, stream() );
break;
case OPEN_AND_SAVE:
playButton->setText( qtr("&Convert / Save") );
BUTTONACT( playButton, stream( true ) );
break;
case OPEN_AND_PLAY:
default:
playButton->setText( qtr("&Play") );
BUTTONACT( playButton, play() );
}
}
void OpenDialog::showTab(int i_tab=0)
......@@ -159,7 +167,7 @@ void OpenDialog::signalCurrent() {
}
}
/***********
/***********
* Actions *
***********/
......@@ -175,7 +183,8 @@ void OpenDialog::cancel()
/* If EnterKey is pressed */
void OpenDialog::close()
{
if ( !b_stream_after )
/* FIXME */
if ( !i_action_flag )
{
play();
}
......@@ -188,22 +197,27 @@ void OpenDialog::close()
/* Play button */
void OpenDialog::play()
{
playOrEnqueue( false );
finish( false );
}
void OpenDialog::enqueue()
{
playOrEnqueue( true );
finish( true );
}
void OpenDialog::stream()
void OpenDialog::transcode()
{
/* not finished FIXME */
THEDP->streamingDialog( mrl );
stream( true );
}
void OpenDialog::stream( bool b_transcode_only )
{
/* not finished FIXME */
/* Should go through the finish function */
THEDP->streamingDialog( mrl, b_transcode_only );
}
void OpenDialog::playOrEnqueue( bool b_enqueue = false )
void OpenDialog::finish( bool b_enqueue = false )
{
this->toggleVisible();
mrl = ui.advancedLineInput->text();
......
......@@ -30,6 +30,8 @@
#include "util/qvlcframe.hpp"
#include "components/open.hpp"
#include "dialogs_provider.hpp"
#include <QTabWidget>
#include <QBoxLayout>
#include <QString>
......@@ -41,19 +43,19 @@ class OpenDialog : public QVLCDialog
Q_OBJECT;
public:
static OpenDialog * getInstance( QWidget *parent, intf_thread_t *p_intf,
bool _stream_after = false )
int _action_flag = 0 )
{
if( !instance)
instance = new OpenDialog( parent, p_intf, false, _stream_after );
instance = new OpenDialog( parent, p_intf, false, _action_flag );
else
{
instance->b_stream_after = _stream_after;
instance->setAfter();
instance->i_action_flag = _action_flag;
instance->setMenuAction();
}
return instance;
}
OpenDialog( QWidget *parent, intf_thread_t *, bool modal,
bool stream_after = false);
OpenDialog( QWidget *parent, intf_thread_t *, bool modal,
int _action_flag = 0 );
virtual ~OpenDialog();
void showTab( int );
......@@ -63,8 +65,9 @@ public:
public slots:
void play();
void stream();
void stream( bool b_transode_only = false );
void enqueue();
void transcode();
private:
static OpenDialog *instance;
input_thread_t *p_input;
......@@ -78,15 +81,15 @@ private:
QString storedMethod;
QString mrlSub;
int advHeight, mainHeight;
bool b_stream_after;
int i_action_flag;
QStringList SeparateEntries( QString );
QToolButton *cancelButton;
QToolButton *playButton;
void playOrEnqueue( bool );
void finish( bool );
private slots:
void setAfter();
void setMenuAction();
void cancel();
void close();
void toggleAdvancedPanel();
......
......@@ -46,7 +46,7 @@ PrefsDialog::PrefsDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
{
QGridLayout *main_layout = new QGridLayout( this );
setWindowTitle( qtr( "Preferences" ) );
resize( 700, 600 );
resize( 700, 550 );
/* Create Panels */
tree_panel = new QWidget( 0 );
......
......@@ -27,13 +27,14 @@
#include <QFileDialog>
SoutDialog::SoutDialog( QWidget *parent, intf_thread_t *_p_intf ) :
QVLCDialog( parent, _p_intf )
SoutDialog::SoutDialog( QWidget *parent, intf_thread_t *_p_intf,
bool _transcode_only ) : 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 ) );
ADD_VCODEC( "MPEG-1", "mp1v" );
ADD_VCODEC( "MPEG-2", "mp2v" );
......@@ -101,6 +102,8 @@ SoutDialog::SoutDialog( QWidget *parent, intf_thread_t *_p_intf ) :
BUTTONACT( okButton, ok());
BUTTONACT( cancelButton, cancel());
if( _transcode_only ) toggleSout();
}
void SoutDialog::fileBrowse()
......@@ -122,6 +125,7 @@ void SoutDialog::toggleSout()
TGV( ui.HTTPLabel ) ; TGV( ui.UDPLabel ) ; TGV( ui.MMSHLabel ) ;
TGV( ui.HTTPPortLabel ) ; TGV( ui.UDPPortLabel ) ; TGV( ui.MMSHPortLabel ) ;
TGV( ui.HTTPPort ) ; TGV( ui.UDPPort ) ; TGV( ui.MMSHPort ) ;
updateGeometry();
}
void SoutDialog::ok()
......
......@@ -18,7 +18,8 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef _SOUT_DIALOG_H_
#define _SOUT_DIALOG_H_
......@@ -35,7 +36,8 @@ class SoutDialog : public QVLCDialog
{
Q_OBJECT;
public:
SoutDialog( QWidget* parent, intf_thread_t * );
SoutDialog( QWidget* parent, intf_thread_t *,
bool _transcode_only = false );
virtual ~SoutDialog() {}
QString mrl;
......
......@@ -350,9 +350,10 @@ void DialogsProvider::MLAppendDir()
* Sout emulation
****************************************************************************/
void DialogsProvider::streamingDialog( QString mrl)
void DialogsProvider::streamingDialog( QString mrl, bool b_transcode_only )
{
SoutDialog *s = new SoutDialog( p_intf->p_sys->p_mi, p_intf );
SoutDialog *s = new SoutDialog( p_intf->p_sys->p_mi, p_intf,
b_transcode_only );
if( s->exec() == QDialog::Accepted )
{
msg_Err(p_intf, "mrl %s\n", qta(s->mrl));
......@@ -370,7 +371,14 @@ void DialogsProvider::streamingDialog( QString mrl)
void DialogsProvider::openThenStreamingDialogs()
{
OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf, true )->showTab( 0 );
OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf, OPEN_AND_STREAM )
->showTab( 0 );
}
void DialogsProvider::openThenTranscodingDialogs()
{
OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf, OPEN_AND_SAVE )
->showTab( 0 );
}
/*
void DialogsProvider::streamingDialog()
......
......@@ -73,6 +73,10 @@
#define OPEN_NETWORK_TAB 0x2
#define OPEN_CAPTURE_TAB 0x3
#define OPEN_AND_PLAY 0x0
#define OPEN_AND_STREAM 0x1
#define OPEN_AND_SAVE 0x2
class QEvent;
class QSignalMapper;
class QVLCMenu;
......@@ -140,8 +144,9 @@ public slots:
void menuAction( QObject *);
void menuUpdateAction( QObject *);
void SDMenuAction( QString );
void streamingDialog( QString mrl = "");
void streamingDialog( QString mrl = "", bool b_stream = true );
void openThenStreamingDialogs();
void openThenTranscodingDialogs();
void openPlaylist();
void savePlaylist();
void PLAppendDir();
......
......@@ -179,18 +179,18 @@ void QVLCMenu::createMenuBar( MainInterface *mi, intf_thread_t *p_intf,
#ifndef WIN32
pthread_sigmask (SIG_BLOCK, &set, NULL);
#endif
BAR_ADD( FileMenu(), qtr("Media") );
BAR_ADD( FileMenu(), qtr("&Media") );
if( playlist )
{
BAR_ADD( PlaylistMenu( mi,p_intf ), qtr("Playlist" ) );
BAR_ADD( PlaylistMenu( mi,p_intf ), qtr("&Playlist" ) );
}
BAR_ADD( ToolsMenu( p_intf, mi, adv_controls_enabled,
visual_selector_enabled ), qtr("Tools") );
BAR_DADD( VideoMenu( p_intf, NULL ), qtr("Video"), 1 );
BAR_DADD( AudioMenu( p_intf, NULL ), qtr("Audio"), 2 );
BAR_DADD( NavigMenu( p_intf, NULL ), qtr("Navigation"), 3 );
visual_selector_enabled ), qtr("&Tools") );
BAR_DADD( VideoMenu( p_intf, NULL ), qtr("&Video"), 1 );
BAR_DADD( AudioMenu( p_intf, NULL ), qtr("&Audio"), 2 );
BAR_DADD( NavigMenu( p_intf, NULL ), qtr("&Navigation"), 3 );
BAR_ADD( HelpMenu(), qtr("Help" ) );
BAR_ADD( HelpMenu(), qtr("&Help" ) );
}
QMenu *QVLCMenu::FileMenu()
{
......@@ -203,6 +203,8 @@ QMenu *QVLCMenu::FileMenu()
menu->addSeparator();
DP_SADD( qtr("&Streaming..."), "", "", openThenStreamingDialogs(),
"Ctrl+S" );
DP_SADD( qtr("Conve&rt / Save..."), "", "", openThenTranscodingDialogs(),
"Ctrl+R" );
menu->addSeparator();
DP_SADD( qtr("&Quit") , "", "", quit(), "Ctrl+Q");
return menu;
......@@ -392,7 +394,7 @@ QMenu *QVLCMenu::HelpMenu()
QMenu *menu = new QMenu();
DP_SADD( qtr("Help") , "", "", helpDialog(), "F1" );
menu->addSeparator();
DP_SADD( qtr(I_MENU_ABOUT), "", "", aboutDialog(), "Ctrl+Shift+F1");
DP_SADD( qtr(I_MENU_ABOUT), "", "", aboutDialog(), "Ctrl+F1");
return menu;
}
......
......@@ -910,6 +910,7 @@ static int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
PLModel *p_model = (PLModel *) param;
PLEvent *event = new PLEvent( PLUpdate_Type, 0 );
QApplication::postEvent( p_model, static_cast<QEvent*>(event) );
printf( "blabla" );
return VLC_SUCCESS;
}
......@@ -921,6 +922,7 @@ static int PlaylistNext( vlc_object_t *p_this, const char *psz_variable,
QApplication::postEvent( p_model, static_cast<QEvent*>(event) );
event = new PLEvent( ItemUpdate_Type, nval.i_int );
QApplication::postEvent( p_model, static_cast<QEvent*>(event) );
printf( "blabla" );
return VLC_SUCCESS;
}
......@@ -930,6 +932,7 @@ static int ItemChanged( vlc_object_t *p_this, const char *psz_variable,
PLModel *p_model = (PLModel *) param;
PLEvent *event = new PLEvent( ItemUpdate_Type, nval.i_int );
QApplication::postEvent( p_model, static_cast<QEvent*>(event) );
printf( "blabla" );
return VLC_SUCCESS;
}
......@@ -939,6 +942,7 @@ static int ItemDeleted( vlc_object_t *p_this, const char *psz_variable,
PLModel *p_model = (PLModel *) param;
PLEvent *event = new PLEvent( ItemDelete_Type, nval.i_int );
QApplication::postEvent( p_model, static_cast<QEvent*>(event) );
printf( "blabla" );
return VLC_SUCCESS;
}
......@@ -956,5 +960,6 @@ static int ItemAppended( vlc_object_t *p_this, const char *psz_variable,
}
PLEvent *event = new PLEvent( p_add );
QApplication::postEvent( p_model, static_cast<QEvent*>(event) );
printf( "blabla" );
return VLC_SUCCESS;
}
......@@ -10,7 +10,7 @@
<x>0</x>
<y>0</y>
<width>440</width>
<height>286</height>
<height>300</height>
</rect>
</property>
<property name="windowTitle" >
......
......@@ -6,14 +6,14 @@
<rect>
<x>0</x>
<y>0</y>
<width>435</width>
<height>249</height>
<width>436</width>
<height>194</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>3</vsizetype>
<vsizetype>1</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
......@@ -62,19 +62,6 @@
<item row="0" column="0" colspan="3" >
<widget class="QWidget" native="1" name="tempWidget" />
</item>
<item row="5" column="0" colspan="3" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>200</width>
<height>2</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="2" >
<spacer>
<property name="orientation" >
......@@ -86,7 +73,7 @@
<property name="sizeHint" >
<size>
<width>273</width>
<height>16</height>
<height>14</height>
</size>
</property>
</spacer>
......@@ -228,6 +215,22 @@
</layout>
</widget>
</item>
<item row="5" column="0" colspan="3" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>200</width>
<height>2</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layoutdefault spacing="0" margin="0" />
......
......@@ -6,9 +6,17 @@
<x>0</x>
<y>0</y>
<width>660</width>
<height>676</height>
<height>669</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle" >
<string>Stream Output</string>
</property>
......@@ -21,6 +29,14 @@
</property>
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title" >
<string>Outputs</string>
</property>
......
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