]> jfr.im git - irc/quakenet/qwebirc.git/blobdiff - js/ui/panes/options.js
use home-made string hashset/map instead of js default
[irc/quakenet/qwebirc.git] / js / ui / panes / options.js
index 4778efb52423b971de90847b3cfa36f32ebc8c9c..879dc2b79d81d8a75830d80259b6dd927ee73312 100644 (file)
@@ -20,7 +20,7 @@ qwebirc.config.DEFAULT_OPTIONS = [
         return [false, false]; /* [disabled, default_value] */
       return [true];
     },
-    get: function(value, ui) {
+    applyChanges: function(value, ui) {
       if(ui.setBeepOnMention)
         ui.setBeepOnMention(value);
     }
@@ -45,11 +45,13 @@ qwebirc.config.DEFAULT_OPTIONS = [
   [11, "STYLE_HUE", "Adjust user interface hue", function() {
     return {class_: qwebirc.config.HueOption, default_: 210};
   }, {
-    get: function(value, ui) {
-      ui.setModifiableStylesheetValues(value, 0, 0);
+    applyChanges: function(value, ui) {
+      ui.setModifiableStylesheetValues({hue: value});
     }
   }],
-  [12, "QUERY_ON_NICK_CLICK", "Query on nickname click in channel", false]
+  [12, "QUERY_ON_NICK_CLICK", "Query on nickname click in channel", false],
+  [13, "SHOW_NICKLIST", "Show nickname list in channels", true],
+  [14, "SHOW_TIMESTAMPS", "Show timestamps", true] /* we rely on the hue update */
 ];
 
 qwebirc.config.DefaultOptions = null;
@@ -85,9 +87,8 @@ qwebirc.config.Input = new Class({
   render: function() {
     this.event("render", this.mainElement);
   },
-  get: function(value) {
-    this.event("get", [value, this.parentObject.optionObject.ui]);
-    return value;
+  applyChanges: function() {
+    this.event("applyChanges", [this.get(), this.parentObject.optionObject.ui]);
   },
   event: function(name, x) {
     if(!$defined(this.option.extras))
@@ -114,7 +115,7 @@ qwebirc.config.TextInput = new Class({
     this.parent();
   },
   get: function() {
-    return this.parent(this.mainElement.value);
+    return this.mainElement.value;
   }
 });
 
@@ -141,7 +142,7 @@ qwebirc.config.HueInput = new Class({
     
     slider.addEvent("change", function(step) {
       this.value = step;
-      this.get();
+      this.applyChanges();
     }.bind(this));
     this.mainElement = i;
     
@@ -151,11 +152,11 @@ qwebirc.config.HueInput = new Class({
     this.parent();
   },
   get: function() {
-    return this.parent(this.value);
+    return this.value;
   },
   cancel: function() {
     this.value = this.startValue;
-    this.get();
+    this.applyChanges();
   }
 });
 
@@ -171,7 +172,7 @@ qwebirc.config.CheckInput = new Class({
     this.parent();
   },
   get: function() {
-    return this.parent(this.mainElement.checked);
+    return this.mainElement.checked;
   }
 });
 
@@ -200,7 +201,7 @@ qwebirc.config.RadioInput = new Class({
       var x = this.elements[i];
       if(x.checked) {
         this.option.position = i;
-        return this.parent(this.option.options[i][1]);
+        return this.option.options[i][1];
       }
     }
   }
@@ -398,6 +399,9 @@ qwebirc.ui.OptionsPane = new Class({
       var box = x[1];
       this.optionObject.setValue(option, box.get());
     }.bind(this));
+    this.boxList.forEach(function(x) {
+      x[1].applyChanges();
+    }.bind(this));
     this.optionObject.flush();
   },
   cancel: function() {
@@ -433,7 +437,7 @@ qwebirc.ui.CookieOptions = new Class({
 qwebirc.ui.SuppliedArgOptions = new Class({
   Extends: qwebirc.ui.CookieOptions,
   initialize: function(ui, arg) {
-    var p = {};
+    var p = new QHash();
     
     if($defined(arg) && arg != "" && arg.length > 2) {
       var checksum = arg.substr(arg.length - 2, 2);
@@ -441,9 +445,9 @@ qwebirc.ui.SuppliedArgOptions = new Class({
       
       if(decoded && (new qwebirc.util.crypto.MD5().digest(decoded).slice(0, 2) == checksum)) {
         var p2 = qwebirc.util.parseURI("?" + decoded);
-        for(var k in p2) {
-          p[k] = JSON.decode(p2[k], true);
-        }
+        p2.each(function(k, v) {
+          p.put(k, JSON.decode(v, true));
+        });
       }
     }
     
@@ -454,7 +458,7 @@ qwebirc.ui.SuppliedArgOptions = new Class({
     if(x.settableByURL !== true)
       return this.parent(x);
 
-    var opt = this.parsedOptions[x.optionId];
+    var opt = this.parsedOptions.get(String(x.optionId));
     if(!$defined(opt))
       return this.parent(x);