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:
parent
d09cd4908e
commit
4c03fad512
|
@ -1,6 +1,75 @@
|
||||||
Deluge.Preferences.addPage(_('Execute'), {
|
(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,
|
border: false,
|
||||||
xtype: 'form',
|
title: _('Execute'),
|
||||||
layout: 'form',
|
layout: 'border'
|
||||||
items: []
|
}, 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());
|
||||||
|
})();
|
|
@ -1,5 +1,6 @@
|
||||||
Deluge.Preferences.addPage(_('Bandwidth'), {
|
Deluge.Preferences.addPage({
|
||||||
border: false,
|
border: false,
|
||||||
|
title: _('Bandwidth'),
|
||||||
xtype: 'form',
|
xtype: 'form',
|
||||||
layout: 'form',
|
layout: 'form',
|
||||||
labelWidth: 10,
|
labelWidth: 10,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
Deluge.Preferences.addPage(_('Daemon'), {
|
Deluge.Preferences.addPage({
|
||||||
border: false,
|
border: false,
|
||||||
|
title: _('Daemon'),
|
||||||
xtype: 'form',
|
xtype: 'form',
|
||||||
layout: 'form',
|
layout: 'form',
|
||||||
items: [{
|
items: [{
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
Deluge.Preferences.addPage(_('Downloads'), {
|
Deluge.Preferences.addPage({
|
||||||
border: false,
|
border: false,
|
||||||
|
title: _('Downloads'),
|
||||||
xtype: 'form',
|
xtype: 'form',
|
||||||
layout: 'form',
|
layout: 'form',
|
||||||
items: [{
|
items: [{
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
Deluge.Preferences.addPage(_('Interface'), {
|
Deluge.Preferences.addPage({
|
||||||
border: false,
|
border: false,
|
||||||
|
title: _('Interface'),
|
||||||
xtype: 'form',
|
xtype: 'form',
|
||||||
layout: 'form',
|
layout: 'form',
|
||||||
items: [{
|
items: [{
|
||||||
|
|
|
@ -69,7 +69,7 @@ Copyright:
|
||||||
collapsible: true
|
collapsible: true
|
||||||
}, {
|
}, {
|
||||||
region: 'center',
|
region: 'center',
|
||||||
title: ' ',
|
header: false,
|
||||||
layout: 'fit',
|
layout: 'fit',
|
||||||
height: 400,
|
height: 400,
|
||||||
margins: '5 5 5 5',
|
margins: '5 5 5 5',
|
||||||
|
@ -91,8 +91,9 @@ Copyright:
|
||||||
this.hide();
|
this.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
addPage: function(name, page) {
|
addPage: function(page) {
|
||||||
var store = this.categoriesGrid.getStore();
|
var store = this.categoriesGrid.getStore();
|
||||||
|
var name = page.title;
|
||||||
store.loadData([[name]], true);
|
store.loadData([[name]], true);
|
||||||
page['bodyStyle'] = 'margin: 5px';
|
page['bodyStyle'] = 'margin: 5px';
|
||||||
this.pages[name] = this.configPanel.add(page);
|
this.pages[name] = this.configPanel.add(page);
|
||||||
|
@ -106,7 +107,6 @@ Copyright:
|
||||||
var name = r.get('name');
|
var name = r.get('name');
|
||||||
|
|
||||||
this.pages[name].show();
|
this.pages[name].show();
|
||||||
this.configPanel.setTitle(name);
|
|
||||||
this.currentPage = this.pages[name];
|
this.currentPage = this.pages[name];
|
||||||
this.configPanel.doLayout();
|
this.configPanel.doLayout();
|
||||||
},
|
},
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue