[vlc-commits] Qt: ConvertDialog: rewrite logic

Francois Cartegnie git at videolan.org
Tue Jun 11 19:51:51 CEST 2013


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Jun 11 19:35:01 2013 +0200| [8aa7563a0a86cd9a954fbf3819d8e2e004e8ed48] | committer: Francois Cartegnie

Qt: ConvertDialog: rewrite logic

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8aa7563a0a86cd9a954fbf3819d8e2e004e8ed48
---

 modules/gui/qt4/dialogs/convert.cpp |   48 ++++++++++++++++++++---------------
 modules/gui/qt4/dialogs/convert.hpp |    5 ++--
 2 files changed, 30 insertions(+), 23 deletions(-)

diff --git a/modules/gui/qt4/dialogs/convert.cpp b/modules/gui/qt4/dialogs/convert.cpp
index 415aa63..a61d032 100644
--- a/modules/gui/qt4/dialogs/convert.cpp
+++ b/modules/gui/qt4/dialogs/convert.cpp
@@ -68,28 +68,41 @@ ConvertDialog::ConvertDialog( QWidget *parent, intf_thread_t *_p_intf,
     destLayout->addWidget( fileSelectButton, 0, 2);
     BUTTONACT( fileSelectButton, fileBrowse() );
 
-    displayBox = new QCheckBox( qtr( "Display the output" ) );
-    displayBox->setToolTip( qtr( "This display the resulting media, but can "
-                               "slow things down." ) );
-    destLayout->addWidget( displayBox, 2, 0, 1, -1 );
-
-    mainLayout->addWidget( destBox, 1, 0, 1, -1  );
+    mainLayout->addWidget( destBox, 3, 0, 1, -1  );
 
 
     /* Profile Editor */
     QGroupBox *settingBox = new QGroupBox( qtr( "Settings" ) );
     QGridLayout *settingLayout = new QGridLayout( settingBox );
 
-    profile = new VLCProfileSelector( this );
-    settingLayout->addWidget( profile, 0, 0, 1, -1 );
+    QRadioButton *convertRadio = new QRadioButton( qtr( "Convert" ) );
+    dumpRadio = new QRadioButton( qtr( "Dump raw input" ) );
+    QButtonGroup *buttonGroup = new QButtonGroup(this);
+    buttonGroup->addButton( convertRadio );
+    buttonGroup->addButton( dumpRadio );
+    convertRadio->setChecked( true );
+
+    settingLayout->addWidget( convertRadio, 1, 0 );
+
+    QWidget *convertPanel = new QWidget( this );
+    QVBoxLayout *convertLayout = new QVBoxLayout( convertPanel );
+
+    displayBox = new QCheckBox( qtr( "Display the output" ) );
+    displayBox->setToolTip( qtr( "This display the resulting media, but can "
+                               "slow things down." ) );
+    convertLayout->addWidget( displayBox );
 
     deinterBox = new QCheckBox( qtr( "Deinterlace" ) );
-    settingLayout->addWidget( deinterBox, 1, 0 );
+    convertLayout->addWidget( deinterBox );
+
+    profile = new VLCProfileSelector( this );
+    convertLayout->addWidget( profile );
 
-    dumpBox = new QCheckBox( qtr( "Dump raw input" ) );
-    settingLayout->addWidget( dumpBox, 1, 1 );
+    settingLayout->addWidget( convertPanel, 2, 0 );
 
-    mainLayout->addWidget( settingBox, 3, 0, 1, -1  );
+    settingLayout->addWidget( dumpRadio, 5, 0 );
+
+    mainLayout->addWidget( settingBox, 1, 0, 1, -1  );
 
     /* Buttons */
     QPushButton *okButton = new QPushButton( qtr( "&Start" ) );
@@ -105,7 +118,7 @@ ConvertDialog::ConvertDialog( QWidget *parent, intf_thread_t *_p_intf,
     BUTTONACT(okButton,close());
     BUTTONACT(cancelButton,cancel());
 
-    CONNECT(dumpBox,toggled(bool),this,dumpChecked(bool));
+    CONNECT( convertRadio, toggled(bool), convertPanel, setEnabled(bool) );
     CONNECT(profile, optionsChanged(), this, setDestinationFileExtension());
     CONNECT(fileLine, editingFinished(), this, setDestinationFileExtension());
 }
@@ -130,7 +143,7 @@ void ConvertDialog::close()
 {
     hide();
 
-    if( dumpBox->isChecked() )
+    if( dumpRadio->isChecked() )
     {
         mrl = "demux=dump :demuxdump-file=" + fileLine->text();
     }
@@ -156,13 +169,6 @@ void ConvertDialog::close()
     accept();
 }
 
-void ConvertDialog::dumpChecked( bool checked )
-{
-    deinterBox->setEnabled( !checked );
-    displayBox->setEnabled( !checked );
-    profile->setEnabled( !checked );
-}
-
 void ConvertDialog::setDestinationFileExtension()
 {
     if( !fileLine->text().isEmpty() && profile->isEnabled() )
diff --git a/modules/gui/qt4/dialogs/convert.hpp b/modules/gui/qt4/dialogs/convert.hpp
index a85a0c8..a2e8296 100644
--- a/modules/gui/qt4/dialogs/convert.hpp
+++ b/modules/gui/qt4/dialogs/convert.hpp
@@ -28,6 +28,7 @@
 
 class QLineEdit;
 class QCheckBox;
+class QRadioButton;
 class VLCProfileSelector;
 
 class ConvertDialog : public QVLCDialog
@@ -42,14 +43,14 @@ public:
 private:
     QLineEdit *fileLine;
 
-    QCheckBox *displayBox, *deinterBox, *dumpBox;
+    QCheckBox *displayBox, *deinterBox;
+    QRadioButton *dumpRadio;
     VLCProfileSelector *profile;
     QString mrl;
 private slots:
     virtual void close();
     virtual void cancel();
     void fileBrowse();
-    void dumpChecked(bool);
     void setDestinationFileExtension();
 };
 



More information about the vlc-commits mailing list