[Plugins] Add webui pref pages for Label and Autoadd

* Add info-only preference pages for these plugins in WebUI.
This commit is contained in:
Calum Lind 2017-03-28 11:55:13 +01:00
parent f870741d9d
commit 85eeadcfca
2 changed files with 81 additions and 16 deletions

View file

@ -31,20 +31,49 @@ Copyright:
statement from all source files in the program, then also delete it here.
*/
AutoAddPlugin = Ext.extend(Deluge.Plugin, {
constructor: function(config) {
config = Ext.apply({
name: "AutoAdd"
}, config);
AutoAddPlugin.superclass.constructor.call(this, config);
},
onDisable: function() {
},
onEnable: function() {
}
Ext.ns('Deluge.ux.preferences');
/**
* @class Deluge.ux.preferences.AutoAddPage
* @extends Ext.Panel
*/
Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, {
title: _('AutoAdd'),
layout: 'fit',
border: false,
initComponent: function() {
Deluge.ux.preferences.AutoAddPage.superclass.initComponent.call(this);
fieldset = this.add({
xtype: 'fieldset',
border: false,
title: _('AutoAdd Preferences'),
autoHeight: true,
labelWidth: 1,
defaultType: 'panel'
});
fieldset.add({
border: false,
bodyCfg: {
html: _('<p>The AutoAdd plugin is enabled however there is no WebUI ' +
'preferences page implemented yet for this plugin.</p><br>' +
'<p>In the meantime please use GtkUI preference page to configure this plugin.<p>')
}
});
}
});
new AutoAddPlugin();
Deluge.plugins.AutoAddPlugin = Ext.extend(Deluge.Plugin, {
name: 'AutoAdd',
onDisable: function() {
deluge.preferences.removePage(this.prefsPage);
},
onEnable: function() {
this.prefsPage = deluge.preferences.addPage(new Deluge.ux.preferences.AutoAddPage());
}
});
Deluge.registerPlugin('AutoAdd', Deluge.plugins.AutoAddPlugin);

View file

@ -31,6 +31,40 @@
*/
Ext.ns('Deluge.ux');
/**
* @class Deluge.ux.preferences.LabelPage
* @extends Ext.Panel
*/
Deluge.ux.preferences.LabelPage = Ext.extend(Ext.Panel, {
title: _('Label'),
layout: 'fit',
border: false,
initComponent: function() {
Deluge.ux.preferences.LabelPage.superclass.initComponent.call(this);
fieldset = this.add({
xtype: 'fieldset',
border: false,
title: _('Label Preferences'),
autoHeight: true,
labelWidth: 1,
defaultType: 'panel'
});
fieldset.add({
border: false,
bodyCfg: {
html: _('<p>The Label plugin is enabled.</p><br>' +
'<p>To add, remove or edit labels right-click on the Label filter ' +
'entry in the sidebar.</p><br>' +
'<p>To apply a label right-click on torrent(s).<p>')
}
});
},
});
/**
* @class Deluge.ux.AddLabelWindow
* @extends Ext.Window
@ -413,9 +447,11 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
this.deregisterTorrentStatus('label');
deluge.menus.torrent.remove(this.tmSep);
deluge.menus.torrent.remove(this.tm);
deluge.preferences.removePage(this.prefsPage);
},
onEnable: function() {
this.prefsPage = deluge.preferences.addPage(new Deluge.ux.preferences.LabelPage());
this.torrentMenu = new Ext.menu.Menu();
this.tmSep = deluge.menus.torrent.add({