[Marble-commits] KDE/kdeedu/marble/src

Torsten Rahn tackat at kde.org
Sun Jul 12 14:44:40 CEST 2009


SVN commit 995244 by rahn:

BUG:199873 fixed.
 


 M  +12 -18    lib/MarbleCacheSettingsWidget.ui  
 M  +15 -15    lib/QtMarbleConfigDialog.cpp  
 M  +1 -2      lib/QtMarbleConfigDialog.h  
 M  +8 -0      lib/global.h  
 M  +8 -1      marble.kcfg  
 M  +11 -4     marble_part.cpp  


--- trunk/KDE/kdeedu/marble/src/lib/MarbleCacheSettingsWidget.ui #995243:995244
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>459</width>
-    <height>398</height>
+    <height>380</height>
    </rect>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout_2">
@@ -250,26 +250,20 @@
          </widget>
         </item>
         <item>
-         <widget class="QRadioButton" name="kcfg_proxyHttp">
-          <property name="text">
-           <string>Http</string>
-          </property>
-          <property name="checked">
-           <bool>true</bool>
-          </property>
+         <widget class="QComboBox" name="kcfg_proxyType">
+          <item>
+           <property name="text">
+            <string>Http</string>
+           </property>
+          </item>
+          <item>
+           <property name="text">
+            <string>Socks5</string>
+           </property>
+          </item>
          </widget>
         </item>
         <item>
-         <widget class="QRadioButton" name="kcfg_proxySocks5">
-          <property name="text">
-           <string>Socks5</string>
-          </property>
-          <property name="checked">
-           <bool>false</bool>
-          </property>
-         </widget>
-        </item>
-        <item>
          <spacer name="horizontalSpacer">
           <property name="orientation">
            <enum>Qt::Horizontal</enum>
--- trunk/KDE/kdeedu/marble/src/lib/QtMarbleConfigDialog.cpp #995243:995244
@@ -181,10 +181,17 @@
     // Make sure that no proxy is used for an empty string or the default value: 
     if ( proxyUrl().isEmpty() || proxyUrl() == "http://" ) {
         proxy.setType( QNetworkProxy::NoProxy );
-    } else if ( proxyHttp() ) {
-        proxy.setType( QNetworkProxy::HttpProxy );
-    } else if ( proxySocks5() ) {
-        proxy.setType( QNetworkProxy::Socks5Proxy );
+    } else {
+        if ( proxyType() == Marble::Socks5Proxy ) {
+            proxy.setType( QNetworkProxy::Socks5Proxy );
+        }
+        else if ( proxyType() == Marble::HttpProxy ) {
+            proxy.setType( QNetworkProxy::HttpProxy );
+        }
+        else {
+            qDebug() << "Unknown proxy type! Using Http Proxy instead.";
+            proxy.setType( QNetworkProxy::HttpProxy );
+        }
     }
     
     proxy.setHostName( proxyUrl() );
@@ -260,8 +267,7 @@
     d->w_cacheSettings->kcfg_proxyPort->setValue( proxyPort() );
     d->w_cacheSettings->kcfg_proxyUser->setText( proxyUser() );
     d->w_cacheSettings->kcfg_proxyPass->setText( proxyPass() );
-    d->w_cacheSettings->kcfg_proxyHttp->setChecked( proxyHttp() );
-    d->w_cacheSettings->kcfg_proxySocks5->setChecked( proxySocks5() );
+    d->w_cacheSettings->kcfg_proxyType->setCurrentIndex( proxyType() );
     if ( proxyAuth() ) {
         d->w_cacheSettings->kcfg_proxyAuth->setCheckState( Qt::Checked );
     } else {
@@ -362,8 +368,7 @@
     d->m_settings->setValue( "persistentTileCacheLimit", d->w_cacheSettings->kcfg_persistentTileCacheLimit->value() );
     d->m_settings->setValue( "proxyUrl", d->w_cacheSettings->kcfg_proxyUrl->text() );
     d->m_settings->setValue( "proxyPort", d->w_cacheSettings->kcfg_proxyPort->value() );
-    d->m_settings->setValue( "proxyHttp", d->w_cacheSettings->kcfg_proxyHttp->isChecked() );
-    d->m_settings->setValue( "proxySocks5", d->w_cacheSettings->kcfg_proxySocks5->isChecked() );
+    d->m_settings->setValue( "proxyType", d->w_cacheSettings->kcfg_proxyType->currentIndex() );
     if ( d->w_cacheSettings->kcfg_proxyAuth->isChecked() ) {
         d->m_settings->setValue( "proxyAuth", true );
         d->m_settings->setValue( "proxyUser", d->w_cacheSettings->kcfg_proxyUser->text() );
@@ -518,16 +523,11 @@
     return d->m_settings->value( "Cache/proxyPass", "" ).toString();
 }
 
-bool QtMarbleConfigDialog::proxyHttp() const
+bool QtMarbleConfigDialog::proxyType() const
 {
-    return d->m_settings->value( "Cache/proxyHttp", "" ).toBool();
+    return d->m_settings->value( "Cache/proxyType", Marble::HttpProxy ).toInt();
 }
 
-bool QtMarbleConfigDialog::proxySocks5() const
-{
-    return d->m_settings->value( "Cache/proxySocks5", "" ).toBool();
-}
-
 bool QtMarbleConfigDialog::proxyAuth() const
 {
     return d->m_settings->value( "Cache/proxyAuth", false ).toBool();
--- trunk/KDE/kdeedu/marble/src/lib/QtMarbleConfigDialog.h #995243:995244
@@ -64,8 +64,7 @@
 
     QString proxyUser() const;
     QString proxyPass() const;
-    bool proxyHttp() const;
-    bool proxySocks5() const;
+    bool proxyType() const;
     bool proxyAuth() const;
 
     Q_SIGNALS:
--- trunk/KDE/kdeedu/marble/src/lib/global.h #995243:995244
@@ -110,6 +110,14 @@
 };
 
 /**
+ * @brief This enum is used to specify the proxy that is used.
+ */
+enum ProxyType {
+    HttpProxy,          ///< Uses an Http proxy
+    Socks5Proxy         ///< Uses a Socks5Proxy
+};
+
+/**
  * @brief This enum is used to choose the localization of the labels.
  */
 enum LabelPositionFlag {
--- trunk/KDE/kdeedu/marble/src/marble.kcfg #995243:995244
@@ -127,7 +127,7 @@
  <group name="Navigation" >
   <entry key="dragLocation" type="Enum" >
    <label>The behaviour of the planet's axis on mouse dragging.</label>
-   <choices name="Marble::DragLocation">
+    <choices name="Marble::DragLocation">
     <choice name="DragLocation::KeepAxisVertically"/>
     <choice name="DragLocation::FollowMousePointer"/>
    </choices>
@@ -179,6 +179,13 @@
    <label>Proxy type is HTTP</label>
    <default>true</default>
   </entry>
+  <entry name="proxyType" type="Enum">
+   <choices name="Marble::ProxyType">
+    <choice name="HttpProxy"/>
+    <choice name="Socks5Proxy"/>
+   </choices>
+   <default>Marble::HttpProxy</default>
+  </entry>
   <entry name="proxySocks5" type="Bool">
    <label>Proxy type is Socks5</label>
    <default>false</default>
--- trunk/KDE/kdeedu/marble/src/marble_part.cpp #995243:995244
@@ -1050,10 +1050,17 @@
     // Make sure that no proxy is used for an empty string or the default value: 
     if ( MarbleSettings::proxyUrl().isEmpty() || MarbleSettings::proxyUrl() == "http://" ) {
         proxy.setType( QNetworkProxy::NoProxy );
-    } else if ( MarbleSettings::proxyHttp() ) {
-        proxy.setType( QNetworkProxy::HttpProxy );
-    } else if ( MarbleSettings::proxySocks5 ) {
-        proxy.setType( QNetworkProxy::Socks5Proxy );
+    } else {
+        if ( MarbleSettings::proxyType() == Marble::Socks5Proxy ) {
+            proxy.setType( QNetworkProxy::Socks5Proxy );
+        }
+        else if ( MarbleSettings::proxyType() == Marble::HttpProxy ) {
+            proxy.setType( QNetworkProxy::HttpProxy );
+        }
+        else {
+            qDebug() << "Unknown proxy type! Using Http Proxy instead.";
+            proxy.setType( QNetworkProxy::HttpProxy );
+        }
     }
     
     proxy.setHostName( MarbleSettings::proxyUrl() );


More information about the Marble-commits mailing list