diff options
Diffstat (limited to 'deluge/plugins/AutoAdd/deluge_autoadd/data')
5 files changed, 78 insertions, 116 deletions
diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd.js b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd.js index 40086b3..e68fce3 100644 --- a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd.js +++ b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd.js @@ -25,7 +25,7 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, { border: false, watchdirs: {}, - initComponent: function() { + initComponent: function () { Deluge.ux.preferences.AutoAddPage.superclass.initComponent.call(this); var autoAdd = this; @@ -41,23 +41,22 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, { sortable: true, dataIndex: 'enabled', tpl: new Ext.XTemplate('{enabled:this.getCheckbox}', { - getCheckbox: function(checked, selected) { - Deluge.ux.AutoAdd.onClickFunctions[ - selected.id - ] = function() { - if (selected.enabled) { - deluge.client.autoadd.disable_watchdir( - selected.id - ); - checked = false; - } else { - deluge.client.autoadd.enable_watchdir( - selected.id - ); - checked = true; - } - autoAdd.updateWatchDirs(); - }; + getCheckbox: function (checked, selected) { + Deluge.ux.AutoAdd.onClickFunctions[selected.id] = + function () { + if (selected.enabled) { + deluge.client.autoadd.disable_watchdir( + selected.id + ); + checked = false; + } else { + deluge.client.autoadd.enable_watchdir( + selected.id + ); + checked = true; + } + autoAdd.updateWatchDirs(); + }; return ( '<input id="enabled-' + selected.id + @@ -122,9 +121,9 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, { this.on('show', this.onPreferencesShow, this); }, - updateWatchDirs: function() { + updateWatchDirs: function () { deluge.client.autoadd.get_watchdirs({ - success: function(watchdirs) { + success: function (watchdirs) { this.watchdirs = watchdirs; var watchdirsArray = []; for (var id in watchdirs) { @@ -145,12 +144,12 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, { }); }, - onAddClick: function() { + onAddClick: function () { if (!this.addWin) { this.addWin = new Deluge.ux.AutoAdd.AddAutoAddCommandWindow(); this.addWin.on( 'watchdiradd', - function() { + function () { this.updateWatchDirs(); }, this @@ -159,12 +158,12 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, { this.addWin.show(); }, - onEditClick: function() { + onEditClick: function () { if (!this.editWin) { this.editWin = new Deluge.ux.AutoAdd.EditAutoAddCommandWindow(); this.editWin.on( 'watchdiredit', - function() { + function () { this.updateWatchDirs(); }, this @@ -174,39 +173,27 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, { this.editWin.show(id, this.watchdirs[id]); }, - onPreferencesShow: function() { + onPreferencesShow: function () { this.updateWatchDirs(); }, - onRemoveClick: function() { + onRemoveClick: function () { var record = this.list.getSelectedRecords()[0]; deluge.client.autoadd.remove(record.id, { - success: function() { + success: function () { this.updateWatchDirs(); }, scope: this, }); }, - onSelectionChange: function(dv, selections) { + onSelectionChange: function (dv, selections) { if (selections.length) { - this.panel - .getBottomToolbar() - .items.get(1) - .enable(); - this.panel - .getBottomToolbar() - .items.get(3) - .enable(); + this.panel.getBottomToolbar().items.get(1).enable(); + this.panel.getBottomToolbar().items.get(3).enable(); } else { - this.panel - .getBottomToolbar() - .items.get(1) - .disable(); - this.panel - .getBottomToolbar() - .items.get(3) - .disable(); + this.panel.getBottomToolbar().items.get(1).disable(); + this.panel.getBottomToolbar().items.get(3).disable(); } }, }); @@ -218,12 +205,12 @@ Deluge.plugins.AutoAddPlugin = Ext.extend(Deluge.Plugin, { prefsPage: null, }, - onDisable: function() { + onDisable: function () { deluge.preferences.removePage(Deluge.plugins.AutoAddPlugin.prefsPage); Deluge.plugins.AutoAddPlugin.prefsPage = null; }, - onEnable: function() { + onEnable: function () { /* * Called for each of the JavaScript files. * This will prevent adding unnecessary tabs to the preferences window. diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options.js b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options.js index 49f752f..7ec4448 100644 --- a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options.js +++ b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options.js @@ -60,7 +60,7 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, { ], }), - initComponent: function() { + initComponent: function () { Deluge.ux.AutoAdd.AutoAddWindowBase.superclass.initComponent.call(this); this.addButton(_('Cancel'), this.onCancelClick, this); @@ -81,18 +81,17 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, { }); }, - onCancelClick: function() { + onCancelClick: function () { this.hide(); }, - getOptions: function() { + getOptions: function () { var options = {}; options['enabled'] = Ext.getCmp('enabled').getValue(); options['path'] = Ext.getCmp('path').getValue(); - options['download_location'] = Ext.getCmp( - 'download_location' - ).getValue(); + options['download_location'] = + Ext.getCmp('download_location').getValue(); options['move_completed_path'] = Ext.getCmp( 'move_completed_path' ).getValue(); @@ -102,22 +101,22 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, { options['append_extension'] = Ext.getCmp('append_extension').getValue(); options['owner'] = Ext.getCmp('owner').getValue(); - this.toggle_ids.forEach(function(toggle_id) { + this.toggle_ids.forEach(function (toggle_id) { options[toggle_id] = Ext.getCmp(toggle_id).getValue(); }); - this.spin_ids.forEach(function(spin_id) { + this.spin_ids.forEach(function (spin_id) { options[spin_id] = Ext.getCmp(spin_id).getValue(); options[spin_id + '_toggle'] = Ext.getCmp( spin_id + '_toggle' ).getValue(); }); - this.spin_int_ids.forEach(function(spin_int_id) { + this.spin_int_ids.forEach(function (spin_int_id) { options[spin_int_id] = Ext.getCmp(spin_int_id).getValue(); options[spin_int_id + '_toggle'] = Ext.getCmp( spin_int_id + '_toggle' ).getValue(); }); - this.chk_ids.forEach(function(chk_id) { + this.chk_ids.forEach(function (chk_id) { options[chk_id] = Ext.getCmp(chk_id).getValue(); options[chk_id + '_toggle'] = Ext.getCmp( chk_id + '_toggle' @@ -137,7 +136,7 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, { return options; }, - loadOptions: function(options) { + loadOptions: function (options) { /* * Populate all available options data to the UI */ @@ -193,7 +192,7 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, { : false ); - this.spin_ids.forEach(function(spin_id) { + this.spin_ids.forEach(function (spin_id) { Ext.getCmp(spin_id).setValue( options[spin_id] !== undefined ? options[spin_id] : 0 ); @@ -203,7 +202,7 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, { : false ); }); - this.chk_ids.forEach(function(chk_id) { + this.chk_ids.forEach(function (chk_id) { Ext.getCmp(chk_id).setValue( options[chk_id] !== undefined ? options[chk_id] : true ); @@ -237,14 +236,14 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, { 'path', 'download_location', 'copy_torrent', - ].forEach(function(field) { + ].forEach(function (field) { value = options[field] !== undefined ? options[field] : ''; Ext.getCmp(field).setValue(value); }); if (Object.keys(options).length === 0) { deluge.client.core.get_config({ - success: function(config) { + success: function (config) { var value; Ext.getCmp('download_location').setValue( options['download_location'] !== undefined @@ -291,11 +290,11 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, { } deluge.client.core.get_enabled_plugins({ - success: function(plugins) { + success: function (plugins) { if (plugins !== undefined && plugins.indexOf('Label') > -1) { this.MainTab.LabelFset.setVisible(true); deluge.client.label.get_labels({ - success: function(labels) { + success: function (labels) { for ( var index = 0; index < labels.length; @@ -305,7 +304,7 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, { } this.labels.loadData(labels, false); }, - failure: function(failure) { + failure: function (failure) { console.error(failure); }, scope: this, @@ -324,30 +323,26 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, { accounts[index] = [accounts[index]['username']]; } me.accounts.loadData(accounts, false); - Ext.getCmp('owner') - .setValue(owner) - .enable(); + Ext.getCmp('owner').setValue(owner).enable(); } function on_accounts_failure(failure) { deluge.client.autoadd.get_auth_user({ - success: function(user) { + success: function (user) { me.accounts.loadData([[user]], false); - Ext.getCmp('owner') - .setValue(user) - .disable(true); + Ext.getCmp('owner').setValue(user).disable(true); }, scope: this, }); } deluge.client.autoadd.is_admin_level({ - success: function(is_admin) { + success: function (is_admin) { if (is_admin) { deluge.client.core.get_known_accounts({ - success: function(accounts) { + success: function (accounts) { deluge.client.autoadd.get_auth_user({ - success: function(user) { + success: function (user) { on_accounts( accounts, options['owner'] !== undefined @@ -379,7 +374,7 @@ Deluge.ux.AutoAdd.EditAutoAddCommandWindow = Ext.extend( { title: _('Edit Watch Folder'), - initComponent: function() { + initComponent: function () { Deluge.ux.AutoAdd.EditAutoAddCommandWindow.superclass.initComponent.call( this ); @@ -389,7 +384,7 @@ Deluge.ux.AutoAdd.EditAutoAddCommandWindow = Ext.extend( }); }, - show: function(watchdir_id, options) { + show: function (watchdir_id, options) { Deluge.ux.AutoAdd.EditAutoAddCommandWindow.superclass.show.call( this ); @@ -397,11 +392,11 @@ Deluge.ux.AutoAdd.EditAutoAddCommandWindow = Ext.extend( this.loadOptions(options); }, - onSaveClick: function() { + onSaveClick: function () { try { var options = this.getOptions(); deluge.client.autoadd.set_options(this.watchdir_id, options, { - success: function() { + success: function () { this.fireEvent('watchdiredit', this, options); }, scope: this, @@ -429,7 +424,7 @@ Deluge.ux.AutoAdd.AddAutoAddCommandWindow = Ext.extend( { title: _('Add Watch Folder'), - initComponent: function() { + initComponent: function () { Deluge.ux.AutoAdd.AddAutoAddCommandWindow.superclass.initComponent.call( this ); @@ -439,21 +434,21 @@ Deluge.ux.AutoAdd.AddAutoAddCommandWindow = Ext.extend( }); }, - show: function() { + show: function () { Deluge.ux.AutoAdd.AddAutoAddCommandWindow.superclass.show.call( this ); this.loadOptions(); }, - onAddClick: function() { + onAddClick: function () { var options = this.getOptions(); deluge.client.autoadd.add(options, { - success: function() { + success: function () { this.fireEvent('watchdiradd', this, options); this.hide(); }, - failure: function(err) { + failure: function (err) { const regex = /: (.*\n)\n?\]/m; var error; if ((error = regex.exec(err.error.message)) !== null) { diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options.ui b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options.ui index a4cd364..f1870f1 100644 --- a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options.ui +++ b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options.ui @@ -150,8 +150,6 @@ <property name="tooltip_text" translatable="yes">If a .torrent file is added to this directory, it will be added to the session.</property> <property name="invisible_char">●</property> - <property name="primary_icon_activatable">False</property> - <property name="secondary_icon_activatable">False</property> </object> <packing> <property name="expand">True</property> @@ -284,8 +282,6 @@ and it will remain in the same directory.</property> <property name="can_focus">True</property> <property name="invisible_char">•</property> <property name="text" translatable="yes">.added</property> - <property name="primary_icon_activatable">False</property> - <property name="secondary_icon_activatable">False</property> </object> <packing> <property name="expand">True</property> @@ -329,8 +325,6 @@ and deleted from the watch folder.</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">•</property> - <property name="primary_icon_activatable">False</property> - <property name="secondary_icon_activatable">False</property> </object> <packing> <property name="expand">True</property> @@ -445,8 +439,6 @@ also delete the .torrent file used to add it.</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">●</property> - <property name="primary_icon_activatable">False</property> - <property name="secondary_icon_activatable">False</property> </object> <packing> <property name="expand">True</property> @@ -534,8 +526,6 @@ also delete the .torrent file used to add it.</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">●</property> - <property name="primary_icon_activatable">False</property> - <property name="secondary_icon_activatable">False</property> </object> <packing> <property name="expand">True</property> @@ -799,8 +789,6 @@ also delete the .torrent file used to add it.</property> <object class="GtkSpinButton" id="max_download_speed"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="primary_icon_activatable">False</property> - <property name="secondary_icon_activatable">False</property> <property name="adjustment">adjustment1</property> <property name="climb_rate">1</property> <property name="digits">1</property> @@ -815,8 +803,6 @@ also delete the .torrent file used to add it.</property> <object class="GtkSpinButton" id="max_upload_speed"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="primary_icon_activatable">False</property> - <property name="secondary_icon_activatable">False</property> <property name="adjustment">adjustment2</property> <property name="climb_rate">1</property> <property name="digits">1</property> @@ -833,8 +819,6 @@ also delete the .torrent file used to add it.</property> <object class="GtkSpinButton" id="max_connections"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="primary_icon_activatable">False</property> - <property name="secondary_icon_activatable">False</property> <property name="adjustment">adjustment3</property> <property name="climb_rate">1</property> </object> @@ -850,8 +834,6 @@ also delete the .torrent file used to add it.</property> <object class="GtkSpinButton" id="max_upload_slots"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="primary_icon_activatable">False</property> - <property name="secondary_icon_activatable">False</property> <property name="adjustment">adjustment4</property> <property name="climb_rate">1</property> </object> @@ -1063,8 +1045,6 @@ also delete the .torrent file used to add it.</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">●</property> - <property name="primary_icon_activatable">False</property> - <property name="secondary_icon_activatable">False</property> <property name="adjustment">adjustment5</property> <property name="climb_rate">1</property> <property name="digits">1</property> diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/main_tab.js b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/main_tab.js index 79d2600..f685ff2 100644 --- a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/main_tab.js +++ b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/main_tab.js @@ -19,7 +19,7 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, { id: 'main_tab_panel', title: _('Main'), - initComponent: function() { + initComponent: function () { Deluge.ux.AutoAdd.AutoAddMainPanel.superclass.initComponent.call(this); this.watchFolderFset = new Ext.form.FieldSet({ xtype: 'fieldset', @@ -69,7 +69,7 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, { checked: true, hideLabel: true, listeners: { - check: function(cb, newValue) { + check: function (cb, newValue) { if (newValue) { Ext.getCmp( 'append_extension' @@ -98,7 +98,7 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, { ), hideLabel: true, listeners: { - check: function(cb, newValue) { + check: function (cb, newValue) { if (newValue) { Ext.getCmp( 'append_extension' @@ -141,7 +141,7 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, { ), hideLabel: true, listeners: { - check: function(cb, newValue) { + check: function (cb, newValue) { if (newValue) { Ext.getCmp( 'append_extension' @@ -201,7 +201,7 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, { xtype: 'checkbox', boxLabel: _('Set download folder'), listeners: { - check: function(cb, checked) { + check: function (cb, checked) { Ext.getCmp('download_location').setDisabled( !checked ); @@ -233,7 +233,7 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, { xtype: 'checkbox', boxLabel: _('Set move completed folder'), listeners: { - check: function(cb, checked) { + check: function (cb, checked) { Ext.getCmp('move_completed_path').setDisabled( !checked ); @@ -271,7 +271,7 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, { xtype: 'checkbox', boxLabel: _('Label:'), listeners: { - check: function(cb, checked) { + check: function (cb, checked) { Ext.getCmp('label').setDisabled(!checked); }, }, diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/options_tab.js b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/options_tab.js index a69490c..4ce030e 100644 --- a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/options_tab.js +++ b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/options_tab.js @@ -19,7 +19,7 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, { id: 'options_tab_panel', title: _('Options'), - initComponent: function() { + initComponent: function () { Deluge.ux.AutoAdd.AutoAddOptionsPanel.superclass.initComponent.call( this ); @@ -149,7 +149,7 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, { hideLabel: true, width: 175, listeners: { - check: function(cb, checked) { + check: function (cb, checked) { Ext.getCmp('stop_ratio').setDisabled( !checked ); @@ -223,7 +223,7 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, { this.add([this.ownerFset, this.bandwidthFset, this.queueFset]); }, - _getBandwidthContainer: function(values) { + _getBandwidthContainer: function (values) { return new Ext.Container({ xtype: 'container', layout: 'hbox', @@ -236,7 +236,7 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, { boxLabel: _(values.labelCheckbox), width: 175, listeners: { - check: function(cb, checked) { + check: function (cb, checked) { Ext.getCmp(values.idSpinner).setDisabled(!checked); }, }, @@ -257,7 +257,7 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, { }); }, - _getQueueContainer: function(values) { + _getQueueContainer: function (values) { return new Ext.Container({ xtype: 'container', layout: 'hbox', @@ -270,7 +270,7 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, { boxLabel: _(values.labelCheckbox), width: 175, listeners: { - check: function(cb, checked) { + check: function (cb, checked) { Ext.getCmp(values.nameRadio).setDisabled(!checked); Ext.getCmp('not_' + values.nameRadio).setDisabled( !checked |