]> git.sesse.net Git - vlc/commitdiff
Qt4 - Open Dialog and related. Change on the actions to stream out. Lots of correctio...
authorJean-Baptiste Kempf <jb@videolan.org>
Sat, 28 Apr 2007 00:16:35 +0000 (00:16 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Sat, 28 Apr 2007 00:16:35 +0000 (00:16 +0000)
12 files changed:
modules/gui/qt4/dialogs/open.cpp
modules/gui/qt4/dialogs/open.hpp
modules/gui/qt4/dialogs/preferences.cpp
modules/gui/qt4/dialogs/sout.cpp
modules/gui/qt4/dialogs/sout.hpp
modules/gui/qt4/dialogs_provider.cpp
modules/gui/qt4/dialogs_provider.hpp
modules/gui/qt4/menus.cpp
modules/gui/qt4/playlist_model.cpp
modules/gui/qt4/ui/open.ui
modules/gui/qt4/ui/open_file.ui
modules/gui/qt4/ui/sout.ui

index 4fe5ba0fe5341ac4f14658b24b50e2a45faa455f..6aeb0ae3eaaafcc989c55bf5a9198c00fc5fcc80 100644 (file)
 #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();
index 571b88e4b066232e77cce4dd027288bc97d30b6a..4ded9d8f01054c74e0493d481a7654f0d04beb4c 100644 (file)
@@ -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();
index c171ea7b011d0db1ab6f0212bfe4574597a443a7..b46a0a83bda84819fe659e0e27616cf81337cba0 100644 (file)
@@ -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 );
index 7de7de00225e76febe388918fd94690cc5925338..87838a40a4d175d18a5aa30ab0f2b7c1cf560ad7 100644 (file)
 
 #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()
index eb08a284d876fda425955c6773eee8d8826b9a74..fd51860e0fc83f3399c7bd5ac8b3fc1f5c1b1503 100644 (file)
@@ -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;
index b691b993fdec2d8ea590d6932768f5114bd2c938..58dd46013635a4f70eb549efbb4c17e41509d38c 100644 (file)
@@ -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()
index 2c18f931789fb02db794a7d3360ba0073c29300e..770a64e4cd98487fee5073767ee5aee106190ee6 100644 (file)
 #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();
index 7ca28f64304db7943c3c5bc7b3b8ca2b7ad5fda5..febb3f1a60049079a8d760f856fdde4ca38a9ed9 100644 (file)
@@ -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;
 }
 
index 3a43c766f1745af16980af4f2405494afad2deee..3efb33e5305b3742249bd69ac54d8d596a311b69 100644 (file)
@@ -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;
 }
index 1bcad015d90f3cc1037d09bb7838eb9ed51110c0..b2b259818d4b0a594db2214862d9b633e4670278 100644 (file)
@@ -10,7 +10,7 @@
     <x>0</x>
     <y>0</y>
     <width>440</width>
-    <height>286</height>
+    <height>300</height>
    </rect>
   </property>
   <property name="windowTitle" >
index 17c80802b06103b8764a13ae234f1bd523b0424b..6a0a29e0518de91eeba648f010eaf74f963b00d5 100644 (file)
@@ -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>
    <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>
      </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" />
index aee2a69e0f95329341f8da4b44033349a7b2edfc..bca904fc18db5caf60d89550e39c4c7f5aa32e76 100644 (file)
@@ -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>
    </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>