[vlc-commits] Qt: profile_selector: Bind data to muxers

Francois Cartegnie git at videolan.org
Mon Sep 17 21:07:28 CEST 2012


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Sep 17 17:23:59 2012 +0200| [e361194318135c52567efcef308cff701d017a5d] | committer: Francois Cartegnie

Qt: profile_selector: Bind data to muxers

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

 .../gui/qt4/components/sout/profile_selector.cpp   |   68 +++++++++++---------
 1 file changed, 38 insertions(+), 30 deletions(-)

diff --git a/modules/gui/qt4/components/sout/profile_selector.cpp b/modules/gui/qt4/components/sout/profile_selector.cpp
index 77f2a52..4599c87 100644
--- a/modules/gui/qt4/components/sout/profile_selector.cpp
+++ b/modules/gui/qt4/components/sout/profile_selector.cpp
@@ -31,6 +31,7 @@
 #include <QComboBox>
 #include <QLabel>
 #include <QMessageBox>
+#include <QRadioButton>
 
 #include <assert.h>
 
@@ -262,6 +263,21 @@ VLCProfileEditor::VLCProfileEditor( const QString& qs_name, const QString& value
 
 inline void VLCProfileEditor::registerCodecs()
 {
+#define SETMUX( button, val ) ui.button->setProperty( "sout", val );
+    SETMUX( PSMux, "ps" )
+    SETMUX( TSMux, "ts" )
+    SETMUX( WEBMux, "webm" )
+    SETMUX( MPEG1Mux, "mpeg1" )
+    SETMUX( OggMux, "ogg" )
+    SETMUX( ASFMux, "asf" )
+    SETMUX( MOVMux, "mp4" )
+    SETMUX( WAVMux, "wav" )
+    SETMUX( RAWMux, "raw" )
+    SETMUX( FLVMux, "flv" )
+    SETMUX( MKVMux, "mkv" )
+    SETMUX( AVIMux, "avi" )
+    SETMUX( MJPEGMux, "mpjpeg" )
+#undef SETMUX
 
 #define ADD_VCODEC( name, fourcc ) ui.vCodecBox->addItem( name, QVariant( fourcc ) );
     ADD_VCODEC( "MPEG-1", "mp1v" )
@@ -325,21 +341,17 @@ void VLCProfileEditor::fillProfile( const QString& qs )
         return;
 
     const QString mux = options[0];
-#define CHECKMUX( button, text) if( text == mux ) ui.button->setChecked( true ); else
-    CHECKMUX( PSMux, "ps" )
-    CHECKMUX( TSMux, "ts" )
-    CHECKMUX( WEBMux, "webm" )
-    CHECKMUX( MPEG1Mux, "mpeg1" )
-    CHECKMUX( OggMux, "ogg" )
-    CHECKMUX( ASFMux, "asf" )
-    CHECKMUX( MOVMux, "mp4" )
-    CHECKMUX( WAVMux, "wav" )
-    CHECKMUX( RAWMux, "raw" )
-    CHECKMUX( FLVMux, "flv" )
-    CHECKMUX( MKVMux, "mkv" )
-    CHECKMUX( AVIMux, "avi" )
-    CHECKMUX( MJPEGMux, "mpjpeg" ){}
-#undef CHECKMUX
+    for ( int i=0; i< ui.muxer->layout()->count(); i++ )
+    {
+        QRadioButton *current =
+                qobject_cast<QRadioButton *>(ui.muxer->layout()->itemAt(i)->widget());
+        if ( unlikely( !current ) ) continue;/* someone is messing up with ui */
+        if ( current->property("sout").toString() == mux )
+        {
+            current->setChecked( true );
+            break;/* radios are exclusive */
+        }
+    }
 
     ui.keepVideo->setChecked( !options[1].toInt() );
     ui.transcodeVideo->setChecked( ( options[4] != "none" ) );
@@ -421,21 +433,17 @@ void VLCProfileEditor::close()
 
 QString VLCProfileEditor::transcodeValue()
 {
-#define SMUX( x, txt ) if( ui.x->isChecked() ) muxValue =  txt; else
-    SMUX( PSMux, "ps" )
-    SMUX( TSMux, "ts" )
-    SMUX( WEBMux, "webm" )
-    SMUX( MPEG1Mux, "mpeg1" )
-    SMUX( OggMux, "ogg" )
-    SMUX( ASFMux, "asf" )
-    SMUX( MOVMux, "mp4" )
-    SMUX( WAVMux, "wav" )
-    SMUX( RAWMux, "raw" )
-    SMUX( FLVMux, "flv" )
-    SMUX( MKVMux, "mkv" )
-    SMUX( AVIMux, "avi" )
-    SMUX( MJPEGMux, "mpjpeg" ){}
-#undef SMUX
+    for ( int i=0; i< ui.muxer->layout()->count(); i++ )
+    {
+        QRadioButton *current =
+                qobject_cast<QRadioButton *>(ui.muxer->layout()->itemAt(i)->widget());
+        if ( unlikely( !current ) ) continue;/* someone is messing up with ui */
+        if ( current->isChecked() )
+        {
+            muxValue = current->property("sout").toString();
+            break;/* radios are exclusive */
+        }
+    }
 
 #define currentData( box ) box->itemData( box->currentIndex() )
     QString qs_acodec, qs_vcodec;



More information about the vlc-commits mailing list