From 4e0a4fabfba5200d81d1a3dfc61c96acbb8f460b Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Tue, 7 Apr 2009 20:25:49 +0000 Subject: [PATCH] begin the preferences window --- deluge/ui/web/css/deluge.css | 1 + deluge/ui/web/index.html | 1 + deluge/ui/web/js/deluge-preferences.js | 108 +++++++++++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 deluge/ui/web/js/deluge-preferences.js diff --git a/deluge/ui/web/css/deluge.css b/deluge/ui/web/css/deluge.css index 392232b94..17a01d8eb 100644 --- a/deluge/ui/web/css/deluge.css +++ b/deluge/ui/web/css/deluge.css @@ -39,6 +39,7 @@ input { .x-deluge-error, .deluge-torrents .error { background-image: url('/icons/alert.png'); } .x-deluge-checking, .deluge-torrents .checking { background-image: url('/icons/checking.png'); } .x-deluge-dht, .x-btn .x-deluge-dht { background-image: url('/icons/dht.png'); } +.x-deluge-preferences, .x-btn .x-deluge-preferences { background-image: url('/icons/preferences.png') } .x-deluge-connections, .x-btn .x-deluge-connections { background-image: url('/icons/connections.png') } .x-deluge-traffic, .x-btn .x-deluge-traffic { background-image: url('/icons/traffic.png') } .x-deluge-edit-trackers, .x-btn .x-deluge-edit-trackers {background-image: url('/icons/edit_trackers.png'); } diff --git a/deluge/ui/web/index.html b/deluge/ui/web/index.html index f56b1f44a..8cd5daeb4 100644 --- a/deluge/ui/web/index.html +++ b/deluge/ui/web/index.html @@ -32,6 +32,7 @@ + diff --git a/deluge/ui/web/js/deluge-preferences.js b/deluge/ui/web/js/deluge-preferences.js new file mode 100644 index 000000000..7bea292c8 --- /dev/null +++ b/deluge/ui/web/js/deluge-preferences.js @@ -0,0 +1,108 @@ +/* +Script: deluge-preferences.js + Contains the preferences window. + +Copyright: + (C) Damien Churchill 2009 + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, write to: + The Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor + Boston, MA 02110-1301, USA. +*/ + +(function() { + PreferencesWindow = Ext.extend(Ext.Window, { + layout: 'border', + width: 450, + height: 450, + buttonAlign: 'right', + closeAction: 'hide', + closable: true, + iconCls: 'x-deluge-preferences', + plain: true, + resizable: false, + title: _('Preferences'), + buttons: [{ + text: _('Close') + },{ + text: _('Apply') + },{ + text: _('Ok') + }], + + initComponent: function() { + PreferencesWindow.superclass.initComponent.call(this); + + this.categoriesGrid = this.add({ + xtype: 'grid', + region: 'west', + title: _('Categories'), + store: new Ext.data.SimpleStore({ + fields: [{name: 'name', mapping: 0}] + }), + columns: [{id: 'name', renderer: fplain, dataIndex: 'name'}], + /*selModel: new Ext.grid.RowSelectionModel({ + singleSelect: true, + listeners: {'rowselect': {fn: this.onPageSelect, scope: this}} + }),*/ + hideHeaders: true, + autoExpandColumn: 'name', + margins: '5 0 5 5', + cmargins: '5 0 5 5', + width: 120, + collapsible: true + }); + + this.configPanel = this.add({ + region: 'center', + title: 'Test', + margins: '5 5 5 5', + cmargins: '5 5 5 5' + }); + + this.currentPage = null; + }, + + addPage: function(name, page) { + var store = this.categoriesGrid.getStore(); + store.loadData([[name]], true); + + if (this.currentPage == null) { + this.configPanel.setTitle(name); + this.currentPage = 0; + } + }, + + onPageSelect: function(selModel, rowIndex, r) { + this.configPanel.setTitle(r.get('name')); + }, + + onRender: function(ct, position) { + PreferencesWindow.superclass.onRender.call(this, ct, position); + //this.categoriesGrid.getSelectionModel().selectFirstRow(); + } + }); + + Deluge.Preferences = new PreferencesWindow(); +})(); +Deluge.Preferences.addPage('Downloads', {}); +Deluge.Preferences.addPage('Network', {}); +Deluge.Preferences.addPage('Bandwidth', {}); +Deluge.Preferences.addPage('Interface', {}); +Deluge.Preferences.addPage('Other', {}); +Deluge.Preferences.addPage('Daemon', {}); +Deluge.Preferences.addPage('Queue', {}); +Deluge.Preferences.addPage('Proxy', {}); +Deluge.Preferences.addPage('Notification', {}); +Deluge.Preferences.addPage('Plugins', {}); \ No newline at end of file