mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-12 04:24:27 +00:00
add in a radiogroup to facilitate in hiding compact/full allocation as one field and extend Ext.form.RadioGroup so it provides the setValue and getValue methods
This commit is contained in:
parent
e94129135b
commit
c5a21e2be9
@ -124,20 +124,28 @@ Ext.deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
|
||||
defaultType: 'radio',
|
||||
width: 100
|
||||
});
|
||||
fieldset.add({
|
||||
name: 'compact_allocation',
|
||||
value: 'false',
|
||||
boxLabel: _('Full'),
|
||||
fieldLabel: '',
|
||||
|
||||
this.optionsManager.bind('compact_allocation', fieldset.add({
|
||||
xtype: 'radiogroup',
|
||||
columns: 1,
|
||||
vertical: true,
|
||||
labelSeparator: '',
|
||||
});
|
||||
fieldset.add({
|
||||
name: 'compact_allocation',
|
||||
value: 'true',
|
||||
boxLabel: _('Compact'),
|
||||
fieldLabel: '',
|
||||
labelSeparator: '',
|
||||
});
|
||||
items: [{
|
||||
name: 'compact_allocation',
|
||||
value: false,
|
||||
inputValue: false,
|
||||
boxLabel: _('Full'),
|
||||
fieldLabel: '',
|
||||
labelSeparator: ''
|
||||
}, {
|
||||
name: 'compact_allocation',
|
||||
value: true,
|
||||
inputValue: true,
|
||||
boxLabel: _('Compact'),
|
||||
fieldLabel: '',
|
||||
labelSeparator: '',
|
||||
}]
|
||||
}));
|
||||
|
||||
fieldset = panel.add({
|
||||
title: _('Bandwidth'),
|
||||
@ -198,6 +206,8 @@ Ext.deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
|
||||
form.layout = new Ext.layout.FormLayout();
|
||||
form.layout.setContainer(form);
|
||||
form.doLayout();
|
||||
|
||||
this.optionsManager.changeId(null);
|
||||
},
|
||||
|
||||
clear: function() {
|
||||
|
File diff suppressed because one or more lines are too long
@ -746,3 +746,28 @@ Ext.ux.FullProgressBar = Ext.extend(Ext.ProgressBar, {
|
||||
}
|
||||
});
|
||||
Ext.reg('fullprogressbar', Ext.ux.FullProgressBar);
|
||||
|
||||
|
||||
// Allow radiogroups to be treated as a single form element.
|
||||
Ext.override(Ext.form.RadioGroup, {
|
||||
getName: function() {
|
||||
return this.items.first().getName();
|
||||
},
|
||||
|
||||
getValue: function() {
|
||||
var v;
|
||||
|
||||
this.items.each(function(item) {
|
||||
v = item.getRawValue();
|
||||
return !item.getValue();
|
||||
});
|
||||
|
||||
return v;
|
||||
},
|
||||
|
||||
setValue: function(v) {
|
||||
this.items.each(function(item) {
|
||||
item.setValue((item.getRawValue() === 'true') == v);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user