From dd866f07de812b1a78620879368b89566c3a120d Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Thu, 18 Mar 2010 22:56:18 +0000 Subject: [PATCH] big refactor to meet the new coding style to allow for tidier namespaces --- .../ui/web/js/deluge-all/Deluge.Add.File.js | 6 +- deluge/ui/web/js/deluge-all/Deluge.Add.Url.js | 12 +-- deluge/ui/web/js/deluge-all/Deluge.Add.js | 30 +++---- .../js/deluge-all/Deluge.ConnectionManager.js | 58 ++++++------- .../js/deluge-all/Deluge.Details.Details.js | 10 +-- .../web/js/deluge-all/Deluge.Details.Files.js | 18 ++-- .../js/deluge-all/Deluge.Details.Options.js | 18 ++-- .../web/js/deluge-all/Deluge.Details.Peers.js | 10 +-- .../js/deluge-all/Deluge.Details.Status.js | 10 +-- deluge/ui/web/js/deluge-all/Deluge.Details.js | 18 ++-- .../web/js/deluge-all/Deluge.EditTrackers.js | 32 ++++---- deluge/ui/web/js/deluge-all/Deluge.Events.js | 20 ++--- deluge/ui/web/js/deluge-all/Deluge.Login.js | 24 +++--- deluge/ui/web/js/deluge-all/Deluge.Menus.js | 82 +++++++++---------- .../web/js/deluge-all/Deluge.MoveStorage.js | 16 ++-- .../Deluge.Preferences.Bandwidth.js | 14 ++-- .../js/deluge-all/Deluge.Preferences.Cache.js | 14 ++-- .../deluge-all/Deluge.Preferences.Daemon.js | 12 +-- .../Deluge.Preferences.Downloads.js | 14 ++-- .../Deluge.Preferences.Encryption.js | 14 ++-- .../Deluge.Preferences.Interface.js | 18 ++-- .../deluge-all/Deluge.Preferences.Network.js | 14 ++-- .../js/deluge-all/Deluge.Preferences.Other.js | 12 +-- .../deluge-all/Deluge.Preferences.Plugins.js | 32 ++++---- .../js/deluge-all/Deluge.Preferences.Proxy.js | 26 +++--- .../js/deluge-all/Deluge.Preferences.Queue.js | 12 +-- .../web/js/deluge-all/Deluge.Preferences.js | 14 ++-- deluge/ui/web/js/deluge-all/Deluge.Sidebar.js | 43 +++++++--- .../ui/web/js/deluge-all/Deluge.Statusbar.js | 24 +++--- deluge/ui/web/js/deluge-all/Deluge.Toolbar.js | 34 ++++---- .../ui/web/js/deluge-all/Deluge.Torrents.js | 20 ++--- deluge/ui/web/js/deluge-all/Deluge.UI.js | 58 ++++++------- deluge/ui/web/js/deluge-all/Deluge.js | 55 ++++++++----- deluge/ui/web/server.py | 2 +- 34 files changed, 414 insertions(+), 382 deletions(-) diff --git a/deluge/ui/web/js/deluge-all/Deluge.Add.File.js b/deluge/ui/web/js/deluge-all/Deluge.Add.File.js index fbf947bfd..ccab81652 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Add.File.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Add.File.js @@ -33,7 +33,7 @@ Copyright: */ Ext.namespace('Ext.deluge.add'); -Ext.deluge.add.FileWindow = Ext.extend(Ext.deluge.add.Window, { +Deluge.add.FileWindow = Ext.extend(Deluge.add.Window, { constructor: function(config) { config = Ext.apply({ layout: 'fit', @@ -47,11 +47,11 @@ Ext.deluge.add.FileWindow = Ext.extend(Ext.deluge.add.Window, { title: _('Add from File'), iconCls: 'x-deluge-add-file' }, config); - Ext.deluge.add.FileWindow.superclass.constructor.call(this, config); + Deluge.add.FileWindow.superclass.constructor.call(this, config); }, initComponent: function() { - Ext.deluge.add.FileWindow.superclass.initComponent.call(this); + Deluge.add.FileWindow.superclass.initComponent.call(this); this.addButton(_('Add'), this.onAddClick, this); this.form = this.add({ diff --git a/deluge/ui/web/js/deluge-all/Deluge.Add.Url.js b/deluge/ui/web/js/deluge-all/Deluge.Add.Url.js index df3aca013..1cd94cf5b 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Add.Url.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Add.Url.js @@ -32,8 +32,8 @@ Copyright: */ -Ext.namespace('Ext.deluge.add'); -Ext.deluge.add.UrlWindow = Ext.extend(Ext.deluge.add.Window, { +Ext.namespace('Deluge.add'); +Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, { constructor: function(config) { config = Ext.apply({ layout: 'fit', @@ -47,11 +47,11 @@ Ext.deluge.add.UrlWindow = Ext.extend(Ext.deluge.add.Window, { title: _('Add from Url'), iconCls: 'x-deluge-add-url-window-icon' }, config); - Ext.deluge.add.UrlWindow.superclass.constructor.call(this, config); + Deluge.add.UrlWindow.superclass.constructor.call(this, config); }, initComponent: function() { - Ext.deluge.add.UrlWindow.superclass.initComponent.call(this); + Deluge.add.UrlWindow.superclass.initComponent.call(this); this.addButton(_('Add'), this.onAddClick, this); var form = this.add({ @@ -86,7 +86,7 @@ Ext.deluge.add.UrlWindow = Ext.extend(Ext.deluge.add.Window, { var cookies = this.cookieField.getValue(); var torrentId = this.createTorrentId(); - Deluge.Client.web.download_torrent_from_url(url, cookies, { + deluge.client.web.download_torrent_from_url(url, cookies, { success: this.onDownload, scope: this, torrentId: torrentId @@ -97,7 +97,7 @@ Ext.deluge.add.UrlWindow = Ext.extend(Ext.deluge.add.Window, { onDownload: function(filename, obj, resp, req) { this.urlField.setValue(''); - Deluge.Client.web.get_torrent_info(filename, { + deluge.client.web.get_torrent_info(filename, { success: this.onGotInfo, scope: this, filename: filename, diff --git a/deluge/ui/web/js/deluge-all/Deluge.Add.js b/deluge/ui/web/js/deluge-all/Deluge.Add.js index 2f1557395..97029e7b9 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Add.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Add.js @@ -32,8 +32,8 @@ Copyright: */ -Ext.namespace('Ext.deluge.add'); -Ext.deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { +Ext.namespace('Deluge.add'); +Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { torrents: {}, @@ -44,11 +44,11 @@ Ext.deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { activeTab: 0, height: 220 }, config); - Ext.deluge.add.OptionsPanel.superclass.constructor.call(this, config); + Deluge.add.OptionsPanel.superclass.constructor.call(this, config); }, initComponent: function() { - Ext.deluge.add.OptionsPanel.superclass.initComponent.call(this); + Deluge.add.OptionsPanel.superclass.initComponent.call(this); this.files = this.add(new Ext.ux.tree.TreeGrid({ layout: 'fit', title: _('Files'), @@ -237,7 +237,7 @@ Ext.deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { 'max_upload_slots_per_torrent','max_upload_speed_per_torrent', 'prioritize_first_last_pieces']; - Deluge.Client.core.get_config_values(keys, { + deluge.client.core.get_config_values(keys, { success: function(config) { var options = { 'file_priorities': [], @@ -343,9 +343,9 @@ Ext.deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { } }); -Ext.deluge.add.Window = Ext.extend(Ext.Window, { +Deluge.add.Window = Ext.extend(Ext.Window, { initComponent: function() { - Ext.deluge.add.Window.superclass.initComponent.call(this); + Deluge.add.Window.superclass.initComponent.call(this); this.addEvents( 'beforeadd', 'add' @@ -357,7 +357,7 @@ Ext.deluge.add.Window = Ext.extend(Ext.Window, { } }); -Ext.deluge.add.AddWindow = Ext.extend(Ext.deluge.add.Window, { +Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { constructor: function(config) { config = Ext.apply({ @@ -372,11 +372,11 @@ Ext.deluge.add.AddWindow = Ext.extend(Ext.deluge.add.Window, { plain: true, iconCls: 'x-deluge-add-window-icon' }, config); - Ext.deluge.add.AddWindow.superclass.constructor.call(this, config); + Deluge.add.AddWindow.superclass.constructor.call(this, config); }, initComponent: function() { - Ext.deluge.add.AddWindow.superclass.initComponent.call(this); + Deluge.add.AddWindow.superclass.initComponent.call(this); this.addButton(_('Cancel'), this.onCancelClick, this); this.addButton(_('Add'), this.onAddClick, this); @@ -453,7 +453,7 @@ Ext.deluge.add.AddWindow = Ext.extend(Ext.deluge.add.Window, { }) }); - this.optionsPanel = this.add(new Ext.deluge.add.OptionsPanel()); + this.optionsPanel = this.add(new Deluge.add.OptionsPanel()); this.on('hide', this.onHide, this); this.on('show', this.onShow, this); }, @@ -474,7 +474,7 @@ Ext.deluge.add.AddWindow = Ext.extend(Ext.deluge.add.Window, { }); }, this); - Deluge.Client.web.add_torrents(torrents, { + deluge.client.web.add_torrents(torrents, { success: function(result) { } }) @@ -515,13 +515,13 @@ Ext.deluge.add.AddWindow = Ext.extend(Ext.deluge.add.Window, { onShow: function() { if (!this.url) { - this.url = new Ext.deluge.add.UrlWindow(); + this.url = new Deluge.add.UrlWindow(); this.url.on('beforeadd', this.onTorrentBeforeAdd, this); this.url.on('add', this.onTorrentAdd, this); } if (!this.file) { - this.file = new Ext.deluge.add.FileWindow(); + this.file = new Deluge.add.FileWindow(); this.file.on('beforeadd', this.onTorrentBeforeAdd, this); this.file.on('add', this.onTorrentAdd, this); } @@ -558,4 +558,4 @@ Ext.deluge.add.AddWindow = Ext.extend(Ext.deluge.add.Window, { this.url.show(); } }); -Deluge.Add = new Ext.deluge.add.AddWindow(); +Deluge.Add = new Deluge.add.AddWindow(); diff --git a/deluge/ui/web/js/deluge-all/Deluge.ConnectionManager.js b/deluge/ui/web/js/deluge-all/Deluge.ConnectionManager.js index 39feaed50..9ed17dd11 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.ConnectionManager.js +++ b/deluge/ui/web/js/deluge-all/Deluge.ConnectionManager.js @@ -37,7 +37,7 @@ Copyright: return value + ':' + r.data['port'] } - Ext.deluge.AddConnectionWindow = Ext.extend(Ext.Window, { + Deluge.AddConnectionWindow = Ext.extend(Ext.Window, { constructor: function(config) { config = Ext.apply({ @@ -52,11 +52,11 @@ Copyright: title: _('Add Connection'), iconCls: 'x-deluge-add-window-icon' }, config); - Ext.deluge.AddConnectionWindow.superclass.constructor.call(this, config); + Deluge.AddConnectionWindow.superclass.constructor.call(this, config); }, initComponent: function() { - Ext.deluge.AddConnectionWindow.superclass.initComponent.call(this); + Deluge.AddConnectionWindow.superclass.initComponent.call(this); this.addEvents('hostadded'); @@ -120,7 +120,7 @@ Copyright: var username = this.usernameField.getValue(); var password = this.passwordField.getValue(); - Deluge.Client.web.add_host(host, port, username, password, { + deluge.client.web.add_host(host, port, username, password, { success: function(result) { if (!result[0]) { Ext.MessageBox.show({ @@ -145,7 +145,7 @@ Copyright: } }); - Ext.deluge.ConnectionManager = Ext.extend(Ext.Window, { + Deluge.ConnectionManager = Ext.extend(Ext.Window, { layout: 'fit', width: 300, @@ -159,13 +159,13 @@ Copyright: iconCls: 'x-deluge-connect-window-icon', initComponent: function() { - Ext.deluge.ConnectionManager.superclass.initComponent.call(this); + Deluge.ConnectionManager.superclass.initComponent.call(this); this.on('hide', this.onHide, this); this.on('show', this.onShow, this); - Deluge.Events.on('disconnect', this.onDisconnect, this); - Deluge.Events.on('login', this.onLogin, this); - Deluge.Events.on('logout', this.onLogout, this); + deluge.events.on('disconnect', this.onDisconnect, this); + deluge.events.on('login', this.onLogin, this); + deluge.events.on('logout', this.onLogout, this); this.addButton(_('Close'), this.onClose, this); this.addButton(_('Connect'), this.onConnect, this); @@ -251,10 +251,10 @@ Copyright: * to a Deluge Daemon and show the Connection Manager if not. */ checkConnected: function() { - Deluge.Client.web.connected({ + deluge.client.web.connected({ success: function(connected) { if (connected) { - Deluge.Events.fire('connect'); + deluge.events.fire('connect'); } else { this.show(); } @@ -264,11 +264,11 @@ Copyright: }, disconnect: function() { - Deluge.Events.fire('disconnect'); + deluge.events.fire('disconnect'); }, loadHosts: function() { - Deluge.Client.web.get_hosts({ + deluge.client.web.get_hosts({ success: this.onGetHosts, scope: this }); @@ -276,7 +276,7 @@ Copyright: update: function() { this.grid.getStore().each(function(r) { - Deluge.Client.web.get_host_status(r.id, { + deluge.client.web.get_host_status(r.id, { success: this.onGetHostStatus, scope: this }); @@ -318,7 +318,7 @@ Copyright: onAddClick: function(button, e) { if (!this.addWindow) { - this.addWindow = new Ext.deluge.AddConnectionWindow(); + this.addWindow = new Deluge.AddConnectionWindow(); this.addWindow.on('hostadded', this.onHostAdded, this); } this.addWindow.show(); @@ -340,7 +340,7 @@ Copyright: if (!selected) return; if (selected.get('status') == _('Connected')) { - Deluge.Client.web.disconnect({ + deluge.client.web.disconnect({ success: function(result) { this.update(this); Deluge.Events.fire('disconnect'); @@ -349,11 +349,11 @@ Copyright: }); } else { var id = selected.id; - Deluge.Client.web.connect(id, { + deluge.client.web.connect(id, { success: function(methods) { - Deluge.Client.reloadMethods(); - Deluge.Client.on('connected', function(e) { - Deluge.Events.fire('connect'); + deluge.client.reloadMethods(); + deluge.client.on('connected', function(e) { + deluge.events.fire('connect'); }, this, {single: true}); } }); @@ -370,7 +370,7 @@ Copyright: onGetHosts: function(hosts) { this.grid.getStore().loadData(hosts); Ext.each(hosts, function(host) { - Deluge.Client.web.get_host_status(host[0], { + deluge.client.web.get_host_status(host[0], { success: this.onGetHostStatus, scope: this }); @@ -393,17 +393,17 @@ Copyright: // private onLogin: function() { - if (Deluge.config.first_login) { + if (deluge.config.first_login) { Ext.MessageBox.confirm('Change password', 'As this is your first login, we recommend that you ' + 'change your password. Would you like to ' + 'do this now?', function(res) { this.checkConnected(); if (res == 'yes') { - Deluge.Preferences.show(); - Deluge.Preferences.selectPage('Interface'); + deluge.preferences.show(); + deluge.preferences.selectPage('Interface'); } - Deluge.Client.web.set_config({first_login: false}); + deluge.client.web.set_config({first_login: false}); }, this); } else { this.checkConnected(); @@ -423,7 +423,7 @@ Copyright: var connection = this.grid.getSelectionModel().getSelected(); if (!connection) return; - Deluge.Client.web.remove_host(connection.id, { + deluge.client.web.remove_host(connection.id, { success: function(result) { if (!result) { Ext.MessageBox.show({ @@ -480,10 +480,10 @@ Copyright: if (connection.get('status') == 'Offline') { // This means we need to start the daemon - Deluge.Client.web.start_daemon(connection.get('port')); + deluge.client.web.start_daemon(connection.get('port')); } else { // This means we need to stop the daemon - Deluge.Client.web.stop_daemon(connection.id, { + deluge.client.web.stop_daemon(connection.id, { success: function(result) { if (!result[0]) { Ext.MessageBox.show({ @@ -500,5 +500,5 @@ Copyright: } } }); - Deluge.ConnectionManager = new Ext.deluge.ConnectionManager(); + deluge.connectionManager = new Deluge.ConnectionManager(); })(); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Details.Details.js b/deluge/ui/web/js/deluge-all/Deluge.Details.Details.js index c881ca707..900e65684 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Details.Details.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Details.Details.js @@ -32,7 +32,7 @@ Copyright: */ -Ext.deluge.details.DetailsTab = Ext.extend(Ext.Panel, { +Deluge.details.DetailsTab = Ext.extend(Ext.Panel, { title: _('Details'), fields: {}, @@ -42,7 +42,7 @@ Ext.deluge.details.DetailsTab = Ext.extend(Ext.Panel, { oldData: {}, initComponent: function() { - Ext.deluge.details.DetailsTab.superclass.initComponent.call(this); + Deluge.details.DetailsTab.superclass.initComponent.call(this); this.addItem('torrent_name', _('Name')); this.addItem('hash', _('Hash')); this.addItem('path', _('Path')); @@ -54,7 +54,7 @@ Ext.deluge.details.DetailsTab = Ext.extend(Ext.Panel, { }, onRender: function(ct, position) { - Ext.deluge.details.DetailsTab.superclass.onRender.call(this, ct, position); + Deluge.details.DetailsTab.superclass.onRender.call(this, ct, position); this.body.setStyle('padding', '10px'); this.dl = Ext.DomHelper.append(this.body, {tag: 'dl'}, true); @@ -85,7 +85,7 @@ Ext.deluge.details.DetailsTab = Ext.extend(Ext.Panel, { }, update: function(torrentId) { - Deluge.Client.core.get_torrent_status(torrentId, Deluge.Keys.Details, { + deluge.client.core.get_torrent_status(torrentId, Deluge.Keys.Details, { success: this.onRequestComplete, scope: this, torrentId: torrentId @@ -112,4 +112,4 @@ Ext.deluge.details.DetailsTab = Ext.extend(Ext.Panel, { this.oldData = data; } }); -Deluge.Details.add(new Ext.deluge.details.DetailsTab()); +deluge.details.add(new Deluge.details.DetailsTab()); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Details.Files.js b/deluge/ui/web/js/deluge-all/Deluge.Details.Files.js index 79b6d25c1..743c8a555 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Details.Files.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Details.Files.js @@ -41,7 +41,7 @@ Copyright: return String.format('
{1}
', FILE_PRIORITY_CSS[value], _(FILE_PRIORITY[value])); } - Ext.deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { + Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { constructor: function(config) { config = Ext.apply({ @@ -79,17 +79,17 @@ Copyright: }) }, config); - Ext.deluge.details.FilesTab.superclass.constructor.call(this, config); + Deluge.details.FilesTab.superclass.constructor.call(this, config); }, initComponent: function() { - Ext.deluge.details.FilesTab.superclass.initComponent.call(this); + Deluge.details.FilesTab.superclass.initComponent.call(this); }, onRender: function(ct, position) { - Ext.deluge.details.FilesTab.superclass.onRender.call(this, ct, position); - Deluge.Menus.FilePriorities.on('itemclick', this.onItemClick, this); + Deluge.details.FilesTab.superclass.onRender.call(this, ct, position); + deluge.menus.filePriorities.on('itemclick', this.onItemClick, this); this.on('contextmenu', this.onContextMenu, this); this.sorter = new Ext.tree.TreeSorter(this, { folderSort: true @@ -113,7 +113,7 @@ Copyright: this.torrentId = torrentId; } - Deluge.Client.web.get_torrent_files(torrentId, { + deluge.client.web.get_torrent_files(torrentId, { success: this.onRequestComplete, scope: this, torrentId: torrentId @@ -127,7 +127,7 @@ Copyright: selModel.clearSelections(); node.select(); } - Deluge.Menus.FilePriorities.showAt(e.getPoint()); + deluge.menus.filePriorities.showAt(e.getPoint()); }, onItemClick: function(baseItem, e) { @@ -162,7 +162,7 @@ Copyright: priorities[index] = indexes[index]; } - Deluge.Client.core.set_torrent_file_priorities(this.torrentId, priorities, { + deluge.client.core.set_torrent_file_priorities(this.torrentId, priorities, { success: function() { Ext.each(nodes, function(node) { node.setColumnValue(3, baseItem.filePriority); @@ -216,5 +216,5 @@ Copyright: root.firstChild.expand(); } }); - Deluge.Details.add(new Ext.deluge.details.FilesTab()); + deluge.details.add(new Deluge.details.FilesTab()); })(); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Details.Options.js b/deluge/ui/web/js/deluge-all/Deluge.Details.Options.js index 9a0227f74..3853d40b3 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Details.Options.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Details.Options.js @@ -32,7 +32,7 @@ Copyright: */ -Ext.deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { +Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { constructor: function(config) { config = Ext.apply({ @@ -49,11 +49,11 @@ Ext.deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { layout: 'column', title: _('Options') }, config); - Ext.deluge.details.OptionsTab.superclass.constructor.call(this, config); + Deluge.details.OptionsTab.superclass.constructor.call(this, config); }, initComponent: function() { - Ext.deluge.details.OptionsTab.superclass.initComponent.call(this); + Deluge.details.OptionsTab.superclass.initComponent.call(this); this.fieldsets = {}, this.fields = {}; this.optionsManager = new Deluge.MultiOptionsManager({ @@ -342,7 +342,7 @@ Ext.deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { }, onRender: function(ct, position) { - Ext.deluge.details.OptionsTab.superclass.onRender.call(this, ct, position); + Deluge.details.OptionsTab.superclass.onRender.call(this, ct, position); // This is another hack I think, so keep an eye out here when upgrading. this.layout = new Ext.layout.ColumnLayout(); @@ -369,7 +369,7 @@ Ext.deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { this.torrentId = torrentId; this.optionsManager.changeId(torrentId); } - Deluge.Client.core.get_torrent_status(torrentId, Deluge.Keys.Options, { + deluge.client.core.get_torrent_status(torrentId, Deluge.Keys.Options, { success: this.onRequestComplete, scope: this }); @@ -379,14 +379,14 @@ Ext.deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { var changed = this.optionsManager.getDirty(); if (!Ext.isEmpty(changed['prioritize_first_last'])) { var value = changed['prioritize_first_last']; - Deluge.Client.core.set_torrent_prioritize_first_last(this.torrentId, value, { + deluge.client.core.set_torrent_prioritize_first_last(this.torrentId, value, { success: function() { this.optionsManager.set('prioritize_first_last', value); }, scope: this }); } - Deluge.Client.core.set_torrent_options([this.torrentId], changed, { + deluge.client.core.set_torrent_options([this.torrentId], changed, { success: function() { this.optionsManager.commit(); }, @@ -395,7 +395,7 @@ Ext.deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { }, onEditTrackers: function() { - Deluge.EditTrackers.show(); + deluge.editTrackers.show(); }, onStopRatioChecked: function(checkbox, checked) { @@ -414,4 +414,4 @@ Ext.deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { this.fields.stop_ratio.setDisabled(!stop_at_ratio); } }); -Deluge.Details.add(new Ext.deluge.details.OptionsTab()); +deluge.details.add(new Deluge.details.OptionsTab()); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Details.Peers.js b/deluge/ui/web/js/deluge-all/Deluge.Details.Peers.js index 0c21da80e..d40e4aedc 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Details.Peers.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Details.Peers.js @@ -49,7 +49,7 @@ Copyright: return ((((((+d[1])*256)+(+d[2]))*256)+(+d[3]))*256)+(+d[4]); } - Ext.deluge.details.PeersTab = Ext.extend(Ext.grid.GridPanel, { + Deluge.details.PeersTab = Ext.extend(Ext.grid.GridPanel, { constructor: function(config) { config = Ext.apply({ @@ -108,11 +108,11 @@ Copyright: deferredRender:false, autoScroll:true }, config); - Ext.deluge.details.PeersTab.superclass.constructor.call(this, config); + Deluge.details.PeersTab.superclass.constructor.call(this, config); }, onRender: function(ct, position) { - Ext.deluge.details.PeersTab.superclass.onRender.call(this, ct, position); + Deluge.details.PeersTab.superclass.onRender.call(this, ct, position); }, clear: function() { @@ -120,7 +120,7 @@ Copyright: }, update: function(torrentId) { - Deluge.Client.core.get_torrent_status(torrentId, Deluge.Keys.Peers, { + deluge.client.core.get_torrent_status(torrentId, Deluge.Keys.Peers, { success: this.onRequestComplete, scope: this }); @@ -135,5 +135,5 @@ Copyright: this.getStore().loadData(peers); } }); - Deluge.Details.add(new Ext.deluge.details.PeersTab()); + deluge.details.add(new Deluge.details.PeersTab()); })(); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Details.Status.js b/deluge/ui/web/js/deluge-all/Deluge.Details.Status.js index 417913533..9570522a6 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Details.Status.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Details.Status.js @@ -31,12 +31,12 @@ Copyright: statement from all source files in the program, then also delete it here. */ -Ext.deluge.details.StatusTab = Ext.extend(Ext.Panel, { +Deluge.details.StatusTab = Ext.extend(Ext.Panel, { title: _('Status'), autoScroll: true, onRender: function(ct, position) { - Ext.deluge.details.StatusTab.superclass.onRender.call(this, ct, position); + Deluge.details.StatusTab.superclass.onRender.call(this, ct, position); this.progressBar = this.add({ xtype: 'progress', @@ -53,7 +53,7 @@ Ext.deluge.details.StatusTab = Ext.extend(Ext.Panel, { 'render': { fn: function(panel) { panel.load({ - url: Deluge.config.base + 'render/tab_status.html', + url: deluge.config.base + 'render/tab_status.html', text: _('Loading') + '...' }); panel.getUpdater().on('update', this.onPanelUpdate, this); @@ -73,7 +73,7 @@ Ext.deluge.details.StatusTab = Ext.extend(Ext.Panel, { update: function(torrentId) { if (!this.fields) this.getFields(); - Deluge.Client.core.get_torrent_status(torrentId, Deluge.Keys.Status, { + deluge.client.core.get_torrent_status(torrentId, Deluge.Keys.Status, { success: this.onRequestComplete, scope: this }); @@ -119,4 +119,4 @@ Ext.deluge.details.StatusTab = Ext.extend(Ext.Panel, { this.progressBar.updateProgress(status.progress, text); } }); -Deluge.Details.add(new Ext.deluge.details.StatusTab()); +deluge.details.add(new Deluge.details.StatusTab()); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Details.js b/deluge/ui/web/js/deluge-all/Deluge.Details.js index 39031ec11..b8a339fe0 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Details.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Details.js @@ -33,8 +33,8 @@ Copyright: */ (function() { - Ext.namespace('Ext.deluge.details'); - Ext.deluge.details.TabPanel = Ext.extend(Ext.TabPanel, { + Ext.namespace('Deluge.details'); + Deluge.details.TabPanel = Ext.extend(Ext.TabPanel, { constructor: function(config) { config = Ext.apply({ @@ -47,7 +47,7 @@ Copyright: margins: '0 5 5 5', activeTab: 0 }, config); - Ext.deluge.details.TabPanel.superclass.constructor.call(this, config); + Deluge.details.TabPanel.superclass.constructor.call(this, config); }, clear: function() { @@ -61,7 +61,7 @@ Copyright: update: function(tab) { - var torrent = Deluge.Torrents.getSelected(); + var torrent = deluge.torrents.getSelected(); if (!torrent) { this.clear(); return; @@ -80,12 +80,12 @@ Copyright: // We need to add the events in onRender since Deluge.Torrents hasn't // been created yet. onRender: function(ct, position) { - Ext.deluge.details.TabPanel.superclass.onRender.call(this, ct, position); - Deluge.Events.on('disconnect', this.clear, this); - Deluge.Torrents.on('rowclick', this.onTorrentsClick, this); + Deluge.details.TabPanel.superclass.onRender.call(this, ct, position); + deluge.events.on('disconnect', this.clear, this); + deluge.torrents.on('rowclick', this.onTorrentsClick, this); this.on('tabchange', this.onTabChange, this); - Deluge.Torrents.getSelectionModel().on('selectionchange', function(selModel) { + deluge.torrents.getSelectionModel().on('selectionchange', function(selModel) { if (!selModel.hasSelection()) this.clear(); }, this); }, @@ -98,5 +98,5 @@ Copyright: this.update(); } }); - Deluge.Details = new Ext.deluge.details.TabPanel(); + deluge.details = new Deluge.details.TabPanel(); })(); diff --git a/deluge/ui/web/js/deluge-all/Deluge.EditTrackers.js b/deluge/ui/web/js/deluge-all/Deluge.EditTrackers.js index be5d3644e..e62202b7f 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.EditTrackers.js +++ b/deluge/ui/web/js/deluge-all/Deluge.EditTrackers.js @@ -33,7 +33,7 @@ Copyright: */ (function() { - Ext.deluge.AddTracker = Ext.extend(Ext.Window, { + Deluge.AddTracker = Ext.extend(Ext.Window, { constructor: function(config) { config = Ext.apply({ title: _('Add Tracker'), @@ -48,11 +48,11 @@ Copyright: plain: true, resizable: false }, config); - Ext.deluge.AddTracker.superclass.constructor.call(this, config); + Deluge.AddTracker.superclass.constructor.call(this, config); }, initComponent: function() { - Ext.deluge.AddTracker.superclass.initComponent.call(this); + Deluge.AddTracker.superclass.initComponent.call(this); this.addButton(_('Cancel'), this.onCancelClick, this); this.addButton(_('Add'), this.onAddClick, this); @@ -92,7 +92,7 @@ Copyright: } }); - Ext.deluge.EditTracker = Ext.extend(Ext.Window, { + Deluge.EditTracker = Ext.extend(Ext.Window, { constructor: function(config) { config = Ext.apply({ title: _('Edit Tracker'), @@ -107,11 +107,11 @@ Copyright: plain: true, resizable: false }, config); - Ext.deluge.EditTracker.superclass.constructor.call(this, config); + Deluge.EditTracker.superclass.constructor.call(this, config); }, initComponent: function() { - Ext.deluge.EditTracker.superclass.initComponent.call(this); + Deluge.EditTracker.superclass.initComponent.call(this); this.addButton(_('Cancel'), this.onCancelClick, this); this.addButton(_('Save'), this.onSaveClick, this); @@ -131,7 +131,7 @@ Copyright: }, show: function(record) { - Ext.deluge.EditTracker.superclass.show.call(this); + Deluge.EditTracker.superclass.show.call(this); this.record = record; this.form.getForm().findField('tracker').setValue(record.data['url']); @@ -153,7 +153,7 @@ Copyright: } }); - Ext.deluge.EditTrackers = Ext.extend(Ext.Window, { + Deluge.EditTrackers = Ext.extend(Ext.Window, { constructor: function(config) { config = Ext.apply({ @@ -169,11 +169,11 @@ Copyright: plain: true, resizable: true }, config); - Ext.deluge.EditTrackers.superclass.constructor.call(this, config); + Deluge.EditTrackers.superclass.constructor.call(this, config); }, initComponent: function() { - Ext.deluge.EditTrackers.superclass.initComponent.call(this); + Deluge.EditTrackers.superclass.initComponent.call(this); this.addButton(_('Cancel'), this.onCancelClick, this); this.addButton(_('Ok'), this.onOkClick, this); @@ -182,9 +182,9 @@ Copyright: this.on('show', this.onShow, this); this.on('save', this.onSave, this); - this.addWindow = new Ext.deluge.AddTracker(); + this.addWindow = new Deluge.AddTracker(); this.addWindow.on('add', this.onAddTrackers, this); - this.editWindow = new Ext.deluge.EditTracker(); + this.editWindow = new Deluge.EditTracker(); this.grid = this.add({ xtype: 'grid', @@ -301,7 +301,7 @@ Copyright: }) }, this); - Deluge.Client.core.set_torrent_trackers(this.torrentId, trackers, { + deluge.client.core.set_torrent_trackers(this.torrentId, trackers, { failure: this.onSaveFail, scope: this }); @@ -335,13 +335,13 @@ Copyright: onShow: function() { this.grid.getBottomToolbar().items.get(4).disable(); - var r = Deluge.Torrents.getSelected(); + var r = deluge.torrents.getSelected(); this.torrentId = r.id; - Deluge.Client.core.get_torrent_status(r.id, ['trackers'], { + deluge.client.core.get_torrent_status(r.id, ['trackers'], { success: this.onRequestComplete, scope: this }); } }); - Deluge.EditTrackers = new Ext.deluge.EditTrackers(); + deluge.editTrackers = new Deluge.EditTrackers(); })(); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Events.js b/deluge/ui/web/js/deluge-all/Deluge.Events.js index c5d7912bb..7c515b2ac 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Events.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Events.js @@ -38,11 +38,11 @@ Copyright: * @singleton * Class for holding global events that occur within the UI. */ - Events = Ext.extend(Ext.util.Observable, { + Deluge.Events = Ext.extend(Ext.util.Observable, { constructor: function() { this.toRegister = []; this.on('login', this.onLogin, this); - Events.superclass.constructor.call(this); + Deluge.Events.superclass.constructor.call(this); }, /** @@ -51,17 +51,17 @@ Copyright: addListener: function(eventName, fn, scope, o) { this.addEvents(eventName); if (/[A-Z]/.test(eventName.substring(0, 1))) { - if (!Deluge.Client) { + if (!deluge.client) { this.toRegister.push(eventName); } else { - Deluge.Client.web.register_event_listener(eventName); + deluge.client.web.register_event_listener(eventName); } } - Events.superclass.addListener.call(this, eventName, fn, scope, o); + Deluge.Events.superclass.addListener.call(this, eventName, fn, scope, o); }, getEvents: function() { - Deluge.Client.web.get_events({ + deluge.client.web.get_events({ success: this.onGetEventsSuccess, failure: this.onGetEventsFailure, scope: this @@ -73,7 +73,7 @@ Copyright: */ start: function() { Ext.each(this.toRegister, function(eventName) { - Deluge.Client.web.register_event_listener(eventName); + deluge.client.web.register_event_listener(eventName); }); this.running = true; this.getEvents(); @@ -115,13 +115,13 @@ Copyright: * Appends an event handler to this object (shorthand for {@link #addListener}) * @method */ - Events.prototype.on = Events.prototype.addListener + Deluge.Events.prototype.on = Deluge.Events.prototype.addListener /** * Fires the specified event with the passed parameters (minus the * event name). * @method */ - Events.prototype.fire = Events.prototype.fireEvent - Deluge.Events = new Events(); + Deluge.Events.prototype.fire = Deluge.Events.prototype.fireEvent + deluge.events = new Deluge.Events(); })(); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Login.js b/deluge/ui/web/js/deluge-all/Deluge.Login.js index 4f88445f6..9dd2296a0 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Login.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Login.js @@ -32,7 +32,7 @@ Copyright: */ -Ext.deluge.LoginWindow = Ext.extend(Ext.Window, { +Deluge.LoginWindow = Ext.extend(Ext.Window, { firstShow: true, bodyStyle: 'padding: 10px 5px;', @@ -49,7 +49,7 @@ Ext.deluge.LoginWindow = Ext.extend(Ext.Window, { height: 120, initComponent: function() { - Ext.deluge.LoginWindow.superclass.initComponent.call(this); + Deluge.LoginWindow.superclass.initComponent.call(this); this.on('show', this.onShow, this); this.addButton({ @@ -78,8 +78,8 @@ Ext.deluge.LoginWindow = Ext.extend(Ext.Window, { }, logout: function() { - Deluge.Events.fire('logout'); - Deluge.Client.auth.delete_session({ + Deluge.events.fire('logout'); + deluge.client.auth.delete_session({ success: function(result) { this.show(true); }, @@ -89,18 +89,18 @@ Ext.deluge.LoginWindow = Ext.extend(Ext.Window, { show: function(skipCheck) { if (this.firstShow) { - Deluge.Client.on('error', this.onClientError, this); + deluge.client.on('error', this.onClientError, this); this.firstShow = false; } if (skipCheck) { - return Ext.deluge.LoginWindow.superclass.show.call(this); + return Deluge.LoginWindow.superclass.show.call(this); } - Deluge.Client.auth.check_session({ + deluge.client.auth.check_session({ success: function(result) { if (result) { - Deluge.Events.fire('login'); + deluge.events.fire('login'); } else { this.show(true); } @@ -118,10 +118,10 @@ Ext.deluge.LoginWindow = Ext.extend(Ext.Window, { onLogin: function() { var passwordField = this.passwordField; - Deluge.Client.auth.login(passwordField.getValue(), { + deluge.client.auth.login(passwordField.getValue(), { success: function(result) { if (result) { - Deluge.Events.fire('login'); + deluge.events.fire('login'); this.hide(); passwordField.setRawValue(''); } else { @@ -144,7 +144,7 @@ Ext.deluge.LoginWindow = Ext.extend(Ext.Window, { onClientError: function(errorObj, response, requestOptions) { if (errorObj.error.code == 1) { - Deluge.Events.fire('logout'); + deluge.events.fire('logout'); this.show(true); } }, @@ -155,4 +155,4 @@ Ext.deluge.LoginWindow = Ext.extend(Ext.Window, { } }); -Deluge.Login = new Ext.deluge.LoginWindow(); +deluge.login = new Deluge.LoginWindow(); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Menus.js b/deluge/ui/web/js/deluge-all/Deluge.Menus.js index 09e35dc0f..65e0823f9 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Menus.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Menus.js @@ -1,5 +1,5 @@ /* -Script: deluge-menus.js +Script: deluge.menus.js Contains all the menus contained within the UI for easy access and editing. Copyright: @@ -32,7 +32,7 @@ Copyright: */ -Deluge.Menus = { +deluge.menus = { onTorrentAction: function(item, e) { var selection = Deluge.Torrents.getSelections(); var ids = []; @@ -44,9 +44,9 @@ Deluge.Menus = { switch (action) { case 'pause': case 'resume': - Deluge.Client.core[action + '_torrent'](ids, { + deluge.client.core[action + '_torrent'](ids, { success: function() { - Deluge.UI.update(); + deluge.ui.update(); } }); break; @@ -54,53 +54,53 @@ Deluge.Menus = { case 'up': case 'down': case 'bottom': - Deluge.Client.core['queue_' + action](ids, { + deluge.client.core['queue_' + action](ids, { success: function() { - Deluge.UI.update(); + deluge.ui.update(); } }); break; case 'edit_trackers': - Deluge.EditTrackers.show(); + deluge.editTrackers.show(); break; case 'update': - Deluge.Client.core.force_reannounce(ids, { + deluge.client.core.force_reannounce(ids, { success: function() { - Deluge.UI.update(); + deluge.ui.update(); } }); break; case 'remove': - Deluge.RemoveWindow.show(ids); + deluge.removeWindow.show(ids); break; case 'recheck': - Deluge.Client.core.force_recheck(ids, { + deluge.client.core.force_recheck(ids, { success: function() { - Deluge.UI.update(); + deluge.ui.update(); } }); break; case 'move': - Deluge.MoveStorage.show(ids); + deluge.moveStorage.show(ids); break; } } } -Deluge.Menus.Torrent = new Ext.menu.Menu({ +deluge.menus.torrent = new Ext.menu.Menu({ id: 'torrentMenu', items: [{ torrentAction: 'pause', text: _('Pause'), iconCls: 'icon-pause', - handler: Deluge.Menus.onTorrentAction, - scope: Deluge.Menus + handler: deluge.menus.onTorrentAction, + scope: deluge.menus }, { torrentAction: 'resume', text: _('Resume'), iconCls: 'icon-resume', - handler: Deluge.Menus.onTorrentAction, - scope: Deluge.Menus + handler: deluge.menus.onTorrentAction, + scope: deluge.menus }, '-', { text: _('Options'), iconCls: 'icon-options', @@ -191,62 +191,62 @@ Deluge.Menus.Torrent = new Ext.menu.Menu({ torrentAction: 'top', text: _('Top'), iconCls: 'icon-top', - handler: Deluge.Menus.onTorrentAction, - scope: Deluge.Menus + handler: deluge.menus.onTorrentAction, + scope: deluge.menus },{ torrentAction: 'up', text: _('Up'), iconCls: 'icon-up', - handler: Deluge.Menus.onTorrentAction, - scope: Deluge.Menus + handler: deluge.menus.onTorrentAction, + scope: deluge.menus },{ torrentAction: 'down', text: _('Down'), iconCls: 'icon-down', - handler: Deluge.Menus.onTorrentAction, - scope: Deluge.Menus + handler: deluge.menus.onTorrentAction, + scope: deluge.menus },{ torrentAction: 'bottom', text: _('Bottom'), iconCls: 'icon-bottom', - handler: Deluge.Menus.onTorrentAction, - scope: Deluge.Menus + handler: deluge.menus.onTorrentAction, + scope: deluge.menus }] }) }, '-', { torrentAction: 'update', text: _('Update Tracker'), iconCls: 'icon-update-tracker', - handler: Deluge.Menus.onTorrentAction, - scope: Deluge.Menus + handler: deluge.menus.onTorrentAction, + scope: deluge.menus }, { torrentAction: 'edit_trackers', text: _('Edit Trackers'), iconCls: 'icon-edit-trackers', - handler: Deluge.Menus.onTorrentAction, - scope: Deluge.Menus + handler: deluge.menus.onTorrentAction, + scope: deluge.menus }, '-', { torrentAction: 'remove', text: _('Remove Torrent'), iconCls: 'icon-remove', - handler: Deluge.Menus.onTorrentAction, - scope: Deluge.Menus + handler: deluge.menus.onTorrentAction, + scope: deluge.menus }, '-', { torrentAction: 'recheck', text: _('Force Recheck'), iconCls: 'icon-recheck', - handler: Deluge.Menus.onTorrentAction, - scope: Deluge.Menus + handler: deluge.menus.onTorrentAction, + scope: deluge.menus }, { torrentAction: 'move', text: _('Move Storage'), iconCls: 'icon-move', - handler: Deluge.Menus.onTorrentAction, - scope: Deluge.Menus + handler: deluge.menus.onTorrentAction, + scope: deluge.menus }] }); -Ext.deluge.StatusbarMenu = Ext.extend(Ext.menu.Menu, { +Deluge.StatusbarMenu = Ext.extend(Ext.menu.Menu, { setValue: function(value) { var beenSet = false; @@ -276,7 +276,7 @@ Ext.deluge.StatusbarMenu = Ext.extend(Ext.menu.Menu, { } }); -Deluge.Menus.Connections = new Ext.deluge.StatusbarMenu({ +deluge.menus.connections = new Deluge.StatusbarMenu({ id: 'connectionsMenu', items: [{ text: '50', @@ -323,7 +323,7 @@ Deluge.Menus.Connections = new Ext.deluge.StatusbarMenu({ }] }); -Deluge.Menus.Download = new Ext.deluge.StatusbarMenu({ +deluge.menus.download = new Deluge.StatusbarMenu({ id: 'downspeedMenu', items: [{ value: '5', @@ -370,7 +370,7 @@ Deluge.Menus.Download = new Ext.deluge.StatusbarMenu({ }] }); -Deluge.Menus.Upload = new Ext.deluge.StatusbarMenu({ +deluge.menus.upload = new Deluge.StatusbarMenu({ id: 'upspeedMenu', items: [{ value: '5', @@ -417,7 +417,7 @@ Deluge.Menus.Upload = new Ext.deluge.StatusbarMenu({ }] }); -Deluge.Menus.FilePriorities = new Ext.menu.Menu({ +deluge.menus.filePriorities = new Ext.menu.Menu({ id: 'filePrioritiesMenu', items: [{ id: 'expandAll', diff --git a/deluge/ui/web/js/deluge-all/Deluge.MoveStorage.js b/deluge/ui/web/js/deluge-all/Deluge.MoveStorage.js index 87cfb08af..eb573059d 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.MoveStorage.js +++ b/deluge/ui/web/js/deluge-all/Deluge.MoveStorage.js @@ -31,8 +31,8 @@ Copyright: statement from all source files in the program, then also delete it here. */ -Ext.namespace('Ext.deluge'); -Ext.deluge.MoveStorage = Ext.extend(Ext.Window, { +Ext.namespace('Deluge'); +Deluge.MoveStorage = Ext.extend(Ext.Window, { constructor: function(config) { config = Ext.apply({ @@ -47,11 +47,11 @@ Ext.deluge.MoveStorage = Ext.extend(Ext.Window, { plain: true, resizable: false }, config); - Ext.deluge.MoveStorage.superclass.constructor.call(this, config); + Deluge.MoveStorage.superclass.constructor.call(this, config); }, initComponent: function() { - Ext.deluge.MoveStorage.superclass.initComponent.call(this); + Deluge.MoveStorage.superclass.initComponent.call(this); this.addButton(_('Cancel'), this.onCancel, this); this.addButton(_('Move'), this.onMove, this); @@ -83,12 +83,12 @@ Ext.deluge.MoveStorage = Ext.extend(Ext.Window, { }, hide: function() { - Ext.deluge.MoveStorage.superclass.hide.call(this); + Deluge.MoveStorage.superclass.hide.call(this); this.torrentIds = null; }, show: function(torrentIds) { - Ext.deluge.MoveStorage.superclass.show.call(this); + Deluge.MoveStorage.superclass.show.call(this); this.torrentIds = torrentIds; }, @@ -98,8 +98,8 @@ Ext.deluge.MoveStorage = Ext.extend(Ext.Window, { onMove: function() { var dest = this.moveLocation.getValue(); - Deluge.Client.core.move_storage(this.torrentIds, dest); + deluge.client.core.move_storage(this.torrentIds, dest); this.hide(); } }); -Deluge.MoveStorage = new Ext.deluge.MoveStorage(); +deluge.moveStorage = new Deluge.MoveStorage(); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Preferences.Bandwidth.js b/deluge/ui/web/js/deluge-all/Deluge.Preferences.Bandwidth.js index 4ffb565d4..76015f1a4 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Preferences.Bandwidth.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Preferences.Bandwidth.js @@ -1,5 +1,5 @@ /* -Script: Deluge.Preferences.Bandwidth.js +Script: deluge.preferences.Bandwidth.js The bandwidth preferences page. Copyright: @@ -31,8 +31,8 @@ Copyright: statement from all source files in the program, then also delete it here. */ -Ext.namespace('Ext.deluge.preferences'); -Ext.deluge.preferences.Bandwidth = Ext.extend(Ext.form.FormPanel, { +Ext.namespace('Deluge.preferences'); +Deluge.preferences.Bandwidth = Ext.extend(Ext.form.FormPanel, { constructor: function(config) { config = Ext.apply({ border: false, @@ -40,13 +40,13 @@ Ext.deluge.preferences.Bandwidth = Ext.extend(Ext.form.FormPanel, { layout: 'form', labelWidth: 10 }, config); - Ext.deluge.preferences.Bandwidth.superclass.constructor.call(this, config); + Deluge.preferences.Bandwidth.superclass.constructor.call(this, config); }, initComponent: function() { - Ext.deluge.preferences.Bandwidth.superclass.initComponent.call(this); + Deluge.preferences.Bandwidth.superclass.initComponent.call(this); - var optMan = Deluge.Preferences.getOptionsManager(); + var optMan = deluge.preferences.getOptionsManager(); var fieldset = this.add({ xtype: 'fieldset', border: false, @@ -211,4 +211,4 @@ Ext.deluge.preferences.Bandwidth = Ext.extend(Ext.form.FormPanel, { })); } }); -Deluge.Preferences.addPage(new Ext.deluge.preferences.Bandwidth()); +deluge.preferences.addPage(new Deluge.preferences.Bandwidth()); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Preferences.Cache.js b/deluge/ui/web/js/deluge-all/Deluge.Preferences.Cache.js index 824a0fb7c..bf7868287 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Preferences.Cache.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Preferences.Cache.js @@ -1,5 +1,5 @@ /* -Script: Deluge.Preferences.Cache.js +Script: deluge.preferences.Cache.js The cache preferences page. Copyright: @@ -31,21 +31,21 @@ Copyright: statement from all source files in the program, then also delete it here. */ -Ext.namespace('Ext.deluge.preferences'); -Ext.deluge.preferences.Cache = Ext.extend(Ext.form.FormPanel, { +Ext.namespace('Deluge.preferences'); +Deluge.preferences.Cache = Ext.extend(Ext.form.FormPanel, { constructor: function(config) { config = Ext.apply({ border: false, title: _('Cache'), layout: 'form' }, config); - Ext.deluge.preferences.Cache.superclass.constructor.call(this, config); + Deluge.preferences.Cache.superclass.constructor.call(this, config); }, initComponent: function() { - Ext.deluge.preferences.Cache.superclass.initComponent.call(this); + Deluge.preferences.Cache.superclass.initComponent.call(this); - var optMan = Deluge.Preferences.getOptionsManager(); + var optMan = deluge.preferences.getOptionsManager(); var fieldset = this.add({ xtype: 'fieldset', @@ -81,4 +81,4 @@ Ext.deluge.preferences.Cache = Ext.extend(Ext.form.FormPanel, { })); } }); -Deluge.Preferences.addPage(new Ext.deluge.preferences.Cache()); +deluge.preferences.addPage(new Deluge.preferences.Cache()); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Preferences.Daemon.js b/deluge/ui/web/js/deluge-all/Deluge.Preferences.Daemon.js index cf886d1b8..ac945bc5f 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Preferences.Daemon.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Preferences.Daemon.js @@ -31,21 +31,21 @@ Copyright: statement from all source files in the program, then also delete it here. */ -Ext.namespace('Ext.deluge.preferences'); -Ext.deluge.preferences.Daemon = Ext.extend(Ext.form.FormPanel, { +Ext.namespace('Deluge.preferences'); +Deluge.preferences.Daemon = Ext.extend(Ext.form.FormPanel, { constructor: function(config) { config = Ext.apply({ border: false, title: _('Daemon'), layout: 'form' }, config); - Ext.deluge.preferences.Daemon.superclass.constructor.call(this, config); + Deluge.preferences.Daemon.superclass.constructor.call(this, config); }, initComponent: function() { - Ext.deluge.preferences.Daemon.superclass.initComponent.call(this); + Deluge.preferences.Daemon.superclass.initComponent.call(this); - var optMan = Deluge.Preferences.getOptionsManager(); + var optMan = deluge.preferences.getOptionsManager(); var fieldset = this.add({ xtype: 'fieldset', @@ -99,4 +99,4 @@ Ext.deluge.preferences.Daemon = Ext.extend(Ext.form.FormPanel, { })); } }); -Deluge.Preferences.addPage(new Ext.deluge.preferences.Daemon()); +deluge.preferences.addPage(new Deluge.preferences.Daemon()); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Preferences.Downloads.js b/deluge/ui/web/js/deluge-all/Deluge.Preferences.Downloads.js index c2b6b8de0..16d89c042 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Preferences.Downloads.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Preferences.Downloads.js @@ -31,8 +31,8 @@ Copyright: statement from all source files in the program, then also delete it here. */ -Ext.namespace('Ext.deluge.preferences'); -Ext.deluge.preferences.Downloads = Ext.extend(Ext.FormPanel, { +Ext.namespace('Deluge.preferences'); +Deluge.preferences.Downloads = Ext.extend(Ext.FormPanel, { constructor: function(config) { config = Ext.apply({ border: false, @@ -41,13 +41,13 @@ Ext.deluge.preferences.Downloads = Ext.extend(Ext.FormPanel, { autoHeight: true, width: 320 }, config); - Ext.deluge.preferences.Downloads.superclass.constructor.call(this, config); + Deluge.preferences.Downloads.superclass.constructor.call(this, config); }, initComponent: function() { - Ext.deluge.preferences.Downloads.superclass.initComponent.call(this); + Deluge.preferences.Downloads.superclass.initComponent.call(this); - var optMan = Deluge.Preferences.getOptionsManager(); + var optMan = deluge.preferences.getOptionsManager(); var fieldset = this.add({ xtype: 'fieldset', border: false, @@ -147,7 +147,7 @@ Ext.deluge.preferences.Downloads = Ext.extend(Ext.FormPanel, { }, onShow: function() { - Ext.deluge.preferences.Downloads.superclass.onShow.call(this); + Deluge.preferences.Downloads.superclass.onShow.call(this); } }); -Deluge.Preferences.addPage(new Ext.deluge.preferences.Downloads()); +deluge.preferences.addPage(new Deluge.preferences.Downloads()); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Preferences.Encryption.js b/deluge/ui/web/js/deluge-all/Deluge.Preferences.Encryption.js index 1a8fd0e74..8ae55767f 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Preferences.Encryption.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Preferences.Encryption.js @@ -1,5 +1,5 @@ /* -Script: Deluge.Preferences.Encryption.js +Script: deluge.preferences.Encryption.js The encryption preferences page. Copyright: @@ -31,21 +31,21 @@ Copyright: statement from all source files in the program, then also delete it here. */ -Ext.namespace('Ext.deluge.preferences'); -Ext.deluge.preferences.Encryption = Ext.extend(Ext.form.FormPanel, { +Ext.namespace('Deluge.preferences'); +Deluge.preferences.Encryption = Ext.extend(Ext.form.FormPanel, { constructor: function(config) { config = Ext.apply({ border: false, title: _('Encryption'), layout: 'form' }, config); - Ext.deluge.preferences.Encryption.superclass.constructor.call(this, config); + Deluge.preferences.Encryption.superclass.constructor.call(this, config); }, initComponent: function() { - Ext.deluge.preferences.Encryption.superclass.initComponent.call(this); + Deluge.preferences.Encryption.superclass.initComponent.call(this); - var optMan = Deluge.Preferences.getOptionsManager(); + var optMan = deluge.preferences.getOptionsManager(); var fieldset = this.add({ xtype: 'fieldset', @@ -111,4 +111,4 @@ Ext.deluge.preferences.Encryption = Ext.extend(Ext.form.FormPanel, { })); } }); -Deluge.Preferences.addPage(new Ext.deluge.preferences.Encryption()); \ No newline at end of file +deluge.preferences.addPage(new Deluge.preferences.Encryption()); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Preferences.Interface.js b/deluge/ui/web/js/deluge-all/Deluge.Preferences.Interface.js index ac656701d..9b7e1d144 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Preferences.Interface.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Preferences.Interface.js @@ -31,19 +31,19 @@ Copyright: statement from all source files in the program, then also delete it here. */ -Ext.namespace('Ext.deluge.preferences'); -Ext.deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { +Ext.namespace('Deluge.preferences'); +Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { constructor: function(config) { config = Ext.apply({ border: false, title: _('Interface'), layout: 'form' }, config); - Ext.deluge.preferences.Interface.superclass.constructor.call(this, config); + Deluge.preferences.Interface.superclass.constructor.call(this, config); }, initComponent: function() { - Ext.deluge.preferences.Interface.superclass.initComponent.call(this); + Deluge.preferences.Interface.superclass.initComponent.call(this); var optMan = this.optionsManager = new Deluge.OptionsManager(); this.on('show', this.onShow, this); @@ -184,7 +184,7 @@ Ext.deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { onApply: function() { var changed = this.optionsManager.getDirty(); if (!Ext.isObjectEmpty(changed)) { - Deluge.Client.web.set_config(changed, { + deluge.client.web.set_config(changed, { success: this.onSetConfig, scope: this }); @@ -210,7 +210,7 @@ Ext.deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { } var oldPassword = this.oldPassword.getValue(); - Deluge.Client.auth.change_password(oldPassword, newPassword, { + deluge.client.auth.change_password(oldPassword, newPassword, { success: function(result) { if (!result) { Ext.MessageBox.show({ @@ -245,8 +245,8 @@ Ext.deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { }, onShow: function() { - Ext.deluge.preferences.Interface.superclass.onShow.call(this); - Deluge.Client.web.get_config({ + Deluge.preferences.Interface.superclass.onShow.call(this); + deluge.client.web.get_config({ success: this.onGotConfig, scope: this }) @@ -257,4 +257,4 @@ Ext.deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { this.certField.setDisabled(!checked); } }); -Deluge.Preferences.addPage(new Ext.deluge.preferences.Interface()); +deluge.preferences.addPage(new Deluge.preferences.Interface()); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Preferences.Network.js b/deluge/ui/web/js/deluge-all/Deluge.Preferences.Network.js index e8fc7336c..f45307cf5 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Preferences.Network.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Preferences.Network.js @@ -1,5 +1,5 @@ /* -Script: Deluge.Preferences.Network.js +Script: deluge.preferences.Network.js The network preferences page. Copyright: @@ -31,21 +31,21 @@ Copyright: statement from all source files in the program, then also delete it here. */ -Ext.namespace('Ext.deluge.preferences'); +Ext.namespace('Deluge.preferences'); -Ext.deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, { +Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, { constructor: function(config) { config = Ext.apply({ border: false, title: _('Network'), layout: 'form' }, config); - Ext.deluge.preferences.Network.superclass.constructor.call(this, config); + Deluge.preferences.Network.superclass.constructor.call(this, config); }, initComponent: function() { - Ext.deluge.preferences.Network.superclass.initComponent.call(this); - var optMan = Deluge.Preferences.getOptionsManager(); + Deluge.preferences.Network.superclass.initComponent.call(this); + var optMan = deluge.preferences.getOptionsManager(); var fieldset = this.add({ xtype: 'fieldset', @@ -232,4 +232,4 @@ Ext.deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, { })); } }); -Deluge.Preferences.addPage(new Ext.deluge.preferences.Network()); +deluge.preferences.addPage(new Deluge.preferences.Network()); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Preferences.Other.js b/deluge/ui/web/js/deluge-all/Deluge.Preferences.Other.js index 552b23cbd..b51b09d1f 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Preferences.Other.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Preferences.Other.js @@ -31,21 +31,21 @@ Copyright: statement from all source files in the program, then also delete it here. */ -Ext.namespace('Ext.deluge.preferences'); -Ext.deluge.preferences.Other = Ext.extend(Ext.form.FormPanel, { +Ext.namespace('Deluge.preferences'); +Deluge.preferences.Other = Ext.extend(Ext.form.FormPanel, { constructor: function(config) { config = Ext.apply({ border: false, title: _('Other'), layout: 'form' }, config); - Ext.deluge.preferences.Other.superclass.constructor.call(this, config); + Deluge.preferences.Other.superclass.constructor.call(this, config); }, initComponent: function() { - Ext.deluge.preferences.Other.superclass.initComponent.call(this); + Deluge.preferences.Other.superclass.initComponent.call(this); - var optMan = Deluge.Preferences.getOptionsManager(); + var optMan = deluge.preferences.getOptionsManager(); var fieldset = this.add({ xtype: 'fieldset', @@ -103,4 +103,4 @@ Ext.deluge.preferences.Other = Ext.extend(Ext.form.FormPanel, { })); } }); -Deluge.Preferences.addPage(new Ext.deluge.preferences.Other()); +deluge.preferences.addPage(new Deluge.preferences.Other()); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Preferences.Plugins.js b/deluge/ui/web/js/deluge-all/Deluge.Preferences.Plugins.js index 563332fdd..ade7da902 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Preferences.Plugins.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Preferences.Plugins.js @@ -31,9 +31,9 @@ Copyright: statement from all source files in the program, then also delete it here. */ -Ext.namespace('Ext.deluge.preferences'); +Ext.namespace('Deluge.preferences'); -Ext.deluge.preferences.InstallPlugin = Ext.extend(Ext.Window, { +Deluge.preferences.InstallPlugin = Ext.extend(Ext.Window, { height: 115, width: 350, @@ -55,7 +55,7 @@ Ext.deluge.preferences.InstallPlugin = Ext.extend(Ext.Window, { title: _('Install Plugin'), initComponent: function() { - Ext.deluge.add.FileWindow.superclass.initComponent.call(this); + Deluge.add.FileWindow.superclass.initComponent.call(this); this.addButton(_('Install'), this.onInstall, this); this.form = this.add({ @@ -96,7 +96,7 @@ Ext.deluge.preferences.InstallPlugin = Ext.extend(Ext.Window, { var filename = this.form.getForm().findField('pluginEgg').value; var path = upload.result.files[0] this.form.getForm().findField('pluginEgg').setValue(''); - Deluge.Client.web.upload_plugin(filename, path, { + deluge.client.web.upload_plugin(filename, path, { success: this.onUploadPlugin, scope: this, filename: filename @@ -106,7 +106,7 @@ Ext.deluge.preferences.InstallPlugin = Ext.extend(Ext.Window, { }); -Ext.deluge.preferences.Plugins = Ext.extend(Ext.Panel, { +Deluge.preferences.Plugins = Ext.extend(Ext.Panel, { constructor: function(config) { config = Ext.apply({ border: false, @@ -115,7 +115,7 @@ Ext.deluge.preferences.Plugins = Ext.extend(Ext.Panel, { height: 400, cls: 'x-deluge-plugins' }, config); - Ext.deluge.preferences.Plugins.superclass.constructor.call(this, config); + Deluge.preferences.Plugins.superclass.constructor.call(this, config); }, pluginTemplate: new Ext.Template( @@ -129,7 +129,7 @@ Ext.deluge.preferences.Plugins = Ext.extend(Ext.Panel, { ), initComponent: function() { - Ext.deluge.preferences.Plugins.superclass.initComponent.call(this); + Deluge.preferences.Plugins.superclass.initComponent.call(this); this.defaultValues = { 'version': '', 'email': '', @@ -215,17 +215,17 @@ Ext.deluge.preferences.Plugins = Ext.extend(Ext.Panel, { this.on('show', this.onShow, this); this.pluginInfo.on('render', this.onPluginInfoRender, this); this.grid.on('cellclick', this.onCellClick, this); - Deluge.Preferences.on('show', this.onPreferencesShow, this); - Deluge.Events.on('PluginDisabledEvent', this.onPluginDisabled, this); - Deluge.Events.on('PluginEnabledEvent', this.onPluginEnabled, this); + deluge.preferences.on('show', this.onPreferencesShow, this); + deluge.events.on('PluginDisabledEvent', this.onPluginDisabled, this); + deluge.events.on('PluginEnabledEvent', this.onPluginEnabled, this); }, disablePlugin: function(plugin) { - Deluge.Client.core.disable_plugin(plugin); + deluge.client.core.disable_plugin(plugin); }, enablePlugin: function(plugin) { - Deluge.Client.core.enable_plugin(plugin); + deluge.client.core.enable_plugin(plugin); }, setInfo: function(plugin) { @@ -235,7 +235,7 @@ Ext.deluge.preferences.Plugins = Ext.extend(Ext.Panel, { }, updatePlugins: function() { - Deluge.Client.web.get_plugins({ + deluge.client.web.get_plugins({ success: this.onGotPlugins, scope: this }); @@ -290,7 +290,7 @@ Ext.deluge.preferences.Plugins = Ext.extend(Ext.Panel, { onInstallPlugin: function() { if (!this.installWindow) { - this.installWindow = new Ext.deluge.preferences.InstallPlugin(); + this.installWindow = new Deluge.preferences.InstallPlugin(); this.installWindow.on('pluginadded', this.onPluginInstall, this); } this.installWindow.show(); @@ -315,7 +315,7 @@ Ext.deluge.preferences.Plugins = Ext.extend(Ext.Panel, { }, onPluginSelect: function(selmodel, rowIndex, r) { - Deluge.Client.web.get_plugin_info(r.get('plugin'), { + deluge.client.web.get_plugin_info(r.get('plugin'), { success: this.onGotPluginInfo, scope: this }); @@ -329,4 +329,4 @@ Ext.deluge.preferences.Plugins = Ext.extend(Ext.Panel, { this.setInfo(); } }); -Deluge.Preferences.addPage(new Ext.deluge.preferences.Plugins()); +deluge.preferences.addPage(new Deluge.preferences.Plugins()); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Preferences.Proxy.js b/deluge/ui/web/js/deluge-all/Deluge.Preferences.Proxy.js index dd734615a..48cd29cc7 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Preferences.Proxy.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Preferences.Proxy.js @@ -31,8 +31,8 @@ Copyright: statement from all source files in the program, then also delete it here. */ -Ext.namespace('Ext.deluge.preferences'); -Ext.deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, { +Ext.namespace('Deluge.preferences'); +Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, { constructor: function(config) { config = Ext.apply({ @@ -40,11 +40,11 @@ Ext.deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, { autoHeight: true, labelWidth: 70 }, config); - Ext.deluge.preferences.ProxyField.superclass.constructor.call(this, config); + Deluge.preferences.ProxyField.superclass.constructor.call(this, config); }, initComponent: function() { - Ext.deluge.preferences.ProxyField.superclass.initComponent.call(this); + Deluge.preferences.ProxyField.superclass.initComponent.call(this); this.type = this.add({ xtype: 'combo', fieldLabel: _('Type'), @@ -166,43 +166,43 @@ Ext.deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, { }); -Ext.deluge.preferences.Proxy = Ext.extend(Ext.form.FormPanel, { +Deluge.preferences.Proxy = Ext.extend(Ext.form.FormPanel, { constructor: function(config) { config = Ext.apply({ border: false, title: _('Proxy'), layout: 'form' }, config); - Ext.deluge.preferences.Proxy.superclass.constructor.call(this, config); + Deluge.preferences.Proxy.superclass.constructor.call(this, config); }, initComponent: function() { - Ext.deluge.preferences.Proxy.superclass.initComponent.call(this); - this.peer = this.add(new Ext.deluge.preferences.ProxyField({ + Deluge.preferences.Proxy.superclass.initComponent.call(this); + this.peer = this.add(new Deluge.preferences.ProxyField({ title: _('Peer'), name: 'peer' })); this.peer.on('change', this.onProxyChange, this); - this.web_seed = this.add(new Ext.deluge.preferences.ProxyField({ + this.web_seed = this.add(new Deluge.preferences.ProxyField({ title: _('Web Seed'), name: 'web_seed' })); this.web_seed.on('change', this.onProxyChange, this); - this.tracker = this.add(new Ext.deluge.preferences.ProxyField({ + this.tracker = this.add(new Deluge.preferences.ProxyField({ title: _('Tracker'), name: 'tracker' })); this.tracker.on('change', this.onProxyChange, this); - this.dht = this.add(new Ext.deluge.preferences.ProxyField({ + this.dht = this.add(new Deluge.preferences.ProxyField({ title: _('DHT'), name: 'dht' })); this.dht.on('change', this.onProxyChange, this); - Deluge.Preferences.getOptionsManager().bind('proxies', this); + deluge.preferences.getOptionsManager().bind('proxies', this); }, getValue: function() { @@ -228,4 +228,4 @@ Ext.deluge.preferences.Proxy = Ext.extend(Ext.form.FormPanel, { this.fireEvent('change', this, newValues, oldValues); } }); -Deluge.Preferences.addPage(new Ext.deluge.preferences.Proxy()); +deluge.preferences.addPage(new Deluge.preferences.Proxy()); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Preferences.Queue.js b/deluge/ui/web/js/deluge-all/Deluge.Preferences.Queue.js index 77975c078..3a8487b29 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Preferences.Queue.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Preferences.Queue.js @@ -31,21 +31,21 @@ Copyright: statement from all source files in the program, then also delete it here. */ -Ext.namespace('Ext.deluge.preferences'); -Ext.deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, { +Ext.namespace('Deluge.preferences'); +Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, { constructor: function(config) { config = Ext.apply({ border: false, title: _('Queue'), layout: 'form' }, config); - Ext.deluge.preferences.Queue.superclass.constructor.call(this, config); + Deluge.preferences.Queue.superclass.constructor.call(this, config); }, initComponent: function() { - Ext.deluge.preferences.Queue.superclass.initComponent.call(this); + Deluge.preferences.Queue.superclass.initComponent.call(this); - var optMan = Deluge.Preferences.getOptionsManager(); + var optMan = deluge.preferences.getOptionsManager(); var fieldset = this.add({ xtype: 'fieldset', @@ -218,4 +218,4 @@ Ext.deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, { this.removeAtRatio.setDisabled(!checked); } }); -Deluge.Preferences.addPage(new Ext.deluge.preferences.Queue()); +deluge.preferences.addPage(new Deluge.preferences.Queue()); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Preferences.js b/deluge/ui/web/js/deluge-all/Deluge.Preferences.js index c7e6fac93..02b30daeb 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Preferences.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Preferences.js @@ -34,7 +34,7 @@ Copyright: PreferencesRecord = Ext.data.Record.create([{name:'name', type:'string'}]); -Ext.deluge.PreferencesWindow = Ext.extend(Ext.Window, { +Deluge.PreferencesWindow = Ext.extend(Ext.Window, { /** * @property {String} currentPage The currently selected page. @@ -54,7 +54,7 @@ Ext.deluge.PreferencesWindow = Ext.extend(Ext.Window, { resizable: false, initComponent: function() { - Ext.deluge.PreferencesWindow.superclass.initComponent.call(this); + Deluge.PreferencesWindow.superclass.initComponent.call(this); this.categoriesGrid = this.add({ xtype: 'grid', @@ -108,7 +108,7 @@ Ext.deluge.PreferencesWindow = Ext.extend(Ext.Window, { onApply: function(e) { var changed = this.optionsManager.getDirty(); if (!Ext.isObjectEmpty(changed)) { - Deluge.Client.core.set_config(changed, { + deluge.client.core.set_config(changed, { success: this.onSetConfig, scope: this }); @@ -188,8 +188,8 @@ Ext.deluge.PreferencesWindow = Ext.extend(Ext.Window, { // private onShow: function() { - if (!Deluge.Client.core) return; - Deluge.Client.core.get_config({ + if (!deluge.client.core) return; + deluge.client.core.get_config({ success: this.onGotConfig, scope: this }) @@ -202,8 +202,8 @@ Ext.deluge.PreferencesWindow = Ext.extend(Ext.Window, { // private onOk: function() { - Deluge.Client.core.set_config(this.optionsManager.getDirty()); + deluge.client.core.set_config(this.optionsManager.getDirty()); this.hide(); } }); -Deluge.Preferences = new Ext.deluge.PreferencesWindow(); +deluge.preferences = new Deluge.PreferencesWindow(); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Sidebar.js b/deluge/ui/web/js/deluge-all/Deluge.Sidebar.js index 993d25f02..3e32ced8a 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Sidebar.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Sidebar.js @@ -45,7 +45,7 @@ Copyright: var image = ''; if (r.store.id == 'tracker_host') { if (value != 'Error') { - image = String.format('url(' + Deluge.config.base + 'tracker/{0})', value); + image = String.format('url(' + deluge.config.base + 'tracker/{0})', value); } else { lname = null; } @@ -60,11 +60,11 @@ Copyright: } /** - * @class Ext.deluge.Sidebar + * @class Deluge.Sidebar * @author Damien Churchill * @version 1.3 */ - Ext.deluge.Sidebar = Ext.extend(Ext.Panel, { + Deluge.Sidebar = Ext.extend(Ext.Panel, { // private panels: {}, @@ -86,13 +86,13 @@ Copyright: margins: '5 0 0 5', cmargins: '5 0 0 5' }, config); - Ext.deluge.Sidebar.superclass.constructor.call(this, config); + Deluge.Sidebar.superclass.constructor.call(this, config); }, // private initComponent: function() { - Ext.deluge.Sidebar.superclass.initComponent.call(this); - Deluge.Events.on("disconnect", this.onDisconnect, this); + Deluge.Sidebar.superclass.initComponent.call(this); + deluge.events.on("disconnect", this.onDisconnect, this); }, createFilter: function(filter, states) { @@ -136,7 +136,7 @@ Copyright: autoScroll: true }); - if (Deluge.config['sidebar_show_zero'] == false) { + if (deluge.config['sidebar_show_zero'] == false) { states = this.removeZero(states); } @@ -179,7 +179,7 @@ Copyright: }, onFilterSelect: function(selModel, rowIndex, record) { - Deluge.UI.update(); + deluge.ui.update(); }, /** @@ -215,20 +215,37 @@ Copyright: }, updateFilter: function(filter, states) { - if (Deluge.config['sidebar_show_zero'] == false) { + if (deluge.config.sidebar_show_zero == false) { states = this.removeZero(states); } - + var store = this.panels[filter].getStore(); + var filters = []; Ext.each(states, function(s, i) { - var record = store.getAt(i); + var record = store.getById(s[0]); + if (!record) { + record = new store.recordType({ + filter: s[0], + count: s[1] + }); + record.id = s[0]; + store.insert(i, [record]); + } record.beginEdit(); record.set('filter', s[0]); record.set('count', s[1]); record.endEdit(); - record.commit(); + filters[s[0]] = true; }, this); + + store.each(function(record) { + if (filters[record.id]) return; + + store.remove(record); + }, this); + + store.commitChanges(); } }); - Deluge.Sidebar = new Ext.deluge.Sidebar(); + deluge.sidebar = new Deluge.Sidebar(); })(); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Statusbar.js b/deluge/ui/web/js/deluge-all/Deluge.Statusbar.js index cbb0d0f13..09e696f3b 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Statusbar.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Statusbar.js @@ -1,18 +1,18 @@ -Ext.deluge.Statusbar = Ext.extend(Ext.ux.StatusBar, { +Deluge.Statusbar = Ext.extend(Ext.ux.StatusBar, { constructor: function(config) { config = Ext.apply({ id: 'deluge-statusbar', defaultIconCls: 'x-not-connected', defaultText: _('Not Connected') }, config); - Ext.deluge.Statusbar.superclass.constructor.call(this, config); + Deluge.Statusbar.superclass.constructor.call(this, config); }, initComponent: function() { - Ext.deluge.Statusbar.superclass.initComponent.call(this); + Deluge.Statusbar.superclass.initComponent.call(this); - Deluge.Events.on('connect', this.onConnect, this); - Deluge.Events.on('disconnect', this.onDisconnect, this); + deluge.events.on('connect', this.onConnect, this); + deluge.events.on('disconnect', this.onDisconnect, this); }, createButtons: function() { @@ -22,21 +22,21 @@ Ext.deluge.Statusbar = Ext.extend(Ext.ux.StatusBar, { cls: 'x-btn-text-icon', iconCls: 'x-deluge-connections', tooltip: _('Connections'), - menu: Deluge.Menus.Connections + menu: deluge.menus.connections }, '-', { id: 'statusbar-downspeed', text: ' ', cls: 'x-btn-text-icon', iconCls: 'x-deluge-downloading', tooltip: _('Download Speed'), - menu: Deluge.Menus.Download + menu: deluge.menus.download }, '-', { id: 'statusbar-upspeed', text: ' ', cls: 'x-btn-text-icon', iconCls: 'x-deluge-seeding', tooltip: _('Upload Speed'), - menu: Deluge.Menus.Upload + menu: deluge.menus.upload }, '-', { id: 'statusbar-traffic', text: ' ', @@ -146,9 +146,9 @@ Ext.deluge.Statusbar = Ext.extend(Ext.ux.StatusBar, { this.items.get('statusbar-dht').setText(stats.dht_nodes); this.items.get('statusbar-freespace').setText(fsize(stats.free_space)); - Deluge.Menus.Connections.setValue(stats.max_num_connections); - Deluge.Menus.Download.setValue(stats.max_download); - Deluge.Menus.Upload.setValue(stats.max_upload); + deluge.menus.connections.setValue(stats.max_num_connections); + deluge.menus.download.setValue(stats.max_download); + deluge.menus.upload.setValue(stats.max_upload); } }); -Deluge.Statusbar = new Ext.deluge.Statusbar(); +deluge.statusbar = new Deluge.Statusbar(); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Toolbar.js b/deluge/ui/web/js/deluge-all/Deluge.Toolbar.js index 7da506b5e..fdd8ef38e 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Toolbar.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Toolbar.js @@ -34,10 +34,10 @@ Copyright: /** * An extension of the Ext.Toolbar class that provides an extensible toolbar for Deluge. - * @class Ext.deluge.Toolbar + * @class Deluge.Toolbar * @extends Ext.Toolbar */ -Ext.deluge.Toolbar = Ext.extend(Ext.Toolbar, { +Deluge.Toolbar = Ext.extend(Ext.Toolbar, { constructor: function(config) { config = Ext.apply({ items: [ @@ -112,7 +112,7 @@ Ext.deluge.Toolbar = Ext.extend(Ext.Toolbar, { } ] }, config); - Ext.deluge.Toolbar.superclass.constructor.call(this, config); + Deluge.Toolbar.superclass.constructor.call(this, config); }, connectedButtons: [ @@ -120,9 +120,9 @@ Ext.deluge.Toolbar = Ext.extend(Ext.Toolbar, { ], initComponent: function() { - Ext.deluge.Toolbar.superclass.initComponent.call(this); - Deluge.Events.on('connect', this.onConnect, this); - Deluge.Events.on('login', this.onLogin, this); + Deluge.Toolbar.superclass.initComponent.call(this); + deluge.events.on('connect', this.onConnect, this); + deluge.events.on('login', this.onLogin, this); }, onConnect: function() { @@ -143,11 +143,11 @@ Ext.deluge.Toolbar = Ext.extend(Ext.Toolbar, { onLogout: function() { this.items.get('logout').disable(); - Deluge.Login.logout(); + deluge.login.logout(); }, onConnectionManagerClick: function() { - Deluge.ConnectionManager.show(); + deluge.connectionManager.show(); }, onHelpClick: function() { @@ -155,11 +155,11 @@ Ext.deluge.Toolbar = Ext.extend(Ext.Toolbar, { }, onPreferencesClick: function() { - Deluge.Preferences.show(); + deluge.preferences.show(); }, onTorrentAction: function(item) { - var selection = Deluge.Torrents.getSelections(); + var selection = deluge.torrents.getSelections(); var ids = []; Ext.each(selection, function(record) { ids.push(record.id); @@ -167,21 +167,21 @@ Ext.deluge.Toolbar = Ext.extend(Ext.Toolbar, { switch (item.id) { case 'remove': - Deluge.RemoveWindow.show(ids); + deluge.removeWindow.show(ids); break; case 'pause': case 'resume': - Deluge.Client.core[item.id + '_torrent'](ids, { + deluge.client.core[item.id + '_torrent'](ids, { success: function() { - Deluge.UI.update(); + deluge.ui.update(); } }); break; case 'up': case 'down': - Deluge.Client.core['queue_' + item.id](ids, { + deluge.client.core['queue_' + item.id](ids, { success: function() { - Deluge.UI.update(); + deluge.ui.update(); } }); break; @@ -189,8 +189,8 @@ Ext.deluge.Toolbar = Ext.extend(Ext.Toolbar, { }, onTorrentAdd: function() { - Deluge.Add.show(); + deluge.add.show(); } }); -Deluge.Toolbar = new Ext.deluge.Toolbar(); +deluge.toolbar = new Deluge.Toolbar(); diff --git a/deluge/ui/web/js/deluge-all/Deluge.Torrents.js b/deluge/ui/web/js/deluge-all/Deluge.Torrents.js index 8628177d9..4aae0b71b 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Torrents.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Torrents.js @@ -70,7 +70,7 @@ Copyright: return (value < 0) ? '∞' : new Number(value).toFixed(3); } function trackerRenderer(value, p, r) { - return String.format('
{0}
', value); + return String.format('
{0}
', value); } function etaSorter(eta) { @@ -78,17 +78,17 @@ Copyright: } /** - * Ext.deluge.TorrentGrid Class + * Deluge.TorrentGrid Class * * @author Damien Churchill * @version 1.3 * - * @class Ext.deluge.TorrentGrid + * @class Deluge.TorrentGrid * @extends Ext.grid.GridPanel * @constructor * @param {Object} config Configuration options */ - Ext.deluge.TorrentGrid = Ext.extend(Ext.grid.GridPanel, { + Deluge.TorrentGrid = Ext.extend(Ext.grid.GridPanel, { // object to store contained torrent ids torrents: {}, @@ -212,13 +212,13 @@ Copyright: scrollDelay: false }) }, config); - Ext.deluge.TorrentGrid.superclass.constructor.call(this, config); + Deluge.TorrentGrid.superclass.constructor.call(this, config); }, initComponent: function() { - Ext.deluge.TorrentGrid.superclass.initComponent.call(this); - Deluge.Events.on('torrentRemoved', this.onTorrentRemoved, this); - Deluge.Events.on('logout', this.onDisconnect, this); + Deluge.TorrentGrid.superclass.initComponent.call(this); + deluge.events.on('torrentRemoved', this.onTorrentRemoved, this); + deluge.events.on('logout', this.onDisconnect, this); this.on('rowcontextmenu', function(grid, rowIndex, e) { e.stopEvent(); @@ -226,7 +226,7 @@ Copyright: if (!selection.hasSelection()) { selection.selectRow(rowIndex); } - Deluge.Menus.Torrent.showAt(e.getPoint()); + deluge.menus.torrent.showAt(e.getPoint()); }); }, @@ -313,5 +313,5 @@ Copyright: }, this); } }); -Deluge.Torrents = new Ext.deluge.TorrentGrid(); +deluge.torrents = new Deluge.TorrentGrid(); })(); diff --git a/deluge/ui/web/js/deluge-all/Deluge.UI.js b/deluge/ui/web/js/deluge-all/Deluge.UI.js index 2c42e064e..71b437544 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.UI.js +++ b/deluge/ui/web/js/deluge-all/Deluge.UI.js @@ -38,7 +38,7 @@ Copyright: * The controller for the whole interface, that ties all the components * together and handles the 2 second poll. */ -Deluge.UI = { +deluge.ui = { errorCount: 0, @@ -54,13 +54,13 @@ Deluge.UI = { iconCls: 'x-deluge-main-panel', title: 'Deluge', layout: 'border', - tbar: Deluge.Toolbar, + tbar: deluge.toolbar, items: [ - Deluge.Sidebar, - Deluge.Details, - Deluge.Torrents + deluge.sidebar, + deluge.details, + deluge.torrents ], - bbar: Deluge.Statusbar + bbar: deluge.statusbar }); this.Viewport = new Ext.Viewport({ @@ -68,22 +68,22 @@ Deluge.UI = { items: [this.MainPanel] }); - Deluge.Events.on("connect", this.onConnect, this); - Deluge.Events.on("disconnect", this.onDisconnect, this); - Deluge.Client = new Ext.ux.util.RpcClient({ - url: Deluge.config.base + 'json' + deluge.events.on("connect", this.onConnect, this); + deluge.events.on("disconnect", this.onDisconnect, this); + deluge.client = new Ext.ux.util.RpcClient({ + url: deluge.config.base + 'json' }); - for (var plugin in Deluge.Plugins) { - plugin = Deluge.Plugins[plugin]; + for (var plugin in deluge.dlugins) { + plugin = deluge.plugins[plugin]; plugin.enable(); } // Initialize quicktips so all the tooltip configs start working. Ext.QuickTips.init(); - Deluge.Client.on('connected', function(e) { - Deluge.Login.show(); + deluge.client.on('connected', function(e) { + deluge.login.show(); }, this, {single: true}); this.update = this.update.createDelegate(this); @@ -92,13 +92,13 @@ Deluge.UI = { }, update: function() { - var filters = Deluge.Sidebar.getFilters(); - Deluge.Client.web.update_ui(Deluge.Keys.Grid, filters, { + var filters = deluge.sidebar.getFilters(); + deluge.client.web.update_ui(Deluge.Keys.Grid, filters, { success: this.onUpdate, failure: this.onUpdateError, scope: this }); - Deluge.Details.update(); + deluge.details.update(); }, onUpdateError: function(error) { @@ -119,16 +119,16 @@ Deluge.UI = { * Updates the various components in the interface. */ onUpdate: function(data) { - if (!data['connected']) Deluge.Events.fire('disconnect'); + if (!data['connected']) deluge.events.fire('disconnect'); - if (Deluge.config.show_session_speed) { + if (deluge.config.show_session_speed) { document.title = this.originalTitle + ' (Down: ' + fspeed(data['stats'].download_rate, true) + ' Up: ' + fspeed(data['stats'].upload_rate, true) + ')'; } - Deluge.Torrents.update(data['torrents']); - Deluge.Statusbar.update(data['stats']); - Deluge.Sidebar.update(data['filters']); + deluge.torrents.update(data['torrents']); + deluge.statusbar.update(data['stats']); + deluge.sidebar.update(data['filters']); this.errorCount = 0; }, @@ -153,14 +153,14 @@ Deluge.UI = { }, onPluginEnabled: function(pluginName) { - Deluge.Client.web.get_plugin_resources(pluginName, { + deluge.client.web.get_plugin_resources(pluginName, { success: this.onGotPluginResources, scope: this }) }, onGotPluginResources: function(resources) { - var scripts = (Deluge.debug) ? resources.debug_scripts : resources.scripts; + var scripts = (deluge.debug) ? resources.debug_scripts : resources.scripts; Ext.each(scripts, function(script) { Ext.ux.JSLoader({ url: script, @@ -171,15 +171,15 @@ Deluge.UI = { }, onPluginDisabled: function(pluginName) { - Deluge.Plugins[pluginName].disable(); + deluge.plugins[pluginName].disable(); }, onPluginLoaded: function(options) { // This could happen if the plugin has multiple scripts - if (!Deluge.Plugins[options.pluginName]) return; + if (!deluge.plugins[options.pluginName]) return; // Enable the plugin - Deluge.Plugins[options.pluginName].enable(); + deluge.plugins[options.pluginName].enable(); }, /** @@ -190,11 +190,11 @@ Deluge.UI = { if (this.running) { clearInterval(this.running); this.running = false; - Deluge.Torrents.getStore().removeAll(); + deluge.torrents.getStore().removeAll(); } } } Ext.onReady(function(e) { - Deluge.UI.initialize(); + deluge.ui.initialize(); }); diff --git a/deluge/ui/web/js/deluge-all/Deluge.js b/deluge/ui/web/js/deluge-all/Deluge.js index a6b6f9e44..8c813b2d3 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.js +++ b/deluge/ui/web/js/deluge-all/Deluge.js @@ -31,13 +31,14 @@ Copyright: statement from all source files in the program, then also delete it here. */ -// Create the namespace Ext.deluge -Ext.namespace('Ext.deluge'); // Setup the state manager Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); +// Add some additional functions to ext and setup some of the +// configurable parameters (function() { + Ext.apply(Ext, { escapeHTML: function(text) { text = String(text).replace('<', '<').replace('>', '>'); @@ -85,34 +86,48 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); } }); Ext.getKeys = Ext.keys; - Ext.BLANK_IMAGE_URL = Deluge.config.base + 'images/s.gif'; + Ext.BLANK_IMAGE_URL = deluge.config.base + 'images/s.gif'; Ext.USE_NATIVE_JSON = true; })(); -(function() { - var tpl = '
' + - '
' + - '
' + - '
' + - '
{0}
' + - '
' + - '
' + - '
' + - '
{0}
' + - '
' + - '
' + - '
'; +// Create the Deluge namespace +Deluge = { - Deluge.progressBar = function(progress, width, text, modifier) { + // private + progressTpl: '
' + + '
' + + '
' + + '
' + + '
{0}
' + + '
' + + '
' + + '
' + + '
{0}
' + + '
' + + '
' + + '
', + + + /** + * A method to create a progress bar that can be used by renderers + * to display a bar within a grid or tree. + * @param {Number} progress The bars progress + * @param {Number} width The width of the bar + * @param {String} text The text to display on the bar + * @param {Number} modified Amount to subtract from the width allowing for fixes + */ + progressBar: function(progress, width, text, modifier) { modifier = Ext.value(modifier, 10); var progressWidth = ((width / 100.0) * progress).toFixed(0); var barWidth = progressWidth - 1; var textWidth = ((progressWidth - modifier) > 0 ? progressWidth - modifier : 0); - return String.format(tpl, text, width, barWidth, textWidth); + return String.format(Deluge.progressTpl, text, width, barWidth, textWidth); } - Deluge.Plugins = {}; -})(); +} + +// Setup a space for plugins to insert themselves +deluge.plugins = {}; // Hinting for gettext_gen.py // _('Do Not Download') diff --git a/deluge/ui/web/server.py b/deluge/ui/web/server.py index c240f783e..4bf5cddce 100644 --- a/deluge/ui/web/server.py +++ b/deluge/ui/web/server.py @@ -131,7 +131,7 @@ class Config(resource.Resource): def render(self, request): web_config = component.get("Web").get_config() config = dict([(key, web_config[key]) for key in UI_CONFIG_KEYS]) - return compress("""Deluge = { + return compress("""deluge = { author: 'Damien Churchill ', version: '%s', config: %s