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

[vidalia-svn] r2951: Cleanup (vidalia/branches/exit-country/src/vidalia/config)



Author: cviecco
Date: 2008-08-11 09:04:22 -0400 (Mon, 11 Aug 2008)
New Revision: 2951

Modified:
   vidalia/branches/exit-country/src/vidalia/config/nodepolicypage.cpp
   vidalia/branches/exit-country/src/vidalia/config/nodepolicypage.h
Log:
Cleanup


Modified: vidalia/branches/exit-country/src/vidalia/config/nodepolicypage.cpp
===================================================================
--- vidalia/branches/exit-country/src/vidalia/config/nodepolicypage.cpp	2008-08-09 20:44:14 UTC (rev 2950)
+++ vidalia/branches/exit-country/src/vidalia/config/nodepolicypage.cpp	2008-08-11 13:04:22 UTC (rev 2951)
@@ -9,8 +9,8 @@
 */
 
 /*
-** \file networkoutpage.cpp
-** \version $Id: appearancepage.cpp 2362 2008-02-29 04:30:11Z cviecco $
+** \file nodepolicypage.cpp
+** \version $Id: nodepolicypage.cpp 2362 2008-02-29 04:30:11Z cviecco $
 ** \brief Displays Vidalia Node policy settings
 */
 
@@ -75,10 +75,7 @@
 bool
 NodePolicyPage::save(QString &errmsg)
 {
-  //NetworkSettings settings(Vidalia::torControl());
-  NodePolicySettings settings(Vidalia::torControl());
 
-
   Q_UNUSED(errmsg);
 
   _settings->setUseNodePolicy(ui.chkNodePolicy->isChecked());
@@ -113,14 +110,13 @@
 NodePolicyPage::load()
 {
   
-  //NetworkSettings settings(Vidalia::torControl());  
-  NodePolicySettings settings(Vidalia::torControl());
+  //NodePolicySettings settings(Vidalia::torControl());
 
 
   //load saved GUIsettings and apply
   ui.chkNodePolicy->setChecked(_settings->getUseNodePolicy()); 
-  ui.chkExitNodePolicy->setChecked(settings.getUseExitNodePolicy());
-  ui.chkExcludeNodePolicy->setChecked(settings.getUseExcludeNodePolicy());
+  ui.chkExitNodePolicy->setChecked(_settings->getUseExitNodePolicy());
+  ui.chkExcludeNodePolicy->setChecked(_settings->getUseExcludeNodePolicy());
  
   
   ui.chkCloseAllActiveCircuits->setChecked(false);
@@ -139,11 +135,11 @@
 }
 
 
+
 /* The monster function! does:
-  a. reload the internal strucuter 
+  a. reload the internal structures 
   b. fills the combo boxes
 */
-
 void
 NodePolicyPage::refresh()
 {
@@ -163,7 +159,6 @@
   vInfo("Network out refresh!\n"); 
 
   /*Fill up the internal structure*/
-  //by_country_exit_nodes.clear();
   by_country_exit_nodes2.clear();
   foreach( RouterStatus router, networkStatus){
 
@@ -175,7 +170,8 @@
      short_country_name=_geoIpResolver->get_country(router.ipAddress()).toLower();
     
  
-     //Only continue if the router is running,valid,isexit and is NOT badexit
+     /*Only continue (insert into struct)
+      * if the router is running,valid,isexit and is NOT badexit*/
      if (!router.isRunning())
       continue;
      if (!router.isValid())
@@ -185,9 +181,8 @@
      if((router.Exit) !=((router.Exit | router.BadExit) & flags) ) 
       continue;
 
-     //Get a unique name, if unnamed use the full descriptor id
+     /*Get a unique name, if unnamed use the full descriptor id*/
      uniqueRouterName=router.name();
-    
      //display names only for registered nodes, this to avoid warnings
      // on tor and assure name uniquness
      if(uniqueRouterName=="Unnamed" || (0x00== (flags & router.Named))){
@@ -196,14 +191,11 @@
 
      /*Now insert the information into the HAsh/MAp*/
      if (by_country_exit_nodes2.contains(short_country_name)){
-        //by_country_exit_nodes.insert(short_country_name, 
-        //         QStringList(by_country_exit_nodes.value(short_country_name))<<uniqueRouterName);
         by_country_exit_nodes2.insert(short_country_name,
                  QList<RouterStatus>(by_country_exit_nodes2.value(short_country_name))<<router);
 
      }
      else{
-        //by_country_exit_nodes.insert(short_country_name,QStringList()<<uniqueRouterName);
         by_country_exit_nodes2.insert(short_country_name,QList<RouterStatus>()<<router);
      }
   }
@@ -288,7 +280,6 @@
 {
   QString current=ui.cmboExitNodesbyCountry->currentText();
     
-  //fprintf(stderr,"qlen=%d",current.length());
   QStringList countrylist=current.split("(");
   
   current=countrylist.at(1);
@@ -393,14 +384,11 @@
 void
 NodePolicyPage::applyTorSettings(){
 
-  //NetworkSettings settings(Vidalia::torControl());
-  NodePolicySettings settings(Vidalia::torControl());
 
-
  /*Now save only is settings have been enabled*/
   if((ui.chkNodePolicy->isChecked())){
-    settings.setUseExitNodePolicy(ui.chkExitNodePolicy->isChecked());
-    settings.setUseExcludeNodePolicy(ui.chkExcludeNodePolicy->isChecked());
+    _settings->setUseExitNodePolicy(ui.chkExitNodePolicy->isChecked());
+    _settings->setUseExcludeNodePolicy(ui.chkExcludeNodePolicy->isChecked());
     vInfo("node pol applyset, checked!\n");
 
     /*Only save if we have enabled saving exit policies!*/
@@ -427,7 +415,7 @@
         }
         //fprintf(stderr,"exit_size=%d\n",exitList.size()); 
         //next only stores it, it does not apply it!
-        settings.setExitNodeList(exitList);     
+        _settings->setExitNodeList(exitList);     
     }
     if (ui.chkExcludeNodePolicy->isChecked()){
        QStringList excludedList;
@@ -447,7 +435,7 @@
         }
         //apply here
         //settings.setExitNodeList(exitList);
-        settings.setExcludeNodeList(excludedList);
+        _settings->setExcludeNodeList(excludedList);
     }
   }
   /*if clear connections is set, clear them up!*/
@@ -455,7 +443,7 @@
      closeAllCircuits();
   }
   /*Now we finalize by actually applying the settings!*/
-  settings.apply();
+  _settings->apply();
 }
 
 /*Get the list of selected exclude countryies from the gui*/
@@ -489,6 +477,9 @@
   return current;
 }
 
+
+/*Loads the internal map of short country names to
+full country names*/
 void
 NodePolicyPage::load_longnames(){
 

Modified: vidalia/branches/exit-country/src/vidalia/config/nodepolicypage.h
===================================================================
--- vidalia/branches/exit-country/src/vidalia/config/nodepolicypage.h	2008-08-09 20:44:14 UTC (rev 2950)
+++ vidalia/branches/exit-country/src/vidalia/config/nodepolicypage.h	2008-08-11 13:04:22 UTC (rev 2951)
@@ -9,9 +9,9 @@
 */
 
 /*
-** \file appearancepage.h
-** \version $Id: appearancepage.h 2362 2008-02-29 04:30:11Z edmanm $
-** \brief Displays Vidalia language and style settings
+** \file nodepolicypage.h
+** \version $Id: nodepolicypage.h 2362 2008-02-29 04:30:11Z cviecco $
+** \brief Displays Vidalia node policy settings
 */
 
 #ifndef _NODEPOLICYPAGE_H
@@ -28,7 +28,6 @@
 #include <filegeoipresolver.h>
 #include <geoipresolver.h>
 #include <nodepolicysettings.h>
-//#include <torsettings.h>
 
 #include "configpage.h"
 #include "ui_networkoutpage.h"
@@ -50,12 +49,12 @@
   
 private slots:
   
-  /*This is an ugly thing!*/
+  /*Hides and Unhides GUI widgets according to settings*/
   void HideUnhide();
 
   /*copies country nodes into exit node text*/
   void copyExitCountryToText();
-  /**/
+  /*copies the names of the excludes nodes into the GUI text*/
   void copyExcludedCountryToText();
 
   /*Do stuff once authenticated*/