convert the daemon preferences page into a class

This commit is contained in:
Damien Churchill 2009-07-30 21:42:04 +00:00
commit c76e67b109

View file

@ -1,44 +1,61 @@
Deluge.Preferences.addPage({ Ext.namespace('Ext.deluge.preferences');
Ext.deluge.preferences.Daemon = Ext.extend(Ext.form.FormPanel, {
constructor: function(config) {
config = Ext.apply({
border: false, border: false,
title: _('Daemon'), title: _('Daemon'),
xtype: 'form', layout: 'form'
layout: 'form', }, config);
items: [{ Ext.deluge.preferences.Daemon.superclass.constructor.call(this, config);
},
initComponent: function() {
Ext.deluge.preferences.Daemon.superclass.initComponent.call(this);
var optMan = Deluge.Preferences.getOptionsManager();
var fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
title: _('Port'), title: _('Port'),
autoHeight: true, autoHeight: true,
defaultType: 'uxspinner', defaultType: 'uxspinner'
items: [{ });
optMan.bind('daemon_port', fieldset.add({
fieldLabel: _('Daemon port'), fieldLabel: _('Daemon port'),
id: 'daemon_port' name: 'daemon_port'
}] }));
}, {
fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
title: _('Connections'), title: _('Connections'),
autoHeight: true, autoHeight: true,
labelWidth: 1, labelWidth: 1,
defaultType: 'checkbox', defaultType: 'checkbox'
items: [{ });
optMan.bind('allow_remote', fieldset.add({
fieldLabel: '', fieldLabel: '',
labelSeparator: '', labelSeparator: '',
boxLabel: _('Allow Remote Connections'), boxLabel: _('Allow Remote Connections'),
id: 'allow_remote' name: 'allow_remote'
}] }));
}, {
fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
title: _('Other'), title: _('Other'),
autoHeight: true, autoHeight: true,
labelWidth: 1, labelWidth: 1,
defaultType: 'checkbox', defaultType: 'checkbox'
items: [{ });
optMan.bind('new_release_check', fieldset.add({
fieldLabel: '', fieldLabel: '',
labelSeparator: '', labelSeparator: '',
height: 40, height: 40,
boxLabel: _('Periodically check the website for new releases'), boxLabel: _('Periodically check the website for new releases'),
id: 'new_releases' id: 'new_release_check'
}] }));
}] }
}); });
Deluge.Preferences.addPage(new Ext.deluge.preferences.Daemon());