[vlc-devel] [PATCH] Qt: Hack in a simple preferences option for http

Edward Wang edward.c.wang at compdigitec.com
Tue Feb 7 05:10:56 CET 2012


Close #5986
---
 Should probably only be applied to 2.0, since we need a solid fix for 2.1 and beyond
 modules/gui/qt4/components/simple_preferences.cpp |   21 +++++++++++++++++++++
 modules/gui/qt4/components/simple_preferences.hpp |    2 +-
 modules/gui/qt4/ui/sprefs_interface.ui            |    7 +++++++
 3 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/modules/gui/qt4/components/simple_preferences.cpp b/modules/gui/qt4/components/simple_preferences.cpp
index a7576d0..a284bf6 100644
--- a/modules/gui/qt4/components/simple_preferences.cpp
+++ b/modules/gui/qt4/components/simple_preferences.cpp
@@ -593,6 +593,13 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
 
             CONFIG_BOOL( "qt-fs-controller", fsController );
             CONFIG_BOOL( "qt-system-tray", systrayBox );
+            /* HTTP simple preferences hack */
+            p_config = config_FindConfig( VLC_OBJECT(p_intf), "extraintf" );
+            if( p_config && p_config->value.psz && strstr( p_config->value.psz, "http" ) != NULL )
+                ui.httpBox->setChecked( true );
+            else
+                ui.httpBox->setChecked( false );
+            optionWidgets.append( ui.httpBox );
             CONFIG_GENERIC( "qt-notification", IntegerList, ui.notificationComboLabel,
                                                       notificationCombo );
             CONNECT( ui.systrayBox, toggled( bool ), ui.notificationCombo, setEnabled( bool ) );
@@ -824,6 +831,20 @@ void SPrefsPanel::apply()
             getSettings()->setValue( "MainWindow/QtStyle",
                 qobject_cast<QComboBox *>(optionWidgets[styleCB])->currentText() );
 
+        /* HTTP simple preferences hack */
+        QCheckBox* c = qobject_cast<QCheckBox*>(optionWidgets[httpCB]);
+        module_config_t* p_config = config_FindConfig( VLC_OBJECT(p_intf), "extraintf" );
+        QString extraintf = "";
+        if( p_config && p_config->value.psz )
+            extraintf = QString( p_config->value.psz );
+        if( c->isChecked() )
+            config_PutPsz( p_intf, "extraintf", (extraintf + ":http").toLocal8Bit().data() );
+        else
+        {
+            QString s = extraintf.replace( ":http", "" );
+            config_PutPsz( p_intf, "extraintf", s.toLocal8Bit().data() );
+        }
+
         break;
     }
 
diff --git a/modules/gui/qt4/components/simple_preferences.hpp b/modules/gui/qt4/components/simple_preferences.hpp
index 50996fb..4dcf032 100644
--- a/modules/gui/qt4/components/simple_preferences.hpp
+++ b/modules/gui/qt4/components/simple_preferences.hpp
@@ -80,7 +80,7 @@ enum {
        spdifChB,
 };
 enum { inputLE, cachingCoB };
-enum { skinRB, qtRB, styleCB };
+enum { skinRB, qtRB, styleCB, httpCB };
 enum { shadowCB, backgroundCB };
 
 class ConfigControl;
diff --git a/modules/gui/qt4/ui/sprefs_interface.ui b/modules/gui/qt4/ui/sprefs_interface.ui
index ef24e36..fff81c2 100644
--- a/modules/gui/qt4/ui/sprefs_interface.ui
+++ b/modules/gui/qt4/ui/sprefs_interface.ui
@@ -542,6 +542,13 @@
              <item row="5" column="2" colspan="2">
               <widget class="QComboBox" name="notificationCombo"/>
              </item>
+             <item row="3" column="2" colspan="2">
+              <widget class="QCheckBox" name="httpBox">
+               <property name="text">
+                <string>Start HTTP interface automatically</string>
+               </property>
+              </widget>
+             </item>
             </layout>
            </widget>
           </item>
-- 
1.7.5.4




More information about the vlc-devel mailing list