an initial attempt at the bandwidth pane

This commit is contained in:
Damien Churchill 2009-07-28 23:33:37 +00:00
parent 58b5c1a68f
commit 21f09a636a
2 changed files with 72 additions and 60 deletions

View File

@ -1,96 +1,118 @@
Deluge.Preferences.addPage({ Ext.namespace('Ext.deluge.preferences');
border: false, Ext.deluge.preferences.Bandwidth = Ext.extend(Ext.form.FormPanel, {
title: _('Bandwidth'), constructor: function(config) {
xtype: 'form', config = Ext.apply({
layout: 'form', border: false,
labelWidth: 10, title: _('Bandwidth'),
items: [{ layout: 'form',
xtype: 'fieldset', labelWidth: 10
border: false, }, config);
title: _('Global Bandwidth Usage'), Ext.deluge.preferences.Bandwidth.superclass.constructor.call(this, config);
autoHeight: true, },
labelWidth: 200,
style: 'margin-bottom: 0px; padding-bottom: 0px;', initComponent: function() {
defaultType: 'uxspinner', Ext.deluge.preferences.Bandwidth.superclass.initComponent.call(this);
items: [{
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', name: 'max_connections',
fieldLabel: _('Maximum Connections'), fieldLabel: _('Maximum Connections'),
width: 60, width: 60,
value: -1 value: -1
}, { }));
optMan.bind('max_upload_slots', fieldset.add({
name: 'max_upload_slots', name: 'max_upload_slots',
fieldLabel: _('Maximum Upload Slots'), fieldLabel: _('Maximum Upload Slots'),
width: 60, width: 60,
value: -1 value: -1
}, { }));
optMan.bind('max_download_speed', fieldset.add({
name: 'max_download_speed', name: 'max_download_speed',
fieldLabel: _('Maximum Download Speed (KiB/s)'), fieldLabel: _('Maximum Download Speed (KiB/s)'),
width: 60, width: 60,
value: -1 value: -1
}, { }));
optMan.bind('max_upload_speed', fieldset.add({
name: 'max_upload_speed', name: 'max_upload_speed',
fieldLabel: _('Maximum Upload Speed (KiB/s)'), fieldLabel: _('Maximum Upload Speed (KiB/s)'),
width: 60, width: 60,
value: -1 value: -1
}, { }));
optMan.bind('max_half_open_connections', fieldset.add({
name: 'max_half_open_connections', name: 'max_half_open_connections',
fieldLabel: _('Maximum Half-Open Connections'), fieldLabel: _('Maximum Half-Open Connections'),
width: 60, width: 60,
value: -1 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'), fieldLabel: _('Maximum Connection Attempts per Second'),
width: 60, width: 60,
value: -1 value: -1
}] }));
}, {
xtype: 'fieldset', fieldset = this.add({
border: false, xtype: 'fieldset',
title: '', border: false,
autoHeight: true, title: '',
style: 'padding-top: 0px; margin-top: 0px; margin-bottom: 0px;', defaultType: 'checkbox',
items: [{ style: 'padding-top: 0px; margin-top: 0px; margin-bottom: 0px;',
xtype: 'checkbox', autoHeight: true
});
optMan.bind('ignore_local', fieldset.add({
name: 'ignore_local', name: 'ignore_local',
fieldLabel: '', fieldLabel: '',
labelSeparator: '', labelSeparator: '',
boxLabel: _('Ignore limits on local network'), boxLabel: _('Ignore limits on local network'),
value: -1 }));
}, { optMan.bind('limit_ip_overhead', fieldset.add({
xtype: 'checkbox',
name: 'limit_ip_overhead', name: 'limit_ip_overhead',
fieldLabel: '', fieldLabel: '',
labelSeparator: '', labelSeparator: '',
boxLabel: _('Rate limit IP overhead'), boxLabel: _('Rate limit IP overhead'),
value: -1 }));
}]
}, { fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
title: _('Per Torrent Bandwidth Usage'), title: _('Per Torrent Bandwidth Usage'),
autoHeight: true, defaultType: 'uxspinner',
labelWidth: 200, labelWidth: 200,
defaultType: 'uxspinner', autoHeight: true
items: [{ });
optMan.bind('max_connections_per_torrent', fieldset.add({
name: 'max_connections_per_torrent', name: 'max_connections_per_torrent',
fieldLabel: _('Maximum Connections'), fieldLabel: _('Maximum Connections'),
width: 60, width: 60,
value: -1 value: -1
}, { }));
optMan.bind('max_upload_slots_per_torrent', fieldset.add({
name: 'max_upload_slots_per_torrent', name: 'max_upload_slots_per_torrent',
fieldLabel: _('Maximum Upload Slots'), fieldLabel: _('Maximum Upload Slots'),
width: 60, width: 60,
value: -1 value: -1
}, { }));
optMan.bind('max_download_speed_per_torrent', fieldset.add({
name: 'max_download_speed_per_torrent', name: 'max_download_speed_per_torrent',
fieldLabel: _('Maximum Download Speed (KiB/s)'), fieldLabel: _('Maximum Download Speed (KiB/s)'),
width: 60, width: 60,
value: -1 value: -1
}, { }));
optMan.bind('max_upload_speed_per_torrent', fieldset.add({
name: 'max_upload_speed_per_torrent', name: 'max_upload_speed_per_torrent',
fieldLabel: _('Maximum Upload Speed (KiB/s)'), fieldLabel: _('Maximum Upload Speed (KiB/s)'),
width: 60, width: 60,
value: -1 value: -1
}] }));
}] }
}); });
Deluge.Preferences.addPage(new Ext.deluge.preferences.Bandwidth());

View File

@ -12,23 +12,13 @@
initComponent: function() { initComponent: function() {
DownloadPanel.superclass.initComponent.call(this); DownloadPanel.superclass.initComponent.call(this);
this.fieldsets = {}
this.fields = {};
var optMan = Deluge.Preferences.getOptionsManager(); var optMan = Deluge.Preferences.getOptionsManager();
optMan.addOptions({
'download_location': ''
});
var fieldset = this.add({ var fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
title: _('Folders'), title: _('Folders'),
labelWidth: 140, labelWidth: 140,
defaultType: 'textfield', defaultType: 'textfield',
defaults: {
enableKeyEvents: true
},
autoHeight: true autoHeight: true
}); });
optMan.bind('download_location', fieldset.add({ optMan.bind('download_location', fieldset.add({