From: Jean-Baptiste Kempf Date: Sat, 28 Apr 2007 00:16:35 +0000 (+0000) Subject: Qt4 - Open Dialog and related. Change on the actions to stream out. Lots of correctio... X-Git-Tag: 0.9.0-test0~7591 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=45264e5f06bd52506b2effda0d45f2b295410838;p=vlc Qt4 - Open Dialog and related. Change on the actions to stream out. Lots of corrections. Add a few new menu entries. Check some sizes. --- diff --git a/modules/gui/qt4/dialogs/open.cpp b/modules/gui/qt4/dialogs/open.cpp index 4fe5ba0fe5..6aeb0ae3ea 100644 --- a/modules/gui/qt4/dialogs/open.cpp +++ b/modules/gui/qt4/dialogs/open.cpp @@ -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(); diff --git a/modules/gui/qt4/dialogs/open.hpp b/modules/gui/qt4/dialogs/open.hpp index 571b88e4b0..4ded9d8f01 100644 --- a/modules/gui/qt4/dialogs/open.hpp +++ b/modules/gui/qt4/dialogs/open.hpp @@ -30,6 +30,8 @@ #include "util/qvlcframe.hpp" #include "components/open.hpp" +#include "dialogs_provider.hpp" + #include #include #include @@ -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(); diff --git a/modules/gui/qt4/dialogs/preferences.cpp b/modules/gui/qt4/dialogs/preferences.cpp index c171ea7b01..b46a0a83bd 100644 --- a/modules/gui/qt4/dialogs/preferences.cpp +++ b/modules/gui/qt4/dialogs/preferences.cpp @@ -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 ); diff --git a/modules/gui/qt4/dialogs/sout.cpp b/modules/gui/qt4/dialogs/sout.cpp index 7de7de0022..87838a40a4 100644 --- a/modules/gui/qt4/dialogs/sout.cpp +++ b/modules/gui/qt4/dialogs/sout.cpp @@ -27,13 +27,14 @@ #include -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() diff --git a/modules/gui/qt4/dialogs/sout.hpp b/modules/gui/qt4/dialogs/sout.hpp index eb08a284d8..fd51860e0f 100644 --- a/modules/gui/qt4/dialogs/sout.hpp +++ b/modules/gui/qt4/dialogs/sout.hpp @@ -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; diff --git a/modules/gui/qt4/dialogs_provider.cpp b/modules/gui/qt4/dialogs_provider.cpp index b691b993fd..58dd460136 100644 --- a/modules/gui/qt4/dialogs_provider.cpp +++ b/modules/gui/qt4/dialogs_provider.cpp @@ -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() diff --git a/modules/gui/qt4/dialogs_provider.hpp b/modules/gui/qt4/dialogs_provider.hpp index 2c18f93178..770a64e4cd 100644 --- a/modules/gui/qt4/dialogs_provider.hpp +++ b/modules/gui/qt4/dialogs_provider.hpp @@ -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(); diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp index 7ca28f6430..febb3f1a60 100644 --- a/modules/gui/qt4/menus.cpp +++ b/modules/gui/qt4/menus.cpp @@ -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; } diff --git a/modules/gui/qt4/playlist_model.cpp b/modules/gui/qt4/playlist_model.cpp index 3a43c766f1..3efb33e530 100644 --- a/modules/gui/qt4/playlist_model.cpp +++ b/modules/gui/qt4/playlist_model.cpp @@ -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(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(event) ); event = new PLEvent( ItemUpdate_Type, nval.i_int ); QApplication::postEvent( p_model, static_cast(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(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(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(event) ); + printf( "blabla" ); return VLC_SUCCESS; } diff --git a/modules/gui/qt4/ui/open.ui b/modules/gui/qt4/ui/open.ui index 1bcad015d9..b2b259818d 100644 --- a/modules/gui/qt4/ui/open.ui +++ b/modules/gui/qt4/ui/open.ui @@ -10,7 +10,7 @@ 0 0 440 - 286 + 300 diff --git a/modules/gui/qt4/ui/open_file.ui b/modules/gui/qt4/ui/open_file.ui index 17c80802b0..6a0a29e051 100644 --- a/modules/gui/qt4/ui/open_file.ui +++ b/modules/gui/qt4/ui/open_file.ui @@ -6,14 +6,14 @@ 0 0 - 435 - 249 + 436 + 194 7 - 3 + 1 0 0 @@ -62,19 +62,6 @@ - - - - Qt::Vertical - - - - 200 - 2 - - - - @@ -86,7 +73,7 @@ 273 - 16 + 14 @@ -228,6 +215,22 @@ + + + + Qt::Vertical + + + QSizePolicy::MinimumExpanding + + + + 200 + 2 + + + + diff --git a/modules/gui/qt4/ui/sout.ui b/modules/gui/qt4/ui/sout.ui index aee2a69e0f..bca904fc18 100644 --- a/modules/gui/qt4/ui/sout.ui +++ b/modules/gui/qt4/ui/sout.ui @@ -6,9 +6,17 @@ 0 0 660 - 676 + 669 + + + 1 + 5 + 0 + 0 + + Stream Output @@ -21,6 +29,14 @@ + + + 1 + 5 + 0 + 0 + + Outputs