[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r1789: Remove from the server config page the 'Address' text box, t (in trunk/src: config gui/config)



Author: edmanm
Date: 2007-06-17 09:04:42 -0400 (Sun, 17 Jun 2007)
New Revision: 1789

Modified:
   trunk/src/config/serversettings.cpp
   trunk/src/config/serversettings.h
   trunk/src/gui/config/serverpage.cpp
   trunk/src/gui/config/serverpage.h
   trunk/src/gui/config/serverpage.ui
Log:
Remove from the server config page the 'Address' text box, the 'Get Address' 
button, and 'Automatically Update' checkbox.

Modified: trunk/src/config/serversettings.cpp
===================================================================
--- trunk/src/config/serversettings.cpp	2007-06-17 11:34:45 UTC (rev 1788)
+++ trunk/src/config/serversettings.cpp	2007-06-17 13:04:42 UTC (rev 1789)
@@ -40,7 +40,6 @@
 
 /* Server-related torrc configuration parameters */
 #define SERVER_NICKNAME         "Nickname"
-#define SERVER_ADDRESS          "Address"
 #define SERVER_ORPORT           "ORPort"
 #define SERVER_DIRPORT          "DirPort"
 #define SERVER_CONTACTINFO      "ContactInfo"
@@ -81,8 +80,6 @@
   setDefault(SETTING_SERVER_BWRATE,     3145728);
   setDefault(SETTING_SERVER_BWBURST,    6291456);
   setDefault(SETTING_SERVER_NICKNAME,   "Unnamed");
-  setDefault(SETTING_SERVER_ADDRESS,    net_local_address().toString());
-  setDefault(SETTING_SERVER_AUTOUPDATE_ADDRESS, false);
   setDefault(SETTING_SERVER_EXITPOLICY,
     ExitPolicy(ExitPolicy::Default).toString());
 }
@@ -216,10 +213,6 @@
   conf.insert(SERVER_EXITPOLICY, 
     VidaliaSettings::value(SETTING_SERVER_EXITPOLICY).toString());
   
-  /* Server Address */
-  conf.insert(SERVER_ADDRESS,      
-    VidaliaSettings::value(SETTING_SERVER_ADDRESS).toString());
-  
   /* Server bandwidth settings */
   conf.insert(SERVER_BANDWIDTH_RATE,
     QString::number(VidaliaSettings::value(SETTING_SERVER_BWRATE).toUInt()) + " bytes");
@@ -256,7 +249,6 @@
     resetKeys << SERVER_ORPORT 
               << SERVER_NICKNAME 
               << SERVER_DIRPORT
-              << SERVER_ADDRESS
               << SERVER_CONTACTINFO
               << SERVER_EXITPOLICY
               << SERVER_BANDWIDTH_RATE
@@ -327,20 +319,6 @@
   return (quint16)value(SETTING_SERVER_DIRPORT).toUInt();
 }
 
-/** Sets the server's externally-reachable address. */
-void
-ServerSettings::setAddress(QString address)
-{
-  setValue(SETTING_SERVER_ADDRESS, address);
-}
-
-/** Gets the server's externally-reachable IP address or hostname. */
-QString
-ServerSettings::getAddress()
-{
-  return value(SETTING_SERVER_ADDRESS).toString();
-}
-
 /** Sets the server's nickname. */
 void
 ServerSettings::setNickname(QString nickname)
@@ -428,17 +406,3 @@
   setValue(SETTING_SERVER_BWBURST, rate);
 }
 
-/** Returns whether we should update the server's IP address automatically. */
-bool
-ServerSettings::getAutoUpdateAddress()
-{
-  return VidaliaSettings::value(SETTING_SERVER_AUTOUPDATE_ADDRESS).toBool();
-}
-
-/** Sets whether we should update the server's IP address automatically. */
-void
-ServerSettings::setAutoUpdateAddress(bool enabled)
-{
-  setValue(SETTING_SERVER_AUTOUPDATE_ADDRESS, enabled);
-}
-

Modified: trunk/src/config/serversettings.h
===================================================================
--- trunk/src/config/serversettings.h	2007-06-17 11:34:45 UTC (rev 1788)
+++ trunk/src/config/serversettings.h	2007-06-17 13:04:42 UTC (rev 1789)
@@ -68,11 +68,6 @@
   /** Gets the server's nickname. */
   QString getNickname();
   
-  /** Sets the server's external IP address. */
-  void setAddress(QString address);
-  /** Gets the server's external IP address. */
-  QString getAddress();
-
   /** Sets the server operator's contact information. */
   void setContactInfo(QString info);
   /** Gets the server operator's contact information. */
@@ -97,11 +92,6 @@
   /** Gets the maximum burst rate (in B/s) of this server. */
   quint32 getBandwidthBurstRate();
 
-  /** Sets whether we automatically update the server address or not. */
-  void setAutoUpdateAddress(bool enabled);
-  /** Gets whether we automatically update the server address. */
-  bool getAutoUpdateAddress();
-
 private:
   /** Sets a value indicating that the server settings have changed since
    * apply() was last called. */

Modified: trunk/src/gui/config/serverpage.cpp
===================================================================
--- trunk/src/gui/config/serverpage.cpp	2007-06-17 11:34:45 UTC (rev 1788)
+++ trunk/src/gui/config/serverpage.cpp	2007-06-17 13:04:42 UTC (rev 1789)
@@ -89,14 +89,7 @@
   /* Create ServerSettings object */
   _settings = new ServerSettings(_torControl);
 
-  /* Create a timer that we can use to remind ourselves to check if our IP
-   * changed since last time we looked. */
-  _autoUpdateTimer = new QTimer(this);
-  connect(_autoUpdateTimer, SIGNAL(timeout()), 
-          this, SLOT(updateServerIP()));
- 
   /* Bind events to actions */
-  connect(ui.btnGetAddress, SIGNAL(clicked()), this, SLOT(getServerAddress()));
   connect(ui.btnRateHelp, SIGNAL(clicked()), this, SLOT(bandwidthHelp()));
   connect(ui.btnExitHelp, SIGNAL(clicked()), this, SLOT(exitPolicyHelp()));
   connect(ui.cmboRate, SIGNAL(currentIndexChanged(int)),
@@ -108,7 +101,6 @@
 
   /* Set validators for address, mask and various port number fields */
   ui.lineServerNickname->setValidator(new NicknameValidator(this));
-  ui.lineServerAddress->setValidator(new DomainValidator(this));
   ui.lineServerPort->setValidator(new QIntValidator(1, 65535, this));
   ui.lineDirPort->setValidator(new QIntValidator(1, 65535, this));
   ui.lineAvgRateLimit->setValidator(
@@ -123,17 +115,6 @@
   delete _settings;
 }
 
-/** Enables or disables the automatic IP address update timer. */
-void
-ServerPage::setAutoUpdateTimer(bool enabled)
-{
-  if (enabled && _settings->isServerEnabled()) {
-    _autoUpdateTimer->start(AUTO_UPDATE_ADDR_INTERVAL);
-  } else {
-    _autoUpdateTimer->stop();
-  }
-}
-
 /** Saves changes made to settings on the Server settings page. */
 bool
 ServerPage::save(QString &errmsg)
@@ -158,15 +139,12 @@
   }
   _settings->setServerEnabled(ui.chkEnableServer->isChecked());
   _settings->setDirectoryMirror(ui.chkMirrorDirectory->isChecked());
-  _settings->setAutoUpdateAddress(ui.chkAutoUpdate->isChecked()); 
   _settings->setNickname(ui.lineServerNickname->text());
   _settings->setORPort(ui.lineServerPort->text().toUInt());
   _settings->setDirPort(ui.lineDirPort->text().toUInt());
-  _settings->setAddress(ui.lineServerAddress->text());
   _settings->setContactInfo(ui.lineServerContact->text());
   saveBandwidthLimits();
   saveExitPolicies();
-  setAutoUpdateTimer(ui.chkAutoUpdate->isChecked());
 
   /* If we're connected to Tor and we've changed the server settings, attempt
    * to apply the new settings now. */
@@ -185,13 +163,10 @@
 {
   ui.chkEnableServer->setChecked(_settings->isServerEnabled());
   ui.chkMirrorDirectory->setChecked(_settings->isDirectoryMirror());
-  ui.chkAutoUpdate->setChecked(_settings->getAutoUpdateAddress());
-  setAutoUpdateTimer(_settings->getAutoUpdateAddress());
 
   ui.lineServerNickname->setText(_settings->getNickname());
   ui.lineServerPort->setText(QString::number(_settings->getORPort()));
   ui.lineDirPort->setText(QString::number(_settings->getDirPort()));
-  ui.lineServerAddress->setText(_settings->getAddress());
   ui.lineServerContact->setText(_settings->getContactInfo());
   loadBandwidthLimits();
   loadExitPolicies();
@@ -213,82 +188,6 @@
   Vidalia::help(BANDWIDTH_HELP);
 }
 
-/** Accesses an external site to try to get the user's public IP address. */
-void
-ServerPage::getServerPublicIP()
-{
-  QString ip;
-  bool success;
-
-  /* This could take a bit, so show the wait cursor. */
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  success = net_get_public_ip(ip);
-  QApplication::restoreOverrideCursor();
-  
-  /* Handle the result */
-  if (success) {
-    ui.lineServerAddress->setText(ip);
-  } else {
-    VMessageBox::warning(this, tr("Error"),
-      p(tr("Vidalia was unable to determine your public IP address.")),
-      VMessageBox::Ok);
-  }
-}
-
-/** Attempts to determine this machine's IP address. If the local IP address
- * is a private address, then the user is asked whether they would like to
- * access an external site to try to get their public IP. */
-void
-ServerPage::getServerAddress()
-{
-  QHostAddress addr = net_local_address();
-  if (net_is_private_address(addr)) {
-    int button = VMessageBox::information(this, tr("Get Address"),
-                   tr("Vidalia was only able to find a private IP " 
-                      "address for your server.\n\nWould you like to "
-                      "access an external service to determine your public " 
-                      "IP address?"),
-                    VMessageBox::Yes, VMessageBox::No);
-    if (button == VMessageBox::Yes) {
-      getServerPublicIP();
-      return;
-    }
-  } else {
-    ui.lineServerAddress->setText(addr.toString());
-  }
-}
-
-/** Checks to see if this server's public IP had changed. If it has, then
- * update the UI, and Tor (if it's running). */
-void
-ServerPage::updateServerIP()
-{
-  bool changed = false;
-  QString ip;
-  QHostAddress addr = net_local_address();
-  
-  if (net_is_private_address(addr)) {
-    /* Try to get our public IP and see if it changed recently. */
-    if (net_get_public_ip(ip) && ip != _settings->getAddress()) {
-      changed = true;
-    }
-  } else if (addr.toString() != _settings->getAddress()) {
-    ip = addr.toString();
-    changed = true;
-  }
-  
-  if (changed) {
-    /* It changed so update our settings and the UI. */
-    _settings->setAddress(ip);
-    ui.lineServerAddress->setText(ip);
-
-    /* If Tor is running, let it know about the change */
-    if (_torControl->isConnected()) {
-      _settings->apply();
-    }
-  }
-}
-
 /** Loads the server's bandwidth average and burst limits. */
 void
 ServerPage::loadBandwidthLimits()

Modified: trunk/src/gui/config/serverpage.h
===================================================================
--- trunk/src/gui/config/serverpage.h	2007-06-17 11:34:45 UTC (rev 1788)
+++ trunk/src/gui/config/serverpage.h	2007-06-17 13:04:42 UTC (rev 1789)
@@ -54,14 +54,10 @@
   void load();
 
 private slots:
-  /** Called when the user clicks "Get Address" to guess our local IP */
-  void getServerAddress();
   /** Called when the user clicks the bandwidth help button */
   void bandwidthHelp();
   /** Called when the user clicks the exit policy help button */
   void exitPolicyHelp();
-  /** Called when the user's public IP address needs to be updated. */
-  void updateServerIP();
 	/** Called when the user selects a new value from the rate combo box */
 	void rateChanged(int rate);
   /** Called when the user edits the max or average bandwidth limits. */
@@ -78,12 +74,8 @@
     CustomBwLimits   /**< Custom bandwidth limits */
   };
   
-  /** Attempts to find the server's public IP address */
-  void getServerPublicIP(); 
   /** Returns the index of the selected item in lstExitPolicies */
   int selectedIndex();
-  /** Enables or disables the automatic update timer. */
-  void setAutoUpdateTimer(bool enabled);
   
   /** Saves the server's bandwidth average and burst limits. */
   void saveBandwidthLimits();
@@ -99,8 +91,6 @@
   /** A ServerSettings object used to get and set information about how a
    * local Tor server is configured. */
   ServerSettings*  _settings;
-  /** A timer that tells us when it's time to check if our server IP changed.*/
-  QTimer* _autoUpdateTimer;
 
   /** Qt Designer generated object */
   Ui::ServerPage ui;

Modified: trunk/src/gui/config/serverpage.ui
===================================================================
--- trunk/src/gui/config/serverpage.ui	2007-06-17 11:34:45 UTC (rev 1788)
+++ trunk/src/gui/config/serverpage.ui	2007-06-17 13:04:42 UTC (rev 1789)
@@ -556,45 +556,7 @@
             </property>
            </spacer>
           </item>
-          <item row="4" column="0" >
-           <widget class="QLabel" name="label_4" >
-            <property name="contextMenuPolicy" >
-             <enum>Qt::NoContextMenu</enum>
-            </property>
-            <property name="text" >
-             <string>Address:</string>
-            </property>
-            <property name="alignment" >
-             <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
-            </property>
-            <property name="margin" >
-             <number>0</number>
-            </property>
-            <property name="indent" >
-             <number>21</number>
-            </property>
-           </widget>
-          </item>
-          <item row="4" column="4" >
-           <widget class="QPushButton" name="btnGetAddress" >
-            <property name="minimumSize" >
-             <size>
-              <width>0</width>
-              <height>0</height>
-             </size>
-            </property>
-            <property name="contextMenuPolicy" >
-             <enum>Qt::NoContextMenu</enum>
-            </property>
-            <property name="toolTip" >
-             <string>Attempts to determine the correct address for your server</string>
-            </property>
-            <property name="text" >
-             <string>Get Address</string>
-            </property>
-           </widget>
-          </item>
-          <item row="5" column="7" colspan="2" >
+          <item row="4" column="7" colspan="2" >
            <spacer>
             <property name="orientation" >
              <enum>Qt::Horizontal</enum>
@@ -688,7 +650,7 @@
             </property>
            </widget>
           </item>
-          <item row="5" column="3" colspan="3" >
+          <item row="4" column="3" colspan="3" >
            <layout class="QHBoxLayout" >
             <property name="margin" >
              <number>0</number>
@@ -749,51 +711,6 @@
             </item>
            </layout>
           </item>
-          <item row="4" column="1" colspan="3" >
-           <widget class="QLineEdit" name="lineServerAddress" >
-            <property name="sizePolicy" >
-             <sizepolicy>
-              <hsizetype>0</hsizetype>
-              <vsizetype>0</vsizetype>
-              <horstretch>0</horstretch>
-              <verstretch>0</verstretch>
-             </sizepolicy>
-            </property>
-            <property name="minimumSize" >
-             <size>
-              <width>105</width>
-              <height>0</height>
-             </size>
-            </property>
-            <property name="maximumSize" >
-             <size>
-              <width>105</width>
-              <height>16777215</height>
-             </size>
-            </property>
-            <property name="cursor" >
-             <cursor>4</cursor>
-            </property>
-            <property name="contextMenuPolicy" >
-             <enum>Qt::NoContextMenu</enum>
-            </property>
-            <property name="toolTip" >
-             <string>Domain name or IP address of your server</string>
-            </property>
-            <property name="inputMask" >
-             <string/>
-            </property>
-            <property name="text" >
-             <string/>
-            </property>
-            <property name="maxLength" >
-             <number>255</number>
-            </property>
-            <property name="alignment" >
-             <set>Qt::AlignLeading</set>
-            </property>
-           </widget>
-          </item>
           <item row="2" column="1" colspan="7" >
            <widget class="QLineEdit" name="lineServerContact" >
             <property name="cursor" >
@@ -828,7 +745,7 @@
             </property>
            </widget>
           </item>
-          <item row="5" column="0" colspan="3" >
+          <item row="4" column="0" colspan="3" >
            <widget class="QCheckBox" name="chkMirrorDirectory" >
             <property name="contextMenuPolicy" >
              <enum>Qt::NoContextMenu</enum>
@@ -841,19 +758,6 @@
             </property>
            </widget>
           </item>
-          <item row="4" column="6" colspan="2" >
-           <widget class="QCheckBox" name="chkAutoUpdate" >
-            <property name="contextMenuPolicy" >
-             <enum>Qt::NoContextMenu</enum>
-            </property>
-            <property name="toolTip" >
-             <string>When enabled, Vidalia will periodically update your IP address if necessary</string>
-            </property>
-            <property name="text" >
-             <string>Automatically Update</string>
-            </property>
-           </widget>
-          </item>
           <item row="4" column="8" >
            <spacer>
             <property name="orientation" >
@@ -1509,8 +1413,6 @@
   <tabstop>chkIRC</tabstop>
   <tabstop>chkMisc</tabstop>
   <tabstop>btnExitHelp</tabstop>
-  <tabstop>btnGetAddress</tabstop>
-  <tabstop>chkAutoUpdate</tabstop>
  </tabstops>
  <resources/>
  <connections>