From c9692bb5bd4ed560226b07428dc033afcab6e7ad Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Tue, 16 May 2017 11:10:38 +0100 Subject: [PATCH] [Plugins] Add webui pref pages for Label and Autoadd * Add info-only preference pages for these plugins in WebUI. --- .../deluge/plugins/autoadd/data/autoadd.js | 49 +++++++++++++++---- .../Label/deluge/plugins/label/data/label.js | 38 ++++++++++++++ 2 files changed, 77 insertions(+), 10 deletions(-) diff --git a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/data/autoadd.js b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/data/autoadd.js index e604fc16a..e7ee476b6 100644 --- a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/data/autoadd.js +++ b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/data/autoadd.js @@ -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: _('

The AutoAdd plugin is enabled however there is no WebUI ' + + 'preferences page implemented yet for this plugin.


' + + '

In the meantime please use GtkUI preference page to configure this plugin.

') + } + }); + } +}); + +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); diff --git a/deluge/plugins/Label/deluge/plugins/label/data/label.js b/deluge/plugins/Label/deluge/plugins/label/data/label.js index c0a3b1199..5f00d2313 100644 --- a/deluge/plugins/Label/deluge/plugins/label/data/label.js +++ b/deluge/plugins/Label/deluge/plugins/label/data/label.js @@ -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: _('

The Label plugin is enabled.


' + + '

To add, remove or edit labels right-click on the Label filter ' + + 'entry in the sidebar.


' + + '

To apply a label right-click on torrent(s).

') + } + }); + + }, + +}); + 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({