diff --git a/deluge/ui/web/js/Deluge.Preferences.Bandwidth.js b/deluge/ui/web/js/Deluge.Preferences.Bandwidth.js index 53686d599..33acc99e8 100644 --- a/deluge/ui/web/js/Deluge.Preferences.Bandwidth.js +++ b/deluge/ui/web/js/Deluge.Preferences.Bandwidth.js @@ -1,96 +1,118 @@ -Deluge.Preferences.addPage({ - border: false, - title: _('Bandwidth'), - xtype: 'form', - layout: 'form', - labelWidth: 10, - items: [{ - xtype: 'fieldset', - border: false, - title: _('Global Bandwidth Usage'), - autoHeight: true, - labelWidth: 200, - style: 'margin-bottom: 0px; padding-bottom: 0px;', - defaultType: 'uxspinner', - items: [{ +Ext.namespace('Ext.deluge.preferences'); +Ext.deluge.preferences.Bandwidth = Ext.extend(Ext.form.FormPanel, { + constructor: function(config) { + config = Ext.apply({ + border: false, + title: _('Bandwidth'), + layout: 'form', + labelWidth: 10 + }, config); + Ext.deluge.preferences.Bandwidth.superclass.constructor.call(this, config); + }, + + initComponent: function() { + Ext.deluge.preferences.Bandwidth.superclass.initComponent.call(this); + + var optMan = Deluge.Preferences.getOptionsManager(); + var fieldset = this.add({ + xtype: 'fieldset', + border: false, + title: _('Global Bandwidth Usage'), + labelWidth: 200, + defaultType: 'uxspinner', + style: 'margin-bottom: 0px; padding-bottom: 0px;', + autoHeight: true + }); + optMan.bind('max_connections', fieldset.add({ name: 'max_connections', fieldLabel: _('Maximum Connections'), width: 60, value: -1 - }, { + })); + optMan.bind('max_upload_slots', fieldset.add({ name: 'max_upload_slots', fieldLabel: _('Maximum Upload Slots'), width: 60, value: -1 - }, { + })); + optMan.bind('max_download_speed', fieldset.add({ name: 'max_download_speed', fieldLabel: _('Maximum Download Speed (KiB/s)'), width: 60, value: -1 - }, { + })); + optMan.bind('max_upload_speed', fieldset.add({ name: 'max_upload_speed', fieldLabel: _('Maximum Upload Speed (KiB/s)'), width: 60, value: -1 - }, { + })); + optMan.bind('max_half_open_connections', fieldset.add({ name: 'max_half_open_connections', fieldLabel: _('Maximum Half-Open Connections'), width: 60, value: -1 - }, { - name: 'max_connections_per_second', + })); + optMan.bind('max_connections_per_second', fieldset.add({ + name: 'max_half_open_connections', fieldLabel: _('Maximum Connection Attempts per Second'), width: 60, value: -1 - }] - }, { - xtype: 'fieldset', - border: false, - title: '', - autoHeight: true, - style: 'padding-top: 0px; margin-top: 0px; margin-bottom: 0px;', - items: [{ - xtype: 'checkbox', + })); + + fieldset = this.add({ + xtype: 'fieldset', + border: false, + title: '', + defaultType: 'checkbox', + style: 'padding-top: 0px; margin-top: 0px; margin-bottom: 0px;', + autoHeight: true + }); + optMan.bind('ignore_local', fieldset.add({ name: 'ignore_local', fieldLabel: '', labelSeparator: '', boxLabel: _('Ignore limits on local network'), - value: -1 - }, { - xtype: 'checkbox', + })); + optMan.bind('limit_ip_overhead', fieldset.add({ name: 'limit_ip_overhead', fieldLabel: '', labelSeparator: '', boxLabel: _('Rate limit IP overhead'), - value: -1 - }] - }, { - xtype: 'fieldset', - border: false, - title: _('Per Torrent Bandwidth Usage'), - autoHeight: true, - labelWidth: 200, - defaultType: 'uxspinner', - items: [{ + })); + + fieldset = this.add({ + xtype: 'fieldset', + border: false, + title: _('Per Torrent Bandwidth Usage'), + defaultType: 'uxspinner', + labelWidth: 200, + autoHeight: true + }); + optMan.bind('max_connections_per_torrent', fieldset.add({ name: 'max_connections_per_torrent', fieldLabel: _('Maximum Connections'), width: 60, value: -1 - }, { + })); + optMan.bind('max_upload_slots_per_torrent', fieldset.add({ name: 'max_upload_slots_per_torrent', fieldLabel: _('Maximum Upload Slots'), width: 60, value: -1 - }, { + })); + optMan.bind('max_download_speed_per_torrent', fieldset.add({ name: 'max_download_speed_per_torrent', fieldLabel: _('Maximum Download Speed (KiB/s)'), width: 60, value: -1 - }, { + })); + optMan.bind('max_upload_speed_per_torrent', fieldset.add({ name: 'max_upload_speed_per_torrent', fieldLabel: _('Maximum Upload Speed (KiB/s)'), width: 60, value: -1 - }] - }] -}); \ No newline at end of file + })); + } +}); +Deluge.Preferences.addPage(new Ext.deluge.preferences.Bandwidth()); \ No newline at end of file diff --git a/deluge/ui/web/js/Deluge.Preferences.Downloads.js b/deluge/ui/web/js/Deluge.Preferences.Downloads.js index 8965f0f52..ae5beb3c6 100644 --- a/deluge/ui/web/js/Deluge.Preferences.Downloads.js +++ b/deluge/ui/web/js/Deluge.Preferences.Downloads.js @@ -12,23 +12,13 @@ initComponent: function() { DownloadPanel.superclass.initComponent.call(this); - this.fieldsets = {} - this.fields = {}; - - var optMan = Deluge.Preferences.getOptionsManager(); - optMan.addOptions({ - 'download_location': '' - }); - + var optMan = Deluge.Preferences.getOptionsManager(); var fieldset = this.add({ xtype: 'fieldset', border: false, title: _('Folders'), labelWidth: 140, defaultType: 'textfield', - defaults: { - enableKeyEvents: true - }, autoHeight: true }); optMan.bind('download_location', fieldset.add({