diff --git a/deluge/plugins/Label/deluge/plugins/label/data/label.js b/deluge/plugins/Label/deluge/plugins/label/data/label.js index 375128444..f7c72aa8b 100644 --- a/deluge/plugins/Label/deluge/plugins/label/data/label.js +++ b/deluge/plugins/Label/deluge/plugins/label/data/label.js @@ -37,64 +37,64 @@ Ext.ns('Deluge.ux'); */ Deluge.ux.AddLabelWindow = Ext.extend(Ext.Window, { - title: _('Add Label'), - width: 300, - height: 100, + title: _('Add Label'), + width: 300, + height: 100, - initComponent: function() { - Deluge.ux.AddLabelWindow.superclass.initComponent.call(this); - this.addButton(_('Cancel'), this.onCancelClick, this); - this.addButton(_('Ok'), this.onOkClick, this); + initComponent: function() { + Deluge.ux.AddLabelWindow.superclass.initComponent.call(this); + this.addButton(_('Cancel'), this.onCancelClick, this); + this.addButton(_('Ok'), this.onOkClick, this); - this.form = this.add({ - xtype: 'form', - height: 35, - baseCls: 'x-plain', - bodyStyle:'padding:5px 5px 0', - defaultType: 'textfield', - labelWidth: 50, - items: [{ - fieldLabel: _('Name'), - name: 'name', - allowBlank: false, - width: 220, - listeners: { - 'specialkey': { - fn: function(field, e) { - if (e.getKey() == 13) this.onOkClick(); - }, - scope: this - } - } - }] - }); - }, + this.form = this.add({ + xtype: 'form', + height: 35, + baseCls: 'x-plain', + bodyStyle:'padding:5px 5px 0', + defaultType: 'textfield', + labelWidth: 50, + items: [{ + fieldLabel: _('Name'), + name: 'name', + allowBlank: false, + width: 220, + listeners: { + 'specialkey': { + fn: function(field, e) { + if (e.getKey() == 13) this.onOkClick(); + }, + scope: this + } + } + }] + }); + }, - onCancelClick: function() { - this.hide(); - }, + onCancelClick: function() { + this.hide(); + }, - onOkClick: function() { - var label = this.form.getForm().getValues().name; - deluge.client.label.add(label, { - success: function() { - deluge.ui.update(); - this.fireEvent('labeladded', label); - }, - scope: this - }); - this.hide(); - }, + onOkClick: function() { + var label = this.form.getForm().getValues().name; + deluge.client.label.add(label, { + success: function() { + deluge.ui.update(); + this.fireEvent('labeladded', label); + }, + scope: this + }); + this.hide(); + }, - onHide: function(comp) { - Deluge.ux.AddLabelWindow.superclass.onHide.call(this, comp); - this.form.getForm().reset(); - }, + onHide: function(comp) { + Deluge.ux.AddLabelWindow.superclass.onHide.call(this, comp); + this.form.getForm().reset(); + }, - onShow: function(comp) { - Deluge.ux.AddLabelWindow.superclass.onShow.call(this, comp); - this.form.getForm().findField('name').focus(false, 150); - } + onShow: function(comp) { + Deluge.ux.AddLabelWindow.superclass.onShow.call(this, comp); + this.form.getForm().findField('name').focus(false, 150); + } }); @@ -104,245 +104,245 @@ Deluge.ux.AddLabelWindow = Ext.extend(Ext.Window, { */ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, { - title: _('Label Options'), - width: 325, - height: 240, + title: _('Label Options'), + width: 325, + height: 240, - initComponent: function() { - Deluge.ux.LabelOptionsWindow.superclass.initComponent.call(this); - this.addButton(_('Cancel'), this.onCancelClick, this); - this.addButton(_('Ok'), this.onOkClick, this); + initComponent: function() { + Deluge.ux.LabelOptionsWindow.superclass.initComponent.call(this); + this.addButton(_('Cancel'), this.onCancelClick, this); + this.addButton(_('Ok'), this.onOkClick, this); - this.form = this.add({ - xtype: 'form' - }); + this.form = this.add({ + xtype: 'form' + }); - this.tabs = this.form.add({ - xtype: 'tabpanel', - height: 175, - border: false, - items: [{ - title: _('Maximum'), - items: [{ - border: false, - items: [{ - xtype: 'fieldset', - border: false, - labelWidth: 1, - style: 'margin-bottom: 0px; padding-bottom: 0px;', - items: [{ - xtype: 'checkbox', - name: 'apply_max', - fieldLabel: '', - boxLabel: _('Apply per torrent max settings:'), - listeners: { - check: this.onFieldChecked - } - }] - }, { - xtype: 'fieldset', - border: false, - defaultType: 'spinnerfield', - style: 'margin-top: 0px; padding-top: 0px;', - items: [{ - fieldLabel: _('Download Speed'), - name: 'max_download_speed', - width: 80, - disabled: true, - value: -1, - minValue: -1 - }, { - fieldLabel: _('Upload Speed'), - name: 'max_upload_speed', - width: 80, - disabled: true, - value: -1, - minValue: -1 - }, { - fieldLabel: _('Upload Slots'), - name: 'max_upload_slots', - width: 80, - disabled: true, - value: -1, - minValue: -1 - }, { - fieldLabel: _('Connections'), - name: 'max_connections', - width: 80, - disabled: true, - value: -1, - minValue: -1 - }] - }] - }] - }, { - title: _('Queue'), - items: [{ - border: false, - items: [{ - xtype: 'fieldset', - border: false, - labelWidth: 1, - style: 'margin-bottom: 0px; padding-bottom: 0px;', - items: [{ - xtype: 'checkbox', - name: 'apply_queue', - fieldLabel: '', - boxLabel: _('Apply queue settings:'), - listeners: { - check: this.onFieldChecked - } - }] - }, { - xtype: 'fieldset', - border: false, - labelWidth: 1, - defaultType: 'checkbox', - style: 'margin-top: 0px; padding-top: 0px;', - defaults: { - style: 'margin-left: 20px' - }, - items: [{ - boxLabel: _('Auto Managed'), - name: 'is_auto_managed', - disabled: true - }, { - boxLabel: _('Stop seed at ratio:'), - name: 'stop_at_ratio', - disabled: true - }, { - xtype: 'spinnerfield', - name: 'stop_ratio', - width: 60, - decimalPrecision: 2, - incrementValue: 0.1, - style: 'position: relative; left: 100px', - disabled: true - }, { - boxLabel: _('Remove at ratio'), - name: 'remove_at_ratio', - disabled: true - }] - }] - }] - }, { - title: _('Location'), - items: [{ - border: false, - items: [{ - xtype: 'fieldset', - border: false, - labelWidth: 1, - style: 'margin-bottom: 0px; padding-bottom: 0px;', - items: [{ - xtype: 'checkbox', - name: 'apply_move_completed', - fieldLabel: '', - boxLabel: _('Apply location settings:'), - listeners: { - check: this.onFieldChecked - } - }] - }, { - xtype: 'fieldset', - border: false, - labelWidth: 1, - defaultType: 'checkbox', - labelWidth: 1, - style: 'margin-top: 0px; padding-top: 0px;', - defaults: { - style: 'margin-left: 20px' - }, - items: [{ - boxLabel: _('Move completed to:'), - name: 'move_completed', - disabled: true - }, { - xtype: 'textfield', - name: 'move_completed_path', - width: 250, - disabled: true - }] - }] - }] - }, { - title: _('Trackers'), - items: [{ - border: false, - items: [{ - xtype: 'fieldset', - border: false, - labelWidth: 1, - style: 'margin-bottom: 0px; padding-bottom: 0px;', - items: [{ - xtype: 'checkbox', - name: 'auto_add', - fieldLabel: '', - boxLabel: _('Automatically apply label:'), - listeners: { - check: this.onFieldChecked - } - }] - }, { - xtype: 'fieldset', - border: false, - labelWidth: 1, - style: 'margin-top: 0px; padding-top: 0px;', - defaults: { - style: 'margin-left: 20px' - }, - defaultType: 'textarea', - items: [{ - boxLabel: _('Move completed to:'), - name: 'auto_add_trackers', - width: 250, - height: 100, - disabled: true - }] - }] - }] - }] - }); - }, + this.tabs = this.form.add({ + xtype: 'tabpanel', + height: 175, + border: false, + items: [{ + title: _('Maximum'), + items: [{ + border: false, + items: [{ + xtype: 'fieldset', + border: false, + labelWidth: 1, + style: 'margin-bottom: 0px; padding-bottom: 0px;', + items: [{ + xtype: 'checkbox', + name: 'apply_max', + fieldLabel: '', + boxLabel: _('Apply per torrent max settings:'), + listeners: { + check: this.onFieldChecked + } + }] + }, { + xtype: 'fieldset', + border: false, + defaultType: 'spinnerfield', + style: 'margin-top: 0px; padding-top: 0px;', + items: [{ + fieldLabel: _('Download Speed'), + name: 'max_download_speed', + width: 80, + disabled: true, + value: -1, + minValue: -1 + }, { + fieldLabel: _('Upload Speed'), + name: 'max_upload_speed', + width: 80, + disabled: true, + value: -1, + minValue: -1 + }, { + fieldLabel: _('Upload Slots'), + name: 'max_upload_slots', + width: 80, + disabled: true, + value: -1, + minValue: -1 + }, { + fieldLabel: _('Connections'), + name: 'max_connections', + width: 80, + disabled: true, + value: -1, + minValue: -1 + }] + }] + }] + }, { + title: _('Queue'), + items: [{ + border: false, + items: [{ + xtype: 'fieldset', + border: false, + labelWidth: 1, + style: 'margin-bottom: 0px; padding-bottom: 0px;', + items: [{ + xtype: 'checkbox', + name: 'apply_queue', + fieldLabel: '', + boxLabel: _('Apply queue settings:'), + listeners: { + check: this.onFieldChecked + } + }] + }, { + xtype: 'fieldset', + border: false, + labelWidth: 1, + defaultType: 'checkbox', + style: 'margin-top: 0px; padding-top: 0px;', + defaults: { + style: 'margin-left: 20px' + }, + items: [{ + boxLabel: _('Auto Managed'), + name: 'is_auto_managed', + disabled: true + }, { + boxLabel: _('Stop seed at ratio:'), + name: 'stop_at_ratio', + disabled: true + }, { + xtype: 'spinnerfield', + name: 'stop_ratio', + width: 60, + decimalPrecision: 2, + incrementValue: 0.1, + style: 'position: relative; left: 100px', + disabled: true + }, { + boxLabel: _('Remove at ratio'), + name: 'remove_at_ratio', + disabled: true + }] + }] + }] + }, { + title: _('Location'), + items: [{ + border: false, + items: [{ + xtype: 'fieldset', + border: false, + labelWidth: 1, + style: 'margin-bottom: 0px; padding-bottom: 0px;', + items: [{ + xtype: 'checkbox', + name: 'apply_move_completed', + fieldLabel: '', + boxLabel: _('Apply location settings:'), + listeners: { + check: this.onFieldChecked + } + }] + }, { + xtype: 'fieldset', + border: false, + labelWidth: 1, + defaultType: 'checkbox', + labelWidth: 1, + style: 'margin-top: 0px; padding-top: 0px;', + defaults: { + style: 'margin-left: 20px' + }, + items: [{ + boxLabel: _('Move completed to:'), + name: 'move_completed', + disabled: true + }, { + xtype: 'textfield', + name: 'move_completed_path', + width: 250, + disabled: true + }] + }] + }] + }, { + title: _('Trackers'), + items: [{ + border: false, + items: [{ + xtype: 'fieldset', + border: false, + labelWidth: 1, + style: 'margin-bottom: 0px; padding-bottom: 0px;', + items: [{ + xtype: 'checkbox', + name: 'auto_add', + fieldLabel: '', + boxLabel: _('Automatically apply label:'), + listeners: { + check: this.onFieldChecked + } + }] + }, { + xtype: 'fieldset', + border: false, + labelWidth: 1, + style: 'margin-top: 0px; padding-top: 0px;', + defaults: { + style: 'margin-left: 20px' + }, + defaultType: 'textarea', + items: [{ + boxLabel: _('Move completed to:'), + name: 'auto_add_trackers', + width: 250, + height: 100, + disabled: true + }] + }] + }] + }] + }); + }, - getLabelOptions: function() { - deluge.client.label.get_options(this.label, { - success: this.gotOptions, - scope: this - }); - }, + getLabelOptions: function() { + deluge.client.label.get_options(this.label, { + success: this.gotOptions, + scope: this + }); + }, - gotOptions: function(options) { - this.form.getForm().setValues(options); - }, + gotOptions: function(options) { + this.form.getForm().setValues(options); + }, - show: function(label) { - Deluge.ux.LabelOptionsWindow.superclass.show.call(this); - this.label = label; - this.setTitle(_('Label Options') + ': ' + this.label); - this.tabs.setActiveTab(0); - this.getLabelOptions(); - }, + show: function(label) { + Deluge.ux.LabelOptionsWindow.superclass.show.call(this); + this.label = label; + this.setTitle(_('Label Options') + ': ' + this.label); + this.tabs.setActiveTab(0); + this.getLabelOptions(); + }, - onCancelClick: function() { - this.hide(); - }, + onCancelClick: function() { + this.hide(); + }, - onOkClick: function() { - var values = this.form.getForm().getFieldValues(); - if (values['auto_add_trackers']) { - values['auto_add_trackers'] = values['auto_add_trackers'].split('\n'); - } - deluge.client.label.set_options(this.label, values); - this.hide(); - }, + onOkClick: function() { + var values = this.form.getForm().getFieldValues(); + if (values['auto_add_trackers']) { + values['auto_add_trackers'] = values['auto_add_trackers'].split('\n'); + } + deluge.client.label.set_options(this.label, values); + this.hide(); + }, - onFieldChecked: function(field, checked) { - var fs = field.ownerCt.nextSibling(); - fs.items.each(function(field) { - field.setDisabled(!checked); - }); - } + onFieldChecked: function(field, checked) { + var fs = field.ownerCt.nextSibling(); + fs.items.each(function(field) { + field.setDisabled(!checked); + }); + } }); @@ -355,178 +355,178 @@ Ext.ns('Deluge.plugins'); */ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, { - name: 'Label', + name: 'Label', - createMenu: function() { - this.labelMenu = new Ext.menu.Menu({ - items: [{ - text: _('Add Label'), - iconCls: 'icon-add', - handler: this.onLabelAddClick, - scope: this - }, { - text: _('Remove Label'), - disabled: true, - iconCls: 'icon-remove', - handler: this.onLabelRemoveClick, - scope: this - }, { - text: _('Label Options'), - disabled: true, - handler: this.onLabelOptionsClick, - scope: this - }] - }); - }, + createMenu: function() { + this.labelMenu = new Ext.menu.Menu({ + items: [{ + text: _('Add Label'), + iconCls: 'icon-add', + handler: this.onLabelAddClick, + scope: this + }, { + text: _('Remove Label'), + disabled: true, + iconCls: 'icon-remove', + handler: this.onLabelRemoveClick, + scope: this + }, { + text: _('Label Options'), + disabled: true, + handler: this.onLabelOptionsClick, + scope: this + }] + }); + }, - setFilter: function(filter) { - filter.show_zero = true; - filter.list.on('contextmenu', this.onLabelContextMenu, this); - filter.header.on('contextmenu', this.onLabelHeaderContextMenu, this); - this.filter = filter; - }, + setFilter: function(filter) { + filter.show_zero = true; + filter.list.on('contextmenu', this.onLabelContextMenu, this); + filter.header.on('contextmenu', this.onLabelHeaderContextMenu, this); + this.filter = filter; + }, - updateTorrentMenu: function(filter) { - for (var state in filter.getStates()) { - if (!state) continue; - this.torrentMenu.addMenuItem({ - text: state, - label: state, - handler: this.onTorrentMenuClick, - scope: this - }); - } - }, + updateTorrentMenu: function(filter) { + for (var state in filter.getStates()) { + if (!state) continue; + this.torrentMenu.addMenuItem({ + text: state, + label: state, + handler: this.onTorrentMenuClick, + scope: this + }); + } + }, - onDisable: function() { - deluge.sidebar.un('filtercreate', this.onFilterCreate); - deluge.sidebar.un('afterfiltercreate', this.onAfterFilterCreate); - delete Deluge.FilterPanel.templates.label; - this.deregisterTorrentStatus('label'); - deluge.menus.torrent.remove(this.tmSep); - deluge.menus.torrent.remove(this.tm); - }, + onDisable: function() { + deluge.sidebar.un('filtercreate', this.onFilterCreate); + deluge.sidebar.un('afterfiltercreate', this.onAfterFilterCreate); + delete Deluge.FilterPanel.templates.label; + this.deregisterTorrentStatus('label'); + deluge.menus.torrent.remove(this.tmSep); + deluge.menus.torrent.remove(this.tm); + }, - onEnable: function() { - this.torrentMenu = new Ext.menu.Menu({ - items: [{ - text: _('No Label'), - label: '', - handler: this.onTorrentMenuClick, - scope: this - }] - }); + onEnable: function() { + this.torrentMenu = new Ext.menu.Menu({ + items: [{ + text: _('No Label'), + label: '', + handler: this.onTorrentMenuClick, + scope: this + }] + }); - this.tmSep = deluge.menus.torrent.add({ - xtype: 'menuseparator' - }); + this.tmSep = deluge.menus.torrent.add({ + xtype: 'menuseparator' + }); - this.tm = deluge.menus.torrent.add({ - text: _('Label'), - menu: this.torrentMenu - }); + this.tm = deluge.menus.torrent.add({ + text: _('Label'), + menu: this.torrentMenu + }); - var lbltpl = '