]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/dialogs/convert.cpp
qt4: use const for QString when possible.
[vlc] / modules / gui / qt4 / dialogs / convert.cpp
index e548c03849c0cfff5038c193ce87656e29b4fb69..0e71944d3e702cd73fbfd0b8cbd1bfe43403165a 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "dialogs/sout.hpp"
 #include "dialogs/convert.hpp"
+#include "components/sout/sout_widgets.hpp"
 
 #include "util/qt_dirs.hpp"
 
 #include <QFileDialog>
 #include <QCheckBox>
 
-ConvertDialog::ConvertDialog( QWidget *parent, intf_thread_t *_p_intf)
+ConvertDialog::ConvertDialog( QWidget *parent, intf_thread_t *_p_intf,
+                              const QString& inputMRL )
               : QVLCDialog( parent, _p_intf )
 {
     setWindowTitle( qtr( "Convert" ) );
 
     QGridLayout *mainLayout = new QGridLayout( this );
-
-    /**
-     * Source Block
-     **/
-    QGroupBox *sourceBox = new QGroupBox( qtr( "Source" ) );
-    QGridLayout *sourceLayout = new QGridLayout( sourceBox );
-
-    QLabel *sourceLabel = new QLabel( qtr( "Source:" ) );
-    sourceLayout->addWidget( sourceLabel, 0, 0 );
-
-    QLineEdit *sourceLine = new QLineEdit;
-    sourceLine->setReadOnly( true );
-    sourceLabel->setBuddy( sourceLine );
-    sourceLayout->addWidget( sourceLine, 0, 1 );
-
-    QLabel *sourceTypeLabel = new QLabel( qtr( "Type:" ) );
-    sourceLayout->addWidget( sourceTypeLabel, 1, 0 );
-    QLabel *sourceValueLabel = new QLabel;
-    sourceLayout->addWidget( sourceValueLabel, 1, 1 );
-
-    /* Line */
-    QFrame *line = new QFrame;
-    line->setFrameStyle( QFrame::HLine |QFrame::Sunken );
-    sourceLayout->addWidget( line, 2, 0, 1, -1 );
-
-    mainLayout->addWidget( sourceBox, 0, 0, 1, -1  );
+    SoutInputBox *inputBox = new SoutInputBox( this );
+    inputBox->setMRL( inputMRL );
+    mainLayout->addWidget( inputBox, 0, 0, 1, -1  );
 
     /**
      * Destination
@@ -75,7 +54,7 @@ ConvertDialog::ConvertDialog( QWidget *parent, intf_thread_t *_p_intf)
     QGroupBox *destBox = new QGroupBox( qtr( "Destination" ) );
     QGridLayout *destLayout = new QGridLayout( destBox );
 
-    QLabel *destLabel = new QLabel( qtr( "Target file:" ) );
+    QLabel *destLabel = new QLabel( qtr( "Destination file:" ) );
     destLayout->addWidget( destLabel, 0, 0);
 
     fileLine = new QLineEdit;
@@ -101,11 +80,14 @@ ConvertDialog::ConvertDialog( QWidget *parent, intf_thread_t *_p_intf)
     QGridLayout *settingLayout = new QGridLayout( settingBox );
 
     profile = new VLCProfileSelector( this );
-    settingLayout->addWidget( profile, 0, 0 );
+    settingLayout->addWidget( profile, 0, 0, 1, -1 );
 
     deinterBox = new QCheckBox( qtr( "Deinterlace" ) );
     settingLayout->addWidget( deinterBox, 1, 0 );
 
+    dumpBox = new QCheckBox( qtr( "Dump raw input" ) );
+    settingLayout->addWidget( dumpBox, 1, 1 );
+
     mainLayout->addWidget( settingBox, 3, 0, 1, -1  );
 
     /* Buttons */
@@ -133,23 +115,31 @@ void ConvertDialog::fileBrowse()
 
 void ConvertDialog::cancel()
 {
-    hide();
+    reject();
 }
 
 void ConvertDialog::close()
 {
     hide();
 
-    QString mrl = "sout=#" + profile->getTranscode();
-    if( deinterBox->isChecked() )
+    if( dumpBox->isChecked() )
     {
-        mrl.remove( '}' );
-        mrl += ",deinterlace}";
+        mrl = "demux=dump :demuxdump-file" + fileLine->text();
     }
-    mrl += ":duplicate{";
-    if( displayBox->isChecked() ) mrl += "dst=display,";
-    mrl += "dst=std{access=file,mux=" + profile->getMux() +
+    else
+    {
+        mrl = "sout=#" + profile->getTranscode();
+        if( deinterBox->isChecked() )
+        {
+            mrl.remove( '}' );
+            mrl += ",deinterlace}";
+        }
+        mrl += ":duplicate{";
+        if( displayBox->isChecked() ) mrl += "dst=display,";
+        mrl += "dst=std{access=file,mux=" + profile->getMux() +
             ",dst='" + fileLine->text() + "'}";
+    }
 
     msg_Dbg( p_intf, "Transcode MRL: %s", qtu( mrl ) );
+    accept();
 }