change how pages are attached to the preferences window, using the title of the passed in object rather

than having to pass in one
This commit is contained in:
Damien Churchill 2009-04-30 07:13:23 +00:00
parent d09cd4908e
commit 4c03fad512
8 changed files with 88 additions and 15 deletions

View File

@ -1,6 +1,75 @@
Deluge.Preferences.addPage(_('Execute'), {
border: false,
xtype: 'form',
layout: 'form',
items: []
});
(function() {
EVENT_MAP = {
'complete': _('Torrent Complete'),
'added': _('Torrent Added')
}
EVENTS = ['complete', 'added']
ExecutePanel = Ext.extend(Ext.Panel, {
constructor: function(config) {
config = Ext.apply({
border: false,
title: _('Execute'),
layout: 'border'
}, config);
ExecutePanel.superclass.constructor.call(this, config);
},
initComponent: function() {
ExecutePanel.superclass.initComponent.call(this);
this.commands = this.add({
xtype: 'grid',
region: 'center',
store: new Ext.data.SimpleStore({
fields: [
{name: 'event', mapping: 1},
{name: 'name', mapping: 2}
],
id: 0
}),
columns: [{
width: 70,
header: _('Event'),
sortable: true,
renderer: fplain,
dataIndex: 'event'
}, {
id: 'name',
header: _('Command'),
sortable: true,
renderer: fplain,
dataIndex: 'name'
}],
stripRows: true,
selModel: new Ext.grid.RowSelectionModel({
singleSelect: true
}),
autoExpandColumn: 'name'
});
this.details = this.add({
xtype: 'tabpanel',
region: 'south',
activeTab: 0
});
this.add = this.details.add({
title: _('Add')
});
this.edit = this.details.add({
title: _('Edit')
});
},
onShow: function() {
ExecutePanel.superclass.onShow.call(this);
Deluge.Client.execute.get_commands({
success: function(commands) {
this.commands.getStore().loadData(commands);
},
scope: this
});
}
});
Deluge.Preferences.addPage(new ExecutePanel());
})();

View File

@ -1,5 +1,6 @@
Deluge.Preferences.addPage(_('Bandwidth'), {
Deluge.Preferences.addPage({
border: false,
title: _('Bandwidth'),
xtype: 'form',
layout: 'form',
labelWidth: 10,

View File

@ -1,5 +1,6 @@
Deluge.Preferences.addPage(_('Daemon'), {
Deluge.Preferences.addPage({
border: false,
title: _('Daemon'),
xtype: 'form',
layout: 'form',
items: [{

View File

@ -1,5 +1,6 @@
Deluge.Preferences.addPage(_('Downloads'), {
Deluge.Preferences.addPage({
border: false,
title: _('Downloads'),
xtype: 'form',
layout: 'form',
items: [{

View File

@ -1,5 +1,6 @@
Deluge.Preferences.addPage(_('Interface'), {
Deluge.Preferences.addPage({
border: false,
title: _('Interface'),
xtype: 'form',
layout: 'form',
items: [{

View File

@ -69,7 +69,7 @@ Copyright:
collapsible: true
}, {
region: 'center',
title: ' ',
header: false,
layout: 'fit',
height: 400,
margins: '5 5 5 5',
@ -91,8 +91,9 @@ Copyright:
this.hide();
},
addPage: function(name, page) {
addPage: function(page) {
var store = this.categoriesGrid.getStore();
var name = page.title;
store.loadData([[name]], true);
page['bodyStyle'] = 'margin: 5px';
this.pages[name] = this.configPanel.add(page);
@ -106,7 +107,6 @@ Copyright:
var name = r.get('name');
this.pages[name].show();
this.configPanel.setTitle(name);
this.currentPage = this.pages[name];
this.configPanel.doLayout();
},

File diff suppressed because one or more lines are too long