diff --git a/deluge/ui/web/index.html b/deluge/ui/web/index.html index bb48596c5..3b53400be 100644 --- a/deluge/ui/web/index.html +++ b/deluge/ui/web/index.html @@ -19,7 +19,7 @@ author: 'Damien Churchill ', version: '${version}', config: ${js_config} - } + }; @@ -31,7 +31,7 @@ -
+
diff --git a/deluge/ui/web/js/deluge-all/.order b/deluge/ui/web/js/deluge-all/.order index 4b6be4373..617e32499 100644 --- a/deluge/ui/web/js/deluge-all/.order +++ b/deluge/ui/web/js/deluge-all/.order @@ -1,2 +1,3 @@ + OptionsManager.js + StatusbarMenu.js ++ Formatters.js diff --git a/deluge/ui/web/js/deluge-all/AddConnectionWindow.js b/deluge/ui/web/js/deluge-all/AddConnectionWindow.js index 67e15b6d5..171a8b6da 100644 --- a/deluge/ui/web/js/deluge-all/AddConnectionWindow.js +++ b/deluge/ui/web/js/deluge-all/AddConnectionWindow.js @@ -1,7 +1,7 @@ /*! * Deluge.AddConnectionWindow.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,13 +29,13 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.ns('Deluge'); /** * @class Deluge.AddConnectionWindow * @extends Ext.Window */ -Deluge.AddConnectionWindow = Ext.extend(Ext.Window, { +Ext.define('Deluge.AddConnectionWindow', { + extend: 'Ext.Window', title: _('Add Connection'), iconCls: 'x-deluge-add-window-icon', @@ -48,15 +48,15 @@ Deluge.AddConnectionWindow = Ext.extend(Ext.Window, { closeAction: 'hide', initComponent: function() { - Deluge.AddConnectionWindow.superclass.initComponent.call(this); + this.callParent(arguments); this.addEvents('hostadded'); - + this.addButton(_('Close'), this.hide, this); this.addButton(_('Add'), this.onAddClick, this); - + this.on('hide', this.onHide, this); - + this.form = this.add({ xtype: 'form', defaultType: 'textfield', diff --git a/deluge/ui/web/js/deluge-all/AddTrackerWindow.js b/deluge/ui/web/js/deluge-all/AddTrackerWindow.js index a921ec2cc..cc12ad396 100644 --- a/deluge/ui/web/js/deluge-all/AddTrackerWindow.js +++ b/deluge/ui/web/js/deluge-all/AddTrackerWindow.js @@ -1,7 +1,7 @@ /*! * Deluge.AddTrackerWindow.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,14 +29,14 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.ns('Deluge'); /** * @class Deluge.AddTrackerWindow * @extends Ext.Window */ -Deluge.AddTrackerWindow = Ext.extend(Ext.Window, { - +Ext.define('Deluge.AddTrackerWindow', { + extend: 'Ext.Window', + title: _('Add Tracker'), layout: 'fit', width: 375, @@ -51,12 +51,12 @@ Deluge.AddTrackerWindow = Ext.extend(Ext.Window, { iconCls: 'x-deluge-edit-trackers', initComponent: function() { - Deluge.AddTrackerWindow.superclass.initComponent.call(this); - - this.addButton(_('Cancel'), this.onCancelClick, this); - this.addButton(_('Add'), this.onAddClick, this); + this.callParent(arguments); + + //this.addButton(_('Cancel'), this.onCancelClick, this); + //this.addButton(_('Add'), this.onAddClick, this); this.addEvents('add'); - + this.form = this.add({ xtype: 'form', defaultType: 'textarea', @@ -73,7 +73,7 @@ Deluge.AddTrackerWindow = Ext.extend(Ext.Window, { onAddClick: function() { var trackers = this.form.getForm().findField('trackers').getValue(); trackers = trackers.split('\n'); - + var cleaned = []; Ext.each(trackers, function(tracker) { if (Ext.form.VTypes.url(tracker)) { diff --git a/deluge/ui/web/js/deluge-all/Client.js b/deluge/ui/web/js/deluge-all/Client.js index 658cf7127..2e61a5596 100644 --- a/deluge/ui/web/js/deluge-all/Client.js +++ b/deluge/ui/web/js/deluge-all/Client.js @@ -1,7 +1,7 @@ /*! * Deluge.Client.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,7 +29,6 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.namespace('Ext.ux.util'); /** * A class that connects to a json-rpc resource and adds the available @@ -37,23 +36,24 @@ Ext.namespace('Ext.ux.util'); * @class Ext.ux.util.RpcClient * @namespace Ext.ux.util */ -Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, { +Ext.define('Ext.ux.util.RpcClient', { + extend: 'Ext.util.Observable', _components: [], - + _methods: [], - + _requests: {}, - + _url: null, - + _optionKeys: ['scope', 'success', 'failure'], - + constructor: function(config) { Ext.ux.util.RpcClient.superclass.constructor.call(this, config); this._url = config.url || null; this._id = 0; - + this.addEvents( // raw events /** @@ -62,12 +62,12 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, { * @param {Ext.ux.util.RpcClient} this */ 'connected', - + 'error' ); this.reloadMethods(); }, - + reloadMethods: function() { Ext.each(this._components, function(component) { delete this[component]; @@ -82,14 +82,14 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, { options = options || {}; options.params = options.params || []; options.id = this._id; - + var request = Ext.encode({ method: method, params: options.params, id: options.id }); this._id++; - + return Ext.Ajax.request({ url: this._url, method: 'POST', @@ -100,7 +100,7 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, { options: options }); }, - + _onFailure: function(response, requestOptions) { var options = requestOptions.options; errorObj = { @@ -111,23 +111,23 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, { code: 255 } } - + this.fireEvent('error', errorObj, response, requestOptions) - + if (Ext.type(options.failure) != 'function') return; if (options.scope) { options.failure.call(options.scope, errorObj, response, requestOptions); } else { options.failure(errorObj, response, requestOptions); - } + } }, - + _onSuccess: function(response, requestOptions) { var responseObj = Ext.decode(response.responseText); var options = requestOptions.options; if (responseObj.error) { this.fireEvent('error', responseObj, response, requestOptions); - + if (Ext.type(options.failure) != 'function') return; if (options.scope) { options.failure.call(options.scope, responseObj, response, requestOptions); @@ -143,23 +143,23 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, { } } }, - + _parseArgs: function(args) { var params = []; Ext.each(args, function(arg) { params.push(arg); }); - + var options = params[params.length - 1]; if (Ext.type(options) == 'object') { var keys = Ext.keys(options), isOption = false; - + Ext.each(this._optionKeys, function(key) { if (keys.indexOf(key) > -1) isOption = true; }); - + if (isOption) { - params.remove(options) + params.pop(-1) } else { options = {} } @@ -172,11 +172,11 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, { _setMethods: function(methods) { var components = {}, self = this; - + Ext.each(methods, function(method) { var parts = method.split('.'); var component = components[parts[0]] || {}; - + var fn = function() { var options = self._parseArgs(arguments); return self._execute(method, options); @@ -184,11 +184,11 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, { component[parts[1]] = fn; components[parts[0]] = component; }); - + for (var name in components) { self[name] = components[name]; } - + this._components = Ext.keys(components); this.fireEvent('connected', this); } diff --git a/deluge/ui/web/js/deluge-all/ConnectionManager.js b/deluge/ui/web/js/deluge-all/ConnectionManager.js index f3d44e70d..7df7f6ac2 100644 --- a/deluge/ui/web/js/deluge-all/ConnectionManager.js +++ b/deluge/ui/web/js/deluge-all/ConnectionManager.js @@ -1,7 +1,7 @@ /*! * Deluge.ConnectionManager.js * - * Copyright (c) Damien Churchill 2009-2010 + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,7 +30,8 @@ * statement from all source files in the program, then also delete it here. */ -Deluge.ConnectionManager = Ext.extend(Ext.Window, { +Ext.define('Deluge.ConnectionManager', { + extend: 'Ext.Window', layout: 'fit', width: 300, @@ -44,15 +45,15 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { iconCls: 'x-deluge-connect-window-icon', initComponent: function() { - Deluge.ConnectionManager.superclass.initComponent.call(this); + this.callParent(arguments); this.on('hide', this.onHide, this); this.on('show', this.onShow, this); deluge.events.on('login', this.onLogin, this); deluge.events.on('logout', this.onLogout, this); - this.addButton(_('Close'), this.onClose, this); - this.addButton(_('Connect'), this.onConnect, this); + //this.addButton(_('Close'), this.onClose, this); + //this.addButton(_('Connect'), this.onConnect, this); this.list = new Ext.list.ListView({ store: new Ext.data.ArrayStore({ @@ -121,7 +122,7 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { ] }) }); - this.update = this.update.createDelegate(this); + this.update = this.update.bind(this); }, /** @@ -337,7 +338,7 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { // private onShow: function() { if (!this.addHostButton) { - var bbar = this.panel.getBottomToolbar(); + var bbar = this.panel.getDockedItems()[0]; this.addHostButton = bbar.items.get('cm-add'); this.removeHostButton = bbar.items.get('cm-remove'); this.stopHostButton = bbar.items.get('cm-stop'); diff --git a/deluge/ui/web/js/deluge-all/EditTrackerWindow.js b/deluge/ui/web/js/deluge-all/EditTrackerWindow.js index 32bcef175..388509ada 100644 --- a/deluge/ui/web/js/deluge-all/EditTrackerWindow.js +++ b/deluge/ui/web/js/deluge-all/EditTrackerWindow.js @@ -1,7 +1,7 @@ /*! * Deluge.EditTrackerWindow.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,13 +29,13 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.ns('Deluge'); /** * @class Deluge.EditTrackerWindow * @extends Ext.Window */ -Deluge.EditTrackerWindow = Ext.extend(Ext.Window, { +Ext.define('Deluge.EditTrackerWindow', { + extend: 'Ext.Window', title: _('Edit Tracker'), layout: 'fit', @@ -49,14 +49,14 @@ Deluge.EditTrackerWindow = Ext.extend(Ext.Window, { buttonAlign: 'right', closeAction: 'hide', iconCls: 'x-deluge-edit-trackers', - + initComponent: function() { - Deluge.EditTrackerWindow.superclass.initComponent.call(this); - - this.addButton(_('Cancel'), this.onCancelClick, this); - this.addButton(_('Save'), this.onSaveClick, this); + this.callParent(arguments); + + //this.addButton(_('Cancel'), this.onCancelClick, this); + //this.addButton(_('Save'), this.onSaveClick, this); this.on('hide', this.onHide, this); - + this.form = this.add({ xtype: 'form', defaultType: 'textfield', @@ -69,22 +69,22 @@ Deluge.EditTrackerWindow = Ext.extend(Ext.Window, { }] }); }, - + show: function(record) { - Deluge.EditTrackerWindow.superclass.show.call(this); - + this.callParent(arguments); + this.record = record; this.form.getForm().findField('tracker').setValue(record.data['url']); }, - + onCancelClick: function() { this.hide(); }, - + onHide: function() { this.form.getForm().findField('tracker').setValue(''); }, - + onSaveClick: function() { var url = this.form.getForm().findField('tracker').getValue(); this.record.set('url', url); diff --git a/deluge/ui/web/js/deluge-all/EditTrackersWindow.js b/deluge/ui/web/js/deluge-all/EditTrackersWindow.js index ed3672079..028983e73 100644 --- a/deluge/ui/web/js/deluge-all/EditTrackersWindow.js +++ b/deluge/ui/web/js/deluge-all/EditTrackersWindow.js @@ -1,7 +1,7 @@ /*! * Deluge.EditTrackers.js * - * Copyright (c) Damien Churchill 2009-2010 + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,7 +35,8 @@ Ext.ns('Deluge'); * @class Deluge.EditTrackerWindow * @extends Ext.Window */ -Deluge.EditTrackersWindow = Ext.extend(Ext.Window, { +Ext.define('Deluge.EditTrackersWindow', { + extend: 'Ext.Window', title: _('Edit Trackers'), layout: 'fit', @@ -51,18 +52,17 @@ Deluge.EditTrackersWindow = Ext.extend(Ext.Window, { iconCls: 'x-deluge-edit-trackers', initComponent: function() { - Deluge.EditTrackersWindow.superclass.initComponent.call(this); + this.callParent(arguments); - this.addButton(_('Cancel'), this.onCancelClick, this); - this.addButton(_('Ok'), this.onOkClick, this); + //this.addButton(_('Cancel'), this.onCancelClick, this); + //this.addButton(_('Ok'), this.onOkClick, this); this.addEvents('save'); this.on('show', this.onShow, this); - this.on('save', this.onSave, this); - this.addWindow = new Deluge.AddTrackerWindow(); + this.addWindow = Ext.create('Deluge.AddTrackerWindow'); this.addWindow.on('add', this.onAddTrackers, this); - this.editWindow = new Deluge.EditTrackerWindow(); + this.editWindow = Ext.create('Deluge.EditTrackerWindow'); this.list = new Ext.list.ListView({ store: new Ext.data.JsonStore({ @@ -194,6 +194,10 @@ Deluge.EditTrackersWindow = Ext.extend(Ext.Window, { this.list.getStore().sort('tier', 'ASC'); }, + onSave: function() { + // What am I meant to do here? + }, + onSaveFail: function() { }, diff --git a/deluge/ui/web/js/deluge-all/EventsManager.js b/deluge/ui/web/js/deluge-all/EventsManager.js index 9a799d53d..941f282ce 100644 --- a/deluge/ui/web/js/deluge-all/EventsManager.js +++ b/deluge/ui/web/js/deluge-all/EventsManager.js @@ -1,7 +1,7 @@ /*! * Deluge.EventsManager.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,12 +37,13 @@ * Class for holding global events that occur within the UI. */ Deluge.EventsManager = Ext.extend(Ext.util.Observable, { + constructor: function() { this.toRegister = []; this.on('login', this.onLogin, this); - Deluge.EventsManager.superclass.constructor.call(this); + this.callParent(arguments); }, - + /** * Append an event handler to this object. */ @@ -55,7 +56,7 @@ Deluge.EventsManager = Ext.extend(Ext.util.Observable, { deluge.client.web.register_event_listener(eventName); } } - Deluge.EventsManager.superclass.addListener.call(this, eventName, fn, scope, o); + this.callParent(arguments); }, getEvents: function() { @@ -114,14 +115,13 @@ Deluge.EventsManager = Ext.extend(Ext.util.Observable, { /** * Appends an event handler to this object (shorthand for {@link #addListener}) - * @method + * @method */ Deluge.EventsManager.prototype.on = Deluge.EventsManager.prototype.addListener /** * Fires the specified event with the passed parameters (minus the * event name). - * @method + * @method */ Deluge.EventsManager.prototype.fire = Deluge.EventsManager.prototype.fireEvent -deluge.events = new Deluge.EventsManager(); diff --git a/deluge/ui/web/js/deluge-all/LoginWindow.js b/deluge/ui/web/js/deluge-all/LoginWindow.js index 37b18a184..0a08a6d39 100644 --- a/deluge/ui/web/js/deluge-all/LoginWindow.js +++ b/deluge/ui/web/js/deluge-all/LoginWindow.js @@ -1,7 +1,7 @@ /*! * Deluge.LoginWindow.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,8 +30,10 @@ * statement from all source files in the program, then also delete it here. */ -Deluge.LoginWindow = Ext.extend(Ext.Window, { - +Ext.define('Deluge.LoginWindow', { + + extend: 'Ext.Window', + firstShow: true, bodyStyle: 'padding: 10px 5px;', buttonAlign: 'center', @@ -45,17 +47,17 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, { title: _('Login'), width: 300, height: 120, - + initComponent: function() { - Deluge.LoginWindow.superclass.initComponent.call(this); + this.callParent(arguments); this.on('show', this.onShow, this); - - this.addButton({ - text: _('Login'), - handler: this.onLogin, - scope: this - }); - + +// this.addButton({ +// text: _('Login'), +// handler: this.onLogin, +// scope: this +// }); + this.form = this.add({ xtype: 'form', baseCls: 'x-plain', @@ -74,7 +76,7 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, { }); this.passwordField.on('specialkey', this.onSpecialKey, this); }, - + logout: function() { deluge.events.fire('logout'); deluge.client.auth.delete_session({ @@ -84,17 +86,17 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, { scope: this }); }, - + show: function(skipCheck) { if (this.firstShow) { deluge.client.on('error', this.onClientError, this); this.firstShow = false; } - + if (skipCheck) { - return Deluge.LoginWindow.superclass.show.call(this); + return this.callParent(arguments); } - + deluge.client.auth.check_session({ success: function(result) { if (result) { @@ -109,11 +111,11 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, { scope: this }); }, - + onSpecialKey: function(field, e) { if (e.getKey() == 13) this.onLogin(); }, - + onLogin: function() { var passwordField = this.passwordField; deluge.client.auth.login(passwordField.getValue(), { @@ -139,14 +141,14 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, { scope: this }); }, - + onClientError: function(errorObj, response, requestOptions) { if (errorObj.error.code == 1) { deluge.events.fire('logout'); this.show(true); } }, - + onShow: function() { this.passwordField.focus(true, true); } diff --git a/deluge/ui/web/js/deluge-all/MoveStorage.js b/deluge/ui/web/js/deluge-all/MoveStorage.js index f9342df38..bb9967c5e 100644 --- a/deluge/ui/web/js/deluge-all/MoveStorage.js +++ b/deluge/ui/web/js/deluge-all/MoveStorage.js @@ -1,7 +1,7 @@ /*! * Deluge.MoveStorage.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,30 +30,26 @@ * statement from all source files in the program, then also delete it here. */ -Ext.namespace('Deluge'); -Deluge.MoveStorage = Ext.extend(Ext.Window, { - - constructor: function(config) { - config = Ext.apply({ - title: _('Move Storage'), - width: 375, - height: 110, - layout: 'fit', - buttonAlign: 'right', - closeAction: 'hide', - closable: true, - iconCls: 'x-deluge-move-storage', - plain: true, - resizable: false - }, config); - Deluge.MoveStorage.superclass.constructor.call(this, config); - }, +Ext.define('Deluge.MoveStorage', { + extend: 'Ext.Window', + + title: _('Move Storage'), + width: 375, + height: 110, + layout: 'fit', + buttonAlign: 'right', + closeAction: 'hide', + closable: true, + iconCls: 'x-deluge-move-storage', + plain: true, + resizable: false, initComponent: function() { - Deluge.MoveStorage.superclass.initComponent.call(this); + this.callParent(arguments); - this.addButton(_('Cancel'), this.onCancel, this); - this.addButton(_('Move'), this.onMove, this); + // FIXME: Replace the buttons + //this.addButton(_('Cancel'), this.onCancel, this); + //this.addButton(_('Move'), this.onMove, this); this.form = this.add({ xtype: 'form', @@ -82,12 +78,12 @@ Deluge.MoveStorage = Ext.extend(Ext.Window, { }, hide: function() { - Deluge.MoveStorage.superclass.hide.call(this); + this.callParent(arguments); this.torrentIds = null; }, show: function(torrentIds) { - Deluge.MoveStorage.superclass.show.call(this); + this.callParent(arguments); this.torrentIds = torrentIds; }, diff --git a/deluge/ui/web/js/deluge-all/Plugin.js b/deluge/ui/web/js/deluge-all/Plugin.js index 2453abe05..3e9f44330 100644 --- a/deluge/ui/web/js/deluge-all/Plugin.js +++ b/deluge/ui/web/js/deluge-all/Plugin.js @@ -1,7 +1,7 @@ /*! * Deluge.Plugin.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,13 +29,13 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.ns('Deluge'); /** * @class Deluge.Plugin * @extends Ext.util.Observable */ -Deluge.Plugin = Ext.extend(Ext.util.Observable, { +Ext.define('Deluge.Plugin', { + extend: 'Ext.util.Observable', /** * The plugins name @@ -59,9 +59,9 @@ Deluge.Plugin = Ext.extend(Ext.util.Observable, { */ "disabled": true }); - Deluge.Plugin.superclass.constructor.call(this, config); + this.callParent(arguments); }, - + /** * Disables the plugin, firing the "{@link #disabled}" event and * then executing the plugins clean up method onDisabled. @@ -70,7 +70,7 @@ Deluge.Plugin = Ext.extend(Ext.util.Observable, { this.fireEvent("disabled", this); if (this.onDisable) this.onDisable(); }, - + /** * Enables the plugin, firing the "{@link #enabled}" event and * then executes the plugins setup method, onEnabled. diff --git a/deluge/ui/web/js/deluge-all/RemoveWindow.js b/deluge/ui/web/js/deluge-all/RemoveWindow.js index 43e872dd3..740fcdbdf 100644 --- a/deluge/ui/web/js/deluge-all/RemoveWindow.js +++ b/deluge/ui/web/js/deluge-all/RemoveWindow.js @@ -1,7 +1,7 @@ /*! * Deluge.RemoveWindow.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,29 +34,31 @@ * @class Deluge.RemoveWindow * @extends Ext.Window */ -Deluge.RemoveWindow = Ext.extend(Ext.Window, { - +Ext.define('Deluge.RemoveWindow', { + extend: 'Ext.Window', + title: _('Remove Torrent'), layout: 'fit', width: 350, height: 100, - + buttonAlign: 'right', closeAction: 'hide', closable: true, iconCls: 'x-deluge-remove-window-icon', plain: true, - + bodyStyle: 'padding: 5px; padding-left: 10px;', html: 'Are you sure you wish to remove the torrent (s)?', - + initComponent: function() { - Deluge.RemoveWindow.superclass.initComponent.call(this); - this.addButton(_('Cancel'), this.onCancel, this); - this.addButton(_('Remove With Data'), this.onRemoveData, this); - this.addButton(_('Remove Torrent'), this.onRemove, this); + this.callParent(arguments); + // FIXME: Replace with docked toolbar + //this.addButton(_('Cancel'), this.onCancel, this); + //this.addButton(_('Remove With Data'), this.onRemoveData, this); + //this.addButton(_('Remove Torrent'), this.onRemove, this); }, - + remove: function(removeData) { Ext.each(this.torrentIds, function(torrentId) { deluge.client.core.remove_torrent(torrentId, removeData, { @@ -67,27 +69,27 @@ Deluge.RemoveWindow = Ext.extend(Ext.Window, { torrentId: torrentId }); }, this); - + }, - + show: function(ids) { - Deluge.RemoveWindow.superclass.show.call(this); + this.callParent(arguments); this.torrentIds = ids; }, - + onCancel: function() { this.hide(); this.torrentIds = null; }, - + onRemove: function() { this.remove(false); }, - + onRemoveData: function() { this.remove(true); }, - + onRemoved: function(torrentId) { deluge.events.fire('torrentRemoved', torrentId); this.hide(); diff --git a/deluge/ui/web/js/deluge-all/Sidebar.js b/deluge/ui/web/js/deluge-all/Sidebar.js index aa9713860..12f3c9347 100644 --- a/deluge/ui/web/js/deluge-all/Sidebar.js +++ b/deluge/ui/web/js/deluge-all/Sidebar.js @@ -1,7 +1,7 @@ /*! * Deluge.Sidebar.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,7 +39,8 @@ * @author Damien Churchill * @version 1.3 */ -Deluge.Sidebar = Ext.extend(Ext.Panel, { +Ext.define('Deluge.Sidebar', { + extend: 'Ext.Panel', // private panels: {}, @@ -61,12 +62,12 @@ Deluge.Sidebar = Ext.extend(Ext.Panel, { margins: '5 0 0 5', cmargins: '5 0 0 5' }, config); - Deluge.Sidebar.superclass.constructor.call(this, config); + this.callParent(arguments); }, // private initComponent: function() { - Deluge.Sidebar.superclass.initComponent.call(this); + this.callParent(arguments); deluge.events.on("disconnect", this.onDisconnect, this); }, @@ -78,7 +79,7 @@ Deluge.Sidebar = Ext.extend(Ext.Panel, { deluge.ui.update(); }); this.add(panel); - + this.doLayout(); this.panels[filter] = panel; @@ -87,7 +88,7 @@ Deluge.Sidebar = Ext.extend(Ext.Panel, { deluge.ui.update(); } if (!panel.list.getSelectionCount()) { - panel.list.select(0); + panel.list.select(0); } }); this.fireEvent('filtercreate', this, panel); diff --git a/deluge/ui/web/js/deluge-all/TorrentGrid.js b/deluge/ui/web/js/deluge-all/TorrentGrid.js index de3672eda..a468c010a 100644 --- a/deluge/ui/web/js/deluge-all/TorrentGrid.js +++ b/deluge/ui/web/js/deluge-all/TorrentGrid.js @@ -1,7 +1,7 @@ /*! * Deluge.TorrentGrid.js * - * Copyright (c) Damien Churchill 2009-2010 + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,230 +30,229 @@ * statement from all source files in the program, then also delete it here. */ -(function() { +/* Renderers for the Torrent Grid */ +function queueRenderer(value) { + return (value == -1) ? '' : value + 1; +} +function torrentNameRenderer(value, p, r) { + return String.format('
{1}
', r.data['state'].toLowerCase(), value); +} +function torrentSpeedRenderer(value) { + if (!value) return; + return fspeed(value); +} +function torrentProgressRenderer(value, p, r) { + value = new Number(value); + var progress = value; + var text = r.data['state'] + ' ' + value.toFixed(2) + '%'; + var width = new Number(this.style.match(/\w+:\s*(\d+)\w+/)[1]); + return Deluge.progressBar(value, width - 8, text); +} +function seedsRenderer(value, p, r) { + if (r.data['total_seeds'] > -1) { + return String.format('{0} ({1})', value, r.data['total_seeds']); + } else { + return value; + } +} +function peersRenderer(value, p, r) { + if (r.data['total_peers'] > -1) { + return String.format('{0} ({1})', value, r.data['total_peers']); + } else { + return value; + } +} +function availRenderer(value, p, r) { + return (value < 0) ? '∞' : new Number(value).toFixed(3); +} +function trackerRenderer(value, p, r) { + return String.format('
{0}
', value); +} - /* Renderers for the Torrent Grid */ - function queueRenderer(value) { - return (value == -1) ? '' : value + 1; - } - function torrentNameRenderer(value, p, r) { - return String.format('
{1}
', r.data['state'].toLowerCase(), value); - } - function torrentSpeedRenderer(value) { - if (!value) return; - return fspeed(value); - } - function torrentProgressRenderer(value, p, r) { - value = new Number(value); - var progress = value; - var text = r.data['state'] + ' ' + value.toFixed(2) + '%'; - var width = new Number(this.style.match(/\w+:\s*(\d+)\w+/)[1]); - return Deluge.progressBar(value, width - 8, text); - } - function seedsRenderer(value, p, r) { - if (r.data['total_seeds'] > -1) { - return String.format('{0} ({1})', value, r.data['total_seeds']); - } else { - return value; +function etaSorter(eta) { + return eta * -1; +} + +function dateOrNever(date) { + return date > 0.0 ? fdate(date) : "Never" +} + +/** + * Deluge.TorrentGrid Class + * + * @author Damien Churchill + * @version 1.3 + * + * @class Deluge.TorrentGrid + * @extends Ext.grid.GridPanel + * @constructor + * @param {Object} config Configuration options + */ +Ext.define('Deluge.TorrentGrid', { + extend: 'Ext.grid.Panel', + + // object to store contained torrent ids + torrents: {}, + + columns: [{ + id:'queue', + header: _('#'), + width: 30, + sortable: true, + renderer: queueRenderer, + dataIndex: 'queue' + }, { + id:'name', + header: _('Name'), + width: 150, + sortable: true, + renderer: torrentNameRenderer, + dataIndex: 'name' + }, { + header: _('Size'), + width: 75, + sortable: true, + renderer: fsize, + dataIndex: 'total_size' + }, { + header: _('Progress'), + width: 150, + sortable: true, + renderer: torrentProgressRenderer, + dataIndex: 'progress' + }, { + header: _('Seeders'), + width: 60, + sortable: true, + renderer: seedsRenderer, + dataIndex: 'num_seeds' + }, { + header: _('Peers'), + width: 60, + sortable: true, + renderer: peersRenderer, + dataIndex: 'num_peers' + }, { + header: _('Down Speed'), + width: 80, + sortable: true, + renderer: torrentSpeedRenderer, + dataIndex: 'download_payload_rate' + }, { + header: _('Up Speed'), + width: 80, + sortable: true, + renderer: torrentSpeedRenderer, + dataIndex: 'upload_payload_rate' + }, { + header: _('ETA'), + width: 60, + sortable: true, + renderer: ftime, + dataIndex: 'eta' + }, { + header: _('Ratio'), + width: 60, + sortable: true, + renderer: availRenderer, + dataIndex: 'ratio' + }, { + header: _('Avail'), + width: 60, + sortable: true, + renderer: availRenderer, + dataIndex: 'distributed_copies' + }, { + header: _('Added'), + width: 80, + sortable: true, + renderer: fdate, + dataIndex: 'time_added' + }, { + header: _('Last Seen Complete'), + width: 80, + sortable: true, + renderer: dateOrNever, + dataIndex: 'last_seen_complete' + }, { + header: _('Tracker'), + width: 120, + sortable: true, + renderer: trackerRenderer, + dataIndex: 'tracker_host' + }, { + header: _('Save Path'), + width: 120, + sortable: true, + renderer: fplain, + dataIndex: 'save_path' + }, { + header: _('Owner'), + width: 80, + sortable: true, + renderer: fplain, + dataIndex: 'owner' + }, { + header: _('Public'), + width: 80, + sortable: true, + renderer: fplain, + dataIndex: 'public' + }, { + header: _('Shared'), + width: 80, + sortable: true, + renderer: fplain, + dataIndex: 'shared' + }], + + meta: { + root: 'torrents', + idProperty: 'id', + fields: [ + {name: 'queue', sortType: Deluge.data.SortTypes.asQueuePosition}, + {name: 'name'}, + {name: 'total_size', type: 'int'}, + {name: 'state'}, + {name: 'progress', type: 'float'}, + {name: 'num_seeds', type: 'int'}, + {name: 'total_seeds', type: 'int'}, + {name: 'num_peers', type: 'int'}, + {name: 'total_peers', type: 'int'}, + {name: 'download_payload_rate', type: 'int'}, + {name: 'upload_payload_speed', type: 'int'}, + {name: 'eta', type: 'int', sortType: etaSorter}, + {name: 'ratio', type: 'float'}, + {name: 'distributed_copies', type: 'float'}, + {name: 'time_added', type: 'int'}, + {name: 'tracker_host'}, + {name: 'save_path'} + ] + }, + + store: Ext.create('Ext.data.Store', { + model: 'Deluge.data.TorrentRecord', + proxy: { + type: 'memory', + reader: { + type: 'json', + root: 'torrents' + } } - } - function peersRenderer(value, p, r) { - if (r.data['total_peers'] > -1) { - return String.format('{0} ({1})', value, r.data['total_peers']); - } else { - return value; - } - } - function availRenderer(value, p, r) { - return (value < 0) ? '∞' : new Number(value).toFixed(3); - } - function trackerRenderer(value, p, r) { - return String.format('
{0}
', value); - } + }), - function etaSorter(eta) { - return eta * -1; - } - - function dateOrNever(date) { - return date > 0.0 ? fdate(date) : "Never" - } - - /** - * Deluge.TorrentGrid Class - * - * @author Damien Churchill - * @version 1.3 - * - * @class Deluge.TorrentGrid - * @extends Ext.grid.GridPanel - * @constructor - * @param {Object} config Configuration options - */ - Deluge.TorrentGrid = Ext.extend(Ext.grid.GridPanel, { - - // object to store contained torrent ids - torrents: {}, - - columns: [{ - id:'queue', - header: _('#'), - width: 30, - sortable: true, - renderer: queueRenderer, - dataIndex: 'queue' - }, { - id:'name', - header: _('Name'), - width: 150, - sortable: true, - renderer: torrentNameRenderer, - dataIndex: 'name' - }, { - header: _('Size'), - width: 75, - sortable: true, - renderer: fsize, - dataIndex: 'total_size' - }, { - header: _('Progress'), - width: 150, - sortable: true, - renderer: torrentProgressRenderer, - dataIndex: 'progress' - }, { - header: _('Seeders'), - width: 60, - sortable: true, - renderer: seedsRenderer, - dataIndex: 'num_seeds' - }, { - header: _('Peers'), - width: 60, - sortable: true, - renderer: peersRenderer, - dataIndex: 'num_peers' - }, { - header: _('Down Speed'), - width: 80, - sortable: true, - renderer: torrentSpeedRenderer, - dataIndex: 'download_payload_rate' - }, { - header: _('Up Speed'), - width: 80, - sortable: true, - renderer: torrentSpeedRenderer, - dataIndex: 'upload_payload_rate' - }, { - header: _('ETA'), - width: 60, - sortable: true, - renderer: ftime, - dataIndex: 'eta' - }, { - header: _('Ratio'), - width: 60, - sortable: true, - renderer: availRenderer, - dataIndex: 'ratio' - }, { - header: _('Avail'), - width: 60, - sortable: true, - renderer: availRenderer, - dataIndex: 'distributed_copies' - }, { - header: _('Added'), - width: 80, - sortable: true, - renderer: fdate, - dataIndex: 'time_added' - }, { - header: _('Last Seen Complete'), - width: 80, - sortable: true, - renderer: dateOrNever, - dataIndex: 'last_seen_complete' - }, { - header: _('Tracker'), - width: 120, - sortable: true, - renderer: trackerRenderer, - dataIndex: 'tracker_host' - }, { - header: _('Save Path'), - width: 120, - sortable: true, - renderer: fplain, - dataIndex: 'save_path' - }, { - header: _('Owner'), - width: 80, - sortable: true, - renderer: fplain, - dataIndex: 'owner' - }, { - header: _('Public'), - width: 80, - sortable: true, - renderer: fplain, - dataIndex: 'public' - }, { - header: _('Shared'), - width: 80, - sortable: true, - renderer: fplain, - dataIndex: 'shared' - }], - - meta: { - root: 'torrents', - idProperty: 'id', - fields: [ - {name: 'queue', sortType: Deluge.data.SortTypes.asQueuePosition}, - {name: 'name'}, - {name: 'total_size', type: 'int'}, - {name: 'state'}, - {name: 'progress', type: 'float'}, - {name: 'num_seeds', type: 'int'}, - {name: 'total_seeds', type: 'int'}, - {name: 'num_peers', type: 'int'}, - {name: 'total_peers', type: 'int'}, - {name: 'download_payload_rate', type: 'int'}, - {name: 'upload_payload_speed', type: 'int'}, - {name: 'eta', type: 'int', sortType: etaSorter}, - {name: 'ratio', type: 'float'}, - {name: 'distributed_copies', type: 'float'}, - {name: 'time_added', type: 'int'}, - {name: 'tracker_host'}, - {name: 'save_path'} - ] - }, - - constructor: function(config) { - config = Ext.apply({ - id: 'torrentGrid', - store: new Ext.data.JsonStore(this.meta), - columns: this.columns, - region: 'center', - cls: 'deluge-torrents', - stripeRows: true, - autoExpandColumn: 'name', - deferredRender:false, - autoScroll:true, - margins: '5 5 0 0', - stateful: true, - view: new Ext.ux.grid.BufferView({ - rowHeight: 26, - scrollDelay: false - }) - }, config); - Deluge.TorrentGrid.superclass.constructor.call(this, config); - }, + id: 'torrentGrid', + region: 'center', + cls: 'deluge-torrents', + stripeRows: true, + autoExpandColumn: 'name', + deferredRender:false, + autoScroll:true, + margins: '5 5 0 0', + stateful: true, initComponent: function() { - Deluge.TorrentGrid.superclass.initComponent.call(this); + this.callParent(arguments); deluge.events.on('torrentRemoved', this.onTorrentRemoved, this); deluge.events.on('disconnect', this.onDisconnect, this); @@ -378,5 +377,3 @@ }, this); } }); -deluge.torrents = new Deluge.TorrentGrid(); -})(); diff --git a/deluge/ui/web/js/deluge-all/UI.js b/deluge/ui/web/js/deluge-all/UI.js index c8e721fdd..865e6fdc8 100644 --- a/deluge/ui/web/js/deluge-all/UI.js +++ b/deluge/ui/web/js/deluge-all/UI.js @@ -1,7 +1,7 @@ /*! * Deluge.UI.js * - * Copyright (c) Damien Churchill 2009-2010 + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -47,15 +47,18 @@ deluge.ui = { * and set up various events that the UI will utilise. */ initialize: function() { - deluge.add = new Deluge.add.AddWindow(); - deluge.details = new Deluge.details.DetailsPanel(); - deluge.connectionManager = new Deluge.ConnectionManager(); - deluge.editTrackers = new Deluge.EditTrackersWindow(); - deluge.login = new Deluge.LoginWindow(); - deluge.preferences = new Deluge.preferences.PreferencesWindow(); - deluge.sidebar = new Deluge.Sidebar(); - deluge.statusbar = new Deluge.Statusbar(); - deluge.toolbar = new Deluge.Toolbar(); + + deluge.events = Ext.create('Deluge.EventsManager'); + deluge.add = Ext.create('Deluge.add.AddWindow'); + deluge.details = Ext.create('Deluge.details.DetailsPanel'); + deluge.connectionManager = Ext.create('Deluge.ConnectionManager'); + deluge.editTrackers = Ext.create('Deluge.EditTrackersWindow'); + deluge.login = Ext.create('Deluge.LoginWindow'); + deluge.preferences = Ext.create('Deluge.preferences.PreferencesWindow'); + deluge.sidebar = Ext.create('Deluge.Sidebar'); + deluge.statusbar = Ext.create('Deluge.Statusbar'); + deluge.toolbar = Ext.create('Deluge.Toolbar'); + deluge.torrents = Ext.create('Deluge.TorrentGrid'); this.MainPanel = new Ext.Panel({ id: 'mainPanel', @@ -98,8 +101,8 @@ deluge.ui = { deluge.login.show(); }, this, {single: true}); - this.update = this.update.createDelegate(this); - this.checkConnection = this.checkConnection.createDelegate(this); + this.update = Ext.bind(this.update, this); + this.checkConnection = Ext.bind(this.checkConnection, this); this.originalTitle = document.title; }, diff --git a/deluge/ui/web/js/deluge-all/add/AddWindow.js b/deluge/ui/web/js/deluge-all/add/AddWindow.js index 85c0da162..006e0f29d 100644 --- a/deluge/ui/web/js/deluge-all/add/AddWindow.js +++ b/deluge/ui/web/js/deluge-all/add/AddWindow.js @@ -1,7 +1,7 @@ /*! * Deluge.add.AddWindow.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,9 +30,8 @@ * statement from all source files in the program, then also delete it here. */ -Ext.namespace('Deluge.add'); - -Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { +Ext.define('Deluge.add.AddWindow', { + extend: 'Deluge.add.Window', title: _('Add Torrents'), layout: 'border', @@ -46,11 +45,11 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { iconCls: 'x-deluge-add-window-icon', initComponent: function() { - Deluge.add.AddWindow.superclass.initComponent.call(this); + this.callParent(arguments); + // FIXME: replace with docked toolbar + //this.addButton(_('Cancel'), this.onCancelClick, this); + //this.addButton(_('Add'), this.onAddClick, this); - this.addButton(_('Cancel'), this.onCancelClick, this); - this.addButton(_('Add'), this.onAddClick, this); - function torrentRenderer(value, p, r) { if (r.data['info_hash']) { return String.format('
{0}
', value); @@ -73,7 +72,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { sortable: true, renderer: torrentRenderer, dataIndex: 'text' - }], + }], stripeRows: true, singleSelect: true, listeners: { @@ -114,7 +113,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { }] }) }); - + this.optionsPanel = this.add(new Deluge.add.OptionsPanel()); this.on('hide', this.onHide, this); this.on('show', this.onShow, this); @@ -165,12 +164,12 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { var torrent = this.list.getSelectedRecords()[0]; this.list.getStore().remove(torrent); this.optionsPanel.clear(); - + if (this.torrents && this.torrents[torrent.id]) delete this.torrents[torrent.id]; }, onSelect: function(list, selections) { - if (selections.length) { + if (selections.length) { var record = this.list.getRecord(selections[0]); this.optionsPanel.setTorrent(record.get('info_hash')); this.optionsPanel.files.setDisabled(false); @@ -193,7 +192,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { this.file.on('beforeadd', this.onTorrentBeforeAdd, this); this.file.on('add', this.onTorrentAdd, this); } - + this.optionsPanel.form.getDefaults(); }, diff --git a/deluge/ui/web/js/deluge-all/add/FileWindow.js b/deluge/ui/web/js/deluge-all/add/FileWindow.js index 65f9a6073..1d990b248 100644 --- a/deluge/ui/web/js/deluge-all/add/FileWindow.js +++ b/deluge/ui/web/js/deluge-all/add/FileWindow.js @@ -1,7 +1,7 @@ /*! * Deluge.add.File.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,13 +29,13 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.ns('Deluge.add'); /** * @class Deluge.add.FileWindow * @extends Deluge.add.Window */ -Deluge.add.FileWindow = Ext.extend(Deluge.add.Window, { +Ext.define('Deluge.add.FileWindow', { + extend: 'Deluge.add.Window', title: _('Add from File'), layout: 'fit', @@ -49,9 +49,9 @@ Deluge.add.FileWindow = Ext.extend(Deluge.add.Window, { iconCls: 'x-deluge-add-file', initComponent: function() { - Deluge.add.FileWindow.superclass.initComponent.call(this); + this.callParent(arguments); this.addButton(_('Add'), this.onAddClick, this); - + this.form = this.add({ xtype: 'form', baseCls: 'x-plain', @@ -71,7 +71,7 @@ Deluge.add.FileWindow = Ext.extend(Deluge.add.Window, { }] }); }, - + // private onAddClick: function(field, e) { if (this.form.getForm().isValid()) { @@ -88,7 +88,7 @@ Deluge.add.FileWindow = Ext.extend(Deluge.add.Window, { this.fireEvent('beforeadd', this.torrentId, name); } }, - + // private onGotInfo: function(info, obj, response, request) { info['filename'] = request.options.filename; @@ -99,7 +99,7 @@ Deluge.add.FileWindow = Ext.extend(Deluge.add.Window, { onUploadFailure: function(form, action) { this.hide(); }, - + // private onUploadSuccess: function(fp, upload) { this.hide(); diff --git a/deluge/ui/web/js/deluge-all/add/FilesTab.js b/deluge/ui/web/js/deluge-all/add/FilesTab.js index 3e624823d..6a5dfe7bf 100644 --- a/deluge/ui/web/js/deluge-all/add/FilesTab.js +++ b/deluge/ui/web/js/deluge-all/add/FilesTab.js @@ -1,7 +1,7 @@ /*! * Deluge.add.FilesTab.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,13 +29,13 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.ns('Deluge.add'); /** * @class Deluge.add.FilesTab * @extends Ext.ux.tree.TreeGrid */ -Deluge.add.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { +Ext.define('Deluge.add.FilesTab', { + extend: 'Ext.tree.Panel', layout: 'fit', title: _('Files'), @@ -71,7 +71,7 @@ Deluge.add.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { }], initComponent: function() { - Deluge.add.FilesTab.superclass.initComponent.call(this); + this.callParent(arguments); this.on('click', this.onNodeClick, this); }, diff --git a/deluge/ui/web/js/deluge-all/add/Infohash.js b/deluge/ui/web/js/deluge-all/add/Infohash.js index ab006fd9f..71d1566ff 100644 --- a/deluge/ui/web/js/deluge-all/add/Infohash.js +++ b/deluge/ui/web/js/deluge-all/add/Infohash.js @@ -1,7 +1,7 @@ /*! * Deluge.add.Infohash.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,4 +29,3 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.namespace('Ext.deluge.add'); diff --git a/deluge/ui/web/js/deluge-all/add/OptionsPanel.js b/deluge/ui/web/js/deluge-all/add/OptionsPanel.js index 5578a4520..cfe2f1e47 100644 --- a/deluge/ui/web/js/deluge-all/add/OptionsPanel.js +++ b/deluge/ui/web/js/deluge-all/add/OptionsPanel.js @@ -1,7 +1,7 @@ /*! * Deluge.add.OptionsPanel.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,9 +29,9 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.ns('Deluge.add'); -Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { +Ext.define('Deluge.add.OptionsPanel', { + extend: 'Ext.TabPanel', torrents: {}, @@ -42,7 +42,7 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { height: 220, initComponent: function() { - Deluge.add.OptionsPanel.superclass.initComponent.call(this); + this.callParent(arguments); this.files = this.add(new Deluge.add.FilesTab()); this.form = this.add(new Deluge.add.OptionsTab()); @@ -61,7 +61,7 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { Ext.each(Ext.keys(fileIndexes), function(index) { priorities[index] = fileIndexes[index]; }); - + var oldId = this.form.optionsManager.changeId(torrent['info_hash'], true); this.form.optionsManager.setDefault('file_priorities', priorities); this.form.optionsManager.changeId(oldId, true); @@ -91,7 +91,7 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { this.torrentId = torrentId; this.form.optionsManager.changeId(torrentId); - + this.files.clearFiles(); var root = this.files.getRootNode(); var priorities = this.form.optionsManager.get('file_priorities'); @@ -120,7 +120,7 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { } else { var ret = callback(filename, type, entry, parentNode); } - + if (type == 'dir') this.walkFileTree(entry, callback, scope, ret); } }, @@ -142,7 +142,7 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { }, this); } else { this.files.setDownload(nodes[0], oldValue, true); - } + } }, scope: this, icon: Ext.MessageBox.QUESTION diff --git a/deluge/ui/web/js/deluge-all/add/OptionsTab.js b/deluge/ui/web/js/deluge-all/add/OptionsTab.js index c65dc6f40..74d44ac7d 100644 --- a/deluge/ui/web/js/deluge-all/add/OptionsTab.js +++ b/deluge/ui/web/js/deluge-all/add/OptionsTab.js @@ -1,7 +1,7 @@ /*! * Deluge.add.OptionsPanel.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,13 +29,13 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.ns('Deluge.add'); /** * @class Deluge.add.OptionsTab * @extends Ext.form.FormPanel */ -Deluge.add.OptionsTab = Ext.extend(Ext.form.FormPanel, { +Ext.define('Deluge.add.OptionsTab', { + extend: 'Ext.form.Panel', title: _('Options'), height: 170, @@ -46,7 +46,7 @@ Deluge.add.OptionsTab = Ext.extend(Ext.form.FormPanel, { labelWidth: 1, initComponent: function() { - Deluge.add.OptionsTab.superclass.initComponent.call(this); + this.callParent(arguments); this.optionsManager = new Deluge.MultiOptionsManager(); @@ -67,7 +67,7 @@ Deluge.add.OptionsTab = Ext.extend(Ext.form.FormPanel, { width: 400, labelSeparator: '' })); - + var panel = this.add({ border: false, layout: 'column', @@ -135,7 +135,7 @@ Deluge.add.OptionsTab = Ext.extend(Ext.form.FormPanel, { name: 'max_upload_slots', width: 60 })); - + fieldset = panel.add({ title: _('General'), border: false, diff --git a/deluge/ui/web/js/deluge-all/add/UrlWindow.js b/deluge/ui/web/js/deluge-all/add/UrlWindow.js index 2fa8199d6..94872a73e 100644 --- a/deluge/ui/web/js/deluge-all/add/UrlWindow.js +++ b/deluge/ui/web/js/deluge-all/add/UrlWindow.js @@ -1,7 +1,7 @@ /*! * Deluge.add.UrlWindow.js * - * Copyright (c) Damien Churchill 2009-2010 + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,8 +30,8 @@ * statement from all source files in the program, then also delete it here. */ -Ext.namespace('Deluge.add'); -Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, { +Ext.define('Deluge.add.UrlWindow', { + extend: 'Deluge.add.Window', title: _('Add from Url'), modal: true, @@ -46,7 +46,7 @@ Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, { iconCls: 'x-deluge-add-url-window-icon', initComponent: function() { - Deluge.add.UrlWindow.superclass.initComponent.call(this); + this.callParent(arguments); this.addButton(_('Add'), this.onAddClick, this); var form = this.add({ diff --git a/deluge/ui/web/js/deluge-all/add/Window.js b/deluge/ui/web/js/deluge-all/add/Window.js index b47c5d658..b9c8bc0ce 100644 --- a/deluge/ui/web/js/deluge-all/add/Window.js +++ b/deluge/ui/web/js/deluge-all/add/Window.js @@ -1,7 +1,7 @@ /*! * Deluge.add.Window.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,16 +29,17 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.ns('Deluge.add'); /** * @class Deluge.add.Window * @extends Ext.Window * Base class for an add Window */ -Deluge.add.Window = Ext.extend(Ext.Window, { +Ext.define('Deluge.add.Window', { + extend: 'Ext.Window', + initComponent: function() { - Deluge.add.Window.superclass.initComponent.call(this); + this.callParent(arguments); this.addEvents( 'beforeadd', 'add' diff --git a/deluge/ui/web/js/deluge-all/data/PeerRecord.js b/deluge/ui/web/js/deluge-all/data/PeerRecord.js index 0fdd58e9b..4d2312c24 100644 --- a/deluge/ui/web/js/deluge-all/data/PeerRecord.js +++ b/deluge/ui/web/js/deluge-all/data/PeerRecord.js @@ -1,7 +1,7 @@ /*! * Deluge.data.PeerRecord.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,7 +29,6 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.namespace('Deluge.data'); /** * Deluge.data.Peer record @@ -38,32 +37,19 @@ Ext.namespace('Deluge.data'); * @version 1.3 * * @class Deluge.data.Peer - * @extends Ext.data.Record + * @extends Ext.data.Model * @constructor * @param {Object} data The peer data */ -Deluge.data.Peer = Ext.data.Record.create([ - { - name: 'country', - type: 'string' - }, { - name: 'ip', - type: 'string', - sortType: Deluge.data.SortTypes.asIPAddress - }, { - name: 'client', - type: 'string' - }, { - name: 'progress', - type: 'float' - }, { - name: 'down_speed', - type: 'int' - }, { - name: 'up_speed', - type: 'int' - }, { - name: 'seed', - type: 'int' - } -]); +Ext.define('Deluge.data.Peer', { + extend: 'Ext.data.Model', + fields: [ + {name: 'country', type: 'string'}, + {name: 'ip', type: 'string', sortType: Deluge.data.SortTypes.asIPAddress}, + {name: 'client', type: 'string'}, + {name: 'progress', type: 'float'}, + {name: 'down_speed', type: 'int'}, + {name: 'up_speed', type: 'int'}, + {name: 'seed', type: 'int'} + ] +}); diff --git a/deluge/ui/web/js/deluge-all/data/PluginRecord.js b/deluge/ui/web/js/deluge-all/data/PluginRecord.js new file mode 100644 index 000000000..d567e1efb --- /dev/null +++ b/deluge/ui/web/js/deluge-all/data/PluginRecord.js @@ -0,0 +1,50 @@ +/*! + * Deluge.data.PluginRecord.js + * + * Copyright (c) Damien Churchill 2011 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, write to: + * The Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor + * Boston, MA 02110-1301, USA. + * + * In addition, as a special exception, the copyright holders give + * permission to link the code of portions of this program with the OpenSSL + * library. + * You must obey the GNU General Public License in all respects for all of + * the code used other than OpenSSL. If you modify file(s) with this + * exception, you may extend this exception to your version of the file(s), + * but you are not obligated to do so. If you do not wish to do so, delete + * this exception statement from your version. If you delete this exception + * statement from all source files in the program, then also delete it here. + */ + +/** + * Deluge.data.Plugin record + * + * @author Damien Churchill + * @version 1.4 + * + * @class Deluge.data.Plugin + * @extends Ext.data.Model + * @constructor + * @param {Object} data The plugin data + */ +Ext.define('Deluge.data.Plugin', { + extend: 'Ext.data.Model', + fields: [ + {name: 'enabled', type: 'boolean'}, + {name: 'plugin', type: 'string'} + ] +}); diff --git a/deluge/ui/web/js/deluge-all/data/SortTypes.js b/deluge/ui/web/js/deluge-all/data/SortTypes.js index e404ba348..23a0a2fdf 100644 --- a/deluge/ui/web/js/deluge-all/data/SortTypes.js +++ b/deluge/ui/web/js/deluge-all/data/SortTypes.js @@ -1,7 +1,7 @@ /*! * Deluge.data.SortTypes.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,7 +39,7 @@ Ext.namespace('Deluge.data'); * * @class Deluge.data.SortTypes * @singleton - */ + */ Deluge.data.SortTypes = { asIPAddress: function(value) { var d = value.match(/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\:(\d+)/); diff --git a/deluge/ui/web/js/deluge-all/data/TorrentRecord.js b/deluge/ui/web/js/deluge-all/data/TorrentRecord.js index d13806c14..33731fad0 100644 --- a/deluge/ui/web/js/deluge-all/data/TorrentRecord.js +++ b/deluge/ui/web/js/deluge-all/data/TorrentRecord.js @@ -1,7 +1,7 @@ /*! * Deluge.data.TorrentRecord.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,7 +29,6 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.namespace('Deluge.data'); /** * Deluge.data.Torrent record @@ -38,57 +37,28 @@ Ext.namespace('Deluge.data'); * @version 1.3 * * @class Deluge.data.Torrent - * @extends Ext.data.Record + * @extends Ext.data.Model * @constructor * @param {Object} data The torrents data */ -Deluge.data.Torrent = Ext.data.Record.create([{ - name: 'queue', - type: 'int' - }, { - name: 'name', - type: 'string' - }, { - name: 'total_size', - type: 'int' - }, { - name: 'state', - type: 'string' - }, { - name: 'progress', - type: 'int' - }, { - name: 'num_seeds', - type: 'int' - }, { - name: 'total_seeds', - type: 'int' - }, { - name: 'num_peers', - type: 'int' - }, { - name: 'total_peers', - type: 'int' - }, { - name: 'download_payload_rate', - type: 'int' - }, { - name: 'upload_payload_rate', - type: 'int' - }, { - name: 'eta', - type: 'int' - }, { - name: 'ratio', - type: 'float' - }, { - name: 'distributed_copies', - type: 'float' - }, { - name: 'time_added', - type: 'int' - }, { - name: 'tracker_host', - type: 'string' - } -]); +Ext.define('Deluge.data.Torrent', { + extend: 'Ext.data.Model', + fields: [ + {name: 'queue', type: 'int', sortType: Deluge.data.SortTypes.asQueuePosition}, + {name: 'name', type: 'string'}, + {name: 'total_size', type: 'int'}, + {name: 'state', type: 'string'}, + {name: 'progress', type: 'int'}, + {name: 'num_seeds', type: 'int'}, + {name: 'total_seeds', type: 'int'}, + {name: 'num_peers', type: 'int'}, + {name: 'total_peers', type: 'int'}, + {name: 'download_payload_rate', type: 'int'}, + {name: 'upload_payload_rate', type: 'int'}, + {name: 'eta', type: 'int'}, + {name: 'ratio', type: 'float'}, + {name: 'distributed_copies', type: 'float'}, + {name: 'time_added', type: 'int'}, + {name: 'tracker_host', type: 'string'} + ] +}); diff --git a/deluge/ui/web/js/deluge-all/details/DetailsPanel.js b/deluge/ui/web/js/deluge-all/details/DetailsPanel.js index 382ae6815..7ff1ed7ba 100644 --- a/deluge/ui/web/js/deluge-all/details/DetailsPanel.js +++ b/deluge/ui/web/js/deluge-all/details/DetailsPanel.js @@ -1,7 +1,7 @@ /*! * Deluge.details.DetailsPanel.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,12 +29,12 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.namespace('Deluge.details'); /** * @class Deluge.details.DetailsPanel */ -Deluge.details.DetailsPanel = Ext.extend(Ext.TabPanel, { +Ext.define('Deluge.details.DetailsPanel', { + extend: 'Ext.tab.Panel', region: 'south', id: 'torrentDetails', @@ -44,16 +44,16 @@ Deluge.details.DetailsPanel = Ext.extend(Ext.TabPanel, { collapsible: true, margins: '0 5 5 5', activeTab: 0, - + initComponent: function() { - Deluge.details.DetailsPanel.superclass.initComponent.call(this); + this.callParent(arguments); this.add(new Deluge.details.StatusTab()); this.add(new Deluge.details.DetailsTab()); this.add(new Deluge.details.FilesTab()); this.add(new Deluge.details.PeersTab()); this.add(new Deluge.details.OptionsTab()); }, - + clear: function() { this.items.each(function(panel) { if (panel.clear) { @@ -62,42 +62,42 @@ Deluge.details.DetailsPanel = Ext.extend(Ext.TabPanel, { } }); }, - - + + update: function(tab) { var torrent = deluge.torrents.getSelected(); if (!torrent) { this.clear(); return; } - + this.items.each(function(tab) { if (tab.disabled) tab.enable(); }); - + tab = tab || this.getActiveTab(); if (tab.update) tab.update(torrent.id); }, - + /* Event Handlers */ - + // We need to add the events in onRender since Deluge.Torrents hasn't // been created yet. onRender: function(ct, position) { - Deluge.details.DetailsPanel.superclass.onRender.call(this, ct, position); + this.callParent(arguments); deluge.events.on('disconnect', this.clear, this); deluge.torrents.on('rowclick', this.onTorrentsClick, this); this.on('tabchange', this.onTabChange, this); - + deluge.torrents.getSelectionModel().on('selectionchange', function(selModel) { if (!selModel.hasSelection()) this.clear(); }, this); }, - + onTabChange: function(panel, tab) { this.update(tab); }, - + onTorrentsClick: function(grid, rowIndex, e) { this.update(); } diff --git a/deluge/ui/web/js/deluge-all/details/DetailsTab.js b/deluge/ui/web/js/deluge-all/details/DetailsTab.js index ca41478d4..75950b037 100644 --- a/deluge/ui/web/js/deluge-all/details/DetailsTab.js +++ b/deluge/ui/web/js/deluge-all/details/DetailsTab.js @@ -32,17 +32,16 @@ Copyright: */ -Deluge.details.DetailsTab = Ext.extend(Ext.Panel, { +Ext.define('Deluge.details.DetailsTab', { + extend: 'Ext.Panel', + title: _('Details'), - fields: {}, - queuedItems: {}, - oldData: {}, initComponent: function() { - Deluge.details.DetailsTab.superclass.initComponent.call(this); + this.callParent(arguments); this.addItem('torrent_name', _('Name')); this.addItem('hash', _('Hash')); this.addItem('path', _('Path')); @@ -54,7 +53,7 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, { }, onRender: function(ct, position) { - Deluge.details.DetailsTab.superclass.onRender.call(this, ct, position); + this.callParent(arguments); this.body.setStyle('padding', '10px'); this.dl = Ext.DomHelper.append(this.body, {tag: 'dl'}, true); diff --git a/deluge/ui/web/js/deluge-all/details/FilesTab.js b/deluge/ui/web/js/deluge-all/details/FilesTab.js index 061ed7950..3d0de06dc 100644 --- a/deluge/ui/web/js/deluge-all/details/FilesTab.js +++ b/deluge/ui/web/js/deluge-all/details/FilesTab.js @@ -1,7 +1,7 @@ /*! * Deluge.details.FilesTab.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,8 +29,19 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ - -Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { + +Ext.define('Deluge.data.File', { + extend: 'Ext.data.Model', + fields: [ + {name: 'filename', type: 'string'}, + {name: 'size', type: 'int'}, + {name: 'progress', type: 'float'} + ] +}); + +Ext.define('Deluge.details.FilesTab', { + + extend: 'Ext.tree.Panel', title: _('Files'), @@ -45,18 +56,19 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { header: _('Size'), width: 150, dataIndex: 'size', - tpl: new Ext.XTemplate('{size:this.fsize}', { + tpl: Ext.create('Ext.XTemplate', '{size:this.fsize}', { fsize: function(v) { return fsize(v); } }) }, { - xtype: 'tgrendercolumn', header: _('Progress'), width: 150, dataIndex: 'progress', - renderer: function(v) { - var progress = v * 100; - return Deluge.progressBar(progress, this.col.width, progress.toFixed(2) + '%', 0); - } + tpl: Ext.create('Ext.XTemplate', '{progress:this.progress}', { + progress: function(v) { + var progress = v * 100; + return Deluge.progressBar(progress, this.col.width, progress.toFixed(2) + '%', 0); + } + }) }, { header: _('Priority'), width: 150, @@ -74,13 +86,8 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { } }) }], - - selModel: new Ext.tree.MultiSelectionModel(), - initComponent: function() { - Deluge.details.FilesTab.superclass.initComponent.call(this); - this.setRootNode(new Ext.tree.TreeNode({text: 'Files'})); - }, + multiSelect: true, clear: function() { var root = this.getRootNode(); @@ -130,7 +137,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { this.clear(); this.torrentId = torrentId; } - + deluge.client.web.get_torrent_files(torrentId, { success: this.onRequestComplete, scope: this, @@ -163,7 +170,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { folderSort: true }); }, - + onContextMenu: function(node, e) { e.stopEvent(); var selModel = this.getSelectionModel(); @@ -173,7 +180,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { } deluge.menus.filePriorities.showAt(e.getPoint()); }, - + onItemClick: function(baseItem, e) { switch (baseItem.id) { case 'expandAll': @@ -200,7 +207,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { return; } }); - + var priorities = new Array(Ext.keys(indexes).length); for (var index in indexes) { priorities[index] = indexes[index]; @@ -217,7 +224,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { break; } }, - + onRequestComplete: function(files, options) { if (!this.getRootNode().hasChildNodes()) { this.createFileTree(files); diff --git a/deluge/ui/web/js/deluge-all/details/OptionsTab.js b/deluge/ui/web/js/deluge-all/details/OptionsTab.js index 4a6294f80..e0925e04f 100644 --- a/deluge/ui/web/js/deluge-all/details/OptionsTab.js +++ b/deluge/ui/web/js/deluge-all/details/OptionsTab.js @@ -1,7 +1,7 @@ /*! * Deluge.details.OptionsTab.js * - * Copyright (c) Damien Churchill 2009-2010 + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,29 +30,24 @@ * statement from all source files in the program, then also delete it here. */ +Ext.define('Deluge.details.OptionsTab', { + extend: 'Ext.form.Panel', -Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { - - constructor: function(config) { - config = Ext.apply({ - autoScroll: true, - bodyStyle: 'padding: 5px;', - border: false, - cls: 'x-deluge-options', - defaults: { - autoHeight: true, - labelWidth: 1, - defaultType: 'checkbox' - }, - deferredRender: false, - layout: 'column', - title: _('Options') - }, config); - Deluge.details.OptionsTab.superclass.constructor.call(this, config); + title: _('Options'), + autoScroll: true, + bodyStyle: 'padding: 5px;', + border: false, + cls: 'x-deluge-options', + defaults: { + autoHeight: true, + labelWidth: 1, + defaultType: 'checkbox' }, + deferredRender: false, + layout: 'column', initComponent: function() { - Deluge.details.OptionsTab.superclass.initComponent.call(this); + this.callParent(arguments); this.fieldsets = {}, this.fields = {}; this.optionsManager = new Deluge.MultiOptionsManager({ @@ -291,7 +286,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { autoHeight: true, defaultType: 'checkbox', title: _('General'), - layout: 'form' + layout: 'anchor' }); this.fields['private'] = this.fieldsets.general.add({ @@ -354,7 +349,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { }, onRender: function(ct, position) { - Deluge.details.OptionsTab.superclass.onRender.call(this, ct, position); + this.callParent(arguments); // This is another hack I think, so keep an eye out here when upgrading. this.layout = new Ext.layout.ColumnLayout(); diff --git a/deluge/ui/web/js/deluge-all/details/PeersTab.js b/deluge/ui/web/js/deluge-all/details/PeersTab.js index bb45d6655..d0980dd40 100644 --- a/deluge/ui/web/js/deluge-all/details/PeersTab.js +++ b/deluge/ui/web/js/deluge-all/details/PeersTab.js @@ -1,7 +1,7 @@ /*! * Deluge.details.PeersTab.js * - * Copyright (c) Damien Churchill 2009-2010 + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -51,65 +51,60 @@ return Deluge.progressBar(progress, this.width - 8, progress + '%'); } - Deluge.details.PeersTab = Ext.extend(Ext.grid.GridPanel, { + Ext.define('Deluge.details.PeersTab', { + extend: 'Ext.grid.Panel', + title: _('Peers'), + cls: 'x-deluge-peers', + + store: Ext.create('Ext.data.Store', { + model: 'Deluge.data.Peer' + }), + + columns: [{ + header: ' ', + width: 30, + sortable: true, + renderer: flagRenderer, + dataIndex: 'country' + }, { + header: 'Address', + width: 125, + sortable: true, + renderer: peerAddressRenderer, + dataIndex: 'ip' + }, { + header: 'Client', + width: 125, + sortable: true, + renderer: function(v) { return fplain(v) }, + dataIndex: 'client' + }, { + header: 'Progress', + width: 150, + sortable: true, + renderer: peerProgressRenderer, + dataIndex: 'progress' + }, { + header: 'Down Speed', + width: 100, + sortable: true, + renderer: function(v) { return fspeed(v) }, + dataIndex: 'down_speed' + }, { + header: 'Up Speed', + width: 100, + sortable: true, + renderer: function(v) { return fspeed(v) }, + dataIndex: 'up_speed' + }], + + stripeRows: true, + deferredRender: false, + autoScroll: true, // fast way to figure out if we have a peer already. peers: {}, - constructor: function(config) { - config = Ext.apply({ - title: _('Peers'), - cls: 'x-deluge-peers', - store: new Ext.data.Store({ - reader: new Ext.data.JsonReader({ - idProperty: 'ip', - root: 'peers' - }, Deluge.data.Peer) - }), - columns: [{ - header: ' ', - width: 30, - sortable: true, - renderer: flagRenderer, - dataIndex: 'country' - }, { - header: 'Address', - width: 125, - sortable: true, - renderer: peerAddressRenderer, - dataIndex: 'ip' - }, { - header: 'Client', - width: 125, - sortable: true, - renderer: fplain, - dataIndex: 'client' - }, { - header: 'Progress', - width: 150, - sortable: true, - renderer: peerProgressRenderer, - dataIndex: 'progress' - }, { - header: 'Down Speed', - width: 100, - sortable: true, - renderer: fspeed, - dataIndex: 'down_speed' - }, { - header: 'Up Speed', - width: 100, - sortable: true, - renderer: fspeed, - dataIndex: 'up_speed' - }], - stripeRows: true, - deferredRender:false, - autoScroll:true - }, config); - Deluge.details.PeersTab.superclass.constructor.call(this, config); - }, - clear: function() { this.getStore().removeAll(); this.peers = {}; diff --git a/deluge/ui/web/js/deluge-all/details/StatusTab.js b/deluge/ui/web/js/deluge-all/details/StatusTab.js index 378b9dab8..f68c8d5a9 100644 --- a/deluge/ui/web/js/deluge-all/details/StatusTab.js +++ b/deluge/ui/web/js/deluge-all/details/StatusTab.js @@ -1,7 +1,7 @@ /*! * Deluge.details.StatusTab.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,52 +29,47 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.ns('Deluge.details'); /** * @class Deluge.details.StatusTab * @extends Ext.Panel */ -Deluge.details.StatusTab = Ext.extend(Ext.Panel, { +Ext.define('Deluge.details.StatusTab', { + extend: 'Ext.Panel', + title: _('Status'), autoScroll: true, - + onRender: function(ct, position) { - Deluge.details.StatusTab.superclass.onRender.call(this, ct, position); - + this.callParent(arguments); + this.progressBar = this.add({ - xtype: 'progress', + xtype: 'progressbar', cls: 'x-deluge-status-progressbar' }); - + this.status = this.add({ cls: 'x-deluge-status', id: 'deluge-details-status', - + border: false, width: 1000, - listeners: { - 'render': { - fn: function(panel) { - panel.load({ - url: deluge.config.base + 'render/tab_status.html', - text: _('Loading') + '...' - }); - panel.getUpdater().on('update', this.onPanelUpdate, this); - }, - scope: this - } + loader: { + url: deluge.config.base + 'render/tab_status.html', + loadMask: true, + success: this.onPanelUpdate, + scope: this } }); }, - + clear: function() { this.progressBar.updateProgress(0, ' '); for (var k in this.fields) { this.fields[k].innerHTML = ''; } }, - + update: function(torrentId) { if (!this.fields) this.getFields(); deluge.client.web.get_torrent_status(torrentId, Deluge.Keys.Status, { @@ -82,14 +77,14 @@ Deluge.details.StatusTab = Ext.extend(Ext.Panel, { scope: this }); }, - + onPanelUpdate: function(el, response) { this.fields = {}; Ext.each(Ext.query('dd', this.status.body.dom), function(field) { this.fields[field.className] = field; }, this); }, - + onRequestComplete: function(status) { seeders = status.total_seeds > -1 ? status.num_seeds + ' (' + status.total_seeds + ')' : status.num_seeds; peers = status.total_peers > -1 ? status.num_peers + ' (' + status.total_peers + ')' : status.num_peers; @@ -117,7 +112,7 @@ Deluge.details.StatusTab = Ext.extend(Ext.Panel, { data.downloaded += ' (' + ((status.total_payload_download) ? fsize(status.total_payload_download) : '0.0 KiB') + ')'; data.uploaded += ' (' + ((status.total_payload_download) ? fsize(status.total_payload_download): '0.0 KiB') + ')'; - + for (var field in this.fields) { this.fields[field].innerHTML = data[field]; } diff --git a/deluge/ui/web/js/deluge-all/preferences/BandwidthPage.js b/deluge/ui/web/js/deluge-all/preferences/BandwidthPage.js index 78d02dffc..84150cda8 100644 --- a/deluge/ui/web/js/deluge-all/preferences/BandwidthPage.js +++ b/deluge/ui/web/js/deluge-all/preferences/BandwidthPage.js @@ -1,7 +1,7 @@ /*! * Deluge.preferences.BandwidthPage.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,26 +29,21 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.namespace('Deluge.preferences'); /** * @class Deluge.preferences.Bandwidth * @extends Ext.form.FormPanel */ -Deluge.preferences.Bandwidth = Ext.extend(Ext.form.FormPanel, { - constructor: function(config) { - config = Ext.apply({ - border: false, - title: _('Bandwidth'), - layout: 'form', - labelWidth: 10 - }, config); - Deluge.preferences.Bandwidth.superclass.constructor.call(this, config); - }, - +Ext.define('Deluge.preferences.Bandwidth', { + extend: 'Ext.form.Panel', + + border: false, + title: _('Bandwidth'), + labelWidth: 10, + initComponent: function() { - Deluge.preferences.Bandwidth.superclass.initComponent.call(this); - + this.callParent(arguments); + var om = deluge.preferences.getOptionsManager(); var fieldset = this.add({ xtype: 'fieldset', @@ -105,7 +100,7 @@ Deluge.preferences.Bandwidth = Ext.extend(Ext.form.FormPanel, { value: -1, decimalPrecision: 0 })); - + fieldset = this.add({ xtype: 'fieldset', border: false, @@ -128,7 +123,7 @@ Deluge.preferences.Bandwidth = Ext.extend(Ext.form.FormPanel, { labelSeparator: '', boxLabel: _('Rate limit IP overhead') })); - + fieldset = this.add({ xtype: 'fieldset', border: false, diff --git a/deluge/ui/web/js/deluge-all/preferences/CachePage.js b/deluge/ui/web/js/deluge-all/preferences/CachePage.js index 4afec2e6a..7a2837f40 100644 --- a/deluge/ui/web/js/deluge-all/preferences/CachePage.js +++ b/deluge/ui/web/js/deluge-all/preferences/CachePage.js @@ -1,7 +1,7 @@ /*! * Deluge.preferences.CachePage.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,23 +29,22 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.namespace('Deluge.preferences'); /** * @class Deluge.preferences.Cache * @extends Ext.form.FormPanel */ -Deluge.preferences.Cache = Ext.extend(Ext.form.FormPanel, { +Ext.define('Deluge.preferences.Cache', { + extend: 'Ext.form.Panel', border: false, title: _('Cache'), - layout: 'form', - + initComponent: function() { - Deluge.preferences.Cache.superclass.initComponent.call(this); + this.callParent(arguments); var om = deluge.preferences.getOptionsManager(); - + var fieldset = this.add({ xtype: 'fieldset', border: false, diff --git a/deluge/ui/web/js/deluge-all/preferences/DaemonPage.js b/deluge/ui/web/js/deluge-all/preferences/DaemonPage.js index 2a344d9c0..a2446ca36 100644 --- a/deluge/ui/web/js/deluge-all/preferences/DaemonPage.js +++ b/deluge/ui/web/js/deluge-all/preferences/DaemonPage.js @@ -1,7 +1,7 @@ /*! * Deluge.preferences.DaemonPage.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,23 +29,22 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.namespace('Deluge.preferences'); /** * @class Deluge.preferences.Daemon * @extends Ext.form.FormPanel */ -Deluge.preferences.Daemon = Ext.extend(Ext.form.FormPanel, { +Ext.define('Deluge.preferences.Daemon', { + extend: 'Ext.form.Panel', border: false, title: _('Daemon'), - layout: 'form', - + initComponent: function() { - Deluge.preferences.Daemon.superclass.initComponent.call(this); + this.callParent(arguments); var om = deluge.preferences.getOptionsManager(); - + var fieldset = this.add({ xtype: 'fieldset', border: false, @@ -61,7 +60,7 @@ Deluge.preferences.Daemon = Ext.extend(Ext.form.FormPanel, { minValue: -1, maxValue: 99999 })); - + fieldset = this.add({ xtype: 'fieldset', border: false, @@ -77,7 +76,7 @@ Deluge.preferences.Daemon = Ext.extend(Ext.form.FormPanel, { boxLabel: _('Allow Remote Connections'), name: 'allow_remote' })); - + fieldset = this.add({ xtype: 'fieldset', border: false, diff --git a/deluge/ui/web/js/deluge-all/preferences/DownloadsPage.js b/deluge/ui/web/js/deluge-all/preferences/DownloadsPage.js index 6984db040..50e58bc67 100644 --- a/deluge/ui/web/js/deluge-all/preferences/DownloadsPage.js +++ b/deluge/ui/web/js/deluge-all/preferences/DownloadsPage.js @@ -1,7 +1,7 @@ /*! * Deluge.preferences.DownloadsPage.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,26 +29,21 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.namespace('Deluge.preferences'); /** * @class Deluge.preferences.Downloads * @extends Ext.form.FormPanel */ -Deluge.preferences.Downloads = Ext.extend(Ext.FormPanel, { - constructor: function(config) { - config = Ext.apply({ - border: false, - title: _('Downloads'), - layout: 'form', - autoHeight: true, - width: 320 - }, config); - Deluge.preferences.Downloads.superclass.constructor.call(this, config); - }, +Ext.define('Deluge.preferences.Downloads', { + extend: 'Ext.form.Panel', + border: false, + title: _('Downloads'), + layout: 'anchor', + autoHeight: true, + width: 320, initComponent: function() { - Deluge.preferences.Downloads.superclass.initComponent.call(this); + this.callParent(arguments); var optMan = deluge.preferences.getOptionsManager(); var fieldset = this.add({ @@ -93,7 +88,7 @@ Deluge.preferences.Downloads = Ext.extend(Ext.FormPanel, { }); optMan.bind('autoadd_enable', field.toggle); optMan.bind('autoadd_location', field.input); - + fieldset = this.add({ xtype: 'fieldset', border: false, @@ -122,7 +117,7 @@ Deluge.preferences.Downloads = Ext.extend(Ext.FormPanel, { inputValue: true }] })); - + fieldset = this.add({ xtype: 'fieldset', border: false, diff --git a/deluge/ui/web/js/deluge-all/preferences/InterfacePage.js b/deluge/ui/web/js/deluge-all/preferences/InterfacePage.js index e8e6b749d..ea77985e4 100644 --- a/deluge/ui/web/js/deluge-all/preferences/InterfacePage.js +++ b/deluge/ui/web/js/deluge-all/preferences/InterfacePage.js @@ -1,7 +1,7 @@ /*! * Deluge.preferences.InterfacePage.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,24 +29,23 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.namespace('Deluge.preferences'); /** * @class Deluge.preferences.Interface * @extends Ext.form.FormPanel */ -Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { +Ext.define('Deluge.preferences.Interface', { + extend: 'Ext.form.Panel', border: false, title: _('Interface'), - layout: 'form', - + initComponent: function() { - Deluge.preferences.Interface.superclass.initComponent.call(this); - + this.callParent(arguments); + var om = this.optionsManager = new Deluge.OptionsManager(); this.on('show', this.onPageShow, this); - + var fieldset = this.add({ xtype: 'fieldset', border: false, @@ -77,7 +76,7 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { labelSeparator: '', boxLabel: _('Allow the use of multiple filters at once') })); - + fieldset = this.add({ xtype: 'fieldset', border: false, @@ -91,7 +90,7 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { inputType: 'password' } }); - + this.oldPassword = fieldset.add({ name: 'old_password', fieldLabel: _('Old Password') @@ -104,7 +103,7 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { name: 'confirm_password', fieldLabel: _('Confirm Password') }); - + var panel = fieldset.add({ xtype: 'panel', autoHeight: true, @@ -122,7 +121,7 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { } } }); - + fieldset = this.add({ xtype: 'fieldset', border: false, @@ -173,7 +172,7 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { fieldLabel: _('Certificate') })); }, - + onApply: function() { var changed = this.optionsManager.getDirty(); if (!Ext.isObjectEmpty(changed)) { @@ -187,11 +186,11 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { } } }, - + onGotConfig: function(config) { this.optionsManager.set(config); }, - + onPasswordChange: function() { var newPassword = this.newPassword.getValue(); if (newPassword != this.confirmPassword.getValue()) { @@ -205,7 +204,7 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { }); return; } - + var oldPassword = this.oldPassword.getValue(); deluge.client.auth.change_password(oldPassword, newPassword, { success: function(result) { @@ -236,18 +235,18 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { scope: this }); }, - + onSetConfig: function() { this.optionsManager.commit(); }, - + onPageShow: function() { deluge.client.web.get_config({ success: this.onGotConfig, scope: this }) }, - + onSSLCheck: function(e, checked) { this.pkeyField.setDisabled(!checked); this.certField.setDisabled(!checked); diff --git a/deluge/ui/web/js/deluge-all/preferences/NetworkPage.js b/deluge/ui/web/js/deluge-all/preferences/NetworkPage.js index 13b1448fb..72ffad551 100644 --- a/deluge/ui/web/js/deluge-all/preferences/NetworkPage.js +++ b/deluge/ui/web/js/deluge-all/preferences/NetworkPage.js @@ -1,7 +1,7 @@ /*! * Deluge.preferences.NetworkPage.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,22 +29,21 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.namespace('Deluge.preferences'); /** * @class Deluge.preferences.Network * @extends Ext.form.FormPanel */ -Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, { - +Ext.define('Deluge.preferences.Network', { + extend: 'Ext.form.Panel', + border: false, - layout: 'form', title: _('Network'), initComponent: function() { - Deluge.preferences.Network.superclass.initComponent.call(this); + this.callParent(arguments); var optMan = deluge.preferences.getOptionsManager(); - + var fieldset = this.add({ xtype: 'fieldset', border: false, @@ -97,7 +96,7 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, { }] }); optMan.bind('listen_ports', this.listenPorts); - + fieldset = this.add({ xtype: 'fieldset', border: false, @@ -150,7 +149,7 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, { }] }); optMan.bind('outgoing_ports', this.outgoingPorts); - + fieldset = this.add({ xtype: 'fieldset', border: false, @@ -166,7 +165,7 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, { labelSeparator: '', width: 200 })); - + fieldset = this.add({ xtype: 'fieldset', border: false, @@ -181,7 +180,7 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, { fieldLabel: _('Peer TOS Byte'), width: 80 })); - + fieldset = this.add({ xtype: 'fieldset', border: false, @@ -190,7 +189,7 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, { layout: 'table', layoutConfig: { columns: 3 - }, + }, defaultType: 'checkbox' }); optMan.bind('upnp', fieldset.add({ diff --git a/deluge/ui/web/js/deluge-all/preferences/OtherPage.js b/deluge/ui/web/js/deluge-all/preferences/OtherPage.js index 105500eb3..437a29a5a 100644 --- a/deluge/ui/web/js/deluge-all/preferences/OtherPage.js +++ b/deluge/ui/web/js/deluge-all/preferences/OtherPage.js @@ -1,7 +1,7 @@ /*! * Deluge.preferences.OtherPage.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,27 +29,21 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.namespace('Deluge.preferences'); /** * @class Deluge.preferences.Other * @extends Ext.form.FormPanel */ -Deluge.preferences.Other = Ext.extend(Ext.form.FormPanel, { - constructor: function(config) { - config = Ext.apply({ - border: false, - title: _('Other'), - layout: 'form' - }, config); - Deluge.preferences.Other.superclass.constructor.call(this, config); - }, - +Ext.define('Deluge.preferences.Other', { + extend: 'Ext.form.Panel', + border: false, + title: _('Other'), + initComponent: function() { - Deluge.preferences.Other.superclass.initComponent.call(this); - + this.callParent(arguments); + var optMan = deluge.preferences.getOptionsManager(); - + var fieldset = this.add({ xtype: 'fieldset', border: false, @@ -65,7 +59,7 @@ Deluge.preferences.Other = Ext.extend(Ext.form.FormPanel, { name: 'new_release_check', boxLabel: _('Be alerted about new releases') })); - + fieldset = this.add({ xtype: 'fieldset', border: false, @@ -90,7 +84,7 @@ Deluge.preferences.Other = Ext.extend(Ext.form.FormPanel, { boxLabel: _('Yes, please send anonymous statistics'), name: 'send_info' })); - + fieldset = this.add({ xtype: 'fieldset', border: false, diff --git a/deluge/ui/web/js/deluge-all/preferences/PluginsPage.js b/deluge/ui/web/js/deluge-all/preferences/PluginsPage.js index 1d7499fe1..1a754bbda 100644 --- a/deluge/ui/web/js/deluge-all/preferences/PluginsPage.js +++ b/deluge/ui/web/js/deluge-all/preferences/PluginsPage.js @@ -54,7 +54,7 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, { ), initComponent: function() { - Deluge.preferences.Plugins.superclass.initComponent.call(this); + this.callParent(arguments); this.defaultValues = { 'version': '', 'email': '', @@ -68,14 +68,12 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, { return '
'; } - this.list = this.add({ - xtype: 'listview', - store: new Ext.data.ArrayStore({ - fields: [ - {name: 'enabled', mapping: 0}, - {name: 'plugin', mapping: 1} - ] + this.grid = this.add({ + xtype: 'grid', + store: Ext.create('Ext.data.JsonStore', { + model: 'Deluge.data.PluginRecord' }), + singleSelect: true, columns: [{ id: 'enabled', header: _('Enabled'), @@ -94,8 +92,6 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, { sortable: true, dataIndex: 'plugin' }], - singleSelect: true, - autoExpandColumn: 'plugin', listeners: { selectionchange: {fn: this.onPluginSelect, scope: this} } @@ -105,7 +101,7 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, { region: 'center', autoScroll: true, margins: '5 5 5 5', - items: [this.list], + items: [this.grid], bbar: new Ext.Toolbar({ items: [{ cls: 'x-btn-text-icon', @@ -147,7 +143,7 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, { }); this.pluginInfo.on('render', this.onPluginInfoRender, this); - this.list.on('click', this.onNodeClick, this); + this.grid.on('click', this.onNodeClick, this); deluge.preferences.on('show', this.onPreferencesShow, this); deluge.events.on('PluginDisabledEvent', this.onPluginDisabled, this); deluge.events.on('PluginEnabledEvent', this.onPluginEnabled, this); diff --git a/deluge/ui/web/js/deluge-all/preferences/PreferencesWindow.js b/deluge/ui/web/js/deluge-all/preferences/PreferencesWindow.js index 67f11fe83..19f7e3c51 100644 --- a/deluge/ui/web/js/deluge-all/preferences/PreferencesWindow.js +++ b/deluge/ui/web/js/deluge-all/preferences/PreferencesWindow.js @@ -1,7 +1,7 @@ /*! * Deluge.preferences.PreferencesWindow.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,15 +29,18 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.namespace('Deluge.preferences'); -PreferencesRecord = Ext.data.Record.create([{name:'name', type:'string'}]); +Ext.define('PreferencesRecord', { + extend: 'Ext.data.Model', + fields: [{name: 'name', type: 'string'}] +}); /** * @class Deluge.preferences.PreferencesWindow * @extends Ext.Window */ -Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, { +Ext.define('Deluge.preferences.PreferencesWindow', { + extend: 'Ext.Window', /** * @property {String} currentPage The currently selected page. @@ -59,10 +62,12 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, { pages: {}, initComponent: function() { - Deluge.preferences.PreferencesWindow.superclass.initComponent.call(this); + this.callParent(arguments); this.list = new Ext.list.ListView({ - store: new Ext.data.Store(), + store: Ext.create('Ext.data.Store', { + model: 'PreferencesRecord' + }), columns: [{ id: 'name', renderer: fplain, @@ -103,10 +108,10 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, { cmargins: '5 5 5 5' }); - this.addButton(_('Close'), this.onClose, this); - this.addButton(_('Apply'), this.onApply, this); - this.addButton(_('Ok'), this.onOk, this); - + //this.addButton(_('Close'), this.onClose, this); + //this.addButton(_('Apply'), this.onApply, this); + //this.addButton(_('Ok'), this.onOk, this); + this.optionsManager = new Deluge.OptionsManager(); this.on('afterrender', this.onAfterRender, this); this.on('show', this.onShow, this); @@ -128,7 +133,7 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, { this.addPage(new Deluge.preferences.Cache()); this.addPage(new Deluge.preferences.Plugins()); }, - + onApply: function(e) { var changed = this.optionsManager.getDirty(); if (!Ext.isObjectEmpty(changed)) { @@ -137,13 +142,13 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, { scope: this }); } - + for (var page in this.pages) { if (this.pages[page].onApply) this.pages[page].onApply(); } }, - - + + /** * Return the options manager for the preferences window. * @returns {Deluge.OptionsManager} the options manager @@ -151,7 +156,7 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, { getOptionsManager: function() { return this.optionsManager; }, - + /** * Adds a page to the preferences window. * @param {Mixed} page @@ -166,7 +171,7 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, { this.pages[name].index = -1; return this.pages[name]; }, - + /** * Removes a preferences page from the window. * @param {mixed} name @@ -179,12 +184,12 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, { delete this.pages[page.title]; }, - /** + /** * Select which preferences page is displayed. * @param {String} page The page name to change to */ selectPage: function(page) { - if (this.pages[page].index < 0) { + if (this.pages[page].index < 0) { this.pages[page].index = this.configPanel.items.indexOf(this.pages[page]); } this.list.select(this.pages[page].index); @@ -192,24 +197,24 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, { // private doSelectPage: function(page) { - if (this.pages[page].index < 0) { + if (this.pages[page].index < 0) { this.pages[page].index = this.configPanel.items.indexOf(this.pages[page]); } this.configPanel.getLayout().setActiveItem(this.pages[page].index); this.currentPage = page; }, - + // private onGotConfig: function(config) { this.getOptionsManager().set(config); }, - + // private onPageSelect: function(list, selections) { var r = list.getRecord(selections[0]); this.doSelectPage(r.get('name')); }, - + // private onSetConfig: function() { this.getOptionsManager().commit(); @@ -222,7 +227,7 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, { } this.configPanel.getLayout().setActiveItem(0); }, - + // private onShow: function() { if (!deluge.client.core) return; diff --git a/deluge/ui/web/js/deluge-all/preferences/ProxyPage.js b/deluge/ui/web/js/deluge-all/preferences/ProxyPage.js index db4740fb6..52f500a6f 100644 --- a/deluge/ui/web/js/deluge-all/preferences/ProxyPage.js +++ b/deluge/ui/web/js/deluge-all/preferences/ProxyPage.js @@ -1,7 +1,7 @@ /*! * Deluge.preferences.ProxyPage.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,51 +29,46 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.namespace('Deluge.preferences'); /** * @class Deluge.preferences.Proxy * @extends Ext.form.FormPanel */ -Deluge.preferences.Proxy = Ext.extend(Ext.form.FormPanel, { - constructor: function(config) { - config = Ext.apply({ - border: false, - title: _('Proxy'), - layout: 'form' - }, config); - Deluge.preferences.Proxy.superclass.constructor.call(this, config); - }, - +Ext.define('Deluge.preferences.Proxy', { + extend: 'Ext.form.Panel', + + border: false, + title: _('Proxy'), + initComponent: function() { - Deluge.preferences.Proxy.superclass.initComponent.call(this); + this.callParent(arguments); this.peer = this.add(new Deluge.preferences.ProxyField({ title: _('Peer'), name: 'peer' })); this.peer.on('change', this.onProxyChange, this); - + this.web_seed = this.add(new Deluge.preferences.ProxyField({ title: _('Web Seed'), name: 'web_seed' })); this.web_seed.on('change', this.onProxyChange, this); - + this.tracker = this.add(new Deluge.preferences.ProxyField({ title: _('Tracker'), name: 'tracker' })); this.tracker.on('change', this.onProxyChange, this); - + this.dht = this.add(new Deluge.preferences.ProxyField({ title: _('DHT'), name: 'dht' })); this.dht.on('change', this.onProxyChange, this); - + deluge.preferences.getOptionsManager().bind('proxies', this); }, - + getValue: function() { return { 'dht': this.dht.getValue(), @@ -82,18 +77,18 @@ Deluge.preferences.Proxy = Ext.extend(Ext.form.FormPanel, { 'web_seed': this.web_seed.getValue() } }, - + setValue: function(value) { for (var proxy in value) { this[proxy].setValue(value[proxy]); } }, - + onProxyChange: function(field, newValue, oldValue) { var newValues = this.getValue(); var oldValues = Ext.apply({}, newValues); oldValues[field.getName()] = oldValue; - + this.fireEvent('change', this, newValues, oldValues); } }); diff --git a/deluge/ui/web/js/deluge-all/preferences/QueuePage.js b/deluge/ui/web/js/deluge-all/preferences/QueuePage.js index 9a6b4cf69..b259dba52 100644 --- a/deluge/ui/web/js/deluge-all/preferences/QueuePage.js +++ b/deluge/ui/web/js/deluge-all/preferences/QueuePage.js @@ -1,7 +1,7 @@ /*! * Deluge.preferences.QueuePage.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,23 +29,22 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.namespace('Deluge.preferences'); /** * @class Deluge.preferences.Queue * @extends Ext.form.FormPanel */ -Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, { +Ext.define('Deluge.preferences.Queue', { + extend: 'Ext.form.Panel', border: false, title: _('Queue'), - layout: 'form', - + initComponent: function() { - Deluge.preferences.Queue.superclass.initComponent.call(this); - + this.callParent(arguments); + var om = deluge.preferences.getOptionsManager(); - + var fieldset = this.add({ xtype: 'fieldset', border: false, @@ -62,7 +61,7 @@ Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, { boxLabel: _('Queue new torrents to top'), name: 'queue_new_to_top' })); - + fieldset = this.add({ xtype: 'fieldset', border: false, @@ -113,7 +112,7 @@ Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, { hideLabel: true, boxLabel: _('Prefer Seeding over Downloading') })); - + fieldset = this.add({ xtype: 'fieldset', border: false, @@ -154,17 +153,17 @@ Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, { minValue: -1, maxValue: 99999 })); - + fieldset = this.add({ xtype: 'fieldset', border: false, autoHeight: true, - + layout: 'table', layoutConfig: {columns: 2}, labelWidth: 0, defaultType: 'checkbox', - + defaults: { fieldLabel: '', labelSeparator: '' @@ -176,7 +175,7 @@ Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, { }); this.stopAtRatio.on('check', this.onStopRatioCheck, this); om.bind('stop_seed_at_ratio', this.stopAtRatio); - + this.stopRatio = fieldset.add({ xtype: 'spinnerfield', name: 'stop_seed_ratio', @@ -191,7 +190,7 @@ Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, { decimalPrecision: 2 }); om.bind('stop_seed_ratio', this.stopRatio); - + this.removeAtRatio = fieldset.add({ name: 'remove_seed_at_ratio', ctCls: 'x-deluge-indent-checkbox', @@ -201,7 +200,7 @@ Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, { }); om.bind('remove_seed_at_ratio', this.removeAtRatio); }, - + onStopRatioCheck: function(e, checked) { this.stopRatio.setDisabled(!checked); this.removeAtRatio.setDisabled(!checked); diff --git a/deluge/ui/web/server.py b/deluge/ui/web/server.py index c067c210e..c9bc2a786 100644 --- a/deluge/ui/web/server.py +++ b/deluge/ui/web/server.py @@ -427,7 +427,7 @@ class TopLevel(resource.Resource): __stylesheets = [ "resources/css/ext-all-gray.css", # "css/ext-extensions.css", -# "css/deluge.css" + "css/deluge.css" ] def __init__(self):