]> jfr.im git - irc/quakenet/qwebirc.git/blobdiff - js/ui/panes/options.js
add spinner to connect dialog
[irc/quakenet/qwebirc.git] / js / ui / panes / options.js
index 4e9698087d11d641a572459351d7daef954af673..1d1f73c6b4a99d58e5f7b648bad62b05cde0d99c 100644 (file)
@@ -14,15 +14,21 @@ qwebirc.ui.supportsFocus = function() {
  * settableByURL...
  */
 qwebirc.config.DEFAULT_OPTIONS = [
-  [1, "BEEP_ON_MENTION", "Beep when nick mentioned or on query activity (requires Flash)", true, {
+  [1, "BEEP_ON_MENTION", "Beep on activity", true, {
+    applyChanges: function(value, ui) {
+      if(ui.setBeepOnMention)
+        ui.setBeepOnMention(value);
+    }
+  }],
+  [16, "NOTIFICATIONS", "Emit HTML5 notifications on activity", false, {
     enabled: function() {
-      if(!$defined(Browser.Plugins.Flash) || Browser.Plugins.Flash.version < 8)
+      if(!("Notification" in window))
         return [false, false]; /* [disabled, default_value] */
       return [true];
     },
     applyChanges: function(value, ui) {
-      if(ui.setBeepOnMention)
-        ui.setBeepOnMention(value);
+      if(ui.setNotifications)
+        ui.setNotifications(value);
     }
   }],
   [7, "FLASH_ON_MENTION", "Flash titlebar when nick mentioned or on query activity", true, {
@@ -31,27 +37,41 @@ qwebirc.config.DEFAULT_OPTIONS = [
   [2, "DEDICATED_MSG_WINDOW", "Send privmsgs to dedicated messages window", false],
   [4, "DEDICATED_NOTICE_WINDOW", "Send notices to dedicated message window", false],
   [3, "NICK_OV_STATUS", "Show status (@/+) before nicknames in channel lines", true],
-  [5, "ACCEPT_SERVICE_INVITES", "Automatically join channels when invited by Q", false, {
-    settableByURL: false
-  }],
-  [6, "USE_HIDDENHOST", "Hide your hostmask when authed to Q (+x)", true, {
-    settableByURL: false
-  }],
+  /* 5 and 6 are reserved */
   [8, "LASTPOS_LINE", "Show a last position indicator for each window", true, {
     enabled: qwebirc.ui.supportsFocus
   }],
   [9, "NICK_COLOURS", "Automatically colour nicknames", false],
   [10, "HIDE_JOINPARTS", "Hide JOINS/PARTS/QUITS", false],
-  [11, "STYLE_HUE", "Adjust user interface hue", function() {
-    return {class_: qwebirc.config.HueOption, default_: 210};
+  [11, "STYLE_HUE", "Adjust user interface hue", function(ui) {
+    return {class_: qwebirc.config.HueOption, default_: ui.__styleValues.hue};
   }, {
     applyChanges: function(value, ui) {
       ui.setModifiableStylesheetValues({hue: value});
     }
   }],
   [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 */
+  [13, "SHOW_NICKLIST", "Show nickname list in channels", qwebirc.util.deviceHasKeyboard()],
+  [14, "SHOW_TIMESTAMPS", "Show timestamps", true], /* we rely on the hue update */
+  [15, "SIDE_TABS", "Show tabs on the side", false, {
+    enabled: function() {
+      if(Browser.Engine.trident && Browser.Engine.version < 8)
+        return [false, false]; /* [disabled, default_value] */
+      return [true];
+    },
+    applyChanges: function(value, ui) {
+      ui.setSideTabs(value);
+    }
+  }]
+];
+
+qwebirc.config.QUAKENET_OPTIONS = [
+  [5, "ACCEPT_SERVICE_INVITES", "Automatically join channels when invited by Q", false, {
+    settableByURL: false
+  }],
+  [6, "USE_HIDDENHOST", "Hide your hostmask when authed to Q (+x)", true, {
+    settableByURL: false
+  }]
 ];
 
 qwebirc.config.DefaultOptions = null;
@@ -281,13 +301,14 @@ qwebirc.config.HueOption = new Class({
 
 qwebirc.ui.Options = new Class({
   initialize: function(ui) {
+    this.ui = ui;
+
     if(!$defined(qwebirc.config.DefaultOptions))
       this.__configureDefaults();
     
     this.optionList = qwebirc.config.DefaultOptions.slice();
-    this.optionHash = {}
-    this.ui = ui;
-    
+    this.optionHash = {};
+
     this._setup();
     this.optionList.forEach(function(x) {
       x.setSavedValue(this._get(x));
@@ -296,7 +317,17 @@ qwebirc.ui.Options = new Class({
     }.bind(this));
   },
   __configureDefaults: function() {
-    qwebirc.config.DefaultOptions = qwebirc.config.DEFAULT_OPTIONS.map(function(x) {
+    var combined = qwebirc.config.DEFAULT_OPTIONS.slice(0);
+
+    var xo = null;
+    if(this.ui.options.networkName == "QuakeNet") /* HACK */
+      xo = qwebirc.config.QUAKENET_OPTIONS;
+
+    if(xo)
+      for(var i=0;i<xo.length;i++)
+        combined.push(xo[i]);
+
+    qwebirc.config.DefaultOptions = combined.map(function(x) {
       var optionId = x[0];
       var prefix = x[1];
       var label = x[2];
@@ -312,7 +343,7 @@ qwebirc.ui.Options = new Class({
         if(stype == "boolean") {
           type = qwebirc.config.CheckOption;
         } else if(stype == "function") {
-          var options = default_();
+          var options = default_.call(this, this.ui);
           type = options.class_;
           default_ = options.default_;
         } else {
@@ -320,12 +351,16 @@ qwebirc.ui.Options = new Class({
         }
         return new type(optionId, prefix, label, default_, moreextras);
       }
-    });
+    }, this);
   },
   setValue: function(option, value) {
     this.optionHash[option.prefix].value = value;
     this[option.prefix] = value;
   },
+  setValueByPrefix: function(prefix, value) {
+    this.optionHash[prefix].value = value;
+    this[prefix] = value;
+  },
   getOptionList: function() {
     return this.optionList;
   },