[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-05-16 11:10:38 +01:00
parent 0353b82c0c
commit c9692bb5bd
2 changed files with 77 additions and 10 deletions

View File

@ -9,20 +9,49 @@
* See LICENSE for more details.
*/
AutoAddPlugin = Ext.extend(Deluge.Plugin, {
constructor: function(config) {
config = Ext.apply({
name: "AutoAdd"
}, config);
AutoAddPlugin.superclass.constructor.call(this, config);
},
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>')
}
});
}
});
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());
}
});
new AutoAddPlugin();
Deluge.registerPlugin('AutoAdd', Deluge.plugins.AutoAddPlugin);

View File

@ -9,6 +9,42 @@
*
*/
Ext.ns('Deluge.ux.preferences');
/**
* @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>')
}
});
},
});
Ext.ns('Deluge.ux');
/**
@ -393,9 +429,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({