changeset 726:1c5ff048dfaa

Added a network settings tab to the settings dialog, where a proxy can be defined. git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@1000 59b1889a-e5ac-428c-b0c7-476e01d41282
author thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
date Sun, 21 Mar 2010 09:21:51 +0000
parents fc850ee753bd
children aae5a8d04f70
files src/UiGuiSettings.cpp src/UiGuiSettings.h src/UiGuiSettingsDialog.ui
diffstat 3 files changed, 187 insertions(+), 76 deletions(-) [+]
line wrap: on
line diff
--- a/src/UiGuiSettings.cpp	Fri Mar 19 19:27:40 2010 +0000
+++ b/src/UiGuiSettings.cpp	Sun Mar 21 09:21:51 2010 +0000
@@ -248,9 +248,15 @@
     else if ( settingName == "IndenterParameterTooltipsEnabled" ) emit indenterParameterTooltipsEnabled( settings[settingName].toBool() );
     else if ( settingName == "TabWidth" ) emit tabWidth( settings[settingName].toInt() );
     else if ( settingName == "Language" ) emit language( settings[settingName].toInt() );
-    else if ( settingName == "CheckForUpdate" ) emit checkForUpdate( settings[settingName].toBool() );
     else if ( settingName == "LastUpdateCheck" ) emit lastUpdateCheck( settings[settingName].toDate() );
     else if ( settingName == "MainWindowState" ) emit mainWindowState( settings[settingName].toByteArray() );
+    // Network settings.
+    else if ( settingName == "CheckForUpdate" ) emit checkForUpdate( settings[settingName].toBool() );
+    else if ( settingName == "ProxyEnabled" ) emit enableProxy( settings[settingName].toBool() );
+    else if ( settingName == "ProxyHostName" ) emit proxyHostName( settings[settingName].toString() );
+    else if ( settingName == "ProxyPort" ) emit proxyPort( settings[settingName].toInt() );
+    else if ( settingName == "ProxyUserName" ) emit proxyUserName( settings[settingName].toString() );
+    else if ( settingName == "ProxyPassword" ) emit proxyPassword( settings[settingName].toString() );
     else if ( settingName == "all" ) {
         emit versionInSettingsFile( settings["VersionInSettingsFile"].toString() );
         emit windowIsMaximized( settings["WindowIsMaximized"].toBool() );
@@ -266,9 +272,15 @@
         emit indenterParameterTooltipsEnabled( settings["IndenterParameterTooltipsEnabled"].toBool() );
         emit tabWidth( settings["TabWidth"].toInt() );
         emit language( settings["Language"].toInt() );
-        emit checkForUpdate( settings["CheckForUpdate"].toBool() );
         emit lastUpdateCheck( settings["LastUpdateCheck"].toDate() );
         emit mainWindowState( settings["MainWindowState"].toByteArray() );
+        // Network settings.
+        emit checkForUpdate( settings["CheckForUpdate"].toBool() );
+        emit enableProxy( settings["ProxyEnabled"].toBool() );
+        emit proxyHostName( settings["ProxyHostName"].toString() );
+        emit proxyPort( settings["ProxyPort"].toInt() );
+        emit proxyUserName( settings["ProxyUserName"].toString() );
+        emit proxyPassword( settings["ProxyPassword"].toString() );
     }
 }
 
--- a/src/UiGuiSettings.h	Fri Mar 19 19:27:40 2010 +0000
+++ b/src/UiGuiSettings.h	Sun Mar 21 09:21:51 2010 +0000
@@ -72,9 +72,15 @@
     void indenterParameterTooltipsEnabled(bool value);
     void tabWidth(int value);
     void language(int value);
-    void checkForUpdate(bool value);
     void lastUpdateCheck(QDate value);
     void mainWindowState(QByteArray value);
+    // Network settings.
+    void checkForUpdate(bool value);
+    void enableProxy(bool value);
+    void proxyHostName(QString value);
+    void proxyPort(int value);
+    void proxyUserName(QString value);
+    void proxyPassword(QString value);
 
 private:
     void emitSignalForSetting(QString settingName);
--- a/src/UiGuiSettingsDialog.ui	Fri Mar 19 19:27:40 2010 +0000
+++ b/src/UiGuiSettingsDialog.ui	Sun Mar 21 09:21:51 2010 +0000
@@ -9,8 +9,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>410</width>
-    <height>285</height>
+    <width>503</width>
+    <height>336</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -21,12 +21,6 @@
     <normaloff>:/mainWindow/preferences-system.png</normaloff>:/mainWindow/preferences-system.png</iconset>
   </property>
   <layout class="QVBoxLayout">
-   <property name="spacing">
-    <number>6</number>
-   </property>
-   <property name="margin">
-    <number>9</number>
-   </property>
    <item>
     <widget class="QTabWidget" name="tabWidget">
      <property name="currentIndex">
@@ -41,20 +35,8 @@
        <string>Common</string>
       </attribute>
       <layout class="QVBoxLayout">
-       <property name="spacing">
-        <number>6</number>
-       </property>
-       <property name="margin">
-        <number>9</number>
-       </property>
        <item>
         <layout class="QHBoxLayout">
-         <property name="spacing">
-          <number>6</number>
-         </property>
-         <property name="margin">
-          <number>0</number>
-         </property>
          <item>
           <widget class="QLabel" name="label">
            <property name="toolTip">
@@ -127,12 +109,6 @@
        </item>
        <item>
         <layout class="QHBoxLayout">
-         <property name="spacing">
-          <number>6</number>
-         </property>
-         <property name="margin">
-          <number>0</number>
-         </property>
          <item>
           <widget class="QLabel" name="labelRecentlyOpenedListSize">
            <property name="toolTip">
@@ -184,19 +160,6 @@
         </layout>
        </item>
        <item>
-        <widget class="QCheckBox" name="uiGuiCheckForUpdateCheckBox">
-         <property name="toolTip">
-          <string>Checks whether a new version of UniversalIndentGUI exists on program start, but only once a day.</string>
-         </property>
-         <property name="text">
-          <string>Check online for update on program start</string>
-         </property>
-         <property name="connectedSettingName" stdset="0">
-          <string>DONOTTRANSLATE:CheckForUpdate</string>
-         </property>
-        </widget>
-       </item>
-       <item>
         <spacer>
          <property name="orientation">
           <enum>Qt::Vertical</enum>
@@ -220,12 +183,6 @@
        <string>Editor</string>
       </attribute>
       <layout class="QVBoxLayout">
-       <property name="spacing">
-        <number>6</number>
-       </property>
-       <property name="margin">
-        <number>9</number>
-       </property>
        <item>
         <widget class="QCheckBox" name="uiGuiWhiteSpaceIsVisibleCheckBox">
          <property name="toolTip">
@@ -241,12 +198,6 @@
        </item>
        <item>
         <layout class="QHBoxLayout">
-         <property name="spacing">
-          <number>6</number>
-         </property>
-         <property name="margin">
-          <number>0</number>
-         </property>
          <item>
           <widget class="QLabel" name="labelTabWidth">
            <property name="toolTip">
@@ -315,6 +266,150 @@
        </item>
       </layout>
      </widget>
+     <widget class="QWidget" name="tab_4">
+      <attribute name="icon">
+       <iconset resource="../resources/Icons.qrc">
+        <normaloff>:/mainWindow/system-software-update.png</normaloff>:/mainWindow/system-software-update.png</iconset>
+      </attribute>
+      <attribute name="title">
+       <string>Network</string>
+      </attribute>
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <item>
+        <widget class="QCheckBox" name="uiGuiCheckForUpdateCheckBox">
+         <property name="toolTip">
+          <string>Checks whether a new version of UniversalIndentGUI exists on program start, but only once a day.</string>
+         </property>
+         <property name="text">
+          <string>Check online for update on program start</string>
+         </property>
+         <property name="connectedSettingName" stdset="0">
+          <string>DONOTTRANSLATE:CheckForUpdate</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QGroupBox" name="groupBox">
+         <property name="title">
+          <string/>
+         </property>
+         <layout class="QVBoxLayout" name="verticalLayout_5">
+          <item>
+           <widget class="QCheckBox" name="uiGuiEnableProxyCheckBox">
+            <property name="toolTip">
+             <string>If checked, the made proxy settings will be applied for all network connections. Type of the used proxy is SOCKS5.</string>
+            </property>
+            <property name="text">
+             <string>Enable proxy</string>
+            </property>
+            <property name="connectedSettingName" stdset="0">
+             <string>DONOTTRANSLATE:ProxyEnabled</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QWidget" name="widget" native="true">
+            <property name="enabled">
+             <bool>false</bool>
+            </property>
+            <layout class="QGridLayout" name="gridLayout">
+             <item row="0" column="0">
+              <widget class="QLabel" name="label_2">
+               <property name="text">
+                <string>Host name:</string>
+               </property>
+               <property name="buddy">
+                <cstring>uiGuiProxyHostNameLineEdit</cstring>
+               </property>
+              </widget>
+             </item>
+             <item row="0" column="1">
+              <widget class="QLineEdit" name="uiGuiProxyHostNameLineEdit">
+               <property name="toolTip">
+                <string>Host name of the to be used proxy. E.g.: proxy.example.com</string>
+               </property>
+               <property name="connectedSettingName" stdset="0">
+                <string>DONOTTRANSLATE:ProxyHostName</string>
+               </property>
+              </widget>
+             </item>
+             <item row="1" column="0">
+              <widget class="QLabel" name="label_3">
+               <property name="text">
+                <string>Port:</string>
+               </property>
+               <property name="buddy">
+                <cstring>uiGuiProxyPortSpinBox</cstring>
+               </property>
+              </widget>
+             </item>
+             <item row="1" column="1">
+              <widget class="QSpinBox" name="uiGuiProxyPortSpinBox">
+               <property name="toolTip">
+                <string>Port number to connect to the before named proxy.</string>
+               </property>
+               <property name="alignment">
+                <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+               </property>
+               <property name="buttonSymbols">
+                <enum>QAbstractSpinBox::NoButtons</enum>
+               </property>
+               <property name="connectedSettingName" stdset="0">
+                <string>DONOTTRANSLATE:ProxyPort</string>
+               </property>
+              </widget>
+             </item>
+             <item row="2" column="0">
+              <widget class="QLabel" name="label_4">
+               <property name="text">
+                <string>User name:</string>
+               </property>
+               <property name="buddy">
+                <cstring>uiGuiProxyUserNameLineEdit</cstring>
+               </property>
+              </widget>
+             </item>
+             <item row="2" column="1">
+              <widget class="QLineEdit" name="uiGuiProxyUserNameLineEdit">
+               <property name="toolTip">
+                <string>If the proxy needs authentification, enter the login name here.</string>
+               </property>
+               <property name="connectedSettingName" stdset="0">
+                <string>DONOTTRANSLATE:ProxyUserName</string>
+               </property>
+              </widget>
+             </item>
+             <item row="3" column="0">
+              <widget class="QLabel" name="label_6">
+               <property name="text">
+                <string>Password:</string>
+               </property>
+               <property name="buddy">
+                <cstring>uiGuiProxyPasswordLineEdit</cstring>
+               </property>
+              </widget>
+             </item>
+             <item row="3" column="1">
+              <widget class="QLineEdit" name="uiGuiProxyPasswordLineEdit">
+               <property name="toolTip">
+                <string>If the proxy needs authentification, enter the password here.</string>
+               </property>
+               <property name="echoMode">
+                <enum>QLineEdit::Password</enum>
+               </property>
+               <property name="connectedSettingName" stdset="0">
+                <string>DONOTTRANSLATE:ProxyPassword</string>
+               </property>
+              </widget>
+             </item>
+            </layout>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+       </item>
+      </layout>
+     </widget>
      <widget class="QWidget" name="tab_3">
       <attribute name="icon">
        <iconset resource="../resources/Icons.qrc">
@@ -324,12 +419,6 @@
        <string>Syntax Highlighting</string>
       </attribute>
       <layout class="QVBoxLayout">
-       <property name="spacing">
-        <number>6</number>
-       </property>
-       <property name="margin">
-        <number>9</number>
-       </property>
        <item>
         <widget class="QCheckBox" name="uiGuiEnableSyntaxHighlightningCheckBox">
          <property name="toolTip">
@@ -355,12 +444,6 @@
           <string>Highlighter settings</string>
          </property>
          <layout class="QHBoxLayout">
-          <property name="spacing">
-           <number>6</number>
-          </property>
-          <property name="margin">
-           <number>9</number>
-          </property>
           <item>
            <widget class="QListWidget" name="listWidget">
             <property name="currentRow">
@@ -377,12 +460,6 @@
           </item>
           <item>
            <layout class="QVBoxLayout">
-            <property name="spacing">
-             <number>6</number>
-            </property>
-            <property name="margin">
-             <number>0</number>
-            </property>
             <item>
              <widget class="QPushButton" name="pushButton_2">
               <property name="toolTip">
@@ -461,8 +538,8 @@
    <slot>accept()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>244</x>
-     <y>224</y>
+     <x>250</x>
+     <y>316</y>
     </hint>
     <hint type="destinationlabel">
      <x>153</x>
@@ -477,8 +554,8 @@
    <slot>reject()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>321</x>
-     <y>227</y>
+     <x>327</x>
+     <y>316</y>
     </hint>
     <hint type="destinationlabel">
      <x>282</x>
@@ -486,5 +563,21 @@
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>uiGuiEnableProxyCheckBox</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>widget</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>73</x>
+     <y>68</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>76</x>
+     <y>95</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
 </ui>