big refactor to meet the new coding style to allow for tidier namespaces

This commit is contained in:
Damien Churchill 2010-03-18 22:56:18 +00:00
parent 26defff7fc
commit dd866f07de
34 changed files with 414 additions and 382 deletions

View File

@ -33,7 +33,7 @@ Copyright:
*/ */
Ext.namespace('Ext.deluge.add'); 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) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
layout: 'fit', layout: 'fit',
@ -47,11 +47,11 @@ Ext.deluge.add.FileWindow = Ext.extend(Ext.deluge.add.Window, {
title: _('Add from File'), title: _('Add from File'),
iconCls: 'x-deluge-add-file' iconCls: 'x-deluge-add-file'
}, config); }, config);
Ext.deluge.add.FileWindow.superclass.constructor.call(this, config); Deluge.add.FileWindow.superclass.constructor.call(this, config);
}, },
initComponent: function() { initComponent: function() {
Ext.deluge.add.FileWindow.superclass.initComponent.call(this); Deluge.add.FileWindow.superclass.initComponent.call(this);
this.addButton(_('Add'), this.onAddClick, this); this.addButton(_('Add'), this.onAddClick, this);
this.form = this.add({ this.form = this.add({

View File

@ -32,8 +32,8 @@ Copyright:
*/ */
Ext.namespace('Ext.deluge.add'); Ext.namespace('Deluge.add');
Ext.deluge.add.UrlWindow = Ext.extend(Ext.deluge.add.Window, { Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
layout: 'fit', layout: 'fit',
@ -47,11 +47,11 @@ Ext.deluge.add.UrlWindow = Ext.extend(Ext.deluge.add.Window, {
title: _('Add from Url'), title: _('Add from Url'),
iconCls: 'x-deluge-add-url-window-icon' iconCls: 'x-deluge-add-url-window-icon'
}, config); }, config);
Ext.deluge.add.UrlWindow.superclass.constructor.call(this, config); Deluge.add.UrlWindow.superclass.constructor.call(this, config);
}, },
initComponent: function() { initComponent: function() {
Ext.deluge.add.UrlWindow.superclass.initComponent.call(this); Deluge.add.UrlWindow.superclass.initComponent.call(this);
this.addButton(_('Add'), this.onAddClick, this); this.addButton(_('Add'), this.onAddClick, this);
var form = this.add({ var form = this.add({
@ -86,7 +86,7 @@ Ext.deluge.add.UrlWindow = Ext.extend(Ext.deluge.add.Window, {
var cookies = this.cookieField.getValue(); var cookies = this.cookieField.getValue();
var torrentId = this.createTorrentId(); 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, success: this.onDownload,
scope: this, scope: this,
torrentId: torrentId torrentId: torrentId
@ -97,7 +97,7 @@ Ext.deluge.add.UrlWindow = Ext.extend(Ext.deluge.add.Window, {
onDownload: function(filename, obj, resp, req) { onDownload: function(filename, obj, resp, req) {
this.urlField.setValue(''); this.urlField.setValue('');
Deluge.Client.web.get_torrent_info(filename, { deluge.client.web.get_torrent_info(filename, {
success: this.onGotInfo, success: this.onGotInfo,
scope: this, scope: this,
filename: filename, filename: filename,

View File

@ -32,8 +32,8 @@ Copyright:
*/ */
Ext.namespace('Ext.deluge.add'); Ext.namespace('Deluge.add');
Ext.deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
torrents: {}, torrents: {},
@ -44,11 +44,11 @@ Ext.deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
activeTab: 0, activeTab: 0,
height: 220 height: 220
}, config); }, config);
Ext.deluge.add.OptionsPanel.superclass.constructor.call(this, config); Deluge.add.OptionsPanel.superclass.constructor.call(this, config);
}, },
initComponent: function() { 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({ this.files = this.add(new Ext.ux.tree.TreeGrid({
layout: 'fit', layout: 'fit',
title: _('Files'), title: _('Files'),
@ -237,7 +237,7 @@ Ext.deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
'max_upload_slots_per_torrent','max_upload_speed_per_torrent', 'max_upload_slots_per_torrent','max_upload_speed_per_torrent',
'prioritize_first_last_pieces']; 'prioritize_first_last_pieces'];
Deluge.Client.core.get_config_values(keys, { deluge.client.core.get_config_values(keys, {
success: function(config) { success: function(config) {
var options = { var options = {
'file_priorities': [], '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() { initComponent: function() {
Ext.deluge.add.Window.superclass.initComponent.call(this); Deluge.add.Window.superclass.initComponent.call(this);
this.addEvents( this.addEvents(
'beforeadd', 'beforeadd',
'add' '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) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
@ -372,11 +372,11 @@ Ext.deluge.add.AddWindow = Ext.extend(Ext.deluge.add.Window, {
plain: true, plain: true,
iconCls: 'x-deluge-add-window-icon' iconCls: 'x-deluge-add-window-icon'
}, config); }, config);
Ext.deluge.add.AddWindow.superclass.constructor.call(this, config); Deluge.add.AddWindow.superclass.constructor.call(this, config);
}, },
initComponent: function() { 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(_('Cancel'), this.onCancelClick, this);
this.addButton(_('Add'), this.onAddClick, 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('hide', this.onHide, this);
this.on('show', this.onShow, this); this.on('show', this.onShow, this);
}, },
@ -474,7 +474,7 @@ Ext.deluge.add.AddWindow = Ext.extend(Ext.deluge.add.Window, {
}); });
}, this); }, this);
Deluge.Client.web.add_torrents(torrents, { deluge.client.web.add_torrents(torrents, {
success: function(result) { success: function(result) {
} }
}) })
@ -515,13 +515,13 @@ Ext.deluge.add.AddWindow = Ext.extend(Ext.deluge.add.Window, {
onShow: function() { onShow: function() {
if (!this.url) { 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('beforeadd', this.onTorrentBeforeAdd, this);
this.url.on('add', this.onTorrentAdd, this); this.url.on('add', this.onTorrentAdd, this);
} }
if (!this.file) { 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('beforeadd', this.onTorrentBeforeAdd, this);
this.file.on('add', this.onTorrentAdd, 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(); this.url.show();
} }
}); });
Deluge.Add = new Ext.deluge.add.AddWindow(); Deluge.Add = new Deluge.add.AddWindow();

View File

@ -37,7 +37,7 @@ Copyright:
return value + ':' + r.data['port'] return value + ':' + r.data['port']
} }
Ext.deluge.AddConnectionWindow = Ext.extend(Ext.Window, { Deluge.AddConnectionWindow = Ext.extend(Ext.Window, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
@ -52,11 +52,11 @@ Copyright:
title: _('Add Connection'), title: _('Add Connection'),
iconCls: 'x-deluge-add-window-icon' iconCls: 'x-deluge-add-window-icon'
}, config); }, config);
Ext.deluge.AddConnectionWindow.superclass.constructor.call(this, config); Deluge.AddConnectionWindow.superclass.constructor.call(this, config);
}, },
initComponent: function() { initComponent: function() {
Ext.deluge.AddConnectionWindow.superclass.initComponent.call(this); Deluge.AddConnectionWindow.superclass.initComponent.call(this);
this.addEvents('hostadded'); this.addEvents('hostadded');
@ -120,7 +120,7 @@ Copyright:
var username = this.usernameField.getValue(); var username = this.usernameField.getValue();
var password = this.passwordField.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) { success: function(result) {
if (!result[0]) { if (!result[0]) {
Ext.MessageBox.show({ Ext.MessageBox.show({
@ -145,7 +145,7 @@ Copyright:
} }
}); });
Ext.deluge.ConnectionManager = Ext.extend(Ext.Window, { Deluge.ConnectionManager = Ext.extend(Ext.Window, {
layout: 'fit', layout: 'fit',
width: 300, width: 300,
@ -159,13 +159,13 @@ Copyright:
iconCls: 'x-deluge-connect-window-icon', iconCls: 'x-deluge-connect-window-icon',
initComponent: function() { initComponent: function() {
Ext.deluge.ConnectionManager.superclass.initComponent.call(this); Deluge.ConnectionManager.superclass.initComponent.call(this);
this.on('hide', this.onHide, this); this.on('hide', this.onHide, this);
this.on('show', this.onShow, this); this.on('show', this.onShow, this);
Deluge.Events.on('disconnect', this.onDisconnect, this); deluge.events.on('disconnect', this.onDisconnect, this);
Deluge.Events.on('login', this.onLogin, this); deluge.events.on('login', this.onLogin, this);
Deluge.Events.on('logout', this.onLogout, this); deluge.events.on('logout', this.onLogout, this);
this.addButton(_('Close'), this.onClose, this); this.addButton(_('Close'), this.onClose, this);
this.addButton(_('Connect'), this.onConnect, this); this.addButton(_('Connect'), this.onConnect, this);
@ -251,10 +251,10 @@ Copyright:
* to a Deluge Daemon and show the Connection Manager if not. * to a Deluge Daemon and show the Connection Manager if not.
*/ */
checkConnected: function() { checkConnected: function() {
Deluge.Client.web.connected({ deluge.client.web.connected({
success: function(connected) { success: function(connected) {
if (connected) { if (connected) {
Deluge.Events.fire('connect'); deluge.events.fire('connect');
} else { } else {
this.show(); this.show();
} }
@ -264,11 +264,11 @@ Copyright:
}, },
disconnect: function() { disconnect: function() {
Deluge.Events.fire('disconnect'); deluge.events.fire('disconnect');
}, },
loadHosts: function() { loadHosts: function() {
Deluge.Client.web.get_hosts({ deluge.client.web.get_hosts({
success: this.onGetHosts, success: this.onGetHosts,
scope: this scope: this
}); });
@ -276,7 +276,7 @@ Copyright:
update: function() { update: function() {
this.grid.getStore().each(function(r) { 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, success: this.onGetHostStatus,
scope: this scope: this
}); });
@ -318,7 +318,7 @@ Copyright:
onAddClick: function(button, e) { onAddClick: function(button, e) {
if (!this.addWindow) { if (!this.addWindow) {
this.addWindow = new Ext.deluge.AddConnectionWindow(); this.addWindow = new Deluge.AddConnectionWindow();
this.addWindow.on('hostadded', this.onHostAdded, this); this.addWindow.on('hostadded', this.onHostAdded, this);
} }
this.addWindow.show(); this.addWindow.show();
@ -340,7 +340,7 @@ Copyright:
if (!selected) return; if (!selected) return;
if (selected.get('status') == _('Connected')) { if (selected.get('status') == _('Connected')) {
Deluge.Client.web.disconnect({ deluge.client.web.disconnect({
success: function(result) { success: function(result) {
this.update(this); this.update(this);
Deluge.Events.fire('disconnect'); Deluge.Events.fire('disconnect');
@ -349,11 +349,11 @@ Copyright:
}); });
} else { } else {
var id = selected.id; var id = selected.id;
Deluge.Client.web.connect(id, { deluge.client.web.connect(id, {
success: function(methods) { success: function(methods) {
Deluge.Client.reloadMethods(); deluge.client.reloadMethods();
Deluge.Client.on('connected', function(e) { deluge.client.on('connected', function(e) {
Deluge.Events.fire('connect'); deluge.events.fire('connect');
}, this, {single: true}); }, this, {single: true});
} }
}); });
@ -370,7 +370,7 @@ Copyright:
onGetHosts: function(hosts) { onGetHosts: function(hosts) {
this.grid.getStore().loadData(hosts); this.grid.getStore().loadData(hosts);
Ext.each(hosts, function(host) { Ext.each(hosts, function(host) {
Deluge.Client.web.get_host_status(host[0], { deluge.client.web.get_host_status(host[0], {
success: this.onGetHostStatus, success: this.onGetHostStatus,
scope: this scope: this
}); });
@ -393,17 +393,17 @@ Copyright:
// private // private
onLogin: function() { onLogin: function() {
if (Deluge.config.first_login) { if (deluge.config.first_login) {
Ext.MessageBox.confirm('Change password', Ext.MessageBox.confirm('Change password',
'As this is your first login, we recommend that you ' + 'As this is your first login, we recommend that you ' +
'change your password. Would you like to ' + 'change your password. Would you like to ' +
'do this now?', function(res) { 'do this now?', function(res) {
this.checkConnected(); this.checkConnected();
if (res == 'yes') { if (res == 'yes') {
Deluge.Preferences.show(); deluge.preferences.show();
Deluge.Preferences.selectPage('Interface'); deluge.preferences.selectPage('Interface');
} }
Deluge.Client.web.set_config({first_login: false}); deluge.client.web.set_config({first_login: false});
}, this); }, this);
} else { } else {
this.checkConnected(); this.checkConnected();
@ -423,7 +423,7 @@ Copyright:
var connection = this.grid.getSelectionModel().getSelected(); var connection = this.grid.getSelectionModel().getSelected();
if (!connection) return; if (!connection) return;
Deluge.Client.web.remove_host(connection.id, { deluge.client.web.remove_host(connection.id, {
success: function(result) { success: function(result) {
if (!result) { if (!result) {
Ext.MessageBox.show({ Ext.MessageBox.show({
@ -480,10 +480,10 @@ Copyright:
if (connection.get('status') == 'Offline') { if (connection.get('status') == 'Offline') {
// This means we need to start the daemon // 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 { } else {
// This means we need to stop the daemon // 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) { success: function(result) {
if (!result[0]) { if (!result[0]) {
Ext.MessageBox.show({ Ext.MessageBox.show({
@ -500,5 +500,5 @@ Copyright:
} }
} }
}); });
Deluge.ConnectionManager = new Ext.deluge.ConnectionManager(); deluge.connectionManager = new Deluge.ConnectionManager();
})(); })();

View File

@ -32,7 +32,7 @@ Copyright:
*/ */
Ext.deluge.details.DetailsTab = Ext.extend(Ext.Panel, { Deluge.details.DetailsTab = Ext.extend(Ext.Panel, {
title: _('Details'), title: _('Details'),
fields: {}, fields: {},
@ -42,7 +42,7 @@ Ext.deluge.details.DetailsTab = Ext.extend(Ext.Panel, {
oldData: {}, oldData: {},
initComponent: function() { initComponent: function() {
Ext.deluge.details.DetailsTab.superclass.initComponent.call(this); Deluge.details.DetailsTab.superclass.initComponent.call(this);
this.addItem('torrent_name', _('Name')); this.addItem('torrent_name', _('Name'));
this.addItem('hash', _('Hash')); this.addItem('hash', _('Hash'));
this.addItem('path', _('Path')); this.addItem('path', _('Path'));
@ -54,7 +54,7 @@ Ext.deluge.details.DetailsTab = Ext.extend(Ext.Panel, {
}, },
onRender: function(ct, position) { 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.body.setStyle('padding', '10px');
this.dl = Ext.DomHelper.append(this.body, {tag: 'dl'}, true); 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) { 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, success: this.onRequestComplete,
scope: this, scope: this,
torrentId: torrentId torrentId: torrentId
@ -112,4 +112,4 @@ Ext.deluge.details.DetailsTab = Ext.extend(Ext.Panel, {
this.oldData = data; this.oldData = data;
} }
}); });
Deluge.Details.add(new Ext.deluge.details.DetailsTab()); deluge.details.add(new Deluge.details.DetailsTab());

View File

@ -41,7 +41,7 @@ Copyright:
return String.format('<div class="{0}">{1}</div>', FILE_PRIORITY_CSS[value], _(FILE_PRIORITY[value])); return String.format('<div class="{0}">{1}</div>', 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) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
@ -79,17 +79,17 @@ Copyright:
}) })
}, config); }, config);
Ext.deluge.details.FilesTab.superclass.constructor.call(this, config); Deluge.details.FilesTab.superclass.constructor.call(this, config);
}, },
initComponent: function() { initComponent: function() {
Ext.deluge.details.FilesTab.superclass.initComponent.call(this); Deluge.details.FilesTab.superclass.initComponent.call(this);
}, },
onRender: function(ct, position) { onRender: function(ct, position) {
Ext.deluge.details.FilesTab.superclass.onRender.call(this, ct, position); Deluge.details.FilesTab.superclass.onRender.call(this, ct, position);
Deluge.Menus.FilePriorities.on('itemclick', this.onItemClick, this); deluge.menus.filePriorities.on('itemclick', this.onItemClick, this);
this.on('contextmenu', this.onContextMenu, this); this.on('contextmenu', this.onContextMenu, this);
this.sorter = new Ext.tree.TreeSorter(this, { this.sorter = new Ext.tree.TreeSorter(this, {
folderSort: true folderSort: true
@ -113,7 +113,7 @@ Copyright:
this.torrentId = torrentId; this.torrentId = torrentId;
} }
Deluge.Client.web.get_torrent_files(torrentId, { deluge.client.web.get_torrent_files(torrentId, {
success: this.onRequestComplete, success: this.onRequestComplete,
scope: this, scope: this,
torrentId: torrentId torrentId: torrentId
@ -127,7 +127,7 @@ Copyright:
selModel.clearSelections(); selModel.clearSelections();
node.select(); node.select();
} }
Deluge.Menus.FilePriorities.showAt(e.getPoint()); deluge.menus.filePriorities.showAt(e.getPoint());
}, },
onItemClick: function(baseItem, e) { onItemClick: function(baseItem, e) {
@ -162,7 +162,7 @@ Copyright:
priorities[index] = indexes[index]; 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() { success: function() {
Ext.each(nodes, function(node) { Ext.each(nodes, function(node) {
node.setColumnValue(3, baseItem.filePriority); node.setColumnValue(3, baseItem.filePriority);
@ -216,5 +216,5 @@ Copyright:
root.firstChild.expand(); root.firstChild.expand();
} }
}); });
Deluge.Details.add(new Ext.deluge.details.FilesTab()); deluge.details.add(new Deluge.details.FilesTab());
})(); })();

View File

@ -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) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
@ -49,11 +49,11 @@ Ext.deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
layout: 'column', layout: 'column',
title: _('Options') title: _('Options')
}, config); }, config);
Ext.deluge.details.OptionsTab.superclass.constructor.call(this, config); Deluge.details.OptionsTab.superclass.constructor.call(this, config);
}, },
initComponent: function() { initComponent: function() {
Ext.deluge.details.OptionsTab.superclass.initComponent.call(this); Deluge.details.OptionsTab.superclass.initComponent.call(this);
this.fieldsets = {}, this.fields = {}; this.fieldsets = {}, this.fields = {};
this.optionsManager = new Deluge.MultiOptionsManager({ this.optionsManager = new Deluge.MultiOptionsManager({
@ -342,7 +342,7 @@ Ext.deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
}, },
onRender: function(ct, position) { 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 is another hack I think, so keep an eye out here when upgrading.
this.layout = new Ext.layout.ColumnLayout(); this.layout = new Ext.layout.ColumnLayout();
@ -369,7 +369,7 @@ Ext.deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
this.torrentId = torrentId; this.torrentId = torrentId;
this.optionsManager.changeId(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, success: this.onRequestComplete,
scope: this scope: this
}); });
@ -379,14 +379,14 @@ Ext.deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
var changed = this.optionsManager.getDirty(); var changed = this.optionsManager.getDirty();
if (!Ext.isEmpty(changed['prioritize_first_last'])) { if (!Ext.isEmpty(changed['prioritize_first_last'])) {
var value = 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() { success: function() {
this.optionsManager.set('prioritize_first_last', value); this.optionsManager.set('prioritize_first_last', value);
}, },
scope: this scope: this
}); });
} }
Deluge.Client.core.set_torrent_options([this.torrentId], changed, { deluge.client.core.set_torrent_options([this.torrentId], changed, {
success: function() { success: function() {
this.optionsManager.commit(); this.optionsManager.commit();
}, },
@ -395,7 +395,7 @@ Ext.deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
}, },
onEditTrackers: function() { onEditTrackers: function() {
Deluge.EditTrackers.show(); deluge.editTrackers.show();
}, },
onStopRatioChecked: function(checkbox, checked) { 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); this.fields.stop_ratio.setDisabled(!stop_at_ratio);
} }
}); });
Deluge.Details.add(new Ext.deluge.details.OptionsTab()); deluge.details.add(new Deluge.details.OptionsTab());

View File

@ -49,7 +49,7 @@ Copyright:
return ((((((+d[1])*256)+(+d[2]))*256)+(+d[3]))*256)+(+d[4]); 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) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
@ -108,11 +108,11 @@ Copyright:
deferredRender:false, deferredRender:false,
autoScroll:true autoScroll:true
}, config); }, config);
Ext.deluge.details.PeersTab.superclass.constructor.call(this, config); Deluge.details.PeersTab.superclass.constructor.call(this, config);
}, },
onRender: function(ct, position) { 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() { clear: function() {
@ -120,7 +120,7 @@ Copyright:
}, },
update: function(torrentId) { 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, success: this.onRequestComplete,
scope: this scope: this
}); });
@ -135,5 +135,5 @@ Copyright:
this.getStore().loadData(peers); this.getStore().loadData(peers);
} }
}); });
Deluge.Details.add(new Ext.deluge.details.PeersTab()); deluge.details.add(new Deluge.details.PeersTab());
})(); })();

View File

@ -31,12 +31,12 @@ Copyright:
statement from all source files in the program, then also delete it here. 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'), title: _('Status'),
autoScroll: true, autoScroll: true,
onRender: function(ct, position) { 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({ this.progressBar = this.add({
xtype: 'progress', xtype: 'progress',
@ -53,7 +53,7 @@ Ext.deluge.details.StatusTab = Ext.extend(Ext.Panel, {
'render': { 'render': {
fn: function(panel) { fn: function(panel) {
panel.load({ panel.load({
url: Deluge.config.base + 'render/tab_status.html', url: deluge.config.base + 'render/tab_status.html',
text: _('Loading') + '...' text: _('Loading') + '...'
}); });
panel.getUpdater().on('update', this.onPanelUpdate, this); panel.getUpdater().on('update', this.onPanelUpdate, this);
@ -73,7 +73,7 @@ Ext.deluge.details.StatusTab = Ext.extend(Ext.Panel, {
update: function(torrentId) { update: function(torrentId) {
if (!this.fields) this.getFields(); 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, success: this.onRequestComplete,
scope: this scope: this
}); });
@ -119,4 +119,4 @@ Ext.deluge.details.StatusTab = Ext.extend(Ext.Panel, {
this.progressBar.updateProgress(status.progress, text); this.progressBar.updateProgress(status.progress, text);
} }
}); });
Deluge.Details.add(new Ext.deluge.details.StatusTab()); deluge.details.add(new Deluge.details.StatusTab());

View File

@ -33,8 +33,8 @@ Copyright:
*/ */
(function() { (function() {
Ext.namespace('Ext.deluge.details'); Ext.namespace('Deluge.details');
Ext.deluge.details.TabPanel = Ext.extend(Ext.TabPanel, { Deluge.details.TabPanel = Ext.extend(Ext.TabPanel, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
@ -47,7 +47,7 @@ Copyright:
margins: '0 5 5 5', margins: '0 5 5 5',
activeTab: 0 activeTab: 0
}, config); }, config);
Ext.deluge.details.TabPanel.superclass.constructor.call(this, config); Deluge.details.TabPanel.superclass.constructor.call(this, config);
}, },
clear: function() { clear: function() {
@ -61,7 +61,7 @@ Copyright:
update: function(tab) { update: function(tab) {
var torrent = Deluge.Torrents.getSelected(); var torrent = deluge.torrents.getSelected();
if (!torrent) { if (!torrent) {
this.clear(); this.clear();
return; return;
@ -80,12 +80,12 @@ Copyright:
// We need to add the events in onRender since Deluge.Torrents hasn't // We need to add the events in onRender since Deluge.Torrents hasn't
// been created yet. // been created yet.
onRender: function(ct, position) { onRender: function(ct, position) {
Ext.deluge.details.TabPanel.superclass.onRender.call(this, ct, position); Deluge.details.TabPanel.superclass.onRender.call(this, ct, position);
Deluge.Events.on('disconnect', this.clear, this); deluge.events.on('disconnect', this.clear, this);
Deluge.Torrents.on('rowclick', this.onTorrentsClick, this); deluge.torrents.on('rowclick', this.onTorrentsClick, this);
this.on('tabchange', this.onTabChange, 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(); if (!selModel.hasSelection()) this.clear();
}, this); }, this);
}, },
@ -98,5 +98,5 @@ Copyright:
this.update(); this.update();
} }
}); });
Deluge.Details = new Ext.deluge.details.TabPanel(); deluge.details = new Deluge.details.TabPanel();
})(); })();

View File

@ -33,7 +33,7 @@ Copyright:
*/ */
(function() { (function() {
Ext.deluge.AddTracker = Ext.extend(Ext.Window, { Deluge.AddTracker = Ext.extend(Ext.Window, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
title: _('Add Tracker'), title: _('Add Tracker'),
@ -48,11 +48,11 @@ Copyright:
plain: true, plain: true,
resizable: false resizable: false
}, config); }, config);
Ext.deluge.AddTracker.superclass.constructor.call(this, config); Deluge.AddTracker.superclass.constructor.call(this, config);
}, },
initComponent: function() { initComponent: function() {
Ext.deluge.AddTracker.superclass.initComponent.call(this); Deluge.AddTracker.superclass.initComponent.call(this);
this.addButton(_('Cancel'), this.onCancelClick, this); this.addButton(_('Cancel'), this.onCancelClick, this);
this.addButton(_('Add'), this.onAddClick, 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) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
title: _('Edit Tracker'), title: _('Edit Tracker'),
@ -107,11 +107,11 @@ Copyright:
plain: true, plain: true,
resizable: false resizable: false
}, config); }, config);
Ext.deluge.EditTracker.superclass.constructor.call(this, config); Deluge.EditTracker.superclass.constructor.call(this, config);
}, },
initComponent: function() { initComponent: function() {
Ext.deluge.EditTracker.superclass.initComponent.call(this); Deluge.EditTracker.superclass.initComponent.call(this);
this.addButton(_('Cancel'), this.onCancelClick, this); this.addButton(_('Cancel'), this.onCancelClick, this);
this.addButton(_('Save'), this.onSaveClick, this); this.addButton(_('Save'), this.onSaveClick, this);
@ -131,7 +131,7 @@ Copyright:
}, },
show: function(record) { show: function(record) {
Ext.deluge.EditTracker.superclass.show.call(this); Deluge.EditTracker.superclass.show.call(this);
this.record = record; this.record = record;
this.form.getForm().findField('tracker').setValue(record.data['url']); 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) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
@ -169,11 +169,11 @@ Copyright:
plain: true, plain: true,
resizable: true resizable: true
}, config); }, config);
Ext.deluge.EditTrackers.superclass.constructor.call(this, config); Deluge.EditTrackers.superclass.constructor.call(this, config);
}, },
initComponent: function() { initComponent: function() {
Ext.deluge.EditTrackers.superclass.initComponent.call(this); Deluge.EditTrackers.superclass.initComponent.call(this);
this.addButton(_('Cancel'), this.onCancelClick, this); this.addButton(_('Cancel'), this.onCancelClick, this);
this.addButton(_('Ok'), this.onOkClick, this); this.addButton(_('Ok'), this.onOkClick, this);
@ -182,9 +182,9 @@ Copyright:
this.on('show', this.onShow, this); this.on('show', this.onShow, this);
this.on('save', this.onSave, 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.addWindow.on('add', this.onAddTrackers, this);
this.editWindow = new Ext.deluge.EditTracker(); this.editWindow = new Deluge.EditTracker();
this.grid = this.add({ this.grid = this.add({
xtype: 'grid', xtype: 'grid',
@ -301,7 +301,7 @@ Copyright:
}) })
}, this); }, this);
Deluge.Client.core.set_torrent_trackers(this.torrentId, trackers, { deluge.client.core.set_torrent_trackers(this.torrentId, trackers, {
failure: this.onSaveFail, failure: this.onSaveFail,
scope: this scope: this
}); });
@ -335,13 +335,13 @@ Copyright:
onShow: function() { onShow: function() {
this.grid.getBottomToolbar().items.get(4).disable(); this.grid.getBottomToolbar().items.get(4).disable();
var r = Deluge.Torrents.getSelected(); var r = deluge.torrents.getSelected();
this.torrentId = r.id; 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, success: this.onRequestComplete,
scope: this scope: this
}); });
} }
}); });
Deluge.EditTrackers = new Ext.deluge.EditTrackers(); deluge.editTrackers = new Deluge.EditTrackers();
})(); })();

View File

@ -38,11 +38,11 @@ Copyright:
* @singleton * @singleton
* Class for holding global events that occur within the UI. * 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() { constructor: function() {
this.toRegister = []; this.toRegister = [];
this.on('login', this.onLogin, this); 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) { addListener: function(eventName, fn, scope, o) {
this.addEvents(eventName); this.addEvents(eventName);
if (/[A-Z]/.test(eventName.substring(0, 1))) { if (/[A-Z]/.test(eventName.substring(0, 1))) {
if (!Deluge.Client) { if (!deluge.client) {
this.toRegister.push(eventName); this.toRegister.push(eventName);
} else { } 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() { getEvents: function() {
Deluge.Client.web.get_events({ deluge.client.web.get_events({
success: this.onGetEventsSuccess, success: this.onGetEventsSuccess,
failure: this.onGetEventsFailure, failure: this.onGetEventsFailure,
scope: this scope: this
@ -73,7 +73,7 @@ Copyright:
*/ */
start: function() { start: function() {
Ext.each(this.toRegister, function(eventName) { Ext.each(this.toRegister, function(eventName) {
Deluge.Client.web.register_event_listener(eventName); deluge.client.web.register_event_listener(eventName);
}); });
this.running = true; this.running = true;
this.getEvents(); this.getEvents();
@ -115,13 +115,13 @@ Copyright:
* Appends an event handler to this object (shorthand for {@link #addListener}) * Appends an event handler to this object (shorthand for {@link #addListener})
* @method * @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 * Fires the specified event with the passed parameters (minus the
* event name). * event name).
* @method * @method
*/ */
Events.prototype.fire = Events.prototype.fireEvent Deluge.Events.prototype.fire = Deluge.Events.prototype.fireEvent
Deluge.Events = new Events(); deluge.events = new Deluge.Events();
})(); })();

View File

@ -32,7 +32,7 @@ Copyright:
*/ */
Ext.deluge.LoginWindow = Ext.extend(Ext.Window, { Deluge.LoginWindow = Ext.extend(Ext.Window, {
firstShow: true, firstShow: true,
bodyStyle: 'padding: 10px 5px;', bodyStyle: 'padding: 10px 5px;',
@ -49,7 +49,7 @@ Ext.deluge.LoginWindow = Ext.extend(Ext.Window, {
height: 120, height: 120,
initComponent: function() { initComponent: function() {
Ext.deluge.LoginWindow.superclass.initComponent.call(this); Deluge.LoginWindow.superclass.initComponent.call(this);
this.on('show', this.onShow, this); this.on('show', this.onShow, this);
this.addButton({ this.addButton({
@ -78,8 +78,8 @@ Ext.deluge.LoginWindow = Ext.extend(Ext.Window, {
}, },
logout: function() { logout: function() {
Deluge.Events.fire('logout'); Deluge.events.fire('logout');
Deluge.Client.auth.delete_session({ deluge.client.auth.delete_session({
success: function(result) { success: function(result) {
this.show(true); this.show(true);
}, },
@ -89,18 +89,18 @@ Ext.deluge.LoginWindow = Ext.extend(Ext.Window, {
show: function(skipCheck) { show: function(skipCheck) {
if (this.firstShow) { if (this.firstShow) {
Deluge.Client.on('error', this.onClientError, this); deluge.client.on('error', this.onClientError, this);
this.firstShow = false; this.firstShow = false;
} }
if (skipCheck) { 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) { success: function(result) {
if (result) { if (result) {
Deluge.Events.fire('login'); deluge.events.fire('login');
} else { } else {
this.show(true); this.show(true);
} }
@ -118,10 +118,10 @@ Ext.deluge.LoginWindow = Ext.extend(Ext.Window, {
onLogin: function() { onLogin: function() {
var passwordField = this.passwordField; var passwordField = this.passwordField;
Deluge.Client.auth.login(passwordField.getValue(), { deluge.client.auth.login(passwordField.getValue(), {
success: function(result) { success: function(result) {
if (result) { if (result) {
Deluge.Events.fire('login'); deluge.events.fire('login');
this.hide(); this.hide();
passwordField.setRawValue(''); passwordField.setRawValue('');
} else { } else {
@ -144,7 +144,7 @@ Ext.deluge.LoginWindow = Ext.extend(Ext.Window, {
onClientError: function(errorObj, response, requestOptions) { onClientError: function(errorObj, response, requestOptions) {
if (errorObj.error.code == 1) { if (errorObj.error.code == 1) {
Deluge.Events.fire('logout'); deluge.events.fire('logout');
this.show(true); 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();

View File

@ -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. Contains all the menus contained within the UI for easy access and editing.
Copyright: Copyright:
@ -32,7 +32,7 @@ Copyright:
*/ */
Deluge.Menus = { deluge.menus = {
onTorrentAction: function(item, e) { onTorrentAction: function(item, e) {
var selection = Deluge.Torrents.getSelections(); var selection = Deluge.Torrents.getSelections();
var ids = []; var ids = [];
@ -44,9 +44,9 @@ Deluge.Menus = {
switch (action) { switch (action) {
case 'pause': case 'pause':
case 'resume': case 'resume':
Deluge.Client.core[action + '_torrent'](ids, { deluge.client.core[action + '_torrent'](ids, {
success: function() { success: function() {
Deluge.UI.update(); deluge.ui.update();
} }
}); });
break; break;
@ -54,53 +54,53 @@ Deluge.Menus = {
case 'up': case 'up':
case 'down': case 'down':
case 'bottom': case 'bottom':
Deluge.Client.core['queue_' + action](ids, { deluge.client.core['queue_' + action](ids, {
success: function() { success: function() {
Deluge.UI.update(); deluge.ui.update();
} }
}); });
break; break;
case 'edit_trackers': case 'edit_trackers':
Deluge.EditTrackers.show(); deluge.editTrackers.show();
break; break;
case 'update': case 'update':
Deluge.Client.core.force_reannounce(ids, { deluge.client.core.force_reannounce(ids, {
success: function() { success: function() {
Deluge.UI.update(); deluge.ui.update();
} }
}); });
break; break;
case 'remove': case 'remove':
Deluge.RemoveWindow.show(ids); deluge.removeWindow.show(ids);
break; break;
case 'recheck': case 'recheck':
Deluge.Client.core.force_recheck(ids, { deluge.client.core.force_recheck(ids, {
success: function() { success: function() {
Deluge.UI.update(); deluge.ui.update();
} }
}); });
break; break;
case 'move': case 'move':
Deluge.MoveStorage.show(ids); deluge.moveStorage.show(ids);
break; break;
} }
} }
} }
Deluge.Menus.Torrent = new Ext.menu.Menu({ deluge.menus.torrent = new Ext.menu.Menu({
id: 'torrentMenu', id: 'torrentMenu',
items: [{ items: [{
torrentAction: 'pause', torrentAction: 'pause',
text: _('Pause'), text: _('Pause'),
iconCls: 'icon-pause', iconCls: 'icon-pause',
handler: Deluge.Menus.onTorrentAction, handler: deluge.menus.onTorrentAction,
scope: Deluge.Menus scope: deluge.menus
}, { }, {
torrentAction: 'resume', torrentAction: 'resume',
text: _('Resume'), text: _('Resume'),
iconCls: 'icon-resume', iconCls: 'icon-resume',
handler: Deluge.Menus.onTorrentAction, handler: deluge.menus.onTorrentAction,
scope: Deluge.Menus scope: deluge.menus
}, '-', { }, '-', {
text: _('Options'), text: _('Options'),
iconCls: 'icon-options', iconCls: 'icon-options',
@ -191,62 +191,62 @@ Deluge.Menus.Torrent = new Ext.menu.Menu({
torrentAction: 'top', torrentAction: 'top',
text: _('Top'), text: _('Top'),
iconCls: 'icon-top', iconCls: 'icon-top',
handler: Deluge.Menus.onTorrentAction, handler: deluge.menus.onTorrentAction,
scope: Deluge.Menus scope: deluge.menus
},{ },{
torrentAction: 'up', torrentAction: 'up',
text: _('Up'), text: _('Up'),
iconCls: 'icon-up', iconCls: 'icon-up',
handler: Deluge.Menus.onTorrentAction, handler: deluge.menus.onTorrentAction,
scope: Deluge.Menus scope: deluge.menus
},{ },{
torrentAction: 'down', torrentAction: 'down',
text: _('Down'), text: _('Down'),
iconCls: 'icon-down', iconCls: 'icon-down',
handler: Deluge.Menus.onTorrentAction, handler: deluge.menus.onTorrentAction,
scope: Deluge.Menus scope: deluge.menus
},{ },{
torrentAction: 'bottom', torrentAction: 'bottom',
text: _('Bottom'), text: _('Bottom'),
iconCls: 'icon-bottom', iconCls: 'icon-bottom',
handler: Deluge.Menus.onTorrentAction, handler: deluge.menus.onTorrentAction,
scope: Deluge.Menus scope: deluge.menus
}] }]
}) })
}, '-', { }, '-', {
torrentAction: 'update', torrentAction: 'update',
text: _('Update Tracker'), text: _('Update Tracker'),
iconCls: 'icon-update-tracker', iconCls: 'icon-update-tracker',
handler: Deluge.Menus.onTorrentAction, handler: deluge.menus.onTorrentAction,
scope: Deluge.Menus scope: deluge.menus
}, { }, {
torrentAction: 'edit_trackers', torrentAction: 'edit_trackers',
text: _('Edit Trackers'), text: _('Edit Trackers'),
iconCls: 'icon-edit-trackers', iconCls: 'icon-edit-trackers',
handler: Deluge.Menus.onTorrentAction, handler: deluge.menus.onTorrentAction,
scope: Deluge.Menus scope: deluge.menus
}, '-', { }, '-', {
torrentAction: 'remove', torrentAction: 'remove',
text: _('Remove Torrent'), text: _('Remove Torrent'),
iconCls: 'icon-remove', iconCls: 'icon-remove',
handler: Deluge.Menus.onTorrentAction, handler: deluge.menus.onTorrentAction,
scope: Deluge.Menus scope: deluge.menus
}, '-', { }, '-', {
torrentAction: 'recheck', torrentAction: 'recheck',
text: _('Force Recheck'), text: _('Force Recheck'),
iconCls: 'icon-recheck', iconCls: 'icon-recheck',
handler: Deluge.Menus.onTorrentAction, handler: deluge.menus.onTorrentAction,
scope: Deluge.Menus scope: deluge.menus
}, { }, {
torrentAction: 'move', torrentAction: 'move',
text: _('Move Storage'), text: _('Move Storage'),
iconCls: 'icon-move', iconCls: 'icon-move',
handler: Deluge.Menus.onTorrentAction, handler: deluge.menus.onTorrentAction,
scope: Deluge.Menus scope: deluge.menus
}] }]
}); });
Ext.deluge.StatusbarMenu = Ext.extend(Ext.menu.Menu, { Deluge.StatusbarMenu = Ext.extend(Ext.menu.Menu, {
setValue: function(value) { setValue: function(value) {
var beenSet = false; 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', id: 'connectionsMenu',
items: [{ items: [{
text: '50', 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', id: 'downspeedMenu',
items: [{ items: [{
value: '5', 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', id: 'upspeedMenu',
items: [{ items: [{
value: '5', 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', id: 'filePrioritiesMenu',
items: [{ items: [{
id: 'expandAll', id: 'expandAll',

View File

@ -31,8 +31,8 @@ Copyright:
statement from all source files in the program, then also delete it here. statement from all source files in the program, then also delete it here.
*/ */
Ext.namespace('Ext.deluge'); Ext.namespace('Deluge');
Ext.deluge.MoveStorage = Ext.extend(Ext.Window, { Deluge.MoveStorage = Ext.extend(Ext.Window, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
@ -47,11 +47,11 @@ Ext.deluge.MoveStorage = Ext.extend(Ext.Window, {
plain: true, plain: true,
resizable: false resizable: false
}, config); }, config);
Ext.deluge.MoveStorage.superclass.constructor.call(this, config); Deluge.MoveStorage.superclass.constructor.call(this, config);
}, },
initComponent: function() { initComponent: function() {
Ext.deluge.MoveStorage.superclass.initComponent.call(this); Deluge.MoveStorage.superclass.initComponent.call(this);
this.addButton(_('Cancel'), this.onCancel, this); this.addButton(_('Cancel'), this.onCancel, this);
this.addButton(_('Move'), this.onMove, this); this.addButton(_('Move'), this.onMove, this);
@ -83,12 +83,12 @@ Ext.deluge.MoveStorage = Ext.extend(Ext.Window, {
}, },
hide: function() { hide: function() {
Ext.deluge.MoveStorage.superclass.hide.call(this); Deluge.MoveStorage.superclass.hide.call(this);
this.torrentIds = null; this.torrentIds = null;
}, },
show: function(torrentIds) { show: function(torrentIds) {
Ext.deluge.MoveStorage.superclass.show.call(this); Deluge.MoveStorage.superclass.show.call(this);
this.torrentIds = torrentIds; this.torrentIds = torrentIds;
}, },
@ -98,8 +98,8 @@ Ext.deluge.MoveStorage = Ext.extend(Ext.Window, {
onMove: function() { onMove: function() {
var dest = this.moveLocation.getValue(); var dest = this.moveLocation.getValue();
Deluge.Client.core.move_storage(this.torrentIds, dest); deluge.client.core.move_storage(this.torrentIds, dest);
this.hide(); this.hide();
} }
}); });
Deluge.MoveStorage = new Ext.deluge.MoveStorage(); deluge.moveStorage = new Deluge.MoveStorage();

View File

@ -1,5 +1,5 @@
/* /*
Script: Deluge.Preferences.Bandwidth.js Script: deluge.preferences.Bandwidth.js
The bandwidth preferences page. The bandwidth preferences page.
Copyright: Copyright:
@ -31,8 +31,8 @@ Copyright:
statement from all source files in the program, then also delete it here. 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.Bandwidth = Ext.extend(Ext.form.FormPanel, { Deluge.preferences.Bandwidth = Ext.extend(Ext.form.FormPanel, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
border: false, border: false,
@ -40,13 +40,13 @@ Ext.deluge.preferences.Bandwidth = Ext.extend(Ext.form.FormPanel, {
layout: 'form', layout: 'form',
labelWidth: 10 labelWidth: 10
}, config); }, config);
Ext.deluge.preferences.Bandwidth.superclass.constructor.call(this, config); Deluge.preferences.Bandwidth.superclass.constructor.call(this, config);
}, },
initComponent: function() { 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({ var fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
border: false, 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());

View File

@ -1,5 +1,5 @@
/* /*
Script: Deluge.Preferences.Cache.js Script: deluge.preferences.Cache.js
The cache preferences page. The cache preferences page.
Copyright: Copyright:
@ -31,21 +31,21 @@ Copyright:
statement from all source files in the program, then also delete it here. 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.Cache = Ext.extend(Ext.form.FormPanel, { Deluge.preferences.Cache = Ext.extend(Ext.form.FormPanel, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
border: false, border: false,
title: _('Cache'), title: _('Cache'),
layout: 'form' layout: 'form'
}, config); }, config);
Ext.deluge.preferences.Cache.superclass.constructor.call(this, config); Deluge.preferences.Cache.superclass.constructor.call(this, config);
}, },
initComponent: function() { 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({ var fieldset = this.add({
xtype: 'fieldset', 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());

View File

@ -31,21 +31,21 @@ Copyright:
statement from all source files in the program, then also delete it here. 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.Daemon = Ext.extend(Ext.form.FormPanel, { Deluge.preferences.Daemon = Ext.extend(Ext.form.FormPanel, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
border: false, border: false,
title: _('Daemon'), title: _('Daemon'),
layout: 'form' layout: 'form'
}, config); }, config);
Ext.deluge.preferences.Daemon.superclass.constructor.call(this, config); Deluge.preferences.Daemon.superclass.constructor.call(this, config);
}, },
initComponent: function() { 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({ var fieldset = this.add({
xtype: 'fieldset', 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());

View File

@ -31,8 +31,8 @@ Copyright:
statement from all source files in the program, then also delete it here. 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.Downloads = Ext.extend(Ext.FormPanel, { Deluge.preferences.Downloads = Ext.extend(Ext.FormPanel, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
border: false, border: false,
@ -41,13 +41,13 @@ Ext.deluge.preferences.Downloads = Ext.extend(Ext.FormPanel, {
autoHeight: true, autoHeight: true,
width: 320 width: 320
}, config); }, config);
Ext.deluge.preferences.Downloads.superclass.constructor.call(this, config); Deluge.preferences.Downloads.superclass.constructor.call(this, config);
}, },
initComponent: function() { 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({ var fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
@ -147,7 +147,7 @@ Ext.deluge.preferences.Downloads = Ext.extend(Ext.FormPanel, {
}, },
onShow: function() { 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());

View File

@ -1,5 +1,5 @@
/* /*
Script: Deluge.Preferences.Encryption.js Script: deluge.preferences.Encryption.js
The encryption preferences page. The encryption preferences page.
Copyright: Copyright:
@ -31,21 +31,21 @@ Copyright:
statement from all source files in the program, then also delete it here. 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.Encryption = Ext.extend(Ext.form.FormPanel, { Deluge.preferences.Encryption = Ext.extend(Ext.form.FormPanel, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
border: false, border: false,
title: _('Encryption'), title: _('Encryption'),
layout: 'form' layout: 'form'
}, config); }, config);
Ext.deluge.preferences.Encryption.superclass.constructor.call(this, config); Deluge.preferences.Encryption.superclass.constructor.call(this, config);
}, },
initComponent: function() { 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({ var fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
@ -111,4 +111,4 @@ Ext.deluge.preferences.Encryption = Ext.extend(Ext.form.FormPanel, {
})); }));
} }
}); });
Deluge.Preferences.addPage(new Ext.deluge.preferences.Encryption()); deluge.preferences.addPage(new Deluge.preferences.Encryption());

View File

@ -31,19 +31,19 @@ Copyright:
statement from all source files in the program, then also delete it here. 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.Interface = Ext.extend(Ext.form.FormPanel, { Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
border: false, border: false,
title: _('Interface'), title: _('Interface'),
layout: 'form' layout: 'form'
}, config); }, config);
Ext.deluge.preferences.Interface.superclass.constructor.call(this, config); Deluge.preferences.Interface.superclass.constructor.call(this, config);
}, },
initComponent: function() { initComponent: function() {
Ext.deluge.preferences.Interface.superclass.initComponent.call(this); Deluge.preferences.Interface.superclass.initComponent.call(this);
var optMan = this.optionsManager = new Deluge.OptionsManager(); var optMan = this.optionsManager = new Deluge.OptionsManager();
this.on('show', this.onShow, this); this.on('show', this.onShow, this);
@ -184,7 +184,7 @@ Ext.deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
onApply: function() { onApply: function() {
var changed = this.optionsManager.getDirty(); var changed = this.optionsManager.getDirty();
if (!Ext.isObjectEmpty(changed)) { if (!Ext.isObjectEmpty(changed)) {
Deluge.Client.web.set_config(changed, { deluge.client.web.set_config(changed, {
success: this.onSetConfig, success: this.onSetConfig,
scope: this scope: this
}); });
@ -210,7 +210,7 @@ Ext.deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
} }
var oldPassword = this.oldPassword.getValue(); var oldPassword = this.oldPassword.getValue();
Deluge.Client.auth.change_password(oldPassword, newPassword, { deluge.client.auth.change_password(oldPassword, newPassword, {
success: function(result) { success: function(result) {
if (!result) { if (!result) {
Ext.MessageBox.show({ Ext.MessageBox.show({
@ -245,8 +245,8 @@ Ext.deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
}, },
onShow: function() { onShow: function() {
Ext.deluge.preferences.Interface.superclass.onShow.call(this); Deluge.preferences.Interface.superclass.onShow.call(this);
Deluge.Client.web.get_config({ deluge.client.web.get_config({
success: this.onGotConfig, success: this.onGotConfig,
scope: this scope: this
}) })
@ -257,4 +257,4 @@ Ext.deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
this.certField.setDisabled(!checked); this.certField.setDisabled(!checked);
} }
}); });
Deluge.Preferences.addPage(new Ext.deluge.preferences.Interface()); deluge.preferences.addPage(new Deluge.preferences.Interface());

View File

@ -1,5 +1,5 @@
/* /*
Script: Deluge.Preferences.Network.js Script: deluge.preferences.Network.js
The network preferences page. The network preferences page.
Copyright: Copyright:
@ -31,21 +31,21 @@ Copyright:
statement from all source files in the program, then also delete it here. 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) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
border: false, border: false,
title: _('Network'), title: _('Network'),
layout: 'form' layout: 'form'
}, config); }, config);
Ext.deluge.preferences.Network.superclass.constructor.call(this, config); Deluge.preferences.Network.superclass.constructor.call(this, config);
}, },
initComponent: function() { initComponent: function() {
Ext.deluge.preferences.Network.superclass.initComponent.call(this); Deluge.preferences.Network.superclass.initComponent.call(this);
var optMan = Deluge.Preferences.getOptionsManager(); var optMan = deluge.preferences.getOptionsManager();
var fieldset = this.add({ var fieldset = this.add({
xtype: 'fieldset', 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());

View File

@ -31,21 +31,21 @@ Copyright:
statement from all source files in the program, then also delete it here. 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.Other = Ext.extend(Ext.form.FormPanel, { Deluge.preferences.Other = Ext.extend(Ext.form.FormPanel, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
border: false, border: false,
title: _('Other'), title: _('Other'),
layout: 'form' layout: 'form'
}, config); }, config);
Ext.deluge.preferences.Other.superclass.constructor.call(this, config); Deluge.preferences.Other.superclass.constructor.call(this, config);
}, },
initComponent: function() { 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({ var fieldset = this.add({
xtype: 'fieldset', 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());

View File

@ -31,9 +31,9 @@ Copyright:
statement from all source files in the program, then also delete it here. 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, height: 115,
width: 350, width: 350,
@ -55,7 +55,7 @@ Ext.deluge.preferences.InstallPlugin = Ext.extend(Ext.Window, {
title: _('Install Plugin'), title: _('Install Plugin'),
initComponent: function() { initComponent: function() {
Ext.deluge.add.FileWindow.superclass.initComponent.call(this); Deluge.add.FileWindow.superclass.initComponent.call(this);
this.addButton(_('Install'), this.onInstall, this); this.addButton(_('Install'), this.onInstall, this);
this.form = this.add({ 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 filename = this.form.getForm().findField('pluginEgg').value;
var path = upload.result.files[0] var path = upload.result.files[0]
this.form.getForm().findField('pluginEgg').setValue(''); this.form.getForm().findField('pluginEgg').setValue('');
Deluge.Client.web.upload_plugin(filename, path, { deluge.client.web.upload_plugin(filename, path, {
success: this.onUploadPlugin, success: this.onUploadPlugin,
scope: this, scope: this,
filename: filename 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) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
border: false, border: false,
@ -115,7 +115,7 @@ Ext.deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
height: 400, height: 400,
cls: 'x-deluge-plugins' cls: 'x-deluge-plugins'
}, config); }, config);
Ext.deluge.preferences.Plugins.superclass.constructor.call(this, config); Deluge.preferences.Plugins.superclass.constructor.call(this, config);
}, },
pluginTemplate: new Ext.Template( pluginTemplate: new Ext.Template(
@ -129,7 +129,7 @@ Ext.deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
), ),
initComponent: function() { initComponent: function() {
Ext.deluge.preferences.Plugins.superclass.initComponent.call(this); Deluge.preferences.Plugins.superclass.initComponent.call(this);
this.defaultValues = { this.defaultValues = {
'version': '', 'version': '',
'email': '', 'email': '',
@ -215,17 +215,17 @@ Ext.deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
this.on('show', this.onShow, this); this.on('show', this.onShow, this);
this.pluginInfo.on('render', this.onPluginInfoRender, this); this.pluginInfo.on('render', this.onPluginInfoRender, this);
this.grid.on('cellclick', this.onCellClick, this); this.grid.on('cellclick', this.onCellClick, this);
Deluge.Preferences.on('show', this.onPreferencesShow, this); deluge.preferences.on('show', this.onPreferencesShow, this);
Deluge.Events.on('PluginDisabledEvent', this.onPluginDisabled, this); deluge.events.on('PluginDisabledEvent', this.onPluginDisabled, this);
Deluge.Events.on('PluginEnabledEvent', this.onPluginEnabled, this); deluge.events.on('PluginEnabledEvent', this.onPluginEnabled, this);
}, },
disablePlugin: function(plugin) { disablePlugin: function(plugin) {
Deluge.Client.core.disable_plugin(plugin); deluge.client.core.disable_plugin(plugin);
}, },
enablePlugin: function(plugin) { enablePlugin: function(plugin) {
Deluge.Client.core.enable_plugin(plugin); deluge.client.core.enable_plugin(plugin);
}, },
setInfo: function(plugin) { setInfo: function(plugin) {
@ -235,7 +235,7 @@ Ext.deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
}, },
updatePlugins: function() { updatePlugins: function() {
Deluge.Client.web.get_plugins({ deluge.client.web.get_plugins({
success: this.onGotPlugins, success: this.onGotPlugins,
scope: this scope: this
}); });
@ -290,7 +290,7 @@ Ext.deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
onInstallPlugin: function() { onInstallPlugin: function() {
if (!this.installWindow) { 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.on('pluginadded', this.onPluginInstall, this);
} }
this.installWindow.show(); this.installWindow.show();
@ -315,7 +315,7 @@ Ext.deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
}, },
onPluginSelect: function(selmodel, rowIndex, r) { 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, success: this.onGotPluginInfo,
scope: this scope: this
}); });
@ -329,4 +329,4 @@ Ext.deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
this.setInfo(); this.setInfo();
} }
}); });
Deluge.Preferences.addPage(new Ext.deluge.preferences.Plugins()); deluge.preferences.addPage(new Deluge.preferences.Plugins());

View File

@ -31,8 +31,8 @@ Copyright:
statement from all source files in the program, then also delete it here. 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.ProxyField = Ext.extend(Ext.form.FieldSet, { Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
@ -40,11 +40,11 @@ Ext.deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
autoHeight: true, autoHeight: true,
labelWidth: 70 labelWidth: 70
}, config); }, config);
Ext.deluge.preferences.ProxyField.superclass.constructor.call(this, config); Deluge.preferences.ProxyField.superclass.constructor.call(this, config);
}, },
initComponent: function() { initComponent: function() {
Ext.deluge.preferences.ProxyField.superclass.initComponent.call(this); Deluge.preferences.ProxyField.superclass.initComponent.call(this);
this.type = this.add({ this.type = this.add({
xtype: 'combo', xtype: 'combo',
fieldLabel: _('Type'), 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) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
border: false, border: false,
title: _('Proxy'), title: _('Proxy'),
layout: 'form' layout: 'form'
}, config); }, config);
Ext.deluge.preferences.Proxy.superclass.constructor.call(this, config); Deluge.preferences.Proxy.superclass.constructor.call(this, config);
}, },
initComponent: function() { initComponent: function() {
Ext.deluge.preferences.Proxy.superclass.initComponent.call(this); Deluge.preferences.Proxy.superclass.initComponent.call(this);
this.peer = this.add(new Ext.deluge.preferences.ProxyField({ this.peer = this.add(new Deluge.preferences.ProxyField({
title: _('Peer'), title: _('Peer'),
name: 'peer' name: 'peer'
})); }));
this.peer.on('change', this.onProxyChange, this); 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'), title: _('Web Seed'),
name: 'web_seed' name: 'web_seed'
})); }));
this.web_seed.on('change', this.onProxyChange, this); 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'), title: _('Tracker'),
name: 'tracker' name: 'tracker'
})); }));
this.tracker.on('change', this.onProxyChange, this); 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'), title: _('DHT'),
name: 'dht' name: 'dht'
})); }));
this.dht.on('change', this.onProxyChange, this); this.dht.on('change', this.onProxyChange, this);
Deluge.Preferences.getOptionsManager().bind('proxies', this); deluge.preferences.getOptionsManager().bind('proxies', this);
}, },
getValue: function() { getValue: function() {
@ -228,4 +228,4 @@ Ext.deluge.preferences.Proxy = Ext.extend(Ext.form.FormPanel, {
this.fireEvent('change', this, newValues, oldValues); this.fireEvent('change', this, newValues, oldValues);
} }
}); });
Deluge.Preferences.addPage(new Ext.deluge.preferences.Proxy()); deluge.preferences.addPage(new Deluge.preferences.Proxy());

View File

@ -31,21 +31,21 @@ Copyright:
statement from all source files in the program, then also delete it here. 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.Queue = Ext.extend(Ext.form.FormPanel, { Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
border: false, border: false,
title: _('Queue'), title: _('Queue'),
layout: 'form' layout: 'form'
}, config); }, config);
Ext.deluge.preferences.Queue.superclass.constructor.call(this, config); Deluge.preferences.Queue.superclass.constructor.call(this, config);
}, },
initComponent: function() { 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({ var fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
@ -218,4 +218,4 @@ Ext.deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, {
this.removeAtRatio.setDisabled(!checked); this.removeAtRatio.setDisabled(!checked);
} }
}); });
Deluge.Preferences.addPage(new Ext.deluge.preferences.Queue()); deluge.preferences.addPage(new Deluge.preferences.Queue());

View File

@ -34,7 +34,7 @@ Copyright:
PreferencesRecord = Ext.data.Record.create([{name:'name', type:'string'}]); 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. * @property {String} currentPage The currently selected page.
@ -54,7 +54,7 @@ Ext.deluge.PreferencesWindow = Ext.extend(Ext.Window, {
resizable: false, resizable: false,
initComponent: function() { initComponent: function() {
Ext.deluge.PreferencesWindow.superclass.initComponent.call(this); Deluge.PreferencesWindow.superclass.initComponent.call(this);
this.categoriesGrid = this.add({ this.categoriesGrid = this.add({
xtype: 'grid', xtype: 'grid',
@ -108,7 +108,7 @@ Ext.deluge.PreferencesWindow = Ext.extend(Ext.Window, {
onApply: function(e) { onApply: function(e) {
var changed = this.optionsManager.getDirty(); var changed = this.optionsManager.getDirty();
if (!Ext.isObjectEmpty(changed)) { if (!Ext.isObjectEmpty(changed)) {
Deluge.Client.core.set_config(changed, { deluge.client.core.set_config(changed, {
success: this.onSetConfig, success: this.onSetConfig,
scope: this scope: this
}); });
@ -188,8 +188,8 @@ Ext.deluge.PreferencesWindow = Ext.extend(Ext.Window, {
// private // private
onShow: function() { onShow: function() {
if (!Deluge.Client.core) return; if (!deluge.client.core) return;
Deluge.Client.core.get_config({ deluge.client.core.get_config({
success: this.onGotConfig, success: this.onGotConfig,
scope: this scope: this
}) })
@ -202,8 +202,8 @@ Ext.deluge.PreferencesWindow = Ext.extend(Ext.Window, {
// private // private
onOk: function() { onOk: function() {
Deluge.Client.core.set_config(this.optionsManager.getDirty()); deluge.client.core.set_config(this.optionsManager.getDirty());
this.hide(); this.hide();
} }
}); });
Deluge.Preferences = new Ext.deluge.PreferencesWindow(); deluge.preferences = new Deluge.PreferencesWindow();

View File

@ -45,7 +45,7 @@ Copyright:
var image = ''; var image = '';
if (r.store.id == 'tracker_host') { if (r.store.id == 'tracker_host') {
if (value != 'Error') { if (value != 'Error') {
image = String.format('url(' + Deluge.config.base + 'tracker/{0})', value); image = String.format('url(' + deluge.config.base + 'tracker/{0})', value);
} else { } else {
lname = null; lname = null;
} }
@ -60,11 +60,11 @@ Copyright:
} }
/** /**
* @class Ext.deluge.Sidebar * @class Deluge.Sidebar
* @author Damien Churchill <damoxc@gmail.com> * @author Damien Churchill <damoxc@gmail.com>
* @version 1.3 * @version 1.3
*/ */
Ext.deluge.Sidebar = Ext.extend(Ext.Panel, { Deluge.Sidebar = Ext.extend(Ext.Panel, {
// private // private
panels: {}, panels: {},
@ -86,13 +86,13 @@ Copyright:
margins: '5 0 0 5', margins: '5 0 0 5',
cmargins: '5 0 0 5' cmargins: '5 0 0 5'
}, config); }, config);
Ext.deluge.Sidebar.superclass.constructor.call(this, config); Deluge.Sidebar.superclass.constructor.call(this, config);
}, },
// private // private
initComponent: function() { initComponent: function() {
Ext.deluge.Sidebar.superclass.initComponent.call(this); Deluge.Sidebar.superclass.initComponent.call(this);
Deluge.Events.on("disconnect", this.onDisconnect, this); deluge.events.on("disconnect", this.onDisconnect, this);
}, },
createFilter: function(filter, states) { createFilter: function(filter, states) {
@ -136,7 +136,7 @@ Copyright:
autoScroll: true autoScroll: true
}); });
if (Deluge.config['sidebar_show_zero'] == false) { if (deluge.config['sidebar_show_zero'] == false) {
states = this.removeZero(states); states = this.removeZero(states);
} }
@ -179,7 +179,7 @@ Copyright:
}, },
onFilterSelect: function(selModel, rowIndex, record) { onFilterSelect: function(selModel, rowIndex, record) {
Deluge.UI.update(); deluge.ui.update();
}, },
/** /**
@ -215,20 +215,37 @@ Copyright:
}, },
updateFilter: function(filter, states) { updateFilter: function(filter, states) {
if (Deluge.config['sidebar_show_zero'] == false) { if (deluge.config.sidebar_show_zero == false) {
states = this.removeZero(states); states = this.removeZero(states);
} }
var store = this.panels[filter].getStore(); var store = this.panels[filter].getStore();
var filters = [];
Ext.each(states, function(s, i) { 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.beginEdit();
record.set('filter', s[0]); record.set('filter', s[0]);
record.set('count', s[1]); record.set('count', s[1]);
record.endEdit(); record.endEdit();
record.commit(); filters[s[0]] = true;
}, this); }, 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();
})(); })();

View File

@ -1,18 +1,18 @@
Ext.deluge.Statusbar = Ext.extend(Ext.ux.StatusBar, { Deluge.Statusbar = Ext.extend(Ext.ux.StatusBar, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
id: 'deluge-statusbar', id: 'deluge-statusbar',
defaultIconCls: 'x-not-connected', defaultIconCls: 'x-not-connected',
defaultText: _('Not Connected') defaultText: _('Not Connected')
}, config); }, config);
Ext.deluge.Statusbar.superclass.constructor.call(this, config); Deluge.Statusbar.superclass.constructor.call(this, config);
}, },
initComponent: function() { 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('connect', this.onConnect, this);
Deluge.Events.on('disconnect', this.onDisconnect, this); deluge.events.on('disconnect', this.onDisconnect, this);
}, },
createButtons: function() { createButtons: function() {
@ -22,21 +22,21 @@ Ext.deluge.Statusbar = Ext.extend(Ext.ux.StatusBar, {
cls: 'x-btn-text-icon', cls: 'x-btn-text-icon',
iconCls: 'x-deluge-connections', iconCls: 'x-deluge-connections',
tooltip: _('Connections'), tooltip: _('Connections'),
menu: Deluge.Menus.Connections menu: deluge.menus.connections
}, '-', { }, '-', {
id: 'statusbar-downspeed', id: 'statusbar-downspeed',
text: ' ', text: ' ',
cls: 'x-btn-text-icon', cls: 'x-btn-text-icon',
iconCls: 'x-deluge-downloading', iconCls: 'x-deluge-downloading',
tooltip: _('Download Speed'), tooltip: _('Download Speed'),
menu: Deluge.Menus.Download menu: deluge.menus.download
}, '-', { }, '-', {
id: 'statusbar-upspeed', id: 'statusbar-upspeed',
text: ' ', text: ' ',
cls: 'x-btn-text-icon', cls: 'x-btn-text-icon',
iconCls: 'x-deluge-seeding', iconCls: 'x-deluge-seeding',
tooltip: _('Upload Speed'), tooltip: _('Upload Speed'),
menu: Deluge.Menus.Upload menu: deluge.menus.upload
}, '-', { }, '-', {
id: 'statusbar-traffic', id: 'statusbar-traffic',
text: ' ', 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-dht').setText(stats.dht_nodes);
this.items.get('statusbar-freespace').setText(fsize(stats.free_space)); this.items.get('statusbar-freespace').setText(fsize(stats.free_space));
Deluge.Menus.Connections.setValue(stats.max_num_connections); deluge.menus.connections.setValue(stats.max_num_connections);
Deluge.Menus.Download.setValue(stats.max_download); deluge.menus.download.setValue(stats.max_download);
Deluge.Menus.Upload.setValue(stats.max_upload); deluge.menus.upload.setValue(stats.max_upload);
} }
}); });
Deluge.Statusbar = new Ext.deluge.Statusbar(); deluge.statusbar = new Deluge.Statusbar();

View File

@ -34,10 +34,10 @@ Copyright:
/** /**
* An extension of the <tt>Ext.Toolbar</tt> class that provides an extensible toolbar for Deluge. * An extension of the <tt>Ext.Toolbar</tt> class that provides an extensible toolbar for Deluge.
* @class Ext.deluge.Toolbar * @class Deluge.Toolbar
* @extends Ext.Toolbar * @extends Ext.Toolbar
*/ */
Ext.deluge.Toolbar = Ext.extend(Ext.Toolbar, { Deluge.Toolbar = Ext.extend(Ext.Toolbar, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
items: [ items: [
@ -112,7 +112,7 @@ Ext.deluge.Toolbar = Ext.extend(Ext.Toolbar, {
} }
] ]
}, config); }, config);
Ext.deluge.Toolbar.superclass.constructor.call(this, config); Deluge.Toolbar.superclass.constructor.call(this, config);
}, },
connectedButtons: [ connectedButtons: [
@ -120,9 +120,9 @@ Ext.deluge.Toolbar = Ext.extend(Ext.Toolbar, {
], ],
initComponent: function() { initComponent: function() {
Ext.deluge.Toolbar.superclass.initComponent.call(this); Deluge.Toolbar.superclass.initComponent.call(this);
Deluge.Events.on('connect', this.onConnect, this); deluge.events.on('connect', this.onConnect, this);
Deluge.Events.on('login', this.onLogin, this); deluge.events.on('login', this.onLogin, this);
}, },
onConnect: function() { onConnect: function() {
@ -143,11 +143,11 @@ Ext.deluge.Toolbar = Ext.extend(Ext.Toolbar, {
onLogout: function() { onLogout: function() {
this.items.get('logout').disable(); this.items.get('logout').disable();
Deluge.Login.logout(); deluge.login.logout();
}, },
onConnectionManagerClick: function() { onConnectionManagerClick: function() {
Deluge.ConnectionManager.show(); deluge.connectionManager.show();
}, },
onHelpClick: function() { onHelpClick: function() {
@ -155,11 +155,11 @@ Ext.deluge.Toolbar = Ext.extend(Ext.Toolbar, {
}, },
onPreferencesClick: function() { onPreferencesClick: function() {
Deluge.Preferences.show(); deluge.preferences.show();
}, },
onTorrentAction: function(item) { onTorrentAction: function(item) {
var selection = Deluge.Torrents.getSelections(); var selection = deluge.torrents.getSelections();
var ids = []; var ids = [];
Ext.each(selection, function(record) { Ext.each(selection, function(record) {
ids.push(record.id); ids.push(record.id);
@ -167,21 +167,21 @@ Ext.deluge.Toolbar = Ext.extend(Ext.Toolbar, {
switch (item.id) { switch (item.id) {
case 'remove': case 'remove':
Deluge.RemoveWindow.show(ids); deluge.removeWindow.show(ids);
break; break;
case 'pause': case 'pause':
case 'resume': case 'resume':
Deluge.Client.core[item.id + '_torrent'](ids, { deluge.client.core[item.id + '_torrent'](ids, {
success: function() { success: function() {
Deluge.UI.update(); deluge.ui.update();
} }
}); });
break; break;
case 'up': case 'up':
case 'down': case 'down':
Deluge.Client.core['queue_' + item.id](ids, { deluge.client.core['queue_' + item.id](ids, {
success: function() { success: function() {
Deluge.UI.update(); deluge.ui.update();
} }
}); });
break; break;
@ -189,8 +189,8 @@ Ext.deluge.Toolbar = Ext.extend(Ext.Toolbar, {
}, },
onTorrentAdd: function() { onTorrentAdd: function() {
Deluge.Add.show(); deluge.add.show();
} }
}); });
Deluge.Toolbar = new Ext.deluge.Toolbar(); deluge.toolbar = new Deluge.Toolbar();

View File

@ -70,7 +70,7 @@ Copyright:
return (value < 0) ? '∞' : new Number(value).toFixed(3); return (value < 0) ? '∞' : new Number(value).toFixed(3);
} }
function trackerRenderer(value, p, r) { function trackerRenderer(value, p, r) {
return String.format('<div style="background: url(' + Deluge.config.base + 'tracker/{0}) no-repeat; padding-left: 20px;">{0}</div>', value); return String.format('<div style="background: url(' + deluge.config.base + 'tracker/{0}) no-repeat; padding-left: 20px;">{0}</div>', value);
} }
function etaSorter(eta) { function etaSorter(eta) {
@ -78,17 +78,17 @@ Copyright:
} }
/** /**
* Ext.deluge.TorrentGrid Class * Deluge.TorrentGrid Class
* *
* @author Damien Churchill <damoxc@gmail.com> * @author Damien Churchill <damoxc@gmail.com>
* @version 1.3 * @version 1.3
* *
* @class Ext.deluge.TorrentGrid * @class Deluge.TorrentGrid
* @extends Ext.grid.GridPanel * @extends Ext.grid.GridPanel
* @constructor * @constructor
* @param {Object} config Configuration options * @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 // object to store contained torrent ids
torrents: {}, torrents: {},
@ -212,13 +212,13 @@ Copyright:
scrollDelay: false scrollDelay: false
}) })
}, config); }, config);
Ext.deluge.TorrentGrid.superclass.constructor.call(this, config); Deluge.TorrentGrid.superclass.constructor.call(this, config);
}, },
initComponent: function() { initComponent: function() {
Ext.deluge.TorrentGrid.superclass.initComponent.call(this); Deluge.TorrentGrid.superclass.initComponent.call(this);
Deluge.Events.on('torrentRemoved', this.onTorrentRemoved, this); deluge.events.on('torrentRemoved', this.onTorrentRemoved, this);
Deluge.Events.on('logout', this.onDisconnect, this); deluge.events.on('logout', this.onDisconnect, this);
this.on('rowcontextmenu', function(grid, rowIndex, e) { this.on('rowcontextmenu', function(grid, rowIndex, e) {
e.stopEvent(); e.stopEvent();
@ -226,7 +226,7 @@ Copyright:
if (!selection.hasSelection()) { if (!selection.hasSelection()) {
selection.selectRow(rowIndex); selection.selectRow(rowIndex);
} }
Deluge.Menus.Torrent.showAt(e.getPoint()); deluge.menus.torrent.showAt(e.getPoint());
}); });
}, },
@ -313,5 +313,5 @@ Copyright:
}, this); }, this);
} }
}); });
Deluge.Torrents = new Ext.deluge.TorrentGrid(); deluge.torrents = new Deluge.TorrentGrid();
})(); })();

View File

@ -38,7 +38,7 @@ Copyright:
* The controller for the whole interface, that ties all the components * The controller for the whole interface, that ties all the components
* together and handles the 2 second poll. * together and handles the 2 second poll.
*/ */
Deluge.UI = { deluge.ui = {
errorCount: 0, errorCount: 0,
@ -54,13 +54,13 @@ Deluge.UI = {
iconCls: 'x-deluge-main-panel', iconCls: 'x-deluge-main-panel',
title: 'Deluge', title: 'Deluge',
layout: 'border', layout: 'border',
tbar: Deluge.Toolbar, tbar: deluge.toolbar,
items: [ items: [
Deluge.Sidebar, deluge.sidebar,
Deluge.Details, deluge.details,
Deluge.Torrents deluge.torrents
], ],
bbar: Deluge.Statusbar bbar: deluge.statusbar
}); });
this.Viewport = new Ext.Viewport({ this.Viewport = new Ext.Viewport({
@ -68,22 +68,22 @@ Deluge.UI = {
items: [this.MainPanel] items: [this.MainPanel]
}); });
Deluge.Events.on("connect", this.onConnect, this); deluge.events.on("connect", this.onConnect, this);
Deluge.Events.on("disconnect", this.onDisconnect, this); deluge.events.on("disconnect", this.onDisconnect, this);
Deluge.Client = new Ext.ux.util.RpcClient({ deluge.client = new Ext.ux.util.RpcClient({
url: Deluge.config.base + 'json' url: deluge.config.base + 'json'
}); });
for (var plugin in Deluge.Plugins) { for (var plugin in deluge.dlugins) {
plugin = Deluge.Plugins[plugin]; plugin = deluge.plugins[plugin];
plugin.enable(); plugin.enable();
} }
// Initialize quicktips so all the tooltip configs start working. // Initialize quicktips so all the tooltip configs start working.
Ext.QuickTips.init(); Ext.QuickTips.init();
Deluge.Client.on('connected', function(e) { deluge.client.on('connected', function(e) {
Deluge.Login.show(); deluge.login.show();
}, this, {single: true}); }, this, {single: true});
this.update = this.update.createDelegate(this); this.update = this.update.createDelegate(this);
@ -92,13 +92,13 @@ Deluge.UI = {
}, },
update: function() { update: function() {
var filters = Deluge.Sidebar.getFilters(); var filters = deluge.sidebar.getFilters();
Deluge.Client.web.update_ui(Deluge.Keys.Grid, filters, { deluge.client.web.update_ui(Deluge.Keys.Grid, filters, {
success: this.onUpdate, success: this.onUpdate,
failure: this.onUpdateError, failure: this.onUpdateError,
scope: this scope: this
}); });
Deluge.Details.update(); deluge.details.update();
}, },
onUpdateError: function(error) { onUpdateError: function(error) {
@ -119,16 +119,16 @@ Deluge.UI = {
* Updates the various components in the interface. * Updates the various components in the interface.
*/ */
onUpdate: function(data) { 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 + document.title = this.originalTitle +
' (Down: ' + fspeed(data['stats'].download_rate, true) + ' (Down: ' + fspeed(data['stats'].download_rate, true) +
' Up: ' + fspeed(data['stats'].upload_rate, true) + ')'; ' Up: ' + fspeed(data['stats'].upload_rate, true) + ')';
} }
Deluge.Torrents.update(data['torrents']); deluge.torrents.update(data['torrents']);
Deluge.Statusbar.update(data['stats']); deluge.statusbar.update(data['stats']);
Deluge.Sidebar.update(data['filters']); deluge.sidebar.update(data['filters']);
this.errorCount = 0; this.errorCount = 0;
}, },
@ -153,14 +153,14 @@ Deluge.UI = {
}, },
onPluginEnabled: function(pluginName) { onPluginEnabled: function(pluginName) {
Deluge.Client.web.get_plugin_resources(pluginName, { deluge.client.web.get_plugin_resources(pluginName, {
success: this.onGotPluginResources, success: this.onGotPluginResources,
scope: this scope: this
}) })
}, },
onGotPluginResources: function(resources) { 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.each(scripts, function(script) {
Ext.ux.JSLoader({ Ext.ux.JSLoader({
url: script, url: script,
@ -171,15 +171,15 @@ Deluge.UI = {
}, },
onPluginDisabled: function(pluginName) { onPluginDisabled: function(pluginName) {
Deluge.Plugins[pluginName].disable(); deluge.plugins[pluginName].disable();
}, },
onPluginLoaded: function(options) { onPluginLoaded: function(options) {
// This could happen if the plugin has multiple scripts // This could happen if the plugin has multiple scripts
if (!Deluge.Plugins[options.pluginName]) return; if (!deluge.plugins[options.pluginName]) return;
// Enable the plugin // Enable the plugin
Deluge.Plugins[options.pluginName].enable(); deluge.plugins[options.pluginName].enable();
}, },
/** /**
@ -190,11 +190,11 @@ Deluge.UI = {
if (this.running) { if (this.running) {
clearInterval(this.running); clearInterval(this.running);
this.running = false; this.running = false;
Deluge.Torrents.getStore().removeAll(); deluge.torrents.getStore().removeAll();
} }
} }
} }
Ext.onReady(function(e) { Ext.onReady(function(e) {
Deluge.UI.initialize(); deluge.ui.initialize();
}); });

View File

@ -31,13 +31,14 @@ Copyright:
statement from all source files in the program, then also delete it here. 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 // Setup the state manager
Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
// Add some additional functions to ext and setup some of the
// configurable parameters
(function() { (function() {
Ext.apply(Ext, { Ext.apply(Ext, {
escapeHTML: function(text) { escapeHTML: function(text) {
text = String(text).replace('<', '&lt;').replace('>', '&gt;'); text = String(text).replace('<', '&lt;').replace('>', '&gt;');
@ -85,34 +86,48 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
} }
}); });
Ext.getKeys = Ext.keys; 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; Ext.USE_NATIVE_JSON = true;
})(); })();
(function() { // Create the Deluge namespace
var tpl = '<div class="x-progress-wrap x-progress-renderered">' + Deluge = {
'<div class="x-progress-inner">' +
'<div style="width: {2}px" class="x-progress-bar">' +
'<div style="z-index: 99; width: {3}px" class="x-progress-text">' +
'<div style="width: {1}px;">{0}</div>' +
'</div>' +
'</div>' +
'<div class="x-progress-text x-progress-text-back">' +
'<div style="width: {1}px;">{0}</div>' +
'</div>' +
'</div>' +
'</div>';
Deluge.progressBar = function(progress, width, text, modifier) { // private
progressTpl: '<div class="x-progress-wrap x-progress-renderered">' +
'<div class="x-progress-inner">' +
'<div style="width: {2}px" class="x-progress-bar">' +
'<div style="z-index: 99; width: {3}px" class="x-progress-text">' +
'<div style="width: {1}px;">{0}</div>' +
'</div>' +
'</div>' +
'<div class="x-progress-text x-progress-text-back">' +
'<div style="width: {1}px;">{0}</div>' +
'</div>' +
'</div>' +
'</div>',
/**
* 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); modifier = Ext.value(modifier, 10);
var progressWidth = ((width / 100.0) * progress).toFixed(0); var progressWidth = ((width / 100.0) * progress).toFixed(0);
var barWidth = progressWidth - 1; var barWidth = progressWidth - 1;
var textWidth = ((progressWidth - modifier) > 0 ? progressWidth - modifier : 0); 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 // Hinting for gettext_gen.py
// _('Do Not Download') // _('Do Not Download')

View File

@ -131,7 +131,7 @@ class Config(resource.Resource):
def render(self, request): def render(self, request):
web_config = component.get("Web").get_config() web_config = component.get("Web").get_config()
config = dict([(key, web_config[key]) for key in UI_CONFIG_KEYS]) config = dict([(key, web_config[key]) for key in UI_CONFIG_KEYS])
return compress("""Deluge = { return compress("""deluge = {
author: 'Damien Churchill <damoxc@gmail.com>', author: 'Damien Churchill <damoxc@gmail.com>',
version: '%s', version: '%s',
config: %s config: %s