summaryrefslogtreecommitdiffstats
path: root/deluge/ui/web/js/deluge-all/preferences
diff options
context:
space:
mode:
Diffstat (limited to 'deluge/ui/web/js/deluge-all/preferences')
-rw-r--r--deluge/ui/web/js/deluge-all/preferences/BandwidthPage.js202
-rw-r--r--deluge/ui/web/js/deluge-all/preferences/CachePage.js61
-rw-r--r--deluge/ui/web/js/deluge-all/preferences/DaemonPage.js85
-rw-r--r--deluge/ui/web/js/deluge-all/preferences/DownloadsPage.js124
-rw-r--r--deluge/ui/web/js/deluge-all/preferences/EncryptionPage.js99
-rw-r--r--deluge/ui/web/js/deluge-all/preferences/InstallPluginWindow.js83
-rw-r--r--deluge/ui/web/js/deluge-all/preferences/InterfacePage.js358
-rw-r--r--deluge/ui/web/js/deluge-all/preferences/NetworkPage.js257
-rw-r--r--deluge/ui/web/js/deluge-all/preferences/OtherPage.js100
-rw-r--r--deluge/ui/web/js/deluge-all/preferences/PluginsPage.js277
-rw-r--r--deluge/ui/web/js/deluge-all/preferences/PreferencesWindow.js245
-rw-r--r--deluge/ui/web/js/deluge-all/preferences/ProxyField.js225
-rw-r--r--deluge/ui/web/js/deluge-all/preferences/ProxyPage.js62
-rw-r--r--deluge/ui/web/js/deluge-all/preferences/QueuePage.js234
14 files changed, 2412 insertions, 0 deletions
diff --git a/deluge/ui/web/js/deluge-all/preferences/BandwidthPage.js b/deluge/ui/web/js/deluge-all/preferences/BandwidthPage.js
new file mode 100644
index 0000000..563dedd
--- /dev/null
+++ b/deluge/ui/web/js/deluge-all/preferences/BandwidthPage.js
@@ -0,0 +1,202 @@
+/**
+ * Deluge.preferences.BandwidthPage.js
+ *
+ * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
+ *
+ * This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
+ * the additional special exception to link portions of this program with the OpenSSL library.
+ * See LICENSE for more details.
+ */
+Ext.namespace('Deluge.preferences');
+
+/**
+ * @class Deluge.preferences.Bandwidth
+ * @extends Ext.form.FormPanel
+ */
+Deluge.preferences.Bandwidth = Ext.extend(Ext.form.FormPanel, {
+ constructor: function (config) {
+ config = Ext.apply(
+ {
+ border: false,
+ title: _('Bandwidth'),
+ header: false,
+ layout: 'form',
+ labelWidth: 10,
+ },
+ config
+ );
+ Deluge.preferences.Bandwidth.superclass.constructor.call(this, config);
+ },
+
+ initComponent: function () {
+ Deluge.preferences.Bandwidth.superclass.initComponent.call(this);
+
+ var om = deluge.preferences.getOptionsManager();
+ var fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('Global Bandwidth Usage'),
+ labelWidth: 200,
+ defaultType: 'spinnerfield',
+ defaults: {
+ minValue: -1,
+ maxValue: 9999999,
+ },
+ style: 'margin-bottom: 0px; padding-bottom: 0px;',
+ autoHeight: true,
+ });
+ om.bind(
+ 'max_connections_global',
+ fieldset.add({
+ name: 'max_connections_global',
+ fieldLabel: _('Maximum Connections:'),
+ labelSeparator: '',
+ width: 80,
+ value: -1,
+ decimalPrecision: 0,
+ })
+ );
+ om.bind(
+ 'max_upload_slots_global',
+ fieldset.add({
+ name: 'max_upload_slots_global',
+ fieldLabel: _('Maximum Upload Slots'),
+ labelSeparator: '',
+ width: 80,
+ value: -1,
+ decimalPrecision: 0,
+ })
+ );
+ om.bind(
+ 'max_download_speed',
+ fieldset.add({
+ name: 'max_download_speed',
+ fieldLabel: _('Maximum Download Speed (KiB/s):'),
+ labelSeparator: '',
+ width: 80,
+ value: -1.0,
+ decimalPrecision: 1,
+ })
+ );
+ om.bind(
+ 'max_upload_speed',
+ fieldset.add({
+ name: 'max_upload_speed',
+ fieldLabel: _('Maximum Upload Speed (KiB/s):'),
+ labelSeparator: '',
+ width: 80,
+ value: -1.0,
+ decimalPrecision: 1,
+ })
+ );
+ om.bind(
+ 'max_half_open_connections',
+ fieldset.add({
+ name: 'max_half_open_connections',
+ fieldLabel: _('Maximum Half-Open Connections:'),
+ labelSeparator: '',
+ width: 80,
+ value: -1,
+ decimalPrecision: 0,
+ })
+ );
+ om.bind(
+ 'max_connections_per_second',
+ fieldset.add({
+ name: 'max_connections_per_second',
+ fieldLabel: _('Maximum Connection Attempts per Second:'),
+ labelSeparator: '',
+ width: 80,
+ value: -1,
+ decimalPrecision: 0,
+ })
+ );
+
+ fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: '',
+ defaultType: 'checkbox',
+ style: 'padding-top: 0px; padding-bottom: 5px; margin-top: 0px; margin-bottom: 0px;',
+ autoHeight: true,
+ });
+ om.bind(
+ 'ignore_limits_on_local_network',
+ fieldset.add({
+ name: 'ignore_limits_on_local_network',
+ height: 22,
+ fieldLabel: '',
+ labelSeparator: '',
+ boxLabel: _('Ignore limits on local network'),
+ })
+ );
+ om.bind(
+ 'rate_limit_ip_overhead',
+ fieldset.add({
+ name: 'rate_limit_ip_overhead',
+ height: 22,
+ fieldLabel: '',
+ labelSeparator: '',
+ boxLabel: _('Rate limit IP overhead'),
+ })
+ );
+
+ fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('Per Torrent Bandwidth Usage'),
+ style: 'margin-bottom: 0px; padding-bottom: 0px;',
+ defaultType: 'spinnerfield',
+ labelWidth: 200,
+ defaults: {
+ minValue: -1,
+ maxValue: 99999,
+ },
+ autoHeight: true,
+ });
+ om.bind(
+ 'max_connections_per_torrent',
+ fieldset.add({
+ name: 'max_connections_per_torrent',
+ fieldLabel: _('Maximum Connections:'),
+ labelSeparator: '',
+ width: 80,
+ value: -1,
+ decimalPrecision: 0,
+ })
+ );
+ om.bind(
+ 'max_upload_slots_per_torrent',
+ fieldset.add({
+ name: 'max_upload_slots_per_torrent',
+ fieldLabel: _('Maximum Upload Slots:'),
+ labelSeparator: '',
+ width: 80,
+ value: -1,
+ decimalPrecision: 0,
+ })
+ );
+ om.bind(
+ 'max_download_speed_per_torrent',
+ fieldset.add({
+ name: 'max_download_speed_per_torrent',
+ fieldLabel: _('Maximum Download Speed (KiB/s):'),
+ labelSeparator: '',
+ width: 80,
+ value: -1,
+ decimalPrecision: 0,
+ })
+ );
+ om.bind(
+ 'max_upload_speed_per_torrent',
+ fieldset.add({
+ name: 'max_upload_speed_per_torrent',
+ fieldLabel: _('Maximum Upload Speed (KiB/s):'),
+ labelSeparator: '',
+ width: 80,
+ value: -1,
+ decimalPrecision: 0,
+ })
+ );
+ },
+});
diff --git a/deluge/ui/web/js/deluge-all/preferences/CachePage.js b/deluge/ui/web/js/deluge-all/preferences/CachePage.js
new file mode 100644
index 0000000..bd5acd8
--- /dev/null
+++ b/deluge/ui/web/js/deluge-all/preferences/CachePage.js
@@ -0,0 +1,61 @@
+/**
+ * Deluge.preferences.CachePage.js
+ *
+ * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
+ *
+ * This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
+ * the additional special exception to link portions of this program with the OpenSSL library.
+ * See LICENSE for more details.
+ */
+Ext.namespace('Deluge.preferences');
+
+/**
+ * @class Deluge.preferences.Cache
+ * @extends Ext.form.FormPanel
+ */
+Deluge.preferences.Cache = Ext.extend(Ext.form.FormPanel, {
+ border: false,
+ title: _('Cache'),
+ header: false,
+ layout: 'form',
+
+ initComponent: function () {
+ Deluge.preferences.Cache.superclass.initComponent.call(this);
+
+ var om = deluge.preferences.getOptionsManager();
+
+ var fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('Settings'),
+ autoHeight: true,
+ labelWidth: 180,
+ defaultType: 'spinnerfield',
+ defaults: {
+ decimalPrecision: 0,
+ minValue: -1,
+ maxValue: 999999,
+ },
+ });
+ om.bind(
+ 'cache_size',
+ fieldset.add({
+ fieldLabel: _('Cache Size (16 KiB Blocks):'),
+ labelSeparator: '',
+ name: 'cache_size',
+ width: 60,
+ value: 512,
+ })
+ );
+ om.bind(
+ 'cache_expiry',
+ fieldset.add({
+ fieldLabel: _('Cache Expiry (seconds):'),
+ labelSeparator: '',
+ name: 'cache_expiry',
+ width: 60,
+ value: 60,
+ })
+ );
+ },
+});
diff --git a/deluge/ui/web/js/deluge-all/preferences/DaemonPage.js b/deluge/ui/web/js/deluge-all/preferences/DaemonPage.js
new file mode 100644
index 0000000..da205c2
--- /dev/null
+++ b/deluge/ui/web/js/deluge-all/preferences/DaemonPage.js
@@ -0,0 +1,85 @@
+/**
+ * Deluge.preferences.DaemonPage.js
+ *
+ * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
+ *
+ * This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
+ * the additional special exception to link portions of this program with the OpenSSL library.
+ * See LICENSE for more details.
+ */
+Ext.namespace('Deluge.preferences');
+
+/**
+ * @class Deluge.preferences.Daemon
+ * @extends Ext.form.FormPanel
+ */
+Deluge.preferences.Daemon = Ext.extend(Ext.form.FormPanel, {
+ border: false,
+ title: _('Daemon'),
+ header: false,
+ layout: 'form',
+
+ initComponent: function () {
+ Deluge.preferences.Daemon.superclass.initComponent.call(this);
+
+ var om = deluge.preferences.getOptionsManager();
+
+ var fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('Port'),
+ autoHeight: true,
+ defaultType: 'spinnerfield',
+ });
+ om.bind(
+ 'daemon_port',
+ fieldset.add({
+ fieldLabel: _('Daemon port:'),
+ labelSeparator: '',
+ name: 'daemon_port',
+ value: 58846,
+ decimalPrecision: 0,
+ minValue: -1,
+ maxValue: 65535,
+ })
+ );
+
+ fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('Connections'),
+ autoHeight: true,
+ labelWidth: 1,
+ defaultType: 'checkbox',
+ });
+ om.bind(
+ 'allow_remote',
+ fieldset.add({
+ fieldLabel: '',
+ height: 22,
+ labelSeparator: '',
+ boxLabel: _('Allow Remote Connections'),
+ name: 'allow_remote',
+ })
+ );
+
+ fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('Other'),
+ autoHeight: true,
+ labelWidth: 1,
+ defaultType: 'checkbox',
+ });
+ om.bind(
+ 'new_release_check',
+ fieldset.add({
+ fieldLabel: '',
+ labelSeparator: '',
+ height: 40,
+ boxLabel: _('Periodically check the website for new releases'),
+ id: 'new_release_check',
+ })
+ );
+ },
+});
diff --git a/deluge/ui/web/js/deluge-all/preferences/DownloadsPage.js b/deluge/ui/web/js/deluge-all/preferences/DownloadsPage.js
new file mode 100644
index 0000000..04ffd15
--- /dev/null
+++ b/deluge/ui/web/js/deluge-all/preferences/DownloadsPage.js
@@ -0,0 +1,124 @@
+/**
+ * Deluge.preferences.DownloadsPage.js
+ *
+ * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
+ *
+ * This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
+ * the additional special exception to link portions of this program with the OpenSSL library.
+ * See LICENSE for more details.
+ */
+Ext.namespace('Deluge.preferences');
+
+/**
+ * @class Deluge.preferences.Downloads
+ * @extends Ext.form.FormPanel
+ */
+Deluge.preferences.Downloads = Ext.extend(Ext.FormPanel, {
+ constructor: function (config) {
+ config = Ext.apply(
+ {
+ border: false,
+ title: _('Downloads'),
+ header: false,
+ layout: 'form',
+ autoHeight: true,
+ width: 320,
+ },
+ config
+ );
+ Deluge.preferences.Downloads.superclass.constructor.call(this, config);
+ },
+
+ initComponent: function () {
+ Deluge.preferences.Downloads.superclass.initComponent.call(this);
+
+ var optMan = deluge.preferences.getOptionsManager();
+ var fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('Folders'),
+ labelWidth: 150,
+ defaultType: 'togglefield',
+ autoHeight: true,
+ labelAlign: 'top',
+ width: 300,
+ style: 'margin-bottom: 5px; padding-bottom: 5px;',
+ });
+
+ optMan.bind(
+ 'download_location',
+ fieldset.add({
+ xtype: 'textfield',
+ name: 'download_location',
+ fieldLabel: _('Download to:'),
+ labelSeparator: '',
+ width: 280,
+ })
+ );
+
+ var field = fieldset.add({
+ name: 'move_completed_path',
+ fieldLabel: _('Move completed to:'),
+ labelSeparator: '',
+ width: 280,
+ });
+ optMan.bind('move_completed', field.toggle);
+ optMan.bind('move_completed_path', field.input);
+
+ field = fieldset.add({
+ name: 'torrentfiles_location',
+ fieldLabel: _('Copy of .torrent files to:'),
+ labelSeparator: '',
+ width: 280,
+ });
+ optMan.bind('copy_torrent_file', field.toggle);
+ optMan.bind('torrentfiles_location', field.input);
+
+ fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('Options'),
+ autoHeight: true,
+ labelWidth: 1,
+ defaultType: 'checkbox',
+ style: 'margin-bottom: 0; padding-bottom: 0;',
+ width: 280,
+ });
+ optMan.bind(
+ 'prioritize_first_last_pieces',
+ fieldset.add({
+ name: 'prioritize_first_last_pieces',
+ labelSeparator: '',
+ height: 22,
+ boxLabel: _('Prioritize first and last pieces of torrent'),
+ })
+ );
+ optMan.bind(
+ 'sequential_download',
+ fieldset.add({
+ name: 'sequential_download',
+ labelSeparator: '',
+ height: 22,
+ boxLabel: _('Sequential download'),
+ })
+ );
+ optMan.bind(
+ 'add_paused',
+ fieldset.add({
+ name: 'add_paused',
+ labelSeparator: '',
+ height: 22,
+ boxLabel: _('Add torrents in Paused state'),
+ })
+ );
+ optMan.bind(
+ 'pre_allocate_storage',
+ fieldset.add({
+ name: 'pre_allocate_storage',
+ labelSeparator: '',
+ height: 22,
+ boxLabel: _('Pre-allocate disk space'),
+ })
+ );
+ },
+});
diff --git a/deluge/ui/web/js/deluge-all/preferences/EncryptionPage.js b/deluge/ui/web/js/deluge-all/preferences/EncryptionPage.js
new file mode 100644
index 0000000..1bcf95e
--- /dev/null
+++ b/deluge/ui/web/js/deluge-all/preferences/EncryptionPage.js
@@ -0,0 +1,99 @@
+/**
+ * Deluge.preferences.EncryptionPage.js
+ *
+ * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
+ *
+ * This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
+ * the additional special exception to link portions of this program with the OpenSSL library.
+ * See LICENSE for more details.
+ */
+Ext.namespace('Deluge.preferences');
+
+/**
+ * @class Deluge.preferences.Encryption
+ * @extends Ext.form.FormPanel
+ */
+Deluge.preferences.Encryption = Ext.extend(Ext.form.FormPanel, {
+ border: false,
+ title: _('Encryption'),
+ header: false,
+
+ initComponent: function () {
+ Deluge.preferences.Encryption.superclass.initComponent.call(this);
+
+ var optMan = deluge.preferences.getOptionsManager();
+
+ var fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('Settings'),
+ header: false,
+ autoHeight: true,
+ defaultType: 'combo',
+ width: 300,
+ });
+ optMan.bind(
+ 'enc_in_policy',
+ fieldset.add({
+ fieldLabel: _('Incoming:'),
+ labelSeparator: '',
+ mode: 'local',
+ width: 150,
+ store: new Ext.data.ArrayStore({
+ fields: ['id', 'text'],
+ data: [
+ [0, _('Forced')],
+ [1, _('Enabled')],
+ [2, _('Disabled')],
+ ],
+ }),
+ editable: false,
+ triggerAction: 'all',
+ valueField: 'id',
+ displayField: 'text',
+ })
+ );
+ optMan.bind(
+ 'enc_out_policy',
+ fieldset.add({
+ fieldLabel: _('Outgoing:'),
+ labelSeparator: '',
+ mode: 'local',
+ width: 150,
+ store: new Ext.data.SimpleStore({
+ fields: ['id', 'text'],
+ data: [
+ [0, _('Forced')],
+ [1, _('Enabled')],
+ [2, _('Disabled')],
+ ],
+ }),
+ editable: false,
+ triggerAction: 'all',
+ valueField: 'id',
+ displayField: 'text',
+ })
+ );
+ optMan.bind(
+ 'enc_level',
+ fieldset.add({
+ fieldLabel: _('Level:'),
+ labelSeparator: '',
+ mode: 'local',
+ width: 150,
+ store: new Ext.data.SimpleStore({
+ fields: ['id', 'text'],
+ data: [
+ [0, _('Handshake')],
+ [1, _('Full Stream')],
+ [2, _('Either')],
+ ],
+ }),
+ editable: false,
+ triggerAction: 'all',
+ valueField: 'id',
+ displayField: 'text',
+ })
+ );
+ },
+});
diff --git a/deluge/ui/web/js/deluge-all/preferences/InstallPluginWindow.js b/deluge/ui/web/js/deluge-all/preferences/InstallPluginWindow.js
new file mode 100644
index 0000000..9aefce3
--- /dev/null
+++ b/deluge/ui/web/js/deluge-all/preferences/InstallPluginWindow.js
@@ -0,0 +1,83 @@
+/**
+ * Deluge.preferences.InstallPluginWindow.js
+ *
+ * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
+ *
+ * This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
+ * the additional special exception to link portions of this program with the OpenSSL library.
+ * See LICENSE for more details.
+ */
+Ext.namespace('Deluge.preferences');
+
+/**
+ * @class Deluge.preferences.InstallPluginWindow
+ * @extends Ext.Window
+ */
+Deluge.preferences.InstallPluginWindow = Ext.extend(Ext.Window, {
+ title: _('Install Plugin'),
+ layout: 'fit',
+ height: 115,
+ width: 350,
+ constrainHeader: true,
+ bodyStyle: 'padding: 10px 5px;',
+ buttonAlign: 'center',
+ closeAction: 'hide',
+ iconCls: 'x-deluge-install-plugin',
+ modal: true,
+ plain: true,
+
+ initComponent: function () {
+ Deluge.preferences.InstallPluginWindow.superclass.initComponent.call(
+ this
+ );
+ this.addButton(_('Install'), this.onInstall, this);
+
+ this.form = this.add({
+ xtype: 'form',
+ baseCls: 'x-plain',
+ labelWidth: 70,
+ autoHeight: true,
+ fileUpload: true,
+ items: [
+ {
+ xtype: 'fileuploadfield',
+ width: 240,
+ emptyText: _('Select an egg'),
+ fieldLabel: _('Plugin Egg'),
+ name: 'file',
+ buttonCfg: {
+ text: _('Browse...'),
+ },
+ },
+ ],
+ });
+ },
+
+ onInstall: function (field, e) {
+ this.form.getForm().submit({
+ url: deluge.config.base + 'upload',
+ waitMsg: _('Uploading your plugin...'),
+ success: this.onUploadSuccess,
+ scope: this,
+ });
+ },
+
+ onUploadPlugin: function (info, obj, response, request) {
+ this.fireEvent('pluginadded');
+ },
+
+ onUploadSuccess: function (fp, upload) {
+ this.hide();
+ if (upload.result.success) {
+ var filename = this.form.getForm().getFieldValues().file;
+ filename = filename.split('\\').slice(-1)[0];
+ var path = upload.result.files[0];
+ this.form.getForm().setValues({ file: '' });
+ deluge.client.web.upload_plugin(filename, path, {
+ success: this.onUploadPlugin,
+ scope: this,
+ filename: filename,
+ });
+ }
+ },
+});
diff --git a/deluge/ui/web/js/deluge-all/preferences/InterfacePage.js b/deluge/ui/web/js/deluge-all/preferences/InterfacePage.js
new file mode 100644
index 0000000..a5a7909
--- /dev/null
+++ b/deluge/ui/web/js/deluge-all/preferences/InterfacePage.js
@@ -0,0 +1,358 @@
+/**
+ * Deluge.preferences.InterfacePage.js
+ *
+ * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
+ *
+ * This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
+ * the additional special exception to link portions of this program with the OpenSSL library.
+ * See LICENSE for more details.
+ */
+Ext.namespace('Deluge.preferences');
+
+/**
+ * @class Deluge.preferences.Interface
+ * @extends Ext.form.FormPanel
+ */
+Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
+ border: false,
+ title: _('Interface'),
+ header: false,
+ layout: 'form',
+
+ initComponent: function () {
+ Deluge.preferences.Interface.superclass.initComponent.call(this);
+
+ var om = (this.optionsManager = new Deluge.OptionsManager());
+ this.on('show', this.onPageShow, this);
+
+ var fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('Interface'),
+ style: 'margin-bottom: 0px; padding-bottom: 5px; padding-top: 5px',
+ autoHeight: true,
+ labelWidth: 1,
+ defaultType: 'checkbox',
+ defaults: {
+ height: 17,
+ fieldLabel: '',
+ labelSeparator: '',
+ },
+ });
+ om.bind(
+ 'show_session_speed',
+ fieldset.add({
+ name: 'show_session_speed',
+ boxLabel: _('Show session speed in titlebar'),
+ })
+ );
+ om.bind(
+ 'sidebar_show_zero',
+ fieldset.add({
+ name: 'sidebar_show_zero',
+ boxLabel: _('Show filters with zero torrents'),
+ })
+ );
+ om.bind(
+ 'sidebar_multiple_filters',
+ fieldset.add({
+ name: 'sidebar_multiple_filters',
+ boxLabel: _('Allow the use of multiple filters at once'),
+ })
+ );
+
+ var languagePanel = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('Language'),
+ style: 'margin-bottom: 0px; padding-bottom: 5px; padding-top: 5px',
+ autoHeight: true,
+ labelWidth: 1,
+ defaultType: 'checkbox',
+ });
+ this.language = om.bind(
+ 'language',
+ languagePanel.add({
+ xtype: 'combo',
+ labelSeparator: '',
+ name: 'language',
+ mode: 'local',
+ width: 200,
+ store: new Ext.data.ArrayStore({
+ fields: ['id', 'text'],
+ }),
+ editable: false,
+ triggerAction: 'all',
+ valueField: 'id',
+ displayField: 'text',
+ })
+ );
+
+ var themePanel = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('Theme'),
+ style: 'margin-bottom: 0px; padding-bottom: 5px; padding-top: 5px',
+ autoHeight: true,
+ labelWidth: 1,
+ defaultType: 'checkbox',
+ });
+ this.theme = om.bind(
+ 'theme',
+ themePanel.add({
+ xtype: 'combo',
+ name: 'theme',
+ labelSeparator: '',
+ mode: 'local',
+ width: 200,
+ store: new Ext.data.ArrayStore({
+ fields: ['id', 'text'],
+ }),
+ editable: false,
+ triggerAction: 'all',
+ valueField: 'id',
+ displayField: 'text',
+ })
+ );
+
+ fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('WebUI Password'),
+ style: 'margin-bottom: 0px; padding-bottom: 5px; padding-top: 5px',
+ autoHeight: true,
+ labelWidth: 100,
+ defaultType: 'textfield',
+ defaults: {
+ width: 100,
+ inputType: 'password',
+ labelStyle: 'padding-left: 5px',
+ height: 20,
+ labelSeparator: '',
+ },
+ });
+
+ this.oldPassword = fieldset.add({
+ name: 'old_password',
+ fieldLabel: _('Old:'),
+ });
+ this.newPassword = fieldset.add({
+ name: 'new_password',
+ fieldLabel: _('New:'),
+ });
+ this.confirmPassword = fieldset.add({
+ name: 'confirm_password',
+ fieldLabel: _('Confirm:'),
+ });
+
+ fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('Server'),
+ style: 'padding-top: 5px; margin-bottom: 0px; padding-bottom: 5px',
+ autoHeight: true,
+ labelWidth: 100,
+ defaultType: 'spinnerfield',
+ defaults: {
+ labelSeparator: '',
+ labelStyle: 'padding-left: 5px',
+ height: 20,
+ width: 80,
+ },
+ });
+ om.bind(
+ 'session_timeout',
+ fieldset.add({
+ name: 'session_timeout',
+ fieldLabel: _('Session Timeout:'),
+ decimalPrecision: 0,
+ minValue: -1,
+ maxValue: Number.MAX_SAFE_INTEGER || Number.MAX_VALUE,
+ })
+ );
+ om.bind(
+ 'port',
+ fieldset.add({
+ name: 'port',
+ fieldLabel: _('Port:'),
+ decimalPrecision: 0,
+ minValue: 1,
+ maxValue: 65535,
+ })
+ );
+ this.httpsField = om.bind(
+ 'https',
+ fieldset.add({
+ xtype: 'checkbox',
+ name: 'https',
+ hideLabel: true,
+ width: 300,
+ style: 'margin-left: 5px',
+ boxLabel: _(
+ 'Enable SSL (paths relative to Deluge config folder)'
+ ),
+ })
+ );
+ this.httpsField.on('check', this.onSSLCheck, this);
+ this.pkeyField = om.bind(
+ 'pkey',
+ fieldset.add({
+ xtype: 'textfield',
+ disabled: true,
+ name: 'pkey',
+ width: 180,
+ fieldLabel: _('Private Key:'),
+ })
+ );
+ this.certField = om.bind(
+ 'cert',
+ fieldset.add({
+ xtype: 'textfield',
+ disabled: true,
+ name: 'cert',
+ width: 180,
+ fieldLabel: _('Certificate:'),
+ })
+ );
+ },
+
+ onApply: function () {
+ var changed = this.optionsManager.getDirty();
+ if (!Ext.isObjectEmpty(changed)) {
+ deluge.client.web.set_config(changed, {
+ success: this.onSetConfig,
+ scope: this,
+ });
+
+ for (var key in deluge.config) {
+ deluge.config[key] = this.optionsManager.get(key);
+ }
+ if ('language' in changed) {
+ Ext.Msg.show({
+ title: _('WebUI Language Changed'),
+ msg: _(
+ 'Do you want to refresh the page now to use the new language?'
+ ),
+ buttons: {
+ yes: _('Refresh'),
+ no: _('Close'),
+ },
+ multiline: false,
+ fn: function (btnText) {
+ if (btnText === 'yes') location.reload();
+ },
+ icon: Ext.MessageBox.QUESTION,
+ });
+ }
+ if ('theme' in changed) {
+ deluge.client.web.set_theme(changed['theme']);
+ Ext.Msg.show({
+ title: _('WebUI Theme Changed'),
+ msg: _(
+ 'Do you want to refresh the page now to use the new theme?'
+ ),
+ buttons: {
+ yes: _('Refresh'),
+ no: _('Close'),
+ },
+ multiline: false,
+ fn: function (btnText) {
+ if (btnText === 'yes') location.reload();
+ },
+ icon: Ext.MessageBox.QUESTION,
+ });
+ }
+ }
+ if (this.oldPassword.getValue() || this.newPassword.getValue()) {
+ this.onPasswordChange();
+ }
+ },
+
+ onOk: function () {
+ this.onApply();
+ },
+
+ onGotConfig: function (config) {
+ this.optionsManager.set(config);
+ },
+
+ onGotLanguages: function (info, obj, response, request) {
+ info.unshift(['', _('System Default')]);
+ this.language.store.loadData(info);
+ this.language.setValue(this.optionsManager.get('language'));
+ },
+
+ onGotThemes: function (info, obj, response, request) {
+ this.theme.store.loadData(info);
+ this.theme.setValue(this.optionsManager.get('theme'));
+ },
+
+ onPasswordChange: function () {
+ var newPassword = this.newPassword.getValue();
+ if (newPassword != this.confirmPassword.getValue()) {
+ Ext.MessageBox.show({
+ title: _('Invalid Password'),
+ msg: _("Your passwords don't match!"),
+ buttons: Ext.MessageBox.OK,
+ modal: false,
+ icon: Ext.MessageBox.ERROR,
+ iconCls: 'x-deluge-icon-error',
+ });
+ return;
+ }
+
+ var oldPassword = this.oldPassword.getValue();
+ deluge.client.auth.change_password(oldPassword, newPassword, {
+ success: function (result) {
+ if (!result) {
+ Ext.MessageBox.show({
+ title: _('Password'),
+ msg: _('Your old password was incorrect!'),
+ buttons: Ext.MessageBox.OK,
+ modal: false,
+ icon: Ext.MessageBox.ERROR,
+ iconCls: 'x-deluge-icon-error',
+ });
+ this.oldPassword.setValue('');
+ } else {
+ Ext.MessageBox.show({
+ title: _('Change Successful'),
+ msg: _('Your password was successfully changed!'),
+ buttons: Ext.MessageBox.OK,
+ modal: false,
+ icon: Ext.MessageBox.INFO,
+ iconCls: 'x-deluge-icon-info',
+ });
+ this.oldPassword.setValue('');
+ this.newPassword.setValue('');
+ this.confirmPassword.setValue('');
+ }
+ },
+ scope: this,
+ });
+ },
+
+ onSetConfig: function () {
+ this.optionsManager.commit();
+ },
+
+ onPageShow: function () {
+ deluge.client.web.get_config({
+ success: this.onGotConfig,
+ scope: this,
+ });
+ deluge.client.webutils.get_languages({
+ success: this.onGotLanguages,
+ scope: this,
+ });
+ deluge.client.webutils.get_themes({
+ success: this.onGotThemes,
+ scope: this,
+ });
+ },
+
+ onSSLCheck: function (e, checked) {
+ this.pkeyField.setDisabled(!checked);
+ this.certField.setDisabled(!checked);
+ },
+});
diff --git a/deluge/ui/web/js/deluge-all/preferences/NetworkPage.js b/deluge/ui/web/js/deluge-all/preferences/NetworkPage.js
new file mode 100644
index 0000000..5ba98e7
--- /dev/null
+++ b/deluge/ui/web/js/deluge-all/preferences/NetworkPage.js
@@ -0,0 +1,257 @@
+/**
+ * Deluge.preferences.NetworkPage.js
+ *
+ * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
+ *
+ * This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
+ * the additional special exception to link portions of this program with the OpenSSL library.
+ * See LICENSE for more details.
+ */
+Ext.namespace('Deluge.preferences');
+
+// custom Vtype for vtype:'IPAddress'
+Ext.apply(Ext.form.VTypes, {
+ IPAddress: function (v) {
+ return /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(v);
+ },
+ IPAddressText: 'Must be a numeric IP address',
+ IPAddressMask: /[\d\.]/i,
+});
+
+/**
+ * @class Deluge.preferences.Network
+ * @extends Ext.form.FormPanel
+ */
+Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
+ border: false,
+ layout: 'form',
+ title: _('Network'),
+ header: false,
+
+ initComponent: function () {
+ Deluge.preferences.Network.superclass.initComponent.call(this);
+ var optMan = deluge.preferences.getOptionsManager();
+
+ fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('Incoming Address'),
+ style: 'margin-bottom: 5px; padding-bottom: 0px;',
+ autoHeight: true,
+ labelWidth: 1,
+ defaultType: 'textfield',
+ });
+ optMan.bind(
+ 'listen_interface',
+ fieldset.add({
+ name: 'listen_interface',
+ fieldLabel: '',
+ labelSeparator: '',
+ width: 200,
+ vtype: 'IPAddress',
+ })
+ );
+
+ var fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('Incoming Port'),
+ style: 'margin-bottom: 5px; padding-bottom: 0px;',
+ autoHeight: true,
+ labelWidth: 1,
+ defaultType: 'checkbox',
+ });
+ optMan.bind(
+ 'random_port',
+ fieldset.add({
+ fieldLabel: '',
+ labelSeparator: '',
+ boxLabel: _('Use Random Port'),
+ name: 'random_port',
+ height: 22,
+ listeners: {
+ check: {
+ fn: function (e, checked) {
+ this.listenPort.setDisabled(checked);
+ },
+ scope: this,
+ },
+ },
+ })
+ );
+
+ this.listenPort = fieldset.add({
+ xtype: 'spinnerfield',
+ name: 'listen_port',
+ fieldLabel: '',
+ labelSeparator: '',
+ width: 75,
+ strategy: {
+ xtype: 'number',
+ decimalPrecision: 0,
+ minValue: 0,
+ maxValue: 65535,
+ },
+ });
+ optMan.bind('listen_ports', this.listenPort);
+
+ fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('Outgoing Interface'),
+ style: 'margin-bottom: 5px; padding-bottom: 0px;',
+ autoHeight: true,
+ labelWidth: 1,
+ defaultType: 'textfield',
+ });
+ optMan.bind(
+ 'outgoing_interface',
+ fieldset.add({
+ name: 'outgoing_interface',
+ fieldLabel: '',
+ labelSeparator: '',
+ width: 40,
+ })
+ );
+
+ fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('Outgoing Ports'),
+ style: 'margin-bottom: 5px; padding-bottom: 0px;',
+ autoHeight: true,
+ labelWidth: 1,
+ defaultType: 'checkbox',
+ });
+ optMan.bind(
+ 'random_outgoing_ports',
+ fieldset.add({
+ fieldLabel: '',
+ labelSeparator: '',
+ boxLabel: _('Use Random Ports'),
+ name: 'random_outgoing_ports',
+ height: 22,
+ listeners: {
+ check: {
+ fn: function (e, checked) {
+ this.outgoingPorts.setDisabled(checked);
+ },
+ scope: this,
+ },
+ },
+ })
+ );
+ this.outgoingPorts = fieldset.add({
+ xtype: 'spinnergroup',
+ name: 'outgoing_ports',
+ fieldLabel: '',
+ labelSeparator: '',
+ colCfg: {
+ labelWidth: 40,
+ style: 'margin-right: 10px;',
+ },
+ items: [
+ {
+ fieldLabel: _('From:'),
+ labelSeparator: '',
+ strategy: {
+ xtype: 'number',
+ decimalPrecision: 0,
+ minValue: 0,
+ maxValue: 65535,
+ },
+ },
+ {
+ fieldLabel: _('To:'),
+ labelSeparator: '',
+ strategy: {
+ xtype: 'number',
+ decimalPrecision: 0,
+ minValue: 0,
+ maxValue: 65535,
+ },
+ },
+ ],
+ });
+ optMan.bind('outgoing_ports', this.outgoingPorts);
+
+ fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('Network Extras'),
+ autoHeight: true,
+ layout: 'table',
+ layoutConfig: {
+ columns: 3,
+ },
+ defaultType: 'checkbox',
+ });
+ optMan.bind(
+ 'upnp',
+ fieldset.add({
+ fieldLabel: '',
+ labelSeparator: '',
+ boxLabel: _('UPnP'),
+ name: 'upnp',
+ })
+ );
+ optMan.bind(
+ 'natpmp',
+ fieldset.add({
+ fieldLabel: '',
+ labelSeparator: '',
+ boxLabel: _('NAT-PMP'),
+ ctCls: 'x-deluge-indent-checkbox',
+ name: 'natpmp',
+ })
+ );
+ optMan.bind(
+ 'utpex',
+ fieldset.add({
+ fieldLabel: '',
+ labelSeparator: '',
+ boxLabel: _('Peer Exchange'),
+ ctCls: 'x-deluge-indent-checkbox',
+ name: 'utpex',
+ })
+ );
+ optMan.bind(
+ 'lsd',
+ fieldset.add({
+ fieldLabel: '',
+ labelSeparator: '',
+ boxLabel: _('LSD'),
+ name: 'lsd',
+ })
+ );
+ optMan.bind(
+ 'dht',
+ fieldset.add({
+ fieldLabel: '',
+ labelSeparator: '',
+ boxLabel: _('DHT'),
+ ctCls: 'x-deluge-indent-checkbox',
+ name: 'dht',
+ })
+ );
+
+ fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('Type Of Service'),
+ style: 'margin-bottom: 5px; padding-bottom: 0px;',
+ bodyStyle: 'margin: 0px; padding: 0px',
+ autoHeight: true,
+ defaultType: 'textfield',
+ });
+ optMan.bind(
+ 'peer_tos',
+ fieldset.add({
+ name: 'peer_tos',
+ fieldLabel: _('Peer TOS Byte:'),
+ labelSeparator: '',
+ width: 40,
+ })
+ );
+ },
+});
diff --git a/deluge/ui/web/js/deluge-all/preferences/OtherPage.js b/deluge/ui/web/js/deluge-all/preferences/OtherPage.js
new file mode 100644
index 0000000..607da22
--- /dev/null
+++ b/deluge/ui/web/js/deluge-all/preferences/OtherPage.js
@@ -0,0 +1,100 @@
+/**
+ * Deluge.preferences.OtherPage.js
+ *
+ * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
+ *
+ * This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
+ * the additional special exception to link portions of this program with the OpenSSL library.
+ * See LICENSE for more details.
+ */
+Ext.namespace('Deluge.preferences');
+
+/**
+ * @class Deluge.preferences.Other
+ * @extends Ext.form.FormPanel
+ */
+Deluge.preferences.Other = Ext.extend(Ext.form.FormPanel, {
+ constructor: function (config) {
+ config = Ext.apply(
+ {
+ border: false,
+ title: _('Other'),
+ header: false,
+ layout: 'form',
+ },
+ config
+ );
+ Deluge.preferences.Other.superclass.constructor.call(this, config);
+ },
+
+ initComponent: function () {
+ Deluge.preferences.Other.superclass.initComponent.call(this);
+
+ var optMan = deluge.preferences.getOptionsManager();
+
+ var fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('Updates'),
+ autoHeight: true,
+ labelWidth: 1,
+ defaultType: 'checkbox',
+ });
+ optMan.bind(
+ 'new_release_check',
+ fieldset.add({
+ fieldLabel: '',
+ labelSeparator: '',
+ height: 22,
+ name: 'new_release_check',
+ boxLabel: _('Be alerted about new releases'),
+ })
+ );
+
+ fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('System Information'),
+ autoHeight: true,
+ labelWidth: 1,
+ defaultType: 'checkbox',
+ });
+ fieldset.add({
+ xtype: 'panel',
+ border: false,
+ bodyCfg: {
+ html: _(
+ 'Help us improve Deluge by sending us your Python version, PyGTK version, OS and processor types. Absolutely no other information is sent.'
+ ),
+ },
+ });
+ optMan.bind(
+ 'send_info',
+ fieldset.add({
+ fieldLabel: '',
+ labelSeparator: '',
+ height: 22,
+ boxLabel: _('Yes, please send anonymous statistics'),
+ name: 'send_info',
+ })
+ );
+
+ fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('GeoIP Database'),
+ autoHeight: true,
+ labelWidth: 80,
+ defaultType: 'textfield',
+ });
+ optMan.bind(
+ 'geoip_db_location',
+ fieldset.add({
+ name: 'geoip_db_location',
+ fieldLabel: _('Path:'),
+ labelSeparator: '',
+ width: 200,
+ })
+ );
+ },
+});
diff --git a/deluge/ui/web/js/deluge-all/preferences/PluginsPage.js b/deluge/ui/web/js/deluge-all/preferences/PluginsPage.js
new file mode 100644
index 0000000..f771d96
--- /dev/null
+++ b/deluge/ui/web/js/deluge-all/preferences/PluginsPage.js
@@ -0,0 +1,277 @@
+/**
+ * Deluge.preferences.PluginsPage.js
+ *
+ * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
+ *
+ * This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
+ * the additional special exception to link portions of this program with the OpenSSL library.
+ * See LICENSE for more details.
+ */
+Ext.namespace('Deluge.preferences');
+
+/**
+ * @class Deluge.preferences.Plugins
+ * @extends Ext.Panel
+ */
+Deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
+ layout: 'border',
+ title: _('Plugins'),
+ header: false,
+ border: false,
+ cls: 'x-deluge-plugins',
+
+ pluginTemplate: new Ext.Template(
+ '<dl class="singleline">' +
+ '<dt>' +
+ _('Author:') +
+ '</dt><dd>{author}</dd>' +
+ '<dt>' +
+ _('Version:') +
+ '</dt><dd>{version}</dd>' +
+ '<dt>' +
+ _('Author Email:') +
+ '</dt><dd>{email}</dd>' +
+ '<dt>' +
+ _('Homepage:') +
+ '</dt><dd>{homepage}</dd>' +
+ '<dt>' +
+ _('Details:') +
+ '</dt><dd style="white-space:normal">{details}</dd>' +
+ '</dl>'
+ ),
+
+ initComponent: function () {
+ Deluge.preferences.Plugins.superclass.initComponent.call(this);
+ this.defaultValues = {
+ version: '',
+ email: '',
+ homepage: '',
+ details: '',
+ };
+ this.pluginTemplate.compile();
+
+ var checkboxRenderer = function (v, p, record) {
+ p.css += ' x-grid3-check-col-td';
+ return (
+ '<div class="x-grid3-check-col' + (v ? '-on' : '') + '"> </div>'
+ );
+ };
+
+ this.list = this.add({
+ xtype: 'listview',
+ store: new Ext.data.ArrayStore({
+ fields: [
+ { name: 'enabled', mapping: 0 },
+ { name: 'plugin', mapping: 1, sortType: 'asUCString' },
+ ],
+ }),
+ columns: [
+ {
+ id: 'enabled',
+ header: _('Enabled'),
+ width: 0.2,
+ sortable: true,
+ tpl: new Ext.XTemplate('{enabled:this.getCheckbox}', {
+ getCheckbox: function (v) {
+ return (
+ '<div class="x-grid3-check-col' +
+ (v ? '-on' : '') +
+ '" rel="chkbox"> </div>'
+ );
+ },
+ }),
+ dataIndex: 'enabled',
+ },
+ {
+ id: 'plugin',
+ header: _('Plugin'),
+ width: 0.8,
+ sortable: true,
+ dataIndex: 'plugin',
+ },
+ ],
+ singleSelect: true,
+ autoExpandColumn: 'plugin',
+ listeners: {
+ selectionchange: { fn: this.onPluginSelect, scope: this },
+ },
+ });
+
+ this.panel = this.add({
+ region: 'center',
+ autoScroll: true,
+ items: [this.list],
+ bbar: new Ext.Toolbar({
+ items: [
+ {
+ cls: 'x-btn-text-icon',
+ iconCls: 'x-deluge-install-plugin',
+ text: _('Install'),
+ handler: this.onInstallPluginWindow,
+ scope: this,
+ },
+ '->',
+ {
+ cls: 'x-btn-text-icon',
+ text: _('Find More'),
+ iconCls: 'x-deluge-find-more',
+ handler: this.onFindMorePlugins,
+ scope: this,
+ },
+ ],
+ }),
+ });
+
+ var pp = (this.pluginInfo = this.add({
+ xtype: 'panel',
+ border: false,
+ height: 100,
+ region: 'south',
+ padding: '5',
+ autoScroll: true,
+ bodyCfg: {
+ style: 'white-space: nowrap',
+ },
+ }));
+
+ this.pluginInfo.on('render', this.onPluginInfoRender, this);
+ this.list.on('click', this.onNodeClick, this);
+ deluge.preferences.on('show', this.onPreferencesShow, this);
+ deluge.events.on('PluginDisabledEvent', this.onPluginDisabled, this);
+ deluge.events.on('PluginEnabledEvent', this.onPluginEnabled, this);
+ },
+
+ disablePlugin: function (plugin) {
+ deluge.client.core.disable_plugin(plugin);
+ },
+
+ enablePlugin: function (plugin) {
+ deluge.client.core.enable_plugin(plugin);
+ },
+
+ setInfo: function (plugin) {
+ if (!this.pluginInfo.rendered) return;
+ var values = plugin || this.defaultValues;
+ this.pluginInfo.body.dom.innerHTML = this.pluginTemplate.apply(values);
+ },
+
+ updatePlugins: function () {
+ var onGotAvailablePlugins = function (plugins) {
+ this.availablePlugins = plugins.sort(function (a, b) {
+ return a.toLowerCase().localeCompare(b.toLowerCase());
+ });
+
+ deluge.client.core.get_enabled_plugins({
+ success: onGotEnabledPlugins,
+ scope: this,
+ });
+ };
+
+ var onGotEnabledPlugins = function (plugins) {
+ this.enabledPlugins = plugins;
+ this.onGotPlugins();
+ };
+
+ deluge.client.core.get_available_plugins({
+ success: onGotAvailablePlugins,
+ scope: this,
+ });
+ },
+
+ updatePluginsGrid: function () {
+ var plugins = [];
+ Ext.each(
+ this.availablePlugins,
+ function (plugin) {
+ if (this.enabledPlugins.indexOf(plugin) > -1) {
+ plugins.push([true, plugin]);
+ } else {
+ plugins.push([false, plugin]);
+ }
+ },
+ this
+ );
+ this.list.getStore().loadData(plugins);
+ },
+
+ onNodeClick: function (dv, index, node, e) {
+ var el = new Ext.Element(e.target);
+ if (el.getAttribute('rel') != 'chkbox') return;
+
+ var r = dv.getStore().getAt(index);
+ if (r.get('plugin') == 'WebUi') return;
+ r.set('enabled', !r.get('enabled'));
+ r.commit();
+ if (r.get('enabled')) {
+ this.enablePlugin(r.get('plugin'));
+ } else {
+ this.disablePlugin(r.get('plugin'));
+ }
+ },
+
+ onFindMorePlugins: function () {
+ window.open('http://dev.deluge-torrent.org/wiki/Plugins');
+ },
+
+ onGotPlugins: function () {
+ this.setInfo();
+ this.updatePluginsGrid();
+ },
+
+ onGotPluginInfo: function (info) {
+ var values = {
+ author: info['Author'],
+ version: info['Version'],
+ email: info['Author-email'],
+ homepage: info['Home-page'],
+ details: info['Description'],
+ };
+ this.setInfo(values);
+ delete info;
+ },
+
+ onInstallPluginWindow: function () {
+ if (!this.installWindow) {
+ this.installWindow = new Deluge.preferences.InstallPluginWindow();
+ this.installWindow.on('pluginadded', this.onPluginInstall, this);
+ }
+ this.installWindow.show();
+ },
+
+ onPluginEnabled: function (pluginName) {
+ var index = this.list.getStore().find('plugin', pluginName);
+ if (index == -1) return;
+ var plugin = this.list.getStore().getAt(index);
+ plugin.set('enabled', true);
+ plugin.commit();
+ },
+
+ onPluginDisabled: function (pluginName) {
+ var index = this.list.getStore().find('plugin', pluginName);
+ if (index == -1) return;
+ var plugin = this.list.getStore().getAt(index);
+ plugin.set('enabled', false);
+ plugin.commit();
+ },
+
+ onPluginInstall: function () {
+ this.updatePlugins();
+ },
+
+ onPluginSelect: function (dv, selections) {
+ if (selections.length == 0) return;
+ var r = dv.getRecords(selections)[0];
+ deluge.client.web.get_plugin_info(r.get('plugin'), {
+ success: this.onGotPluginInfo,
+ scope: this,
+ });
+ },
+
+ onPreferencesShow: function () {
+ this.updatePlugins();
+ },
+
+ onPluginInfoRender: function (ct, position) {
+ this.setInfo();
+ },
+});
diff --git a/deluge/ui/web/js/deluge-all/preferences/PreferencesWindow.js b/deluge/ui/web/js/deluge-all/preferences/PreferencesWindow.js
new file mode 100644
index 0000000..4cfed01
--- /dev/null
+++ b/deluge/ui/web/js/deluge-all/preferences/PreferencesWindow.js
@@ -0,0 +1,245 @@
+/**
+ * Deluge.preferences.PreferencesWindow.js
+ *
+ * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
+ *
+ * This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
+ * the additional special exception to link portions of this program with the OpenSSL library.
+ * See LICENSE for more details.
+ */
+Ext.namespace('Deluge.preferences');
+
+PreferencesRecord = Ext.data.Record.create([{ name: 'name', type: 'string' }]);
+
+/**
+ * @class Deluge.preferences.PreferencesWindow
+ * @extends Ext.Window
+ */
+Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, {
+ /**
+ * @property {String} currentPage The currently selected page.
+ */
+ currentPage: null,
+
+ title: _('Preferences'),
+ layout: 'border',
+ width: 485,
+ height: 500,
+ border: false,
+ constrainHeader: true,
+ buttonAlign: 'right',
+ closeAction: 'hide',
+ closable: true,
+ iconCls: 'x-deluge-preferences',
+ plain: true,
+ resizable: false,
+
+ pages: {},
+
+ initComponent: function () {
+ Deluge.preferences.PreferencesWindow.superclass.initComponent.call(
+ this
+ );
+
+ this.list = new Ext.list.ListView({
+ store: new Ext.data.Store(),
+ columns: [
+ {
+ id: 'name',
+ dataIndex: 'name',
+ },
+ ],
+ singleSelect: true,
+ listeners: {
+ selectionchange: {
+ fn: this.onPageSelect,
+ scope: this,
+ },
+ },
+ hideHeaders: true,
+ autoExpandColumn: 'name',
+ deferredRender: false,
+ autoScroll: true,
+ collapsible: true,
+ });
+ this.add({
+ region: 'west',
+ items: [this.list],
+ width: 120,
+ margins: '0 5 0 0',
+ cmargins: '0 5 0 0',
+ });
+
+ this.configPanel = this.add({
+ type: 'container',
+ autoDestroy: false,
+ region: 'center',
+ layout: 'card',
+ layoutConfig: {
+ deferredRender: true,
+ },
+ autoScroll: true,
+ width: 300,
+ });
+
+ this.addButton(_('Close'), this.onClose, this);
+ this.addButton(_('Apply'), this.onApply, this);
+ this.addButton(_('OK'), this.onOk, this);
+
+ this.optionsManager = new Deluge.OptionsManager();
+ this.on('afterrender', this.onAfterRender, this);
+ this.on('show', this.onShow, this);
+
+ this.initPages();
+ },
+
+ initPages: function () {
+ deluge.preferences = this;
+ this.addPage(new Deluge.preferences.Downloads());
+ this.addPage(new Deluge.preferences.Network());
+ this.addPage(new Deluge.preferences.Encryption());
+ this.addPage(new Deluge.preferences.Bandwidth());
+ this.addPage(new Deluge.preferences.Interface());
+ this.addPage(new Deluge.preferences.Other());
+ this.addPage(new Deluge.preferences.Daemon());
+ this.addPage(new Deluge.preferences.Queue());
+ this.addPage(new Deluge.preferences.Proxy());
+ this.addPage(new Deluge.preferences.Cache());
+ this.addPage(new Deluge.preferences.Plugins());
+ },
+
+ onApply: function (e) {
+ var changed = this.optionsManager.getDirty();
+ if (!Ext.isObjectEmpty(changed)) {
+ // Workaround for only displaying single listen port but still pass array to core.
+ if ('listen_ports' in changed) {
+ changed.listen_ports = [
+ changed.listen_ports,
+ changed.listen_ports,
+ ];
+ }
+ deluge.client.core.set_config(changed, {
+ success: this.onSetConfig,
+ scope: this,
+ });
+ }
+
+ for (var page in this.pages) {
+ if (this.pages[page].onApply) this.pages[page].onApply();
+ }
+ },
+
+ /**
+ * Return the options manager for the preferences window.
+ * @returns {Deluge.OptionsManager} the options manager
+ */
+ getOptionsManager: function () {
+ return this.optionsManager;
+ },
+
+ /**
+ * Adds a page to the preferences window.
+ * @param {Mixed} page
+ */
+ addPage: function (page) {
+ var store = this.list.getStore();
+ var name = page.title;
+ store.add([new PreferencesRecord({ name: name })]);
+ page['bodyStyle'] = 'padding: 5px';
+ page.preferences = this;
+ this.pages[name] = this.configPanel.add(page);
+ this.pages[name].index = -1;
+ return this.pages[name];
+ },
+
+ /**
+ * Removes a preferences page from the window.
+ * @param {mixed} name
+ */
+ removePage: function (page) {
+ var name = page.title;
+ var store = this.list.getStore();
+ store.removeAt(store.find('name', name));
+ this.configPanel.remove(page);
+ delete this.pages[page.title];
+ },
+
+ /**
+ * Select which preferences page is displayed.
+ * @param {String} page The page name to change to
+ */
+ selectPage: function (page) {
+ if (this.pages[page].index < 0) {
+ this.pages[page].index = this.configPanel.items.indexOf(
+ this.pages[page]
+ );
+ }
+ this.list.select(this.pages[page].index);
+ },
+
+ // private
+ doSelectPage: function (page) {
+ if (this.pages[page].index < 0) {
+ this.pages[page].index = this.configPanel.items.indexOf(
+ this.pages[page]
+ );
+ }
+ this.configPanel.getLayout().setActiveItem(this.pages[page].index);
+ this.currentPage = page;
+ },
+
+ // private
+ onGotConfig: function (config) {
+ this.getOptionsManager().set(config);
+ },
+
+ // private
+ onPageSelect: function (list, selections) {
+ var r = list.getRecord(selections[0]);
+ this.doSelectPage(r.get('name'));
+ },
+
+ // private
+ onSetConfig: function () {
+ this.getOptionsManager().commit();
+ },
+
+ // private
+ onAfterRender: function () {
+ if (!this.list.getSelectionCount()) {
+ this.list.select(0);
+ }
+ this.configPanel.getLayout().setActiveItem(0);
+ },
+
+ // private
+ onShow: function () {
+ if (!deluge.client.core) return;
+ deluge.client.core.get_config({
+ success: this.onGotConfig,
+ scope: this,
+ });
+ },
+
+ // private
+ onClose: function () {
+ this.hide();
+ },
+
+ // private
+ onOk: function () {
+ var changed = this.optionsManager.getDirty();
+ if (!Ext.isObjectEmpty(changed)) {
+ deluge.client.core.set_config(changed, {
+ success: this.onSetConfig,
+ scope: this,
+ });
+ }
+
+ for (var page in this.pages) {
+ if (this.pages[page].onOk) this.pages[page].onOk();
+ }
+
+ this.hide();
+ },
+});
diff --git a/deluge/ui/web/js/deluge-all/preferences/ProxyField.js b/deluge/ui/web/js/deluge-all/preferences/ProxyField.js
new file mode 100644
index 0000000..d3bb0bf
--- /dev/null
+++ b/deluge/ui/web/js/deluge-all/preferences/ProxyField.js
@@ -0,0 +1,225 @@
+/**
+ * Deluge.preferences.ProxyField.js
+ *
+ * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
+ *
+ * This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
+ * the additional special exception to link portions of this program with the OpenSSL library.
+ * See LICENSE for more details.
+ */
+Ext.ns('Deluge.preferences');
+
+/**
+ * @class Deluge.preferences.ProxyField
+ * @extends Ext.form.FieldSet
+ */
+Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
+ border: false,
+ autoHeight: true,
+ labelWidth: 70,
+
+ initComponent: function () {
+ Deluge.preferences.ProxyField.superclass.initComponent.call(this);
+ this.proxyType = this.add({
+ xtype: 'combo',
+ fieldLabel: _('Type:'),
+ labelSeparator: '',
+ name: 'proxytype',
+ mode: 'local',
+ width: 150,
+ store: new Ext.data.ArrayStore({
+ fields: ['id', 'text'],
+ data: [
+ [0, _('None')],
+ [1, _('Socks4')],
+ [2, _('Socks5')],
+ [3, _('Socks5 Auth')],
+ [4, _('HTTP')],
+ [5, _('HTTP Auth')],
+ [6, _('I2P')],
+ ],
+ }),
+ editable: false,
+ triggerAction: 'all',
+ valueField: 'id',
+ displayField: 'text',
+ });
+ this.proxyType.on('change', this.onFieldChange, this);
+ this.proxyType.on('select', this.onTypeSelect, this);
+
+ this.hostname = this.add({
+ xtype: 'textfield',
+ name: 'hostname',
+ fieldLabel: _('Host:'),
+ labelSeparator: '',
+ width: 220,
+ });
+ this.hostname.on('change', this.onFieldChange, this);
+
+ this.port = this.add({
+ xtype: 'spinnerfield',
+ name: 'port',
+ fieldLabel: _('Port:'),
+ labelSeparator: '',
+ width: 80,
+ decimalPrecision: 0,
+ minValue: 0,
+ maxValue: 65535,
+ });
+ this.port.on('change', this.onFieldChange, this);
+
+ this.username = this.add({
+ xtype: 'textfield',
+ name: 'username',
+ fieldLabel: _('Username:'),
+ labelSeparator: '',
+ width: 220,
+ });
+ this.username.on('change', this.onFieldChange, this);
+
+ this.password = this.add({
+ xtype: 'textfield',
+ name: 'password',
+ fieldLabel: _('Password:'),
+ labelSeparator: '',
+ inputType: 'password',
+ width: 220,
+ });
+ this.password.on('change', this.onFieldChange, this);
+
+ this.proxy_host_resolve = this.add({
+ xtype: 'checkbox',
+ name: 'proxy_host_resolve',
+ fieldLabel: '',
+ boxLabel: _('Proxy Hostnames'),
+ width: 220,
+ });
+ this.proxy_host_resolve.on('change', this.onFieldChange, this);
+
+ this.proxy_peer_conn = this.add({
+ xtype: 'checkbox',
+ name: 'proxy_peer_conn',
+ fieldLabel: '',
+ boxLabel: _('Proxy Peers'),
+ width: 220,
+ });
+ this.proxy_peer_conn.on('change', this.onFieldChange, this);
+
+ this.proxy_tracker_conn = this.add({
+ xtype: 'checkbox',
+ name: 'proxy_tracker_conn',
+ fieldLabel: '',
+ boxLabel: _('Proxy Trackers'),
+ width: 220,
+ });
+ this.proxy_tracker_conn.on('change', this.onFieldChange, this);
+
+ var fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('Force Proxy'),
+ autoHeight: true,
+ labelWidth: 1,
+ defaultType: 'checkbox',
+ style: 'padding-left: 0px; margin-top: 10px',
+ });
+
+ this.force_proxy = fieldset.add({
+ fieldLabel: '',
+ labelSeparator: '',
+ height: 20,
+ name: 'force_proxy',
+ boxLabel: _('Force Use of Proxy'),
+ });
+ this.force_proxy.on('change', this.onFieldChange, this);
+
+ this.anonymous_mode = fieldset.add({
+ fieldLabel: '',
+ labelSeparator: '',
+ height: 20,
+ name: 'anonymous_mode',
+ boxLabel: _('Hide Client Identity'),
+ });
+ this.anonymous_mode.on('change', this.onFieldChange, this);
+
+ this.setting = false;
+ },
+
+ getName: function () {
+ return this.initialConfig.name;
+ },
+
+ getValue: function () {
+ return {
+ type: this.proxyType.getValue(),
+ hostname: this.hostname.getValue(),
+ port: Number(this.port.getValue()),
+ username: this.username.getValue(),
+ password: this.password.getValue(),
+ proxy_hostnames: this.proxy_host_resolve.getValue(),
+ proxy_peer_connections: this.proxy_peer_conn.getValue(),
+ proxy_tracker_connections: this.proxy_tracker_conn.getValue(),
+ force_proxy: this.force_proxy.getValue(),
+ anonymous_mode: this.anonymous_mode.getValue(),
+ };
+ },
+
+ // Set the values of the proxies
+ setValue: function (value) {
+ this.setting = true;
+ this.proxyType.setValue(value['type']);
+ var index = this.proxyType.getStore().find('id', value['type']);
+ var record = this.proxyType.getStore().getAt(index);
+
+ this.hostname.setValue(value['hostname']);
+ this.port.setValue(value['port']);
+ this.username.setValue(value['username']);
+ this.password.setValue(value['password']);
+ this.proxy_host_resolve.setValue(value['proxy_hostnames']);
+ this.proxy_peer_conn.setValue(value['proxy_peer_connections']);
+ this.proxy_tracker_conn.setValue(value['proxy_tracker_connections']);
+ this.force_proxy.setValue(value['force_proxy']);
+ this.anonymous_mode.setValue(value['anonymous_mode']);
+
+ this.onTypeSelect(this.type, record, index);
+ this.setting = false;
+ },
+
+ onFieldChange: function (field, newValue, oldValue) {
+ if (this.setting) return;
+ var newValues = this.getValue();
+ var oldValues = Ext.apply({}, newValues);
+ oldValues[field.getName()] = oldValue;
+
+ this.fireEvent('change', this, newValues, oldValues);
+ },
+
+ onTypeSelect: function (combo, record, index) {
+ var typeId = record.get('id');
+ if (typeId > 0) {
+ this.hostname.show();
+ this.port.show();
+ this.proxy_peer_conn.show();
+ this.proxy_tracker_conn.show();
+ if (typeId > 1 && typeId < 6) {
+ this.proxy_host_resolve.show();
+ } else {
+ this.proxy_host_resolve.hide();
+ }
+ } else {
+ this.hostname.hide();
+ this.port.hide();
+ this.proxy_host_resolve.hide();
+ this.proxy_peer_conn.hide();
+ this.proxy_tracker_conn.hide();
+ }
+
+ if (typeId == 3 || typeId == 5) {
+ this.username.show();
+ this.password.show();
+ } else {
+ this.username.hide();
+ this.password.hide();
+ }
+ },
+});
diff --git a/deluge/ui/web/js/deluge-all/preferences/ProxyPage.js b/deluge/ui/web/js/deluge-all/preferences/ProxyPage.js
new file mode 100644
index 0000000..2dc4cae
--- /dev/null
+++ b/deluge/ui/web/js/deluge-all/preferences/ProxyPage.js
@@ -0,0 +1,62 @@
+/**
+ * Deluge.preferences.ProxyPage.js
+ *
+ * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
+ *
+ * This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
+ * the additional special exception to link portions of this program with the OpenSSL library.
+ * See LICENSE for more details.
+ */
+Ext.namespace('Deluge.preferences');
+
+/**
+ * @class Deluge.preferences.Proxy
+ * @extends Ext.form.FormPanel
+ */
+Deluge.preferences.Proxy = Ext.extend(Ext.form.FormPanel, {
+ constructor: function (config) {
+ config = Ext.apply(
+ {
+ border: false,
+ title: _('Proxy'),
+ header: false,
+ layout: 'form',
+ autoScroll: true,
+ },
+ config
+ );
+ Deluge.preferences.Proxy.superclass.constructor.call(this, config);
+ },
+
+ initComponent: function () {
+ Deluge.preferences.Proxy.superclass.initComponent.call(this);
+ this.proxy = this.add(
+ new Deluge.preferences.ProxyField({
+ title: _('Proxy'),
+ name: 'proxy',
+ })
+ );
+ this.proxy.on('change', this.onProxyChange, this);
+ deluge.preferences.getOptionsManager().bind('proxy', this.proxy);
+ },
+
+ getValue: function () {
+ return {
+ proxy: this.proxy.getValue(),
+ };
+ },
+
+ setValue: function (value) {
+ for (var proxy in value) {
+ this[proxy].setValue(value[proxy]);
+ }
+ },
+
+ onProxyChange: function (field, newValue, oldValue) {
+ var newValues = this.getValue();
+ var oldValues = Ext.apply({}, newValues);
+ oldValues[field.getName()] = oldValue;
+
+ this.fireEvent('change', this, newValues, oldValues);
+ },
+});
diff --git a/deluge/ui/web/js/deluge-all/preferences/QueuePage.js b/deluge/ui/web/js/deluge-all/preferences/QueuePage.js
new file mode 100644
index 0000000..c7b47c5
--- /dev/null
+++ b/deluge/ui/web/js/deluge-all/preferences/QueuePage.js
@@ -0,0 +1,234 @@
+/**
+ * Deluge.preferences.QueuePage.js
+ *
+ * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
+ *
+ * This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
+ * the additional special exception to link portions of this program with the OpenSSL library.
+ * See LICENSE for more details.
+ */
+Ext.namespace('Deluge.preferences');
+
+/**
+ * @class Deluge.preferences.Queue
+ * @extends Ext.form.FormPanel
+ */
+Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, {
+ border: false,
+ title: _('Queue'),
+ header: false,
+ layout: 'form',
+
+ initComponent: function () {
+ Deluge.preferences.Queue.superclass.initComponent.call(this);
+
+ var om = deluge.preferences.getOptionsManager();
+
+ var fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('New Torrents'),
+ style: 'padding-top: 5px; margin-bottom: 0px;',
+ autoHeight: true,
+ labelWidth: 1,
+ defaultType: 'checkbox',
+ });
+ om.bind(
+ 'queue_new_to_top',
+ fieldset.add({
+ fieldLabel: '',
+ labelSeparator: '',
+ height: 22,
+ boxLabel: _('Queue to top'),
+ name: 'queue_new_to_top',
+ })
+ );
+
+ fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('Active Torrents'),
+ autoHeight: true,
+ labelWidth: 150,
+ defaultType: 'spinnerfield',
+ style: 'padding-top: 5px; margin-bottom: 0px',
+ });
+ om.bind(
+ 'max_active_limit',
+ fieldset.add({
+ fieldLabel: _('Total:'),
+ labelSeparator: '',
+ name: 'max_active_limit',
+ value: 8,
+ width: 80,
+ decimalPrecision: 0,
+ minValue: -1,
+ maxValue: 99999,
+ })
+ );
+ om.bind(
+ 'max_active_downloading',
+ fieldset.add({
+ fieldLabel: _('Downloading:'),
+ labelSeparator: '',
+ name: 'max_active_downloading',
+ value: 3,
+ width: 80,
+ decimalPrecision: 0,
+ minValue: -1,
+ maxValue: 99999,
+ })
+ );
+ om.bind(
+ 'max_active_seeding',
+ fieldset.add({
+ fieldLabel: _('Seeding:'),
+ labelSeparator: '',
+ name: 'max_active_seeding',
+ value: 5,
+ width: 80,
+ decimalPrecision: 0,
+ minValue: -1,
+ maxValue: 99999,
+ })
+ );
+ om.bind(
+ 'dont_count_slow_torrents',
+ fieldset.add({
+ xtype: 'checkbox',
+ name: 'dont_count_slow_torrents',
+ height: 22,
+ hideLabel: true,
+ boxLabel: _('Ignore slow torrents'),
+ })
+ );
+ om.bind(
+ 'auto_manage_prefer_seeds',
+ fieldset.add({
+ xtype: 'checkbox',
+ name: 'auto_manage_prefer_seeds',
+ hideLabel: true,
+ boxLabel: _('Prefer seeding torrents'),
+ })
+ );
+
+ fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ title: _('Seeding Rotation'),
+ autoHeight: true,
+ labelWidth: 150,
+ defaultType: 'spinnerfield',
+ style: 'padding-top: 5px; margin-bottom: 0px',
+ });
+ om.bind(
+ 'share_ratio_limit',
+ fieldset.add({
+ fieldLabel: _('Share Ratio:'),
+ labelSeparator: '',
+ name: 'share_ratio_limit',
+ value: 8,
+ width: 80,
+ incrementValue: 0.1,
+ minValue: -1,
+ maxValue: 99999,
+ alternateIncrementValue: 1,
+ decimalPrecision: 2,
+ })
+ );
+ om.bind(
+ 'seed_time_ratio_limit',
+ fieldset.add({
+ fieldLabel: _('Time Ratio:'),
+ labelSeparator: '',
+ name: 'seed_time_ratio_limit',
+ value: 3,
+ width: 80,
+ incrementValue: 0.1,
+ minValue: -1,
+ maxValue: 99999,
+ alternateIncrementValue: 1,
+ decimalPrecision: 2,
+ })
+ );
+ om.bind(
+ 'seed_time_limit',
+ fieldset.add({
+ fieldLabel: _('Time (m):'),
+ labelSeparator: '',
+ name: 'seed_time_limit',
+ value: 5,
+ width: 80,
+ decimalPrecision: 0,
+ minValue: -1,
+ maxValue: 99999,
+ })
+ );
+
+ fieldset = this.add({
+ xtype: 'fieldset',
+ border: false,
+ autoHeight: true,
+ style: 'padding-top: 5px; margin-bottom: 0px',
+ title: _('Share Ratio Reached'),
+
+ layout: 'table',
+ layoutConfig: { columns: 2 },
+ labelWidth: 0,
+ defaultType: 'checkbox',
+
+ defaults: {
+ fieldLabel: '',
+ labelSeparator: '',
+ },
+ });
+ this.stopAtRatio = fieldset.add({
+ name: 'stop_seed_at_ratio',
+ boxLabel: _('Share Ratio:'),
+ });
+ this.stopAtRatio.on('check', this.onStopRatioCheck, this);
+ om.bind('stop_seed_at_ratio', this.stopAtRatio);
+
+ this.stopRatio = fieldset.add({
+ xtype: 'spinnerfield',
+ name: 'stop_seed_ratio',
+ ctCls: 'x-deluge-indent-checkbox',
+ disabled: true,
+ value: '2.0',
+ width: 60,
+ incrementValue: 0.1,
+ minValue: -1,
+ maxValue: 99999,
+ alternateIncrementValue: 1,
+ decimalPrecision: 2,
+ });
+ om.bind('stop_seed_ratio', this.stopRatio);
+
+ this.removeAtRatio = fieldset.add({
+ xtype: 'radiogroup',
+ columns: 1,
+ colspan: 2,
+ disabled: true,
+ style: 'margin-left: 10px',
+ items: [
+ {
+ boxLabel: _('Pause torrent'),
+ name: 'at_ratio',
+ inputValue: false,
+ checked: true,
+ },
+ {
+ boxLabel: _('Remove torrent'),
+ name: 'at_ratio',
+ inputValue: true,
+ },
+ ],
+ });
+ om.bind('remove_seed_at_ratio', this.removeAtRatio);
+ },
+
+ onStopRatioCheck: function (e, checked) {
+ this.stopRatio.setDisabled(!checked);
+ this.removeAtRatio.setDisabled(!checked);
+ },
+});