mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-12 12:34:43 +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',
|
defaultType: 'radio',
|
||||||
width: 100
|
width: 100
|
||||||
});
|
});
|
||||||
fieldset.add({
|
|
||||||
name: 'compact_allocation',
|
this.optionsManager.bind('compact_allocation', fieldset.add({
|
||||||
value: 'false',
|
xtype: 'radiogroup',
|
||||||
boxLabel: _('Full'),
|
columns: 1,
|
||||||
fieldLabel: '',
|
vertical: true,
|
||||||
labelSeparator: '',
|
labelSeparator: '',
|
||||||
});
|
items: [{
|
||||||
fieldset.add({
|
name: 'compact_allocation',
|
||||||
name: 'compact_allocation',
|
value: false,
|
||||||
value: 'true',
|
inputValue: false,
|
||||||
boxLabel: _('Compact'),
|
boxLabel: _('Full'),
|
||||||
fieldLabel: '',
|
fieldLabel: '',
|
||||||
labelSeparator: '',
|
labelSeparator: ''
|
||||||
});
|
}, {
|
||||||
|
name: 'compact_allocation',
|
||||||
|
value: true,
|
||||||
|
inputValue: true,
|
||||||
|
boxLabel: _('Compact'),
|
||||||
|
fieldLabel: '',
|
||||||
|
labelSeparator: '',
|
||||||
|
}]
|
||||||
|
}));
|
||||||
|
|
||||||
fieldset = panel.add({
|
fieldset = panel.add({
|
||||||
title: _('Bandwidth'),
|
title: _('Bandwidth'),
|
||||||
@ -198,6 +206,8 @@ Ext.deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
|
|||||||
form.layout = new Ext.layout.FormLayout();
|
form.layout = new Ext.layout.FormLayout();
|
||||||
form.layout.setContainer(form);
|
form.layout.setContainer(form);
|
||||||
form.doLayout();
|
form.doLayout();
|
||||||
|
|
||||||
|
this.optionsManager.changeId(null);
|
||||||
},
|
},
|
||||||
|
|
||||||
clear: function() {
|
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);
|
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