}
+#kiwi.theme_relaxed .applet > div.settings button.save {
+ padding:1em 2em;
+ border:1px solid gray; border-radius:3px;
+}
+#kiwi.theme_relaxed .applet > div.settings tr {
+ border-bottom: 1px dashed black;
+}
+#kiwi.theme_relaxed .applet > div.settings td.label {
+ font-weight: bold;
+}
+#kiwi.theme_relaxed .applet > div.settings tr.save {
+ text-align: right;
+}
/**
loadSettings: function () {\r
var settings = _kiwi.global.settings;\r
\r
- this.$el.find('.setting-theme').val(settings.get('theme') || 'relaxed');\r
+ // TODO: Tidy this up\r
+ var theme = settings.get('theme') || 'relaxed';\r
+ this.$el.find('.setting-theme option').filter(function() {\r
+ return $(this).val() === theme;\r
+ }).attr('selected', true);\r
+\r
+ var list_style = settings.get('channel_list_style') || 'tabs';\r
+ this.$el.find('.setting-channel_list_style option').filter(function() {\r
+ return $(this).val() === list_style;\r
+ }).attr('selected', true);\r
+\r
this.$el.find('.setting-scrollback').val(settings.get('scrollback') || '250');\r
\r
if (typeof settings.get('show_joins_parts') === 'undefined' || settings.get('show_joins_parts')) {\r
saveSettings: function () {\r
var settings = _kiwi.global.settings;\r
\r
+ // Stop settings being updated while we're saving one by one\r
+ _kiwi.global.settings.off('change', this.loadSettings, this);\r
+\r
settings.set('theme', $('.setting-theme', this.$el).val());\r
+ settings.set('channel_list_style', $('.setting-channel_list_style', this.$el).val());\r
settings.set('scrollback', $('.setting-scrollback', this.$el).val());\r
settings.set('show_joins_parts', $('.setting-show_joins_parts', this.$el).is(':checked'));\r
\r
settings.save();\r
+\r
+ // Continue listening for setting changes\r
+ _kiwi.global.settings.on('change', this.loadSettings, this);\r
}\r
});\r
\r
<div class="settings">\r
<table>\r
<tr>\r
- <td>Theme</td>\r
- <td>\r
+ <td class="label">Theme</td>\r
+ <td class="setting">\r
<select class="setting-theme">\r
<option value="relaxed">Relaxed</option>\r
<option value="mini">Mini</option>\r
</td>\r
</tr>\r
<tr>\r
- <td>Scrollback</td>\r
- <td><input type="text" class="setting-scrollback" value="150" /></td>\r
+ <td class="label">Channel list</td>\r
+ <td class="setting">\r
+ <select class="setting-channel_list_style">\r
+ <option value="list">List</option>\r
+ <option value="tabs">Tabs</option>\r
+ </select>\r
+\r
+ <i style="font-size:0.9em;">Lots of channels? `List` may be more suited</i>\r
+ </td>\r
+ </tr>\r
+ <tr>\r
+ <td class="label">Scrollback</td>\r
+ <td class="setting"><input type="text" class="setting-scrollback" value="150" /></td>\r
</tr>\r
\r
<tr>\r
- <td>Show joins/parts</td>\r
- <td><input type="checkbox" class="setting-show_joins_parts" /></td>\r
+ <td class="label">Show joins/parts</td>\r
+ <td class="setting"><input type="checkbox" class="setting-show_joins_parts" /></td>\r
</tr>\r
- </table>\r
\r
- <button class="save">Save</button>\r
+ <tr class="save">\r
+ <td colspan="2"><button class="save">Save</button></td>\r
+ </tr>\r
+ </table>\r
</div>\r
</script>\r
\r
_kiwi.global.settings.on('change:theme', this.updateTheme, this);\r
this.updateTheme(getQueryVariable('theme'));\r
\r
+ _kiwi.global.settings.on('change:channel_list_style', this.setTabLayout, this);\r
+ this.setTabLayout(_kiwi.global.settings.get('channel_list_style'));\r
+\r
this.doLayout();\r
\r
$(document).keydown(this.setKeyFocus);\r
},\r
\r
\r
+ setTabLayout: function (layout_style) {\r
+ // If called by the settings callback, get the correct new_value\r
+ if (layout_style === _kiwi.global.settings) {\r
+ layout_style = arguments[1];\r
+ }\r
+ \r
+ if (layout_style == 'list') {\r
+ this.$el.addClass('chanlist_treeview');\r
+ } else {\r
+ this.$el.removeClass('chanlist_treeview');\r
+ }\r
+ \r
+ this.doLayout();\r
+ },\r
+\r
+\r
// Globally shift focus to the command input box on a keypress\r
setKeyFocus: function (ev) {\r
// If we're copying text, don't shift focus\r
},\r
\r
\r
- toggleLayout: function () {\r
- this.$el.toggleClass('chanlist_treeview');\r
- this.doLayout();\r
- },\r
-\r
-\r
alertWindow: function (title) {\r
if (!this.alertWindowTimer) {\r
this.alertWindowTimer = new (function () {\r