Author: toad
Date: 2008-11-08 15:50:14 +0000 (Sat, 08 Nov 2008)
New Revision: 23424

Modified:
   trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java
   trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
Log:
If store size is set to default, don't auto-configure it, ask the user, with 
the default being the current size.
Same with bandwidth limit.


Modified: trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java  
2008-11-08 14:57:23 UTC (rev 23423)
+++ trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java  
2008-11-08 15:50:14 UTC (rev 23424)
@@ -11,6 +11,7 @@
 import freenet.client.HighLevelSimpleClient;
 import freenet.config.Config;
 import freenet.config.ConfigException;
+import freenet.config.Option;
 import freenet.config.WrapperConfig;
 import freenet.l10n.L10n;
 import freenet.node.Node;
@@ -185,13 +186,22 @@
                        HTMLNode bandwidthForm = 
ctx.addFormChild(bandwidthInfoboxContent, ".", "bwForm");
                        HTMLNode result = bandwidthForm.addChild("select", 
"name", "bw");

+                       Option sizeOption = 
config.get("node").getOption("outputBandwidthLimit");
+                       if(!sizeOption.isDefault()) {
+                               long current = (Integer)sizeOption.getValue();
+                               result.addChild("option", new String[] { 
"value", "selected" }, new String[] { SizeUtil.formatSize(current), "on" }, 
l10n("currentSpeed")+" "+SizeUtil.formatSize(current)+"/s");
+                       }
+
                        // don't forget to update handlePost too if you change 
that!
                        result.addChild("option", "value", "8K", 
l10n("bwlimitLowerSpeed"));
                        // Special case for 128kbps to increase performance at 
the cost of some link degradation. Above that we use 50% of the limit.
-                       result.addChild("option", "value", "12K", "512+/128 
kbps");
-                       result.addChild("option", new String[] { "value", 
"selected" }, new String[] { "16K", "selected" }, "1024+/256 kbps");
-                       result.addChild("option", "value", "32K", "1024+/512 
kbps");
-                       result.addChild("option", "value", "64K", "1024+/1024 
kbps");
+                       result.addChild("option", "value", "12K", "512+/128 
kbps (12KB/s)");
+                       if(!sizeOption.isDefault())
+                               result.addChild("option", "value", "16K", 
"1024+/256 kbps (16KB/s)");
+                       else
+                               result.addChild("option", new String[] { 
"value", "selected" }, new String[] { "16K", "selected" }, "1024+/256 kbps 
(16KB/s)");
+                       result.addChild("option", "value", "32K", "1024+/512 
kbps (32K/s)");
+                       result.addChild("option", "value", "64K", "1024+/1024 
kbps (64K/s)");
                        result.addChild("option", "value", "1000K", 
l10n("bwlimitHigherSpeed"));

                        bandwidthForm.addChild("input", new String[] { "type", 
"name", "value" }, new String[] { "submit", "bwF", 
L10n.getString("FirstTimeWizardToadlet.continue")});
@@ -216,9 +226,17 @@
                        HTMLNode bandwidthForm = 
ctx.addFormChild(bandwidthInfoboxContent, ".", "dsForm");
                        HTMLNode result = bandwidthForm.addChild("select", 
"name", "ds");

+                       Option sizeOption = 
config.get("node").getOption("storeSize");
+                       if(!sizeOption.isDefault()) {
+                               long current = (Long)sizeOption.getValue();
+                               result.addChild("option", new String[] { 
"value", "selected" }, new String[] { SizeUtil.formatSize(current), "on" }, 
l10n("currentPrefix")+" "+SizeUtil.formatSize(current));
+                       }
                        result.addChild("option", "value", "512M", "512MiB");
                        result.addChild("option", "value", "1G", "1GiB");
-                       result.addChild("option", new String[] { "value", 
"selected" }, new String[] { "2G", "on" }, "2GiB");
+                       if(!sizeOption.isDefault())
+                               result.addChild("option", "value", "2G", 
"2GiB");
+                       else
+                               result.addChild("option", new String[] { 
"value", "selected" }, new String[] { "2G", "on" }, "2GiB");
                        result.addChild("option", "value", "3G", "3GiB");
                        result.addChild("option", "value", "5G", "5GiB");
                        result.addChild("option", "value", "10G", "10GiB");
@@ -499,6 +517,8 @@
        }

        private boolean canAutoconfigureBandwidth() {
+               
if(!config.get("node").getOption("outputBandwidthLimit").isDefault())
+                       return false;
                FredPluginBandwidthIndicator bwIndicator = 
core.node.ipDetector.getBandwidthIndicator();
                if(bwIndicator == null)
                        return false;
@@ -524,6 +544,8 @@
        }

        private boolean canAutoconfigureDatastoreSize() {
+               if(!config.get("node").getOption("storeSize").isDefault())
+                       return false;
                // Use JNI to find out the free space on this partition.
                long freeSpace = -1;
                File dir = FileUtil.getCanonicalFile(core.node.getNodeDir());

Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2008-11-08 
14:57:23 UTC (rev 23423)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2008-11-08 
15:50:14 UTC (rev 23424)
@@ -273,6 +273,8 @@
 FirstTimeWizardToadlet.clickContinue=Click here to continue.
 FirstTimeWizardToadlet.continue=Continue
 FirstTimeWizardToadlet.continueEnd=Click here to start using Freenet!
+FirstTimeWizardToadlet.currentPrefix=Current size:
+FirstTimeWizardToadlet.currentSpeed=Current limit:
 FirstTimeWizardToadlet.datastoreSize=Datastore size
 FirstTimeWizardToadlet.datastoreSizeLong=Please select a size for your 
datastore. The datastore acts like a cache; storing data for the network will 
help you to get better throughput when requesting popular files. The more space 
you can afford the better it is for the community and the faster your node and 
especially your downloads will go.
 FirstTimeWizardToadlet.highNetworkThreatLevelWarning=${bold}WARNING${/bold}: 
You are about to set the network security level to high. This means your node 
will not be able to connect unless ${bold}you add some connections to 
Friends${/bold}. These should be people you already know and at least 
marginally trust. If you don't know anyone already using Freenet, please use 
the NORMAL network security level so that Freenet will setup connections 
automatically. Adding people you don't know as Friends will not significantly 
improve security and will harm performance. Also note that HIGH security level 
is slower, especially if you don't have many Friends (you need 5-10 for 
adequate performance).


Reply via email to