qt4: fix the use of HTTP in open dialog
authorRafaël Carré <funman@videolan.org>
Fri, 19 Oct 2007 10:30:34 +0000 (10:30 +0000)
committerRafaël Carré <funman@videolan.org>
Fri, 19 Oct 2007 10:30:34 +0000 (10:30 +0000)
modules/gui/qt4/components/open.cpp
modules/gui/qt4/components/simple_preferences.cpp
modules/gui/qt4/components/simple_preferences.hpp
modules/gui/qt4/ui/sprefs_audio.ui

index fdf3909..dfc8198 100644 (file)
@@ -423,6 +423,8 @@ void NetOpenPanel::updateMRL() {
         switch( proto ) {
         case 0:
             mrl = "http://" + addr;
+            emit methodChanged("http-caching");
+            break;
         case 1:
             mrl = "https://" + addr;
             emit methodChanged("http-caching");
index 2d35fb1..1ae8b82 100644 (file)
@@ -34,6 +34,7 @@
 #include "ui/sprefs_interface.h"
 
 #include <vlc_config_cat.h>
+#include "vlc_control.h"
 
 #include <QString>
 #include <QFont>
@@ -243,6 +244,18 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
          CONFIG_GENERIC_NO_BOOL( "norm-max-level" , Float , NULL,
                  volNormalizer );
          CONFIG_GENERIC( "audio-visual" , Module , NULL, visualisation);
+
+
+        if( control_Exists( VLC_OBJECT( p_intf ), "audioscrobbler" ) )
+            ui.lastfm->setCheckState( Qt::Checked );
+        else
+            ui.lastfm->setCheckState( Qt::Unchecked );
+        CONNECT( ui.lastfm, stateChanged( int ), this , lastfm_Changed( int ) );
+
+         CONFIG_GENERIC( "lastfm-username", String, ui.lastfm_user_label,
+                         lastfm_user_edit );
+         CONFIG_GENERIC( "lastfm-password", String, ui.lastfm_pass_label,
+                         lastfm_pass_edit );
         END_SPREFS_CAT;
 
         /* Input and Codecs Panel Implementation */
@@ -375,3 +388,10 @@ void SPrefsPanel::apply()
 void SPrefsPanel::clean()
 {}
 
+void SPrefsPanel::lastfm_Changed( int i_state )
+{
+    if( i_state == Qt::Checked )
+        control_Add( VLC_OBJECT( p_intf ), "audioscrobbler" );
+    else if( i_state == Qt::Unchecked )
+        control_Remove( VLC_OBJECT( p_intf ), "audioscrobbler" );
+}
index ef8c479..bc739e2 100644 (file)
@@ -82,6 +82,7 @@ private:
 /* Display only the options for the selected audio output */
 private slots:
     void AudioDeviceChanged();
+    void lastfm_Changed( int );
 };
 
 #endif
index ad9fb9f..a6fd4bb 100644 (file)
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>461</width>
-    <height>554</height>
+    <height>682</height>
    </rect>
   </property>
   <property name="windowTitle" >
      </layout>
     </widget>
    </item>
+   <item>
+    <widget class="QGroupBox" name="groupBox_4" >
+     <property name="title" >
+      <string>_("Last.fm")</string>
+     </property>
+     <layout class="QGridLayout" >
+      <item row="0" column="0" colspan="2" >
+       <widget class="QCheckBox" name="lastfm" >
+        <property name="text" >
+         <string>_("Enable")</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1" colspan="2" >
+       <widget class="QLineEdit" name="lastfm_user_edit" />
+      </item>
+      <item row="1" column="0" >
+       <widget class="QLabel" name="lastfm_user_label" >
+        <property name="text" >
+         <string>_("Username")</string>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="0" >
+       <widget class="QLabel" name="lastfm_pass_label" >
+        <property name="text" >
+         <string>_("Password")</string>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="1" colspan="2" >
+       <widget class="QLineEdit" name="lastfm_pass_edit" >
+        <property name="echoMode" >
+         <enum>QLineEdit::PasswordEchoOnEdit</enum>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
   </layout>
  </widget>
  <tabstops>