diff --git a/deluge/ui/web/docs/files.html b/deluge/ui/web/docs/files.html index be2f2aa3b..94e9ed057 100644 --- a/deluge/ui/web/docs/files.html +++ b/deluge/ui/web/docs/files.html @@ -644,7 +644,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu May 28 2009 11:35:18 GMT+0100 (BST) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Jun 02 2009 23:11:36 GMT+0100 (BST)
\ No newline at end of file diff --git a/deluge/ui/web/docs/index.html b/deluge/ui/web/docs/index.html index 472311425..6d495e896 100644 --- a/deluge/ui/web/docs/index.html +++ b/deluge/ui/web/docs/index.html @@ -260,7 +260,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu May 28 2009 11:35:18 GMT+0100 (BST) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Jun 02 2009 23:11:36 GMT+0100 (BST)
\ No newline at end of file diff --git a/deluge/ui/web/docs/symbols/Deluge.Events.html b/deluge/ui/web/docs/symbols/Deluge.Events.html index e04b5073e..f8b86220e 100644 --- a/deluge/ui/web/docs/symbols/Deluge.Events.html +++ b/deluge/ui/web/docs/symbols/Deluge.Events.html @@ -306,7 +306,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu May 28 2009 11:35:18 GMT+0100 (BST) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Jun 02 2009 23:11:35 GMT+0100 (BST)
diff --git a/deluge/ui/web/docs/symbols/Deluge.Formatters.html b/deluge/ui/web/docs/symbols/Deluge.Formatters.html index 9c27f07b2..09dbe7573 100644 --- a/deluge/ui/web/docs/symbols/Deluge.Formatters.html +++ b/deluge/ui/web/docs/symbols/Deluge.Formatters.html @@ -592,7 +592,7 @@ if seconds < 0
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu May 28 2009 11:35:18 GMT+0100 (BST) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Jun 02 2009 23:11:35 GMT+0100 (BST)
diff --git a/deluge/ui/web/docs/symbols/Deluge.Keys.html b/deluge/ui/web/docs/symbols/Deluge.Keys.html index eaa100280..9c3929cfb 100644 --- a/deluge/ui/web/docs/symbols/Deluge.Keys.html +++ b/deluge/ui/web/docs/symbols/Deluge.Keys.html @@ -528,7 +528,7 @@ by Deluge.Keys.Grid.
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu May 28 2009 11:35:18 GMT+0100 (BST) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Jun 02 2009 23:11:35 GMT+0100 (BST)
diff --git a/deluge/ui/web/docs/symbols/Deluge.OptionsManager.html b/deluge/ui/web/docs/symbols/Deluge.OptionsManager.html index 71bb835e4..8d56ae573 100644 --- a/deluge/ui/web/docs/symbols/Deluge.OptionsManager.html +++ b/deluge/ui/web/docs/symbols/Deluge.OptionsManager.html @@ -280,17 +280,6 @@ ul.inheritsList -
-
Parameters:
- -
- config - -
-
- -
- @@ -317,7 +306,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu May 28 2009 11:35:18 GMT+0100 (BST) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Jun 02 2009 23:11:35 GMT+0100 (BST)
diff --git a/deluge/ui/web/docs/symbols/Deluge.UI.html b/deluge/ui/web/docs/symbols/Deluge.UI.html index 58e3620bd..3628d1117 100644 --- a/deluge/ui/web/docs/symbols/Deluge.UI.html +++ b/deluge/ui/web/docs/symbols/Deluge.UI.html @@ -523,7 +523,7 @@ and set up various events that the UI will utilise.
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu May 28 2009 11:35:18 GMT+0100 (BST) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Jun 02 2009 23:11:36 GMT+0100 (BST)
diff --git a/deluge/ui/web/docs/symbols/Ext.deluge.TorrentGrid.html b/deluge/ui/web/docs/symbols/Ext.deluge.TorrentGrid.html index c62dba593..13bfceb9b 100644 --- a/deluge/ui/web/docs/symbols/Ext.deluge.TorrentGrid.html +++ b/deluge/ui/web/docs/symbols/Ext.deluge.TorrentGrid.html @@ -319,7 +319,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu May 28 2009 11:35:18 GMT+0100 (BST) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Jun 02 2009 23:11:36 GMT+0100 (BST)
diff --git a/deluge/ui/web/docs/symbols/Ext.ux.FullProgressBar.html b/deluge/ui/web/docs/symbols/Ext.ux.FullProgressBar.html index 32276e486..9beb6191f 100644 --- a/deluge/ui/web/docs/symbols/Ext.ux.FullProgressBar.html +++ b/deluge/ui/web/docs/symbols/Ext.ux.FullProgressBar.html @@ -319,7 +319,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu May 28 2009 11:35:18 GMT+0100 (BST) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Jun 02 2009 23:11:36 GMT+0100 (BST)
diff --git a/deluge/ui/web/docs/symbols/_global_.html b/deluge/ui/web/docs/symbols/_global_.html index 08477ab6e..3fcd26139 100644 --- a/deluge/ui/web/docs/symbols/_global_.html +++ b/deluge/ui/web/docs/symbols/_global_.html @@ -314,15 +314,6 @@ ul.inheritsList - -   - -
addOptions(id, options) -
-
Add a set of default options and values for an id to the options manager
- - -   @@ -332,24 +323,6 @@ ul.inheritsList - -   - -
getChanged(id) -
-
Returns the changed values for a specified id.
- - - - -   - -
getDefault(id, option) -
-
Get the default value for an option given an id and option name
- - -   @@ -377,15 +350,6 @@ ul.inheritsList - -   - -
hasChanged(id, option) -
-
Check to see if the option has been changed.
- - -   @@ -413,51 +377,6 @@ ul.inheritsList - -   - -
resetOptions(id) -
-
Reset the options back to the default values for the specified id.
- - - - -   - -
setOption(id, option, value) -
-
Set the specified option for the passed in id.
- - - - -   - -
setOptions(id, options) -
-
Set the specified options for the passed in id.
- - - - -   - -
updateOption(id, option, value;) -
-
Update the default value for the specified option and id.
- - - - -   - -
updateOptions(id, options) -
-
Update the defaults for the specified id.
- - - @@ -636,51 +555,6 @@ ul.inheritsList Method Detail - -
- - - addOptions(id, options) - -
-
- Add a set of default options and values for an id to the options manager - -
- Defined in: Deluge.OptionsManager.js. - - -
- - - - -
-
Parameters:
- -
- {String} id - -
-
- -
- {Object} options - -
-
The default options for the id.
- -
- - - - - - - - -
-
@@ -707,104 +581,6 @@ ul.inheritsList -
- - -
- - {Object} - getChanged(id) - -
-
- Returns the changed values for a specified id. - -
- Defined in: Deluge.OptionsManager.js. - - -
- - - - -
-
Parameters:
- -
- {String} id - -
-
- -
- - - - - -
-
Returns:
- -
{Object} the changed options
- -
- - - - -
- - -
- - {Object} - getDefault(id, option) - -
-
- Get the default value for an option given an id and option name - -
- Defined in: Deluge.OptionsManager.js. - - -
- - - - -
-
Parameters:
- -
- {String} id - -
-
- -
- {String} option - -
-
- -
- - - - - -
-
Returns:
- -
{Object} the value of the option
- -
- - - -
@@ -889,58 +665,6 @@ ul.inheritsList -
- - -
- - {Boolean} - hasChanged(id, option) - -
-
- Check to see if the option has been changed. - -
- Defined in: Deluge.OptionsManager.js. - - -
- - - - -
-
Parameters:
- -
- {String} id - -
-
- -
- {String} option - -
-
- -
- - - - - -
-
Returns:
- -
{Boolean} true if the option has been changed, else false.
- -
- - - -
@@ -1059,237 +783,6 @@ ul.inheritsList -
- - -
- - - resetOptions(id) - -
-
- Reset the options back to the default values for the specified id. - -
- Defined in: Deluge.OptionsManager.js. - - -
- - - - -
-
Parameters:
- -
- {String} id - -
-
- -
- - - - - - - - -
- - -
- - - setOption(id, option, value) - -
-
- Set the specified option for the passed in id. - -
- Defined in: Deluge.OptionsManager.js. - - -
- - - - -
-
Parameters:
- -
- {String} id - -
-
- -
- {String} option - -
-
- -
- {Object} value - -
-
The new value for the option
- -
- - - - - - - - -
- - -
- - - setOptions(id, options) - -
-
- Set the specified options for the passed in id. - -
- Defined in: Deluge.OptionsManager.js. - - -
- - - - -
-
Parameters:
- -
- {String} id - -
-
- -
- {Object} options - -
-
The option values to change.
- -
- - - - - - - - -
- - -
- - - updateOption(id, option, value;) - -
-
- Update the default value for the specified option and id. - -
- Defined in: Deluge.OptionsManager.js. - - -
- - - - -
-
Parameters:
- -
- {String} id - -
-
- -
- {String} option - -
-
- -
- {Object} value; - -
-
- -
- - - - - - - - -
- - -
- - - updateOptions(id, options) - -
-
- Update the defaults for the specified id. - -
- Defined in: Deluge.OptionsManager.js. - - -
- - - - -
-
Parameters:
- -
- {String} id - -
-
- -
- {Object} options - -
-
The option defaults to change.
- -
- - - - - - - - @@ -1354,7 +847,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu May 28 2009 11:35:18 GMT+0100 (BST) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Jun 02 2009 23:11:35 GMT+0100 (BST)
diff --git a/deluge/ui/web/docs/symbols/src/Deluge.Add.File.js.html b/deluge/ui/web/docs/symbols/src/Deluge.Add.File.js.html index 0f5669be1..e9cc46550 100644 --- a/deluge/ui/web/docs/symbols/src/Deluge.Add.File.js.html +++ b/deluge/ui/web/docs/symbols/src/Deluge.Add.File.js.html @@ -26,17 +26,17 @@ 19 The Free Software Foundation, Inc., 20 51 Franklin Street, Fifth Floor 21 Boston, MA 02110-1301, USA. - 22 # - 23 # In addition, as a special exception, the copyright holders give - 24 # permission to link the code of portions of this program with the OpenSSL - 25 # library. - 26 # You must obey the GNU General Public License in all respects for all of - 27 # the code used other than OpenSSL. If you modify file(s) with this - 28 # exception, you may extend this exception to your version of the file(s), - 29 # but you are not obligated to do so. If you do not wish to do so, delete - 30 # this exception statement from your version. If you delete this exception - 31 # statement from all source files in the program, then also delete it here. - 32 # + 22 + 23 In addition, as a special exception, the copyright holders give + 24 permission to link the code of portions of this program with the OpenSSL + 25 library. + 26 You must obey the GNU General Public License in all respects for all of + 27 the code used other than OpenSSL. If you modify file(s) with this + 28 exception, you may extend this exception to your version of the file(s), + 29 but you are not obligated to do so. If you do not wish to do so, delete + 30 this exception statement from your version. If you delete this exception + 31 statement from all source files in the program, then also delete it here. + 32 33 */ 34 35 Ext.deluge.add.FileWindow = Ext.extend(Ext.deluge.add.Window, { diff --git a/deluge/ui/web/docs/symbols/src/Deluge.Add.Url.js.html b/deluge/ui/web/docs/symbols/src/Deluge.Add.Url.js.html index 23232f4b6..91b11cb55 100644 --- a/deluge/ui/web/docs/symbols/src/Deluge.Add.Url.js.html +++ b/deluge/ui/web/docs/symbols/src/Deluge.Add.Url.js.html @@ -26,17 +26,17 @@ 19 The Free Software Foundation, Inc., 20 51 Franklin Street, Fifth Floor 21 Boston, MA 02110-1301, USA. - 22 # - 23 # In addition, as a special exception, the copyright holders give - 24 # permission to link the code of portions of this program with the OpenSSL - 25 # library. - 26 # You must obey the GNU General Public License in all respects for all of - 27 # the code used other than OpenSSL. If you modify file(s) with this - 28 # exception, you may extend this exception to your version of the file(s), - 29 # but you are not obligated to do so. If you do not wish to do so, delete - 30 # this exception statement from your version. If you delete this exception - 31 # statement from all source files in the program, then also delete it here. - 32 # + 22 + 23 In addition, as a special exception, the copyright holders give + 24 permission to link the code of portions of this program with the OpenSSL + 25 library. + 26 You must obey the GNU General Public License in all respects for all of + 27 the code used other than OpenSSL. If you modify file(s) with this + 28 exception, you may extend this exception to your version of the file(s), + 29 but you are not obligated to do so. If you do not wish to do so, delete + 30 this exception statement from your version. If you delete this exception + 31 statement from all source files in the program, then also delete it here. + 32 33 */ 34 35 Ext.deluge.add.UrlWindow = Ext.extend(Ext.deluge.add.Window, { diff --git a/deluge/ui/web/docs/symbols/src/Deluge.Add.js.html b/deluge/ui/web/docs/symbols/src/Deluge.Add.js.html index 9576f66f7..ff4b19b68 100644 --- a/deluge/ui/web/docs/symbols/src/Deluge.Add.js.html +++ b/deluge/ui/web/docs/symbols/src/Deluge.Add.js.html @@ -26,17 +26,17 @@ 19 The Free Software Foundation, Inc., 20 51 Franklin Street, Fifth Floor 21 Boston, MA 02110-1301, USA. - 22 # - 23 # In addition, as a special exception, the copyright holders give - 24 # permission to link the code of portions of this program with the OpenSSL - 25 # library. - 26 # You must obey the GNU General Public License in all respects for all of - 27 # the code used other than OpenSSL. If you modify file(s) with this - 28 # exception, you may extend this exception to your version of the file(s), - 29 # but you are not obligated to do so. If you do not wish to do so, delete - 30 # this exception statement from your version. If you delete this exception - 31 # statement from all source files in the program, then also delete it here. - 32 # + 22 + 23 In addition, as a special exception, the copyright holders give + 24 permission to link the code of portions of this program with the OpenSSL + 25 library. + 26 You must obey the GNU General Public License in all respects for all of + 27 the code used other than OpenSSL. If you modify file(s) with this + 28 exception, you may extend this exception to your version of the file(s), + 29 but you are not obligated to do so. If you do not wish to do so, delete + 30 this exception statement from your version. If you delete this exception + 31 statement from all source files in the program, then also delete it here. + 32 33 */ 34 35 Ext.namespace('Ext.deluge.add'); diff --git a/deluge/ui/web/docs/symbols/src/Deluge.Client.js.html b/deluge/ui/web/docs/symbols/src/Deluge.Client.js.html index 6093311ef..df274fe71 100644 --- a/deluge/ui/web/docs/symbols/src/Deluge.Client.js.html +++ b/deluge/ui/web/docs/symbols/src/Deluge.Client.js.html @@ -26,17 +26,17 @@ 19 The Free Software Foundation, Inc., 20 51 Franklin Street, Fifth Floor 21 Boston, MA 02110-1301, USA. - 22 # - 23 # In addition, as a special exception, the copyright holders give - 24 # permission to link the code of portions of this program with the OpenSSL - 25 # library. - 26 # You must obey the GNU General Public License in all respects for all of - 27 # the code used other than OpenSSL. If you modify file(s) with this - 28 # exception, you may extend this exception to your version of the file(s), - 29 # but you are not obligated to do so. If you do not wish to do so, delete - 30 # this exception statement from your version. If you delete this exception - 31 # statement from all source files in the program, then also delete it here. - 32 # + 22 + 23 In addition, as a special exception, the copyright holders give + 24 permission to link the code of portions of this program with the OpenSSL + 25 library. + 26 You must obey the GNU General Public License in all respects for all of + 27 the code used other than OpenSSL. If you modify file(s) with this + 28 exception, you may extend this exception to your version of the file(s), + 29 but you are not obligated to do so. If you do not wish to do so, delete + 30 this exception statement from your version. If you delete this exception + 31 statement from all source files in the program, then also delete it here. + 32 33 */ 34 35 Ext.namespace('Ext.ux.util'); diff --git a/deluge/ui/web/docs/symbols/src/Deluge.ConnectionManager.js.html b/deluge/ui/web/docs/symbols/src/Deluge.ConnectionManager.js.html index a9b33f26e..7f1b96e98 100644 --- a/deluge/ui/web/docs/symbols/src/Deluge.ConnectionManager.js.html +++ b/deluge/ui/web/docs/symbols/src/Deluge.ConnectionManager.js.html @@ -26,17 +26,17 @@ 19 The Free Software Foundation, Inc., 20 51 Franklin Street, Fifth Floor 21 Boston, MA 02110-1301, USA. - 22 # - 23 # In addition, as a special exception, the copyright holders give - 24 # permission to link the code of portions of this program with the OpenSSL - 25 # library. - 26 # You must obey the GNU General Public License in all respects for all of - 27 # the code used other than OpenSSL. If you modify file(s) with this - 28 # exception, you may extend this exception to your version of the file(s), - 29 # but you are not obligated to do so. If you do not wish to do so, delete - 30 # this exception statement from your version. If you delete this exception - 31 # statement from all source files in the program, then also delete it here. - 32 # + 22 + 23 In addition, as a special exception, the copyright holders give + 24 permission to link the code of portions of this program with the OpenSSL + 25 library. + 26 You must obey the GNU General Public License in all respects for all of + 27 the code used other than OpenSSL. If you modify file(s) with this + 28 exception, you may extend this exception to your version of the file(s), + 29 but you are not obligated to do so. If you do not wish to do so, delete + 30 this exception statement from your version. If you delete this exception + 31 statement from all source files in the program, then also delete it here. + 32 33 */ 34 35 (function() { diff --git a/deluge/ui/web/docs/symbols/src/Deluge.Details.Details.js.html b/deluge/ui/web/docs/symbols/src/Deluge.Details.Details.js.html index 5b2d99acd..3064895ba 100644 --- a/deluge/ui/web/docs/symbols/src/Deluge.Details.Details.js.html +++ b/deluge/ui/web/docs/symbols/src/Deluge.Details.Details.js.html @@ -26,22 +26,22 @@ 19 The Free Software Foundation, Inc., 20 51 Franklin Street, Fifth Floor 21 Boston, MA 02110-1301, USA. - 22 # - 23 # In addition, as a special exception, the copyright holders give - 24 # permission to link the code of portions of this program with the OpenSSL - 25 # library. - 26 # You must obey the GNU General Public License in all respects for all of - 27 # the code used other than OpenSSL. If you modify file(s) with this - 28 # exception, you may extend this exception to your version of the file(s), - 29 # but you are not obligated to do so. If you do not wish to do so, delete - 30 # this exception statement from your version. If you delete this exception - 31 # statement from all source files in the program, then also delete it here. - 32 # + 22 + 23 In addition, as a special exception, the copyright holders give + 24 permission to link the code of portions of this program with the OpenSSL + 25 library. + 26 You must obey the GNU General Public License in all respects for all of + 27 the code used other than OpenSSL. If you modify file(s) with this + 28 exception, you may extend this exception to your version of the file(s), + 29 but you are not obligated to do so. If you do not wish to do so, delete + 30 this exception statement from your version. If you delete this exception + 31 statement from all source files in the program, then also delete it here. + 32 33 */ 34 35 Ext.deluge.details.DetailsTab = Ext.extend(Ext.Panel, { 36 title: _('Details'), - 37 cls: 'x-deluge-status', + 37 bodyStyle: 'padding 5px', 38 39 onRender: function(ct, position) { 40 Ext.deluge.details.DetailsTab.superclass.onRender.call(this, ct, position); @@ -49,46 +49,47 @@ 42 url: '/render/tab_details.html', 43 text: _('Loading') + '...' 44 }); - 45 this.getUpdater().on('update', this.onPanelUpdate, this); - 46 }, - 47 - 48 clear: function() { - 49 if (!this.fields) return; - 50 for (var k in this.fields) { - 51 this.fields[k].innerHTML = ''; - 52 } - 53 }, - 54 - 55 update: function(torrentId) { - 56 Deluge.Client.core.get_torrent_status(torrentId, Deluge.Keys.Details, { - 57 success: this.onRequestComplete, - 58 scope: this, - 59 torrentId: torrentId - 60 }); - 61 }, - 62 - 63 onPanelUpdate: function(el, response) { - 64 this.fields = {}; - 65 Ext.each(Ext.query('dd', this.body.dom), function(field) { - 66 this.fields[field.className] = field; - 67 }, this); - 68 }, - 69 - 70 onRequestComplete: function(torrent, options) { - 71 var data = { - 72 torrent_name: torrent.name, - 73 hash: options.torrentId, - 74 path: torrent.save_path, - 75 size: fsize(torrent.total_size), - 76 files: torrent.num_files, - 77 status: torrent.tracker_status, - 78 tracker: torrent.tracker, - 79 comment: torrent.comment - 80 }; - 81 - 82 for (var field in this.fields) { - 83 this.fields[field].innerHTML = data[field]; - 84 } - 85 } - 86 }); - 87 Deluge.Details.add(new Ext.deluge.details.DetailsTab()); \ No newline at end of file + 45 this.body.setStyle('padding', '5px'); + 46 this.getUpdater().on('update', this.onPanelUpdate, this); + 47 }, + 48 + 49 clear: function() { + 50 if (!this.fields) return; + 51 for (var k in this.fields) { + 52 this.fields[k].innerHTML = ''; + 53 } + 54 }, + 55 + 56 update: function(torrentId) { + 57 Deluge.Client.core.get_torrent_status(torrentId, Deluge.Keys.Details, { + 58 success: this.onRequestComplete, + 59 scope: this, + 60 torrentId: torrentId + 61 }); + 62 }, + 63 + 64 onPanelUpdate: function(el, response) { + 65 this.fields = {}; + 66 Ext.each(Ext.query('dd', this.body.dom), function(field) { + 67 this.fields[field.className] = field; + 68 }, this); + 69 }, + 70 + 71 onRequestComplete: function(torrent, options) { + 72 var data = { + 73 torrent_name: torrent.name, + 74 hash: options.torrentId, + 75 path: torrent.save_path, + 76 size: fsize(torrent.total_size), + 77 files: torrent.num_files, + 78 status: torrent.tracker_status, + 79 tracker: torrent.tracker, + 80 comment: torrent.comment + 81 }; + 82 + 83 for (var field in this.fields) { + 84 this.fields[field].innerHTML = data[field]; + 85 } + 86 } + 87 }); + 88 Deluge.Details.add(new Ext.deluge.details.DetailsTab()); \ No newline at end of file diff --git a/deluge/ui/web/docs/symbols/src/Deluge.Details.Files.js.html b/deluge/ui/web/docs/symbols/src/Deluge.Details.Files.js.html index e9c4661d1..84a6441c6 100644 --- a/deluge/ui/web/docs/symbols/src/Deluge.Details.Files.js.html +++ b/deluge/ui/web/docs/symbols/src/Deluge.Details.Files.js.html @@ -26,184 +26,184 @@ 19 The Free Software Foundation, Inc., 20 51 Franklin Street, Fifth Floor 21 Boston, MA 02110-1301, USA. - 22 # - 23 # In addition, as a special exception, the copyright holders give - 24 # permission to link the code of portions of this program with the OpenSSL - 25 # library. - 26 # You must obey the GNU General Public License in all respects for all of - 27 # the code used other than OpenSSL. If you modify file(s) with this - 28 # exception, you may extend this exception to your version of the file(s), - 29 # but you are not obligated to do so. If you do not wish to do so, delete - 30 # this exception statement from your version. If you delete this exception - 31 # statement from all source files in the program, then also delete it here. - 32 # - 33 */ - 34 (function() { - 35 /* Renderers for the column tree */ - 36 function fileProgressRenderer(value) { - 37 var progress = value * 100; - 38 return Deluge.progressBar(progress, this.width - 50, progress.toFixed(2) + '%'); - 39 } - 40 function priorityRenderer(value) { - 41 return String.format('<div class="{0}">{1}</div>', FILE_PRIORITY_CSS[value], _(FILE_PRIORITY[value])); - 42 } - 43 - 44 Ext.deluge.details.FilesTab = Ext.extend(Ext.tree.ColumnTree, { - 45 - 46 constructor: function(config) { - 47 config = Ext.apply({ - 48 title: _('Files'), - 49 rootVisible: false, - 50 autoScroll: true, - 51 selModel: new Ext.tree.MultiSelectionModel(), - 52 - 53 columns: [{ - 54 header: _('Filename'), - 55 width: 330, - 56 dataIndex: 'filename' - 57 }, { - 58 header: _('Size'), - 59 width: 150, - 60 dataIndex: 'size', - 61 renderer: fsize - 62 }, { - 63 header: _('Progress'), - 64 width: 150, - 65 dataIndex: 'progress', - 66 renderer: fileProgressRenderer - 67 }, { - 68 header: _('Priority'), - 69 width: 150, - 70 dataIndex: 'priority', - 71 renderer: priorityRenderer - 72 }], - 73 - 74 root: new Ext.tree.TreeNode({ - 75 text: 'Files' - 76 }) - 77 }, config); - 78 Ext.deluge.details.FilesTab.superclass.constructor.call(this, config); - 79 }, - 80 - 81 onRender: function(ct, position) { - 82 Ext.deluge.details.FilesTab.superclass.onRender.call(this, ct, position); - 83 Deluge.Menus.FilePriorities.on('itemclick', this.onItemClick, this); - 84 this.on('contextmenu', this.onContextMenu, this); - 85 this.sorter = new Ext.tree.TreeSorter(this, { - 86 folderSort: true - 87 }); - 88 }, - 89 - 90 clear: function() { - 91 var root = this.getRootNode(); - 92 if (!root.hasChildNodes()) return; - 93 root.cascade(function(node) { - 94 var parent = node.parentNode; - 95 if (!parent) return; - 96 if (!parent.ownerTree) return; - 97 parent.removeChild(node); - 98 }); - 99 }, -100 -101 update: function(torrentId) { -102 if (this.torrentId != torrentId) { -103 this.clear(); -104 this.torrentId = torrentId; -105 } -106 -107 Deluge.Client.web.get_torrent_files(torrentId, { -108 success: this.onRequestComplete, -109 scope: this, -110 torrentId: torrentId -111 }); -112 }, -113 -114 onContextMenu: function(node, e) { -115 e.stopEvent(); -116 var selModel = this.getSelectionModel(); -117 if (selModel.getSelectedNodes().length < 2) { -118 selModel.clearSelections(); -119 node.select(); -120 } -121 Deluge.Menus.FilePriorities.showAt(e.getPoint()); -122 }, -123 -124 onItemClick: function(baseItem, e) { -125 switch (baseItem.id) { -126 case 'expandAll': -127 this.expandAll(); -128 break; -129 default: -130 var indexes = {}; -131 function walk(node) { -132 if (Ext.isEmpty(node.attributes.fileIndex)) return; -133 indexes[node.attributes.fileIndex] = node.attributes.priority; -134 } -135 this.getRootNode().cascade(walk); -136 -137 var nodes = this.getSelectionModel().getSelectedNodes(); -138 Ext.each(nodes, function(node) { -139 if (Ext.isEmpty(node.attributes.fileIndex)) return; -140 indexes[node.attributes.fileIndex] = baseItem.filePriority; -141 }); -142 -143 var priorities = new Array(Ext.keys(indexes).length); -144 for (var index in indexes) { -145 priorities[index] = indexes[index]; -146 } -147 -148 Deluge.Client.core.set_torrent_file_priorities(this.torrentId, priorities, { -149 success: function() { -150 Ext.each(nodes, function(node) { -151 node.setColumnValue(3, baseItem.filePriority); -152 }); -153 }, -154 scope: this -155 }); -156 break; -157 } -158 }, -159 -160 onRequestComplete: function(files, options) { -161 function walk(files, parent) { -162 for (var file in files) { -163 var item = files[file]; -164 var child = parent.findChild('id', file); -165 if (Ext.type(item) == 'object') { -166 if (!child) { -167 child = new Ext.tree.TreeNode({ -168 id: file, -169 text: file -170 }); -171 parent.appendChild(child); -172 } -173 walk(item, child); -174 } else { -175 if (!child) { -176 child = new Ext.tree.ColumnTreeNode({ -177 id: file, -178 filename: file, -179 text: file, // this needs to be here for sorting -180 fileIndex: item[0], -181 size: item[1], -182 progress: item[2], -183 priority: item[3], -184 leaf: true, -185 iconCls: 'x-deluge-file', -186 uiProvider: Ext.tree.ColumnNodeUI -187 }); -188 parent.appendChild(child); -189 } -190 child.setColumnValue(1, item[1]); -191 child.setColumnValue(2, item[2]); -192 child.setColumnValue(3, item[3]); -193 } -194 } -195 } -196 var root = this.getRootNode(); -197 walk(files, root); -198 root.firstChild.expand(); -199 } -200 }); -201 Deluge.Details.add(new Ext.deluge.details.FilesTab()); -202 })(); \ No newline at end of file + 22 + 23 In addition, as a special exception, the copyright holders give + 24 permission to link the code of portions of this program with the OpenSSL + 25 library. + 26 You must obey the GNU General Public License in all respects for all of + 27 the code used other than OpenSSL. If you modify file(s) with this + 28 exception, you may extend this exception to your version of the file(s), + 29 but you are not obligated to do so. If you do not wish to do so, delete + 30 this exception statement from your version. If you delete this exception + 31 statement from all source files in the program, then also delete it here. + 32 */ + 33 (function() { + 34 /* Renderers for the column tree */ + 35 function fileProgressRenderer(value) { + 36 var progress = value * 100; + 37 return Deluge.progressBar(progress, this.width - 50, progress.toFixed(2) + '%', 0); + 38 } + 39 function priorityRenderer(value) { + 40 return String.format('<div class="{0}">{1}</div>', FILE_PRIORITY_CSS[value], _(FILE_PRIORITY[value])); + 41 } + 42 + 43 Ext.deluge.details.FilesTab = Ext.extend(Ext.tree.ColumnTree, { + 44 + 45 constructor: function(config) { + 46 config = Ext.apply({ + 47 title: _('Files'), + 48 rootVisible: false, + 49 autoScroll: true, + 50 selModel: new Ext.tree.MultiSelectionModel(), + 51 + 52 columns: [{ + 53 header: _('Filename'), + 54 width: 330, + 55 dataIndex: 'filename' + 56 }, { + 57 header: _('Size'), + 58 width: 150, + 59 dataIndex: 'size', + 60 renderer: fsize + 61 }, { + 62 header: _('Progress'), + 63 width: 150, + 64 dataIndex: 'progress', + 65 renderer: fileProgressRenderer + 66 }, { + 67 header: _('Priority'), + 68 width: 150, + 69 dataIndex: 'priority', + 70 renderer: priorityRenderer + 71 }], + 72 + 73 root: new Ext.tree.TreeNode({ + 74 text: 'Files' + 75 }) + 76 }, config); + 77 Ext.deluge.details.FilesTab.superclass.constructor.call(this, config); + 78 }, + 79 + 80 onRender: function(ct, position) { + 81 Ext.deluge.details.FilesTab.superclass.onRender.call(this, ct, position); + 82 Deluge.Menus.FilePriorities.on('itemclick', this.onItemClick, this); + 83 this.on('contextmenu', this.onContextMenu, this); + 84 this.sorter = new Ext.tree.TreeSorter(this, { + 85 folderSort: true + 86 }); + 87 }, + 88 + 89 clear: function() { + 90 var root = this.getRootNode(); + 91 if (!root.hasChildNodes()) return; + 92 root.cascade(function(node) { + 93 var parent = node.parentNode; + 94 if (!parent) return; + 95 if (!parent.ownerTree) return; + 96 parent.removeChild(node); + 97 }); + 98 }, + 99 +100 update: function(torrentId) { +101 if (this.torrentId != torrentId) { +102 this.clear(); +103 this.torrentId = torrentId; +104 } +105 +106 Deluge.Client.web.get_torrent_files(torrentId, { +107 success: this.onRequestComplete, +108 scope: this, +109 torrentId: torrentId +110 }); +111 }, +112 +113 onContextMenu: function(node, e) { +114 e.stopEvent(); +115 var selModel = this.getSelectionModel(); +116 if (selModel.getSelectedNodes().length < 2) { +117 selModel.clearSelections(); +118 node.select(); +119 } +120 Deluge.Menus.FilePriorities.showAt(e.getPoint()); +121 }, +122 +123 onItemClick: function(baseItem, e) { +124 switch (baseItem.id) { +125 case 'expandAll': +126 this.expandAll(); +127 break; +128 default: +129 var indexes = {}; +130 function walk(node) { +131 if (Ext.isEmpty(node.attributes.fileIndex)) return; +132 indexes[node.attributes.fileIndex] = node.attributes.priority; +133 } +134 this.getRootNode().cascade(walk); +135 +136 var nodes = this.getSelectionModel().getSelectedNodes(); +137 Ext.each(nodes, function(node) { +138 if (Ext.isEmpty(node.attributes.fileIndex)) return; +139 indexes[node.attributes.fileIndex] = baseItem.filePriority; +140 }); +141 +142 var priorities = new Array(Ext.keys(indexes).length); +143 for (var index in indexes) { +144 priorities[index] = indexes[index]; +145 } +146 +147 Deluge.Client.core.set_torrent_file_priorities(this.torrentId, priorities, { +148 success: function() { +149 Ext.each(nodes, function(node) { +150 node.setColumnValue(3, baseItem.filePriority); +151 }); +152 }, +153 scope: this +154 }); +155 break; +156 } +157 }, +158 +159 onRequestComplete: function(files, options) { +160 function walk(files, parent) { +161 for (var file in files) { +162 var item = files[file]; +163 var child = parent.findChild('id', file); +164 if (Ext.type(item) == 'object') { +165 if (!child) { +166 child = new Ext.tree.TreeNode({ +167 id: file, +168 text: file +169 }); +170 parent.appendChild(child); +171 } +172 walk(item, child); +173 } else { +174 if (!child) { +175 child = new Ext.tree.ColumnTreeNode({ +176 id: file, +177 filename: file, +178 text: file, // this needs to be here for sorting +179 fileIndex: item[0], +180 size: item[1], +181 progress: item[2], +182 priority: item[3], +183 leaf: true, +184 iconCls: 'x-deluge-file', +185 uiProvider: Ext.tree.ColumnNodeUI +186 }); +187 parent.appendChild(child); +188 } +189 child.setColumnValue(1, item[1]); +190 child.setColumnValue(2, item[2]); +191 child.setColumnValue(3, item[3]); +192 } +193 } +194 } +195 var root = this.getRootNode(); +196 walk(files, root); +197 root.firstChild.expand(); +198 } +199 }); +200 Deluge.Details.add(new Ext.deluge.details.FilesTab()); +201 })(); +202 \ No newline at end of file diff --git a/deluge/ui/web/docs/symbols/src/Deluge.Details.Options.js.html b/deluge/ui/web/docs/symbols/src/Deluge.Details.Options.js.html index 0771ecaec..0bacdd851 100644 --- a/deluge/ui/web/docs/symbols/src/Deluge.Details.Options.js.html +++ b/deluge/ui/web/docs/symbols/src/Deluge.Details.Options.js.html @@ -64,157 +64,157 @@ 57 58 this.fieldsets = {}, this.fields = {}; 59 this.optionsManager = new Deluge.OptionsManager(); - 60 - 61 /* - 62 * Bandwidth Options - 63 */ - 64 this.fieldsets.bandwidth = this.add({ - 65 xtype: 'fieldset', - 66 defaultType: 'uxspinner', - 67 bodyStyle: 'padding: 5px', - 68 - 69 layout: 'table', - 70 layoutConfig: {columns: 3}, - 71 labelWidth: 150, - 72 - 73 style: 'margin-left: 10px; margin-right: 5px; padding: 5px', - 74 title: _('Bandwidth'), - 75 width: 300 - 76 }); - 77 - 78 /* - 79 * Max Download Speed - 80 */ - 81 this.fieldsets.bandwidth.add({ - 82 xtype: 'label', - 83 text: _('Max Download Speed'), - 84 forId: 'max_download_speed', - 85 cls: 'x-deluge-options-label' - 86 }); - 87 this.fields.max_download_speed = this.fieldsets.bandwidth.add({ - 88 id: 'max_download_speed', - 89 name: 'max_download_speed', - 90 width: 100, - 91 value: -1, + 60 this.optionsManager.on('changed', this.onOptionChanged, this); + 61 + 62 /* + 63 * Bandwidth Options + 64 */ + 65 this.fieldsets.bandwidth = this.add({ + 66 xtype: 'fieldset', + 67 defaultType: 'uxspinner', + 68 bodyStyle: 'padding: 5px', + 69 + 70 layout: 'table', + 71 layoutConfig: {columns: 3}, + 72 labelWidth: 150, + 73 + 74 style: 'margin-left: 10px; margin-right: 5px; padding: 5px', + 75 title: _('Bandwidth'), + 76 width: 250 + 77 }); + 78 + 79 /* + 80 * Max Download Speed + 81 */ + 82 this.fieldsets.bandwidth.add({ + 83 xtype: 'label', + 84 text: _('Max Download Speed'), + 85 forId: 'max_download_speed', + 86 cls: 'x-deluge-options-label' + 87 }); + 88 this.fields.max_download_speed = this.fieldsets.bandwidth.add({ + 89 id: 'max_download_speed', + 90 name: 'max_download_speed', + 91 width: 70, 92 stragegy: new Ext.ux.form.Spinner.NumberStrategy({ 93 minValue: -1, - 94 maxValue: 99999, - 95 incrementValue: 1 - 96 }), - 97 listeners: { - 98 'spin': { - 99 fn: this.onFieldChange, -100 scope: this -101 }, -102 'keypress': { -103 fn: this.onFieldChange, -104 scope: this -105 } -106 } -107 }); -108 this.fieldsets.bandwidth.add({ -109 xtype: 'label', -110 text: _('KiB/s'), -111 style: 'margin-left: 10px' -112 }); -113 -114 /* -115 * Max Upload Speed -116 */ -117 this.fieldsets.bandwidth.add({ -118 xtype: 'label', -119 text: _('Max Upload Speed'), -120 forId: 'max_upload_speed', -121 cls: 'x-deluge-options-label' -122 }); -123 this.fields.max_upload_speed = this.fieldsets.bandwidth.add({ -124 id: 'max_upload_speed', -125 name: 'max_upload_speed', -126 width: 100, -127 value: -1, -128 stragegy: new Ext.ux.form.Spinner.NumberStrategy({ -129 minValue: -1, -130 maxValue: 99999, -131 incrementValue: 1 -132 }), -133 listeners: { -134 'spin': { -135 fn: this.onFieldChange, -136 scope: this -137 }, -138 'keypress': { -139 fn: this.onFieldChange, -140 scope: this -141 } -142 } -143 }); -144 this.fieldsets.bandwidth.add({ -145 xtype: 'label', -146 text: _('KiB/s'), -147 style: 'margin-left: 10px' -148 }); -149 -150 /* -151 * Max Connections -152 */ -153 this.fieldsets.bandwidth.add({ -154 xtype: 'label', -155 text: _('Max Connections'), -156 forId: 'max_connections', -157 cls: 'x-deluge-options-label' -158 }); -159 this.fields.max_connections = this.fieldsets.bandwidth.add({ -160 id: 'max_connections', -161 name: 'max_connections', -162 width: 100, -163 value: -1, -164 stragegy: new Ext.ux.form.Spinner.NumberStrategy({ -165 minValue: -1, -166 maxValue: 99999, -167 incrementValue: 1 -168 }), -169 listeners: { -170 'spin': { -171 fn: this.onFieldChange, -172 scope: this -173 }, -174 'keypress': { -175 fn: this.onFieldChange, -176 scope: this -177 } -178 } + 94 maxValue: 99999 + 95 }), + 96 listeners: { + 97 'spin': { + 98 fn: this.onFieldChange, + 99 scope: this +100 }, +101 'keypress': { +102 fn: this.onFieldChange, +103 scope: this +104 } +105 } +106 }); +107 this.fieldsets.bandwidth.add({ +108 xtype: 'label', +109 text: _('KiB/s'), +110 style: 'margin-left: 10px' +111 }); +112 +113 /* +114 * Max Upload Speed +115 */ +116 this.fieldsets.bandwidth.add({ +117 xtype: 'label', +118 text: _('Max Upload Speed'), +119 forId: 'max_upload_speed', +120 cls: 'x-deluge-options-label' +121 }); +122 this.fields.max_upload_speed = this.fieldsets.bandwidth.add({ +123 id: 'max_upload_speed', +124 name: 'max_upload_speed', +125 width: 70, +126 value: -1, +127 stragegy: new Ext.ux.form.Spinner.NumberStrategy({ +128 minValue: -1, +129 maxValue: 99999, +130 incrementValue: 1 +131 }), +132 listeners: { +133 'spin': { +134 fn: this.onFieldChange, +135 scope: this +136 }, +137 'keypress': { +138 fn: this.onFieldChange, +139 scope: this +140 } +141 } +142 }); +143 this.fieldsets.bandwidth.add({ +144 xtype: 'label', +145 text: _('KiB/s'), +146 style: 'margin-left: 10px' +147 }); +148 +149 /* +150 * Max Connections +151 */ +152 this.fieldsets.bandwidth.add({ +153 xtype: 'label', +154 text: _('Max Connections'), +155 forId: 'max_connections', +156 cls: 'x-deluge-options-label' +157 }); +158 this.fields.max_connections = this.fieldsets.bandwidth.add({ +159 id: 'max_connections', +160 name: 'max_connections', +161 width: 70, +162 value: -1, +163 stragegy: new Ext.ux.form.Spinner.NumberStrategy({ +164 minValue: -1, +165 maxValue: 99999, +166 incrementValue: 1 +167 }), +168 listeners: { +169 'spin': { +170 fn: this.onFieldChange, +171 scope: this +172 }, +173 'keypress': { +174 fn: this.onFieldChange, +175 scope: this +176 } +177 }, +178 colspan: 2 179 }); -180 this.fieldsets.bandwidth.add({xtype: 'label'}); -181 -182 /* -183 * Max Upload Slots -184 */ -185 this.fieldsets.bandwidth.add({ -186 xtype: 'label', -187 text: _('Max Upload Slots'), -188 forId: 'max_upload_slots', -189 cls: 'x-deluge-options-label' -190 }); -191 this.fields.max_upload_slots = this.fieldsets.bandwidth.add({ -192 id: 'max_upload_slots', -193 name: 'max_upload_slots', -194 width: 100, -195 value: -1, -196 stragegy: new Ext.ux.form.Spinner.NumberStrategy({ -197 minValue: -1, -198 maxValue: 99999, -199 incrementValue: 1 -200 }), -201 listeners: { -202 'spin': { -203 fn: this.onFieldChange, -204 scope: this -205 }, -206 'keypress': { -207 fn: this.onFieldChange, -208 scope: this -209 } -210 } +180 +181 /* +182 * Max Upload Slots +183 */ +184 this.fieldsets.bandwidth.add({ +185 xtype: 'label', +186 text: _('Max Upload Slots'), +187 forId: 'max_upload_slots', +188 cls: 'x-deluge-options-label' +189 }); +190 this.fields.max_upload_slots = this.fieldsets.bandwidth.add({ +191 id: 'max_upload_slots', +192 name: 'max_upload_slots', +193 width: 70, +194 value: -1, +195 stragegy: new Ext.ux.form.Spinner.NumberStrategy({ +196 minValue: -1, +197 maxValue: 99999, +198 incrementValue: 1 +199 }), +200 listeners: { +201 'spin': { +202 fn: this.onFieldChange, +203 scope: this +204 }, +205 'keypress': { +206 fn: this.onFieldChange, +207 scope: this +208 } +209 }, +210 colspan: 2 211 }); 212 213 /* @@ -224,227 +224,278 @@ 217 xtype: 'fieldset', 218 title: _('Queue'), 219 style: 'margin-left: 5px; margin-right: 5px; padding: 5px', -220 width: 200, -221 defaults: { -222 fieldLabel: '', -223 labelSeparator: '' -224 } -225 }); -226 -227 this.fields.is_auto_managed = this.fieldsets.queue.add({ -228 fieldLabel: '', -229 labelSeparator: '', -230 id: 'is_auto_managed', -231 boxLabel: _('Auto Managed'), -232 listeners: { -233 'check': { -234 fn: this.onFieldChange, -235 scope: this -236 } -237 } -238 }); -239 -240 this.fields.stop_at_ratio = this.fieldsets.queue.add({ -241 fieldLabel: '', -242 labelSeparator: '', -243 id: 'stop_at_ratio', -244 boxLabel: _('Stop seed at ratio'), -245 listeners: { -246 'check': { -247 fn: this.onFieldChange, -248 scope: this -249 } -250 } -251 }); -252 -253 this.fields.remove_at_ratio = this.fieldsets.queue.add({ -254 fieldLabel: '', -255 labelSeparator: '', -256 id: 'remove_at_ratio', -257 style: 'margin-left: 10px', -258 boxLabel: _('Remove at ratio'), -259 listeners: { -260 'check': { -261 fn: this.onFieldChange, -262 scope: this -263 } -264 } -265 }); -266 -267 this.fields.move_completed = this.fieldsets.queue.add({ -268 fieldLabel: '', -269 labelSeparator: '', -270 id: 'move_completed', -271 boxLabel: _('Move Completed'), +220 width: 210, +221 +222 layout: 'table', +223 layoutConfig: {columns: 2}, +224 labelWidth: 0, +225 +226 defaults: { +227 fieldLabel: '', +228 labelSeparator: '' +229 } +230 }); +231 +232 this.fields.is_auto_managed = this.fieldsets.queue.add({ +233 fieldLabel: '', +234 labelSeparator: '', +235 id: 'is_auto_managed', +236 boxLabel: _('Auto Managed'), +237 width: 200, +238 listeners: { +239 'check': { +240 fn: this.onFieldChange, +241 scope: this +242 } +243 }, +244 colspan: 2 +245 }); +246 +247 this.fields.stop_at_ratio = this.fieldsets.queue.add({ +248 fieldLabel: '', +249 labelSeparator: '', +250 id: 'stop_at_ratio', +251 width: 110, +252 boxLabel: _('Stop seed at ratio'), +253 listeners: { +254 'check': { +255 fn: this.onFieldChange, +256 scope: this +257 } +258 } +259 }); +260 this.fields.stop_ratio = this.fieldsets.queue.add({ +261 xtype: 'uxspinner', +262 id: 'stop_ratio', +263 name: 'stop_ratio', +264 disabled: true, +265 width: 50, +266 value: 2.0, +267 stragegy: new Ext.ux.form.Spinner.NumberStrategy({ +268 minValue: -1, +269 maxValue: 99999, +270 incrementValue: 1 +271 }), 272 listeners: { -273 'check': { +273 'spin': { 274 fn: this.onFieldChange, 275 scope: this -276 } -277 } -278 }); -279 -280 -281 /* -282 * General Options -283 */ -284 this.rightColumn = this.add({ -285 border: false, -286 autoHeight: true, -287 style: 'margin-left: 5px', -288 width: 200 -289 }); -290 -291 this.fieldsets.general = this.rightColumn.add({ -292 xtype: 'fieldset', -293 autoHeight: true, -294 defaultType: 'checkbox', -295 title: _('General'), -296 layout: 'form' -297 }); -298 -299 this.fields['private'] = this.fieldsets.general.add({ -300 fieldLabel: '', -301 labelSeparator: '', -302 boxLabel: _('Private'), -303 id: 'private', -304 listeners: { -305 'check': { -306 fn: this.onFieldChange, -307 scope: this -308 } -309 } -310 }); -311 -312 this.fields.prioritize_first_last = this.fieldsets.general.add({ -313 fieldLabel: '', -314 labelSeparator: '', -315 boxLabel: _('Prioritize First/Last'), -316 id: 'prioritize_first_last', -317 listeners: { -318 'check': { -319 fn: this.onFieldChange, -320 scope: this -321 } -322 } +276 }, +277 'keypress': { +278 fn: this.onFieldChange, +279 scope: this +280 } +281 } +282 }); +283 +284 this.fields.remove_at_ratio = this.fieldsets.queue.add({ +285 fieldLabel: '', +286 labelSeparator: '', +287 id: 'remove_at_ratio', +288 bodyStyle: 'padding-left: 10px', +289 boxLabel: _('Remove at ratio'), +290 disabled: true, +291 listeners: { +292 'check': { +293 fn: this.onFieldChange, +294 scope: this +295 } +296 }, +297 colspan: 2 +298 }); +299 +300 this.fields.move_completed = this.fieldsets.queue.add({ +301 fieldLabel: '', +302 labelSeparator: '', +303 id: 'move_completed', +304 boxLabel: _('Move Completed'), +305 listeners: { +306 'check': { +307 fn: this.onFieldChange, +308 scope: this +309 } +310 }, +311 colspan: 2 +312 }); +313 +314 +315 /* +316 * General Options +317 */ +318 this.rightColumn = this.add({ +319 border: false, +320 autoHeight: true, +321 style: 'margin-left: 5px', +322 width: 200 323 }); 324 -325 /* -326 * Buttons -327 */ -328 this.buttonPanel = this.rightColumn.add({ -329 layout: 'column', -330 xtype: 'panel', -331 border: false -332 }); -333 -334 // The buttons below are required to be added to a panel -335 // first as simply adding them to the column layout throws an -336 // error c.getSize() does not exist. This could be intentional -337 // or it may possible be a bug in ext-js. Take care when upgrading -338 // to ext-js 3.0. -339 -340 /* -341 * Edit Trackers button -342 */ -343 this.buttonPanel.add({ -344 xtype: 'panel', -345 border: false -346 }).add({ -347 id: 'edit_trackers', -348 xtype: 'button', -349 text: _('Edit Trackers'), -350 cls: 'x-btn-text-icon', -351 iconCls: 'x-deluge-edit-trackers', -352 border: false, -353 width: 100, -354 handler: this.onEditTrackers, -355 scope: this -356 }); -357 -358 /* -359 * Apply button -360 */ -361 this.buttonPanel.add({ -362 xtype: 'panel', -363 border: false -364 }).add({ -365 id: 'apply', -366 xtype: 'button', -367 text: _('Apply'), -368 style: 'margin-left: 10px;', -369 border: false, -370 width: 100, -371 handler: this.onApply, -372 scope: this -373 }); -374 }, -375 -376 onRender: function(ct, position) { -377 Ext.deluge.details.OptionsTab.superclass.onRender.call(this, ct, position); -378 -379 // This is another hack I think, so keep an eye out here when upgrading. -380 this.layout = new Ext.layout.ColumnLayout(); -381 this.layout.setContainer(this); -382 this.doLayout(); -383 }, -384 -385 clear: function() { -386 this.fields.max_download_speed.setValue(0); -387 this.fields.max_upload_speed.setValue(0); -388 this.fields.max_connections.setValue(0); -389 this.fields.max_upload_slots.setValue(0); -390 this.fields.is_auto_managed.setValue(false); -391 this.fields.stop_at_ratio.setValue(false); -392 this.fields.remove_at_ratio.setValue(false); -393 this.fields['private'].setValue(false); -394 this.fields.prioritize_first_last.setValue(false); -395 }, -396 -397 reset: function() { -398 if (this.torrentId) { -399 this.optionsManager.resetOptions(this.torrentId); -400 } -401 }, -402 -403 update: function(torrentId) { -404 this.torrentId = torrentId; -405 Deluge.Client.core.get_torrent_status(torrentId, Deluge.Keys.Options, { -406 success: this.onRequestComplete, -407 scope: this -408 }); -409 }, -410 -411 onApply: function() { -412 var changed = this.optionsManager.getChanged(this.torrentId); -413 alert(Ext.encode(changed)); -414 Deluge.Client.core.set_torrent_options([this.torrentId], changed, { -415 success: function() { -416 this.optionsManager.updateOptions(this.torrentId, changed); -417 this.optionsManager.resetOptions(this.torrentId); -418 }, -419 scope: this -420 }); -421 }, -422 -423 onEditTrackers: function() { -424 Deluge.EditTrackers.show(); -425 }, -426 -427 onFieldChange: function(field) { -428 if (field.getValue() != this.optionsManager.getDefault(this.torrentId, field.id)) { -429 this.optionsManager.setOption(this.torrentId, field.id, field.getValue()); -430 } -431 }, -432 -433 onRequestComplete: function(torrent, options) { -434 this.optionsManager.updateOptions(this.torrentId, torrent); -435 for (var key in torrent) { -436 if (this.fields[key] && !this.optionsManager.hasChanged(this.torrentId, key)) { -437 this.fields[key].setValue(torrent[key]) -438 } -439 } -440 } -441 }); -442 Deluge.Details.add(new Ext.deluge.details.OptionsTab()); -443 \ No newline at end of file +325 this.fieldsets.general = this.rightColumn.add({ +326 xtype: 'fieldset', +327 autoHeight: true, +328 defaultType: 'checkbox', +329 title: _('General'), +330 layout: 'form' +331 }); +332 +333 this.fields['private'] = this.fieldsets.general.add({ +334 fieldLabel: '', +335 labelSeparator: '', +336 boxLabel: _('Private'), +337 id: 'private', +338 listeners: { +339 'check': { +340 fn: this.onFieldChange, +341 scope: this +342 } +343 } +344 }); +345 +346 this.fields.prioritize_first_last = this.fieldsets.general.add({ +347 fieldLabel: '', +348 labelSeparator: '', +349 boxLabel: _('Prioritize First/Last'), +350 id: 'prioritize_first_last', +351 listeners: { +352 'check': { +353 fn: this.onFieldChange, +354 scope: this +355 } +356 } +357 }); +358 +359 /* +360 * Buttons +361 */ +362 this.buttonPanel = this.rightColumn.add({ +363 layout: 'column', +364 xtype: 'panel', +365 border: false +366 }); +367 +368 // The buttons below are required to be added to a panel +369 // first as simply adding them to the column layout throws an +370 // error c.getSize() does not exist. This could be intentional +371 // or it may possible be a bug in ext-js. Take care when upgrading +372 // to ext-js 3.0. +373 +374 /* +375 * Edit Trackers button +376 */ +377 this.buttonPanel.add({ +378 xtype: 'panel', +379 border: false +380 }).add({ +381 id: 'edit_trackers', +382 xtype: 'button', +383 text: _('Edit Trackers'), +384 cls: 'x-btn-text-icon', +385 iconCls: 'x-deluge-edit-trackers', +386 border: false, +387 width: 100, +388 handler: this.onEditTrackers, +389 scope: this +390 }); +391 +392 /* +393 * Apply button +394 */ +395 this.buttonPanel.add({ +396 xtype: 'panel', +397 border: false +398 }).add({ +399 id: 'apply', +400 xtype: 'button', +401 text: _('Apply'), +402 style: 'margin-left: 10px;', +403 border: false, +404 width: 100, +405 handler: this.onApply, +406 scope: this +407 }); +408 }, +409 +410 onRender: function(ct, position) { +411 Ext.deluge.details.OptionsTab.superclass.onRender.call(this, ct, position); +412 +413 // This is another hack I think, so keep an eye out here when upgrading. +414 this.layout = new Ext.layout.ColumnLayout(); +415 this.layout.setContainer(this); +416 this.doLayout(); +417 }, +418 +419 clear: function() { +420 this.fields.max_download_speed.setValue(0); +421 this.fields.max_upload_speed.setValue(0); +422 this.fields.max_connections.setValue(0); +423 this.fields.max_upload_slots.setValue(0); +424 this.fields.is_auto_managed.setValue(false); +425 this.fields.stop_at_ratio.setValue(false); +426 this.fields.remove_at_ratio.setValue(false); +427 this.fields['private'].setValue(false); +428 this.fields.prioritize_first_last.setValue(false); +429 }, +430 +431 reset: function() { +432 if (this.torrentId) { +433 this.optionsManager.resetOptions(this.torrentId); +434 } +435 }, +436 +437 update: function(torrentId) { +438 this.torrentId = torrentId; +439 Deluge.Client.core.get_torrent_status(torrentId, Deluge.Keys.Options, { +440 success: this.onRequestComplete, +441 scope: this +442 }); +443 }, +444 +445 onApply: function() { +446 var changed = this.optionsManager.getChanged(this.torrentId); +447 if (!Ext.isEmpty(changed['prioritize_first_last'])) { +448 var value = changed['prioritize_first_last']; +449 Deluge.Client.core.set_torrent_prioritize_first_last(this.torrentId, value, { +450 success: function() { +451 this.optionsManager.updateOption(this.torrentId, 'prioritize_first_last', value); +452 }, +453 scope: this +454 }); +455 } +456 Deluge.Client.core.set_torrent_options([this.torrentId], changed, { +457 success: function() { +458 this.optionsManager.updateOptions(this.torrentId, changed); +459 this.optionsManager.resetOptions(this.torrentId); +460 }, +461 scope: this +462 }); +463 }, +464 +465 onEditTrackers: function() { +466 Deluge.EditTrackers.show(); +467 }, +468 +469 onFieldChange: function(field) { +470 this.optionsManager.setOption(this.torrentId, field.id, field.getValue()); +471 }, +472 +473 onOptionChanged: function(id, key, newValue, oldValue) { +474 //alert(String.format('Key: {0}\nValue: {1}\nOld Value: {2}', key, newValue, oldValue)); +475 if (key == 'stop_at_ratio') { +476 this.fields.remove_at_ratio.setDisabled(!newValue); +477 this.fields.stop_ratio.setDisabled(!newValue); +478 } +479 }, +480 +481 onRequestComplete: function(torrent, options) { +482 this.fields['private'].setDisabled(!torrent['private']); +483 delete torrent['private']; +484 +485 this.optionsManager.updateOptions(this.torrentId, torrent); +486 for (var key in torrent) { +487 if (this.fields[key] && !this.optionsManager.hasChanged(this.torrentId, key)) { +488 if (!this.fields[key].disabled) this.fields[key].setValue(torrent[key]); +489 } +490 } +491 } +492 }); +493 Deluge.Details.add(new Ext.deluge.details.OptionsTab()); +494 \ No newline at end of file diff --git a/deluge/ui/web/docs/symbols/src/Deluge.Details.Peers.js.html b/deluge/ui/web/docs/symbols/src/Deluge.Details.Peers.js.html index 345555ad8..b1032da66 100644 --- a/deluge/ui/web/docs/symbols/src/Deluge.Details.Peers.js.html +++ b/deluge/ui/web/docs/symbols/src/Deluge.Details.Peers.js.html @@ -26,17 +26,17 @@ 19 The Free Software Foundation, Inc., 20 51 Franklin Street, Fifth Floor 21 Boston, MA 02110-1301, USA. - 22 # - 23 # In addition, as a special exception, the copyright holders give - 24 # permission to link the code of portions of this program with the OpenSSL - 25 # library. - 26 # You must obey the GNU General Public License in all respects for all of - 27 # the code used other than OpenSSL. If you modify file(s) with this - 28 # exception, you may extend this exception to your version of the file(s), - 29 # but you are not obligated to do so. If you do not wish to do so, delete - 30 # this exception statement from your version. If you delete this exception - 31 # statement from all source files in the program, then also delete it here. - 32 # + 22 + 23 In addition, as a special exception, the copyright holders give + 24 permission to link the code of portions of this program with the OpenSSL + 25 library. + 26 You must obey the GNU General Public License in all respects for all of + 27 the code used other than OpenSSL. If you modify file(s) with this + 28 exception, you may extend this exception to your version of the file(s), + 29 but you are not obligated to do so. If you do not wish to do so, delete + 30 this exception statement from your version. If you delete this exception + 31 statement from all source files in the program, then also delete it here. + 32 33 */ 34 35 (function() { @@ -142,12 +142,13 @@ 135 }, 136 137 onRequestComplete: function(torrent, options) { -138 var peers = new Array(); -139 Ext.each(torrent.peers, function(peer) { -140 peers.push([peer.country, peer.ip, peer.client, peer.progress, peer.down_speed, peer.up_speed, peer.seed]); -141 }, this); -142 this.getStore().loadData(peers); -143 } -144 }); -145 Deluge.Details.add(new Ext.deluge.details.PeersTab()); -146 })(); \ No newline at end of file +138 if (!torrent) return; +139 var peers = new Array(); +140 Ext.each(torrent.peers, function(peer) { +141 peers.push([peer.country, peer.ip, peer.client, peer.progress, peer.down_speed, peer.up_speed, peer.seed]); +142 }, this); +143 this.getStore().loadData(peers); +144 } +145 }); +146 Deluge.Details.add(new Ext.deluge.details.PeersTab()); +147 })(); \ No newline at end of file diff --git a/deluge/ui/web/docs/symbols/src/Deluge.Details.Status.js.html b/deluge/ui/web/docs/symbols/src/Deluge.Details.Status.js.html index 93d2d0185..82db3cf5e 100644 --- a/deluge/ui/web/docs/symbols/src/Deluge.Details.Status.js.html +++ b/deluge/ui/web/docs/symbols/src/Deluge.Details.Status.js.html @@ -26,21 +26,21 @@ 19 The Free Software Foundation, Inc., 20 51 Franklin Street, Fifth Floor 21 Boston, MA 02110-1301, USA. - 22 # - 23 # In addition, as a special exception, the copyright holders give - 24 # permission to link the code of portions of this program with the OpenSSL - 25 # library. - 26 # You must obey the GNU General Public License in all respects for all of - 27 # the code used other than OpenSSL. If you modify file(s) with this - 28 # exception, you may extend this exception to your version of the file(s), - 29 # but you are not obligated to do so. If you do not wish to do so, delete - 30 # this exception statement from your version. If you delete this exception - 31 # statement from all source files in the program, then also delete it here. - 32 # - 33 */ - 34 - 35 Ext.deluge.details.StatusTab = Ext.extend(Ext.Panel, { - 36 title: _('Status'), + 22 + 23 In addition, as a special exception, the copyright holders give + 24 permission to link the code of portions of this program with the OpenSSL + 25 library. + 26 You must obey the GNU General Public License in all respects for all of + 27 the code used other than OpenSSL. If you modify file(s) with this + 28 exception, you may extend this exception to your version of the file(s), + 29 but you are not obligated to do so. If you do not wish to do so, delete + 30 this exception statement from your version. If you delete this exception + 31 statement from all source files in the program, then also delete it here. + 32 */ + 33 + 34 Ext.deluge.details.StatusTab = Ext.extend(Ext.Panel, { + 35 title: _('Status'), + 36 autoScroll: true, 37 38 onRender: function(ct, position) { 39 Ext.deluge.details.StatusTab.superclass.onRender.call(this, ct, position); @@ -52,74 +52,76 @@ 45 46 this.status = this.add({ 47 cls: 'x-deluge-status', - 48 border: false, - 49 listeners: { - 50 'render': { - 51 fn: function(panel) { - 52 panel.load({ - 53 url: '/render/tab_status.html', - 54 text: _('Loading') + '...' - 55 }); - 56 panel.getUpdater().on('update', this.onPanelUpdate, this); - 57 }, - 58 scope: this - 59 } - 60 } - 61 }); - 62 }, - 63 - 64 clear: function() { - 65 if (!this.fields) return; - 66 this.progressBar.updateProgress(0, ' '); - 67 for (var k in this.fields) { - 68 this.fields[k].innerHTML = ''; - 69 } - 70 }, - 71 - 72 update: function(torrentId) { - 73 if (!this.fields) this.getFields(); - 74 Deluge.Client.core.get_torrent_status(torrentId, Deluge.Keys.Status, { - 75 success: this.onRequestComplete, - 76 scope: this - 77 }); - 78 }, - 79 - 80 onPanelUpdate: function(el, response) { - 81 this.fields = {}; - 82 Ext.each(Ext.query('dd', this.status.body.dom), function(field) { - 83 this.fields[field.className] = field; - 84 }, this); - 85 }, - 86 - 87 onRequestComplete: function(status) { - 88 seeders = status.total_seeds > -1 ? status.num_seeds + ' (' + status.total_seeds + ')' : status.num_seeds - 89 peers = status.total_peers > -1 ? status.num_peers + ' (' + status.total_peers + ')' : status.num_peers - 90 var data = { - 91 downloaded: fsize(status.total_done) + ' (' + fsize(status.total_payload_download) + ')', - 92 uploaded: fsize(status.total_uploaded) + ' (' + fsize(status.total_payload_upload) + ')', - 93 share: status.ratio.toFixed(3), - 94 announce: ftime(status.next_announce), - 95 tracker_status: status.tracker_status, - 96 downspeed: fspeed(status.download_payload_rate), - 97 upspeed: fspeed(status.upload_payload_rate), - 98 eta: ftime(status.eta), - 99 pieces: status.num_pieces + ' (' + fsize(status.piece_length) + ')', -100 seeders: seeders, -101 peers: peers, -102 avail: status.distributed_copies.toFixed(3), -103 active_time: ftime(status.active_time), -104 seeding_time: ftime(status.seeding_time), -105 seed_rank: status.seed_rank, -106 auto_managed: 'False', -107 time_added: fdate(status.time_added) -108 } -109 if (status.is_auto_managed) {data.auto_managed = 'True'} -110 -111 for (var field in this.fields) { -112 this.fields[field].innerHTML = data[field]; -113 } -114 var text = status.state + ' ' + status.progress.toFixed(2) + '%'; -115 this.progressBar.updateProgress(status.progress, text); -116 } -117 }); -118 Deluge.Details.add(new Ext.deluge.details.StatusTab()); \ No newline at end of file + 48 id: 'deluge-details-status', + 49 + 50 border: false, + 51 width: 1000, + 52 listeners: { + 53 'render': { + 54 fn: function(panel) { + 55 panel.load({ + 56 url: '/render/tab_status.html', + 57 text: _('Loading') + '...' + 58 }); + 59 panel.getUpdater().on('update', this.onPanelUpdate, this); + 60 }, + 61 scope: this + 62 } + 63 } + 64 }); + 65 }, + 66 + 67 clear: function() { + 68 this.progressBar.updateProgress(0, ' '); + 69 for (var k in this.fields) { + 70 this.fields[k].innerHTML = ''; + 71 } + 72 }, + 73 + 74 update: function(torrentId) { + 75 if (!this.fields) this.getFields(); + 76 Deluge.Client.core.get_torrent_status(torrentId, Deluge.Keys.Status, { + 77 success: this.onRequestComplete, + 78 scope: this + 79 }); + 80 }, + 81 + 82 onPanelUpdate: function(el, response) { + 83 this.fields = {}; + 84 Ext.each(Ext.query('dd', this.status.body.dom), function(field) { + 85 this.fields[field.className] = field; + 86 }, this); + 87 }, + 88 + 89 onRequestComplete: function(status) { + 90 seeders = status.total_seeds > -1 ? status.num_seeds + ' (' + status.total_seeds + ')' : status.num_seeds + 91 peers = status.total_peers > -1 ? status.num_peers + ' (' + status.total_peers + ')' : status.num_peers + 92 var data = { + 93 downloaded: fsize(status.total_done) + ' (' + fsize(status.total_payload_download) + ')', + 94 uploaded: fsize(status.total_uploaded) + ' (' + fsize(status.total_payload_upload) + ')', + 95 share: status.ratio.toFixed(3), + 96 announce: ftime(status.next_announce), + 97 tracker_status: status.tracker_status, + 98 downspeed: fspeed(status.download_payload_rate), + 99 upspeed: fspeed(status.upload_payload_rate), +100 eta: ftime(status.eta), +101 pieces: status.num_pieces + ' (' + fsize(status.piece_length) + ')', +102 seeders: seeders, +103 peers: peers, +104 avail: status.distributed_copies.toFixed(3), +105 active_time: ftime(status.active_time), +106 seeding_time: ftime(status.seeding_time), +107 seed_rank: status.seed_rank, +108 time_added: fdate(status.time_added) +109 } +110 data.auto_managed = _((status.is_auto_managed) ? 'True' : 'False'); +111 +112 for (var field in this.fields) { +113 this.fields[field].innerHTML = data[field]; +114 } +115 var text = status.state + ' ' + status.progress.toFixed(2) + '%'; +116 this.progressBar.updateProgress(status.progress, text); +117 } +118 }); +119 Deluge.Details.add(new Ext.deluge.details.StatusTab()); +120 \ No newline at end of file diff --git a/deluge/ui/web/docs/symbols/src/Deluge.Details.js.html b/deluge/ui/web/docs/symbols/src/Deluge.Details.js.html index 1896bf404..31a8eab1e 100644 --- a/deluge/ui/web/docs/symbols/src/Deluge.Details.js.html +++ b/deluge/ui/web/docs/symbols/src/Deluge.Details.js.html @@ -46,63 +46,65 @@ 39 constructor: function(config) { 40 config = Ext.apply({ 41 region: 'south', - 42 split: true, - 43 height: 220, - 44 minSize: 100, - 45 collapsible: true, - 46 margins: '0 5 5 5', - 47 activeTab: 0 - 48 }, config); - 49 Ext.deluge.details.TabPanel.superclass.constructor.call(this, config); - 50 }, - 51 - 52 clear: function() { - 53 this.items.each(function(panel) { - 54 if (panel.clear) panel.clear(); - 55 }); - 56 }, - 57 - 58 - 59 update: function(tab) { - 60 var torrent = Deluge.Torrents.getSelected(); - 61 if (!torrent) { - 62 this.items.each(function(tab) { - 63 tab.disable(); - 64 }); - 65 return; - 66 } - 67 - 68 this.items.each(function(tab) { - 69 tab.enable(); - 70 }); - 71 - 72 tab = tab || this.getActiveTab(); - 73 if (tab.update) tab.update(torrent.id); - 74 }, - 75 - 76 /* Event Handlers */ + 42 id: 'torrentDetails', + 43 split: true, + 44 height: 220, + 45 minSize: 100, + 46 collapsible: true, + 47 margins: '0 5 5 5', + 48 activeTab: 0 + 49 }, config); + 50 Ext.deluge.details.TabPanel.superclass.constructor.call(this, config); + 51 }, + 52 + 53 clear: function() { + 54 this.items.each(function(panel) { + 55 if (panel.clear) { + 56 panel.clear.defer(100, panel); + 57 panel.disable(); + 58 } + 59 }); + 60 }, + 61 + 62 + 63 update: function(tab) { + 64 var torrent = Deluge.Torrents.getSelected(); + 65 if (!torrent) { + 66 this.clear(); + 67 return; + 68 } + 69 + 70 this.items.each(function(tab) { + 71 if (tab.disabled) tab.enable(); + 72 }); + 73 + 74 tab = tab || this.getActiveTab(); + 75 if (tab.update) tab.update(torrent.id); + 76 }, 77 - 78 // We need to add the events in onRender since Deluge.Torrents hasn't - 79 // been created yet. - 80 onRender: function(ct, position) { - 81 Ext.deluge.details.TabPanel.superclass.onRender.call(this, ct, position); - 82 Deluge.Events.on('disconnect', this.clear, this); - 83 Deluge.Torrents.on('rowclick', this.onTorrentsClick, this); - 84 this.on('tabchange', this.onTabChange, this); - 85 - 86 Deluge.Torrents.getSelectionModel().on('selectionchange', function(selModel) { - 87 if (!selModel.hasSelection()) this.clear(); - 88 }, this); - 89 }, - 90 - 91 onTabChange: function(panel, tab) { - 92 this.update(tab); - 93 }, - 94 - 95 onTorrentsClick: function(grid, rowIndex, e) { - 96 this.update(); - 97 } - 98 }); - 99 Deluge.Details = new Ext.deluge.details.TabPanel(); -100 })(); -101 \ No newline at end of file + 78 /* Event Handlers */ + 79 + 80 // We need to add the events in onRender since Deluge.Torrents hasn't + 81 // been created yet. + 82 onRender: function(ct, position) { + 83 Ext.deluge.details.TabPanel.superclass.onRender.call(this, ct, position); + 84 Deluge.Events.on('disconnect', this.clear, this); + 85 Deluge.Torrents.on('rowclick', this.onTorrentsClick, this); + 86 this.on('tabchange', this.onTabChange, this); + 87 + 88 Deluge.Torrents.getSelectionModel().on('selectionchange', function(selModel) { + 89 if (!selModel.hasSelection()) this.clear(); + 90 }, this); + 91 }, + 92 + 93 onTabChange: function(panel, tab) { + 94 this.update(tab); + 95 }, + 96 + 97 onTorrentsClick: function(grid, rowIndex, e) { + 98 this.update(); + 99 } +100 }); +101 Deluge.Details = new Ext.deluge.details.TabPanel(); +102 })(); +103 \ No newline at end of file diff --git a/deluge/ui/web/docs/symbols/src/Deluge.EditTrackers.js.html b/deluge/ui/web/docs/symbols/src/Deluge.EditTrackers.js.html index 4d5f86cba..346558fee 100644 --- a/deluge/ui/web/docs/symbols/src/Deluge.EditTrackers.js.html +++ b/deluge/ui/web/docs/symbols/src/Deluge.EditTrackers.js.html @@ -26,17 +26,17 @@ 19 The Free Software Foundation, Inc., 20 51 Franklin Street, Fifth Floor 21 Boston, MA 02110-1301, USA. - 22 # - 23 # In addition, as a special exception, the copyright holders give - 24 # permission to link the code of portions of this program with the OpenSSL - 25 # library. - 26 # You must obey the GNU General Public License in all respects for all of - 27 # the code used other than OpenSSL. If you modify file(s) with this - 28 # exception, you may extend this exception to your version of the file(s), - 29 # but you are not obligated to do so. If you do not wish to do so, delete - 30 # this exception statement from your version. If you delete this exception - 31 # statement from all source files in the program, then also delete it here. - 32 # + 22 + 23 In addition, as a special exception, the copyright holders give + 24 permission to link the code of portions of this program with the OpenSSL + 25 library. + 26 You must obey the GNU General Public License in all respects for all of + 27 the code used other than OpenSSL. If you modify file(s) with this + 28 exception, you may extend this exception to your version of the file(s), + 29 but you are not obligated to do so. If you do not wish to do so, delete + 30 this exception statement from your version. If you delete this exception + 31 statement from all source files in the program, then also delete it here. + 32 33 */ 34 35 (function() { diff --git a/deluge/ui/web/docs/symbols/src/Deluge.Login.js.html b/deluge/ui/web/docs/symbols/src/Deluge.Login.js.html index ba08e8982..786160507 100644 --- a/deluge/ui/web/docs/symbols/src/Deluge.Login.js.html +++ b/deluge/ui/web/docs/symbols/src/Deluge.Login.js.html @@ -26,17 +26,17 @@ 19 The Free Software Foundation, Inc., 20 51 Franklin Street, Fifth Floor 21 Boston, MA 02110-1301, USA. - 22 # - 23 # In addition, as a special exception, the copyright holders give - 24 # permission to link the code of portions of this program with the OpenSSL - 25 # library. - 26 # You must obey the GNU General Public License in all respects for all of - 27 # the code used other than OpenSSL. If you modify file(s) with this - 28 # exception, you may extend this exception to your version of the file(s), - 29 # but you are not obligated to do so. If you do not wish to do so, delete - 30 # this exception statement from your version. If you delete this exception - 31 # statement from all source files in the program, then also delete it here. - 32 # + 22 + 23 In addition, as a special exception, the copyright holders give + 24 permission to link the code of portions of this program with the OpenSSL + 25 library. + 26 You must obey the GNU General Public License in all respects for all of + 27 the code used other than OpenSSL. If you modify file(s) with this + 28 exception, you may extend this exception to your version of the file(s), + 29 but you are not obligated to do so. If you do not wish to do so, delete + 30 this exception statement from your version. If you delete this exception + 31 statement from all source files in the program, then also delete it here. + 32 33 */ 34 35 (function(){ diff --git a/deluge/ui/web/docs/symbols/src/Deluge.Menus.js.html b/deluge/ui/web/docs/symbols/src/Deluge.Menus.js.html index 1d3812c38..645d98f51 100644 --- a/deluge/ui/web/docs/symbols/src/Deluge.Menus.js.html +++ b/deluge/ui/web/docs/symbols/src/Deluge.Menus.js.html @@ -26,17 +26,17 @@ 19 The Free Software Foundation, Inc., 20 51 Franklin Street, Fifth Floor 21 Boston, MA 02110-1301, USA. - 22 # - 23 # In addition, as a special exception, the copyright holders give - 24 # permission to link the code of portions of this program with the OpenSSL - 25 # library. - 26 # You must obey the GNU General Public License in all respects for all of - 27 # the code used other than OpenSSL. If you modify file(s) with this - 28 # exception, you may extend this exception to your version of the file(s), - 29 # but you are not obligated to do so. If you do not wish to do so, delete - 30 # this exception statement from your version. If you delete this exception - 31 # statement from all source files in the program, then also delete it here. - 32 # + 22 + 23 In addition, as a special exception, the copyright holders give + 24 permission to link the code of portions of this program with the OpenSSL + 25 library. + 26 You must obey the GNU General Public License in all respects for all of + 27 the code used other than OpenSSL. If you modify file(s) with this + 28 exception, you may extend this exception to your version of the file(s), + 29 but you are not obligated to do so. If you do not wish to do so, delete + 30 this exception statement from your version. If you delete this exception + 31 statement from all source files in the program, then also delete it here. + 32 33 */ 34 35 Deluge.Menus = { diff --git a/deluge/ui/web/docs/symbols/src/Deluge.OptionsManager.js.html b/deluge/ui/web/docs/symbols/src/Deluge.OptionsManager.js.html index 514ef126a..5362f5037 100644 --- a/deluge/ui/web/docs/symbols/src/Deluge.OptionsManager.js.html +++ b/deluge/ui/web/docs/symbols/src/Deluge.OptionsManager.js.html @@ -43,125 +43,146 @@ 36 * @namespace Deluge 37 * @class Deluge.OptionsManager 38 */ - 39 Deluge.OptionsManager = function(config) { - 40 this.changed = {}; - 41 this.options = {}; - 42 Deluge.OptionsManager.superclass.constructor.call(this); - 43 }; - 44 Ext.extend(Deluge.OptionsManager, Ext.util.Observable, { - 45 - 46 /** - 47 * Add a set of default options and values for an id to the options manager - 48 * @param {String} id - 49 * @param {Object} options The default options for the id. - 50 */ - 51 addOptions: function(id, options) { - 52 this.options[id] = options; - 53 }, - 54 - 55 /** - 56 * Returns the changed values for a specified id. - 57 * @param {String} id - 58 * @returns {Object} the changed options - 59 */ - 60 getChanged: function(id) { - 61 return (this.changed[id]) ? this.changed[id] : {}; - 62 }, - 63 - 64 /** - 65 * Get the default value for an option given an id and option name - 66 * @param {String} id - 67 * @param {String} option - 68 * @returns {Object} the value of the option - 69 */ - 70 getDefault: function(id, option) { - 71 return this.options[id][option]; - 72 }, - 73 - 74 /** - 75 * Check to see if the option has been changed. - 76 * @param {String} id - 77 * @param {String} option - 78 * @returns {Boolean} true if the option has been changed, else false. - 79 */ - 80 hasChanged: function(id, option) { - 81 return (this.changed[id] && !Ext.isEmpty(this.changed[id][option])); - 82 }, - 83 - 84 /** - 85 * Reset the options back to the default values for the specified id. - 86 * @param {String} id - 87 */ - 88 resetOptions: function(id) { - 89 if (!this.changed[id]) return; - 90 delete this.changed[id]; - 91 }, - 92 - 93 /** - 94 * Set the specified option for the passed in id. - 95 * @param {String} id - 96 * @param {String} option - 97 * @param {Object} value The new value for the option - 98 */ - 99 setOption: function(id, option, value) { -100 if (!this.changed[id]) this.changed[id] = {}; -101 -102 if (this.options[id][option] == value) { -103 if (!Ext.isEmpty(this.changed[id][option])) delete this.changed[id][option]; -104 return; -105 } -106 -107 if (Ext.type(this.options[id][option]) != Ext.type(value)) { -108 switch (Ext.type(this.options[id][option])) { -109 case 'string': -110 value = String(value); -111 break; -112 case 'number': -113 value = Number(value); -114 break; -115 case 'boolean': -116 value = Boolean(value); -117 break; -118 } -119 } -120 -121 this.changed[id][option] = value; -122 }, -123 -124 /** -125 * Set the specified options for the passed in id. -126 * @param {String} id -127 * @param {Object} options The option values to change. -128 */ -129 setOptions: function(id, options) { -130 if (!this.changed[id]) this.changed[id] = {}; -131 for (var key in options) { -132 this.setOption(id, key, options[key]); -133 } -134 }, -135 -136 /** -137 * Update the default value for the specified option and id. -138 * @param {String} id -139 * @param {String} option -140 * @param {Object} value; -141 */ -142 updateOption: function(id, option, value) { -143 this.options[id][option] = value; -144 }, -145 -146 /** -147 * Update the defaults for the specified id. -148 * @param {String} id -149 * @param {Object} options The option defaults to change. -150 */ -151 updateOptions: function(id, options) { -152 if (!this.options[id]) { -153 this.addOptions(id, options); -154 } else { -155 for (var key in options) { -156 this.updateOption(id, key, options[key]); -157 } -158 } -159 } -160 }); \ No newline at end of file + 39 Deluge.OptionsManager = Ext.extend(Ext.util.Observable, { + 40 + 41 constructor: function(config) { + 42 this.changed = {}; + 43 this.options = {}; + 44 Deluge.OptionsManager.superclass.constructor.call(this); + 45 + 46 this.addEvents({ + 47 'add': true, + 48 'changed': true, + 49 'reset': true + 50 }); + 51 }, + 52 + 53 /** + 54 * Add a set of default options and values for an id to the options manager + 55 * @param {String} id + 56 * @param {Object} options The default options for the id. + 57 */ + 58 addOptions: function(id, options) { + 59 this.options[id] = options; + 60 }, + 61 + 62 /** + 63 * Returns the changed values for a specified id. + 64 * @param {String} id + 65 * @returns {Object} the changed options + 66 */ + 67 getChanged: function(id) { + 68 return (this.changed[id]) ? this.changed[id] : {}; + 69 }, + 70 + 71 /** + 72 * Get the default value for an option given an id and option name + 73 * @param {String} id + 74 * @param {String} option + 75 * @returns {Object} the value of the option + 76 */ + 77 getDefault: function(id, option) { + 78 return this.options[id][option]; + 79 }, + 80 + 81 /** + 82 * Get the value for an option given an id and option name. + 83 * @param {String} id + 84 * @param {String} option + 85 * @returns {Object} the options value. + 86 */ + 87 getValue: function(id, option) { + 88 return (this.hasChanged(id, option)) ? this.changed[id][option] : this.options[id][option]; + 89 }, + 90 + 91 /** + 92 * Check to see if the option has been changed. + 93 * @param {String} id + 94 * @param {String} option + 95 * @returns {Boolean} true if the option has been changed, else false. + 96 */ + 97 hasChanged: function(id, option) { + 98 return (this.changed[id] && !Ext.isEmpty(this.changed[id][option])); + 99 }, +100 +101 /** +102 * Reset the options back to the default values for the specified id. +103 * @param {String} id +104 */ +105 resetOptions: function(id) { +106 if (!this.changed[id]) return; +107 delete this.changed[id]; +108 }, +109 +110 /** +111 * Set the specified option for the passed in id. +112 * @param {String} id +113 * @param {String} option +114 * @param {Object} value The new value for the option +115 */ +116 setOption: function(id, option, value) { +117 if (!this.changed[id]) this.changed[id] = {}; +118 +119 var oldValue = this.getValue(id, option); +120 if (this.options[id][option] == value) { +121 if (!Ext.isEmpty(this.changed[id][option])) delete this.changed[id][option]; +122 this.fireEvent('changed', id, option, value, oldValue); +123 return; +124 } +125 +126 if (Ext.type(this.options[id][option]) != Ext.type(value)) { +127 switch (Ext.type(this.options[id][option])) { +128 case 'string': +129 value = String(value); +130 break; +131 case 'number': +132 value = Number(value); +133 break; +134 case 'boolean': +135 value = Boolean(value); +136 break; +137 } +138 } +139 +140 this.changed[id][option] = value; +141 this.fireEvent('changed', id, option, value, oldValue); +142 }, +143 +144 /** +145 * Set the specified options for the passed in id. +146 * @param {String} id +147 * @param {Object} options The option values to change. +148 */ +149 setOptions: function(id, options) { +150 if (!this.changed[id]) this.changed[id] = {}; +151 for (var key in options) { +152 this.setOption(id, key, options[key]); +153 } +154 }, +155 +156 /** +157 * Update the default value for the specified option and id. +158 * @param {String} id +159 * @param {String} option +160 * @param {Object} value; +161 */ +162 updateOption: function(id, option, value) { +163 this.options[id][option] = value; +164 }, +165 +166 /** +167 * Update the defaults for the specified id. +168 * @param {String} id +169 * @param {Object} options The option defaults to change. +170 */ +171 updateOptions: function(id, options) { +172 if (!this.options[id]) { +173 this.addOptions(id, options); +174 } else { +175 for (var key in options) { +176 this.updateOption(id, key, options[key]); +177 } +178 } +179 } +180 }); +181 \ No newline at end of file diff --git a/deluge/ui/web/docs/symbols/src/Deluge.Preferences.js.html b/deluge/ui/web/docs/symbols/src/Deluge.Preferences.js.html index e53f91be8..cf5593d76 100644 --- a/deluge/ui/web/docs/symbols/src/Deluge.Preferences.js.html +++ b/deluge/ui/web/docs/symbols/src/Deluge.Preferences.js.html @@ -26,17 +26,17 @@ 19 The Free Software Foundation, Inc., 20 51 Franklin Street, Fifth Floor 21 Boston, MA 02110-1301, USA. - 22 # - 23 # In addition, as a special exception, the copyright holders give - 24 # permission to link the code of portions of this program with the OpenSSL - 25 # library. - 26 # You must obey the GNU General Public License in all respects for all of - 27 # the code used other than OpenSSL. If you modify file(s) with this - 28 # exception, you may extend this exception to your version of the file(s), - 29 # but you are not obligated to do so. If you do not wish to do so, delete - 30 # this exception statement from your version. If you delete this exception - 31 # statement from all source files in the program, then also delete it here. - 32 # + 22 + 23 In addition, as a special exception, the copyright holders give + 24 permission to link the code of portions of this program with the OpenSSL + 25 library. + 26 You must obey the GNU General Public License in all respects for all of + 27 the code used other than OpenSSL. If you modify file(s) with this + 28 exception, you may extend this exception to your version of the file(s), + 29 but you are not obligated to do so. If you do not wish to do so, delete + 30 this exception statement from your version. If you delete this exception + 31 statement from all source files in the program, then also delete it here. + 32 33 */ 34 35 (function() { diff --git a/deluge/ui/web/docs/symbols/src/Deluge.Sidebar.js.html b/deluge/ui/web/docs/symbols/src/Deluge.Sidebar.js.html index 64090fd68..a9dd263ab 100644 --- a/deluge/ui/web/docs/symbols/src/Deluge.Sidebar.js.html +++ b/deluge/ui/web/docs/symbols/src/Deluge.Sidebar.js.html @@ -27,20 +27,20 @@ 20 The Free Software Foundation, Inc., 21 51 Franklin Street, Fifth Floor 22 Boston, MA 02110-1301, USA. - 23 # - 24 # In addition, as a special exception, the copyright holders give - 25 # permission to link the code of portions of this program with the OpenSSL - 26 # library. - 27 # You must obey the GNU General Public License in all respects for all of - 28 # the code used other than OpenSSL. If you modify file(s) with this - 29 # exception, you may extend this exception to your version of the file(s), - 30 # but you are not obligated to do so. If you do not wish to do so, delete - 31 # this exception statement from your version. If you delete this exception - 32 # statement from all source files in the program, then also delete it here. - 33 # + 23 + 24 In addition, as a special exception, the copyright holders give + 25 permission to link the code of portions of this program with the OpenSSL + 26 library. + 27 You must obey the GNU General Public License in all respects for all of + 28 the code used other than OpenSSL. If you modify file(s) with this + 29 exception, you may extend this exception to your version of the file(s), + 30 but you are not obligated to do so. If you do not wish to do so, delete + 31 this exception statement from your version. If you delete this exception + 32 statement from all source files in the program, then also delete it here. + 33 34 */ 35 - 36 // These are just so gen_gettext.js will pick up the strings + 36 // These are just so gen_gettext.py will pick up the strings 37 // _('State') 38 // _('Tracker Host') 39 @@ -135,86 +135,109 @@ 128 deferredRender: false, 129 autoScroll: true 130 }); -131 store.loadData(states); -132 this.add(panel); -133 -134 this.doLayout(); -135 this.panels[filter] = panel; -136 -137 if (!this.selected) { -138 panel.getSelectionModel().selectFirstRow(); -139 this.selected = { -140 row: 0, -141 filter: states[0][0], -142 panel: panel -143 } -144 } -145 }, -146 -147 getFilters: function() { -148 var filters = {} -149 if (!this.selected) { -150 return filters; -151 } -152 if (!this.selected.filter || !this.selected.panel) { -153 return filters; -154 } -155 var filterType = this.selected.panel.store.id; -156 if (filterType == "state" && this.selected.filter == "All") { -157 return filters; -158 } -159 -160 filters[filterType] = this.selected.filter; -161 return filters; -162 }, -163 -164 // private -165 onDisconnect: function() { -166 Ext.each(Ext.getKeys(this.panels), function(filter) { -167 this.remove(filter + '-panel'); -168 }, this); -169 this.panels = {}; -170 this.selected = null; -171 }, -172 -173 onFilterSelect: function(selModel, rowIndex, record) { -174 if (!this.selected) needsUpdate = true; -175 else if (this.selected.row != rowIndex) needsUpdate = true; -176 else needsUpdate = false; -177 this.selected = { -178 row: rowIndex, -179 filter: record.get('filter'), -180 panel: this.panels[record.store.id] -181 } -182 -183 if (needsUpdate) Deluge.UI.update(); -184 }, -185 -186 update: function(filters) { -187 for (var filter in filters) { -188 var states = filters[filter]; -189 if (Ext.getKeys(this.panels).indexOf(filter) > -1) { -190 this.updateFilter(filter, states); -191 } else { -192 this.createFilter(filter, states); -193 } -194 } -195 -196 // Perform a cleanup of fitlers that aren't enabled any more -197 Ext.each(Ext.keys(this.panels), function(filter) { -198 if (Ext.keys(filters).indexOf(filter) == -1) { -199 // We need to remove the panel -200 } -201 }); +131 +132 if (Deluge.config['sidebar_show_zero'] == false) { +133 states = this.removeZero(states); +134 } +135 +136 store.loadData(states); +137 this.add(panel); +138 +139 this.doLayout(); +140 this.panels[filter] = panel; +141 +142 if (!this.selected) { +143 panel.getSelectionModel().selectFirstRow(); +144 this.selected = { +145 row: 0, +146 filter: states[0][0], +147 panel: panel +148 } +149 } +150 }, +151 +152 getFilters: function() { +153 var filters = {} +154 if (!this.selected) { +155 return filters; +156 } +157 if (!this.selected.filter || !this.selected.panel) { +158 return filters; +159 } +160 var filterType = this.selected.panel.store.id; +161 if (filterType == "state" && this.selected.filter == "All") { +162 return filters; +163 } +164 +165 filters[filterType] = this.selected.filter; +166 return filters; +167 }, +168 +169 // private +170 onDisconnect: function() { +171 Ext.each(Ext.getKeys(this.panels), function(filter) { +172 this.remove(filter + '-panel'); +173 }, this); +174 this.panels = {}; +175 this.selected = null; +176 }, +177 +178 onFilterSelect: function(selModel, rowIndex, record) { +179 if (!this.selected) needsUpdate = true; +180 else if (this.selected.row != rowIndex) needsUpdate = true; +181 else needsUpdate = false; +182 this.selected = { +183 row: rowIndex, +184 filter: record.get('filter'), +185 panel: this.panels[record.store.id] +186 } +187 +188 if (needsUpdate) Deluge.UI.update(); +189 }, +190 +191 /** +192 * Remove the states with zero torrents in them. +193 */ +194 removeZero: function(states) { +195 var newStates = []; +196 Ext.each(states, function(state) { +197 if (state[1] > 0) { +198 newStates.push(state); +199 } +200 }); +201 return newStates; 202 }, 203 -204 updateFilter: function(filter, states) { -205 this.panels[filter].store.loadData(states); -206 if (this.selected && this.selected.panel == this.panels[filter]) { -207 this.panels[filter].getSelectionModel().selectRow(this.selected.row); -208 } -209 } -210 -211 }); -212 Deluge.Sidebar = new Ext.deluge.Sidebar(); -213 })(); \ No newline at end of file +204 update: function(filters) { +205 for (var filter in filters) { +206 var states = filters[filter]; +207 if (Ext.getKeys(this.panels).indexOf(filter) > -1) { +208 this.updateFilter(filter, states); +209 } else { +210 this.createFilter(filter, states); +211 } +212 } +213 +214 // Perform a cleanup of fitlers that aren't enabled any more +215 Ext.each(Ext.keys(this.panels), function(filter) { +216 if (Ext.keys(filters).indexOf(filter) == -1) { +217 // We need to remove the panel +218 this.panels[filter] +219 } +220 }); +221 }, +222 +223 updateFilter: function(filter, states) { +224 if (Deluge.config['sidebar_show_zero'] == false) { +225 states = this.removeZero(states); +226 } +227 +228 this.panels[filter].store.loadData(states); +229 if (this.selected && this.selected.panel == this.panels[filter]) { +230 this.panels[filter].getSelectionModel().selectRow(this.selected.row); +231 } +232 } +233 +234 }); +235 Deluge.Sidebar = new Ext.deluge.Sidebar(); +236 })(); \ No newline at end of file diff --git a/deluge/ui/web/docs/symbols/src/Deluge.Toolbar.js.html b/deluge/ui/web/docs/symbols/src/Deluge.Toolbar.js.html index c2db44cf0..06d8c70d5 100644 --- a/deluge/ui/web/docs/symbols/src/Deluge.Toolbar.js.html +++ b/deluge/ui/web/docs/symbols/src/Deluge.Toolbar.js.html @@ -26,17 +26,17 @@ 19 The Free Software Foundation, Inc., 20 51 Franklin Street, Fifth Floor 21 Boston, MA 02110-1301, USA. - 22 # - 23 # In addition, as a special exception, the copyright holders give - 24 # permission to link the code of portions of this program with the OpenSSL - 25 # library. - 26 # You must obey the GNU General Public License in all respects for all of - 27 # the code used other than OpenSSL. If you modify file(s) with this - 28 # exception, you may extend this exception to your version of the file(s), - 29 # but you are not obligated to do so. If you do not wish to do so, delete - 30 # this exception statement from your version. If you delete this exception - 31 # statement from all source files in the program, then also delete it here. - 32 # + 22 + 23 In addition, as a special exception, the copyright holders give + 24 permission to link the code of portions of this program with the OpenSSL + 25 library. + 26 You must obey the GNU General Public License in all respects for all of + 27 the code used other than OpenSSL. If you modify file(s) with this + 28 exception, you may extend this exception to your version of the file(s), + 29 but you are not obligated to do so. If you do not wish to do so, delete + 30 this exception statement from your version. If you delete this exception + 31 statement from all source files in the program, then also delete it here. + 32 33 */ 34 35 (function() { diff --git a/deluge/ui/web/docs/symbols/src/Deluge.Torrents.js.html b/deluge/ui/web/docs/symbols/src/Deluge.Torrents.js.html index 0e7db73c1..7b0ea52e4 100644 --- a/deluge/ui/web/docs/symbols/src/Deluge.Torrents.js.html +++ b/deluge/ui/web/docs/symbols/src/Deluge.Torrents.js.html @@ -26,17 +26,17 @@ 19 The Free Software Foundation, Inc., 20 51 Franklin Street, Fifth Floor 21 Boston, MA 02110-1301, USA. - 22 # - 23 # In addition, as a special exception, the copyright holders give - 24 # permission to link the code of portions of this program with the OpenSSL - 25 # library. - 26 # You must obey the GNU General Public License in all respects for all of - 27 # the code used other than OpenSSL. If you modify file(s) with this - 28 # exception, you may extend this exception to your version of the file(s), - 29 # but you are not obligated to do so. If you do not wish to do so, delete - 30 # this exception statement from your version. If you delete this exception - 31 # statement from all source files in the program, then also delete it here. - 32 # + 22 + 23 In addition, as a special exception, the copyright holders give + 24 permission to link the code of portions of this program with the OpenSSL + 25 library. + 26 You must obey the GNU General Public License in all respects for all of + 27 the code used other than OpenSSL. If you modify file(s) with this + 28 exception, you may extend this exception to your version of the file(s), + 29 but you are not obligated to do so. If you do not wish to do so, delete + 30 this exception statement from your version. If you delete this exception + 31 statement from all source files in the program, then also delete it here. + 32 33 */ 34 35 (function() { diff --git a/deluge/ui/web/docs/symbols/src/Deluge.js.html b/deluge/ui/web/docs/symbols/src/Deluge.js.html index e62dae885..310e7856b 100644 --- a/deluge/ui/web/docs/symbols/src/Deluge.js.html +++ b/deluge/ui/web/docs/symbols/src/Deluge.js.html @@ -26,68 +26,68 @@ 19 The Free Software Foundation, Inc., 20 51 Franklin Street, Fifth Floor 21 Boston, MA 02110-1301, USA. - 22 # - 23 # In addition, as a special exception, the copyright holders give - 24 # permission to link the code of portions of this program with the OpenSSL - 25 # library. - 26 # You must obey the GNU General Public License in all respects for all of - 27 # the code used other than OpenSSL. If you modify file(s) with this - 28 # exception, you may extend this exception to your version of the file(s), - 29 # but you are not obligated to do so. If you do not wish to do so, delete - 30 # this exception statement from your version. If you delete this exception - 31 # statement from all source files in the program, then also delete it here. - 32 # - 33 */ - 34 - 35 Ext.namespace('Ext.deluge'); - 36 - 37 (function() { - 38 /* Add some helper functions to Ext */ - 39 Ext.apply(Function.prototype, { - 40 bind: function(scope) { - 41 var self = this; - 42 return function() { - 43 return self.apply(scope, arguments); - 44 } - 45 } - 46 }); - 47 - 48 Ext.apply(Ext, { - 49 keys: function(obj) { - 50 var keys = []; - 51 for (i in obj) if (obj.hasOwnProperty(i)) - 52 { - 53 keys.push(i); - 54 } - 55 return keys; - 56 }, - 57 - 58 splat: function(obj) { - 59 var type = Ext.type(obj); - 60 return (type) ? ((type != 'array') ? [obj] : obj) : []; - 61 } - 62 }); - 63 Ext.getKeys = Ext.keys; - 64 })(); - 65 - 66 (function() { - 67 var tpl = '<div class="x-progress-wrap x-progress-renderered">' + - 68 '<div class="x-progress-inner">' + - 69 '<div style="width: {2}px" class="x-progress-bar">' + - 70 '<div style="z-index: 99; width: {3}px" class="x-progress-text">' + - 71 '<div style="width: {1}px;">{0}</div>' + - 72 '</div>' + - 73 '</div>' + - 74 '<div class="x-progress-text x-progress-text-back">' + - 75 '<div style="width: {1}px;">{0}</div>' + - 76 '</div>' + - 77 '</div>' + - 78 '</div>'; - 79 - 80 Deluge.progressBar = function(progress, width, text) { + 22 + 23 In addition, as a special exception, the copyright holders give + 24 permission to link the code of portions of this program with the OpenSSL + 25 library. + 26 You must obey the GNU General Public License in all respects for all of + 27 the code used other than OpenSSL. If you modify file(s) with this + 28 exception, you may extend this exception to your version of the file(s), + 29 but you are not obligated to do so. If you do not wish to do so, delete + 30 this exception statement from your version. If you delete this exception + 31 statement from all source files in the program, then also delete it here. + 32 */ + 33 + 34 Ext.namespace('Ext.deluge'); + 35 + 36 (function() { + 37 /* Add some helper functions to Ext */ + 38 Ext.apply(Function.prototype, { + 39 bind: function(scope) { + 40 var self = this; + 41 return function() { + 42 return self.apply(scope, arguments); + 43 } + 44 } + 45 }); + 46 + 47 Ext.apply(Ext, { + 48 keys: function(obj) { + 49 var keys = []; + 50 for (i in obj) if (obj.hasOwnProperty(i)) + 51 { + 52 keys.push(i); + 53 } + 54 return keys; + 55 }, + 56 + 57 splat: function(obj) { + 58 var type = Ext.type(obj); + 59 return (type) ? ((type != 'array') ? [obj] : obj) : []; + 60 } + 61 }); + 62 Ext.getKeys = Ext.keys; + 63 })(); + 64 + 65 (function() { + 66 var tpl = '<div class="x-progress-wrap x-progress-renderered">' + + 67 '<div class="x-progress-inner">' + + 68 '<div style="width: {2}px" class="x-progress-bar">' + + 69 '<div style="z-index: 99; width: {3}px" class="x-progress-text">' + + 70 '<div style="width: {1}px;">{0}</div>' + + 71 '</div>' + + 72 '</div>' + + 73 '<div class="x-progress-text x-progress-text-back">' + + 74 '<div style="width: {1}px;">{0}</div>' + + 75 '</div>' + + 76 '</div>' + + 77 '</div>'; + 78 + 79 Deluge.progressBar = function(progress, width, text, modifier) { + 80 modifier = Ext.value(modifier, 10); 81 var progressWidth = ((width / 100.0) * progress).toFixed(0); 82 var barWidth = progressWidth - 1; - 83 var textWidth = ((progressWidth - 10) > 0 ? progressWidth - 10 : 0); + 83 var textWidth = ((progressWidth - modifier) > 0 ? progressWidth - modifier : 0); 84 return String.format(tpl, text, width, barWidth, textWidth); 85 } 86 })(); @@ -113,4 +113,5 @@ 106 1: 'x-normal-download', 107 2: 'x-high-download', 108 5: 'x-highest-download' -109 } \ No newline at end of file +109 } +110 \ No newline at end of file diff --git a/deluge/ui/web/js/Deluge.Details.Options.js b/deluge/ui/web/js/Deluge.Details.Options.js index 441b2c655..e20a36605 100644 --- a/deluge/ui/web/js/Deluge.Details.Options.js +++ b/deluge/ui/web/js/Deluge.Details.Options.js @@ -57,6 +57,7 @@ Ext.deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { this.fieldsets = {}, this.fields = {}; this.optionsManager = new Deluge.OptionsManager(); + this.optionsManager.on('changed', this.onOptionChanged, this); /* * Bandwidth Options @@ -260,8 +261,9 @@ Ext.deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { xtype: 'uxspinner', id: 'stop_ratio', name: 'stop_ratio', + disabled: true, width: 50, - value: -1, + value: 2.0, stragegy: new Ext.ux.form.Spinner.NumberStrategy({ minValue: -1, maxValue: 99999, @@ -285,6 +287,7 @@ Ext.deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { id: 'remove_at_ratio', bodyStyle: 'padding-left: 10px', boxLabel: _('Remove at ratio'), + disabled: true, listeners: { 'check': { fn: this.onFieldChange, @@ -464,12 +467,21 @@ Ext.deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { }, onFieldChange: function(field) { - if (field.getValue() != this.optionsManager.getDefault(this.torrentId, field.id)) { - this.optionsManager.setOption(this.torrentId, field.id, field.getValue()); + this.optionsManager.setOption(this.torrentId, field.id, field.getValue()); + }, + + onOptionChanged: function(id, key, newValue, oldValue) { + //alert(String.format('Key: {0}\nValue: {1}\nOld Value: {2}', key, newValue, oldValue)); + if (key == 'stop_at_ratio') { + this.fields.remove_at_ratio.setDisabled(!newValue); + this.fields.stop_ratio.setDisabled(!newValue); } }, onRequestComplete: function(torrent, options) { + this.fields['private'].setDisabled(!torrent['private']); + delete torrent['private']; + this.optionsManager.updateOptions(this.torrentId, torrent); for (var key in torrent) { if (this.fields[key] && !this.optionsManager.hasChanged(this.torrentId, key)) { diff --git a/deluge/ui/web/js/Deluge.Details.js b/deluge/ui/web/js/Deluge.Details.js index cf6c2cdf1..5f9486834 100644 --- a/deluge/ui/web/js/Deluge.Details.js +++ b/deluge/ui/web/js/Deluge.Details.js @@ -68,7 +68,7 @@ Copyright: } this.items.each(function(tab) { - tab.enable(); + if (tab.disabled) tab.enable(); }); tab = tab || this.getActiveTab(); diff --git a/deluge/ui/web/js/Deluge.OptionsManager.js b/deluge/ui/web/js/Deluge.OptionsManager.js index cb55b75e4..5fa60f1dc 100644 --- a/deluge/ui/web/js/Deluge.OptionsManager.js +++ b/deluge/ui/web/js/Deluge.OptionsManager.js @@ -36,12 +36,19 @@ Copyright: * @namespace Deluge * @class Deluge.OptionsManager */ -Deluge.OptionsManager = function(config) { - this.changed = {}; - this.options = {}; - Deluge.OptionsManager.superclass.constructor.call(this); -}; -Ext.extend(Deluge.OptionsManager, Ext.util.Observable, { +Deluge.OptionsManager = Ext.extend(Ext.util.Observable, { + + constructor: function(config) { + this.changed = {}; + this.options = {}; + Deluge.OptionsManager.superclass.constructor.call(this); + + this.addEvents({ + 'add': true, + 'changed': true, + 'reset': true + }); + }, /** * Add a set of default options and values for an id to the options manager @@ -71,6 +78,16 @@ Ext.extend(Deluge.OptionsManager, Ext.util.Observable, { return this.options[id][option]; }, + /** + * Get the value for an option given an id and option name. + * @param {String} id + * @param {String} option + * @returns {Object} the options value. + */ + getValue: function(id, option) { + return (this.hasChanged(id, option)) ? this.changed[id][option] : this.options[id][option]; + }, + /** * Check to see if the option has been changed. * @param {String} id @@ -99,8 +116,10 @@ Ext.extend(Deluge.OptionsManager, Ext.util.Observable, { setOption: function(id, option, value) { if (!this.changed[id]) this.changed[id] = {}; + var oldValue = this.getValue(id, option); if (this.options[id][option] == value) { if (!Ext.isEmpty(this.changed[id][option])) delete this.changed[id][option]; + this.fireEvent('changed', id, option, value, oldValue); return; } @@ -117,8 +136,9 @@ Ext.extend(Deluge.OptionsManager, Ext.util.Observable, { break; } } - + this.changed[id][option] = value; + this.fireEvent('changed', id, option, value, oldValue); }, /** @@ -157,4 +177,4 @@ Ext.extend(Deluge.OptionsManager, Ext.util.Observable, { } } } -}); \ No newline at end of file +}); diff --git a/deluge/ui/web/js/build.sh b/deluge/ui/web/js/build.sh index c9b0fd84d..e99877f8a 100755 --- a/deluge/ui/web/js/build.sh +++ b/deluge/ui/web/js/build.sh @@ -1,6 +1,9 @@ DELUGE_FILES="Deluge.js Deluge.Formatters.js Deluge.Menus.js Deluge.Events.js Deluge.OptionsManager.js Deluge.Add.js Deluge.Add.File.js Deluge.Add.Url.js Deluge.Client.js Deluge.ConnectionManager.js Deluge.Details.js Deluge.Details.Status.js Deluge.Details.Details.js Deluge.Details.Files.js Deluge.Details.Peers.js Deluge.Details.Options.js Deluge.EditTrackers.js Deluge.Keys.js Deluge.Login.js Deluge.Preferences.js Deluge.Preferences.Downloads.js Deluge.Preferences.Network.js Deluge.Preferences.Bandwidth.js Deluge.Preferences.Interface.js Deluge.Preferences.Other.js Deluge.Preferences.Daemon.js Deluge.Preferences.Queue.js Deluge.Preferences.Proxy.js Deluge.Preferences.Notification.js Deluge.Preferences.Plugins.js Deluge.Sidebar.js Deluge.Statusbar.js Deluge.Toolbar.js Deluge.Torrents.js Deluge.UI.js" ALL_FILES="ext-extensions-debug.js $DELUGE_FILES" +[ -e /usr/bin/jsdoc_toolkit ] && JSDOC="/usr/bin/jsdoc_toolkit" +[ -e /usr/local/bin/jsdoc-toolkit ] && JSDOC="/usr/local/bin/jsdoc-toolkit" + scan() { cat /dev/null > .build_data.tmp for FILE in $ALL_FILES; do @@ -39,7 +42,7 @@ build_deluge() { build_docs() { echo "building docs"; - jsdoc-toolkit -d="../docs/" $ALL_FILES + $JSDOC -d="../docs/" $ALL_FILES } build_ext() { @@ -57,4 +60,4 @@ else build_ext build_deluge mv .build_data.tmp .build_data -fi; \ No newline at end of file +fi; diff --git a/deluge/ui/web/js/deluge-yc.js b/deluge/ui/web/js/deluge-yc.js index 72731da57..156160497 100644 --- a/deluge/ui/web/js/deluge-yc.js +++ b/deluge/ui/web/js/deluge-yc.js @@ -1 +1 @@ -Ext.namespace("Ext.deluge");(function(){Ext.apply(Function.prototype,{bind:function(b){var a=this;return function(){return a.apply(b,arguments)}}});Ext.apply(Ext,{keys:function(b){var a=[];for(i in b){if(b.hasOwnProperty(i)){a.push(i)}}return a},splat:function(b){var a=Ext.type(b);return(a)?((a!="array")?[b]:b):[]}});Ext.getKeys=Ext.keys})();(function(){var a='
{0}
{0}
';Deluge.progressBar=function(d,f,h,b){b=Ext.value(b,10);var c=((f/100)*d).toFixed(0);var e=c-1;var g=((c-b)>0?c-b:0);return String.format(a,h,f,e,g)}})();FILE_PRIORITY={0:"Do Not Download",1:"Normal Priority",2:"High Priority",5:"Highest Priority","Do Not Download":0,"Normal Priority":1,"High Priority":2,"Highest Priority":5};FILE_PRIORITY_CSS={0:"x-no-download",1:"x-normal-download",2:"x-high-download",5:"x-highest-download"};Deluge.Formatters={date:function(c){function b(d,e){var f=d+"";while(f.length0){return b+"m "+d+"s"}else{return b+"m"}}else{c=c/60}if(c<24){var a=Math.floor(c);var b=Math.round(60*(c-a));if(b>0){return a+"h "+b+"m"}else{return a+"h"}}else{c=c/24}var e=Math.floor(c);var a=Math.round(24*(c-e));if(a>0){return e+"d "+a+"h"}else{return e+"d"}},plain:function(a){return a}};var fsize=Deluge.Formatters.size;var fspeed=Deluge.Formatters.speed;var ftime=Deluge.Formatters.timeRemaining;var fdate=Deluge.Formatters.date;var fplain=Deluge.Formatters.plain;Deluge.Menus={onTorrentAction:function(c,d){var b=Deluge.Torrents.getSelections();var a=[];Ext.each(b,function(e){a.push(e.id)});switch(c.id){case"pause":case"resume":Deluge.Client.core[c.id+"_torrent"](a,{success:function(){Deluge.UI.update()}});break;case"top":case"up":case"down":case"bottom":Deluge.Client.core["queue_"+c.id](a,{success:function(){Deluge.UI.update()}});break;case"edit_trackers":Deluge.EditTrackers.show();break;case"update":Deluge.Client.core.force_reannounce(a,{success:function(){Deluge.UI.update()}});break;case"remove":Deluge.Events.fire("torrentRemoved",a);Deluge.Client.core.remove_torrent(a,null,{success:function(){Deluge.UI.update()}});break;case"recheck":Deluge.Client.core.force_recheck(a,{success:function(){Deluge.UI.update()}});break}}};Deluge.Menus.Torrent=new Ext.menu.Menu({id:"torrentMenu",items:[{id:"pause",text:_("Pause"),icon:"/icons/pause.png",handler:Deluge.Menus.onTorrentAction,scope:Deluge.Menus},{id:"resume",text:_("Resume"),icon:"/icons/start.png",handler:Deluge.Menus.onTorrentAction,scope:Deluge.Menus},"-",{id:"options",text:_("Options"),icon:"/icons/preferences.png",menu:new Ext.menu.Menu({items:[{text:_("D/L Speed Limit"),iconCls:"x-deluge-downloading",menu:new Ext.menu.Menu({items:[{text:_("5 KiB/s")},{text:_("10 KiB/s")},{text:_("30 KiB/s")},{text:_("80 KiB/s")},{text:_("300 KiB/s")},{text:_("Unlimited")}]})},{text:_("U/L Speed Limit"),iconCls:"x-deluge-seeding",menu:new Ext.menu.Menu({items:[{text:_("5 KiB/s")},{text:_("10 KiB/s")},{text:_("30 KiB/s")},{text:_("80 KiB/s")},{text:_("300 KiB/s")},{text:_("Unlimited")}]})},{text:_("Connection Limit"),iconCls:"x-deluge-connections",menu:new Ext.menu.Menu({items:[{text:_("50")},{text:_("100")},{text:_("200")},{text:_("300")},{text:_("500")},{text:_("Unlimited")}]})},{text:_("Upload Slot Limit"),icon:"/icons/upload_slots.png",menu:new Ext.menu.Menu({items:[{text:_("0")},{text:_("1")},{text:_("2")},{text:_("3")},{text:_("5")},{text:_("Unlimited")}]})},{id:"auto_managed",text:_("Auto Managed"),checked:false}]})},"-",{text:_("Queue"),icon:"/icons/queue.png",menu:new Ext.menu.Menu({items:[{id:"top",text:_("Top"),icon:"/icons/top.png",handler:Deluge.Menus.onTorrentAction,scope:Deluge.Menus},{id:"up",text:_("Up"),icon:"/icons/up.png",handler:Deluge.Menus.onTorrentAction,scope:Deluge.Menus},{id:"down",text:_("Down"),icon:"/icons/down.png",handler:Deluge.Menus.onTorrentAction,scope:Deluge.Menus},{id:"bottom",text:_("Bottom"),icon:"/icons/bottom.png",handler:Deluge.Menus.onTorrentAction,scope:Deluge.Menus}]})},"-",{id:"update",text:_("Update Tracker"),icon:"/icons/update.png",handler:Deluge.Menus.onTorrentAction,scope:Deluge.Menus},{id:"edit_trackers",text:_("Edit Trackers"),icon:"/icons/edit_trackers.png",handler:Deluge.Menus.onTorrentAction,scope:Deluge.Menus},"-",{id:"remove",text:_("Remove Torrent"),icon:"/icons/remove.png",handler:Deluge.Menus.onTorrentAction,scope:Deluge.Menus},"-",{id:"recheck",text:_("Force Recheck"),icon:"/icons/recheck.png",handler:Deluge.Menus.onTorrentAction,scope:Deluge.Menus},{id:"move",text:_("Move Storage"),icon:"/icons/move.png",handler:Deluge.Menus.onTorrentAction,scope:Deluge.Menus}]});Deluge.Menus.Connections=new Ext.menu.Menu({id:"connectionsMenu",items:[{id:"50",text:"50",group:"max_connections_global",checked:false,checkHandler:onLimitChanged},{id:"100",text:"100",group:"max_connections_global",checked:false,checkHandler:onLimitChanged},{id:"200",text:"200",group:"max_connections_global",checked:false,checkHandler:onLimitChanged},{id:"300",text:"300",group:"max_connections_global",checked:false,checkHandler:onLimitChanged},{id:"500",text:"500",group:"max_connections_global",checked:false,checkHandler:onLimitChanged},{id:"-1",text:_("Unlimited"),group:"max_connections_global",checked:false,checkHandler:onLimitChanged},"-",{id:"other",text:_("Other"),group:"max_connections_global",checked:false,checkHandler:onLimitChanged}]});Deluge.Menus.Download=new Ext.menu.Menu({id:"downspeedMenu",items:[{id:"5",text:"5 KiB/s",group:"max_download_speed",checked:false,checkHandler:onLimitChanged},{id:"10",text:"10 KiB/s",group:"max_download_speed",checked:false,checkHandler:onLimitChanged},{id:"30",text:"30 KiB/s",group:"max_download_speed",checked:false,checkHandler:onLimitChanged},{id:"80",text:"80 KiB/s",group:"max_download_speed",checked:false,checkHandler:onLimitChanged},{id:"300",text:"300 KiB/s",group:"max_download_speed",checked:false,checkHandler:onLimitChanged},{id:"-1",text:_("Unlimited"),group:"max_download_speed",checked:false,checkHandler:onLimitChanged},"-",{id:"other",text:_("Other"),group:"max_download_speed",checked:false,checkHandler:onLimitChanged}]});Deluge.Menus.Upload=new Ext.menu.Menu({id:"upspeedMenu",items:[{id:"5",text:"5 KiB/s",group:"max_upload_speed",checked:false,checkHandler:onLimitChanged},{id:"10",text:"10 KiB/s",group:"max_upload_speed",checked:false,checkHandler:onLimitChanged},{id:"30",text:"30 KiB/s",group:"max_upload_speed",checked:false,checkHandler:onLimitChanged},{id:"80",text:"80 KiB/s",group:"max_upload_speed",checked:false,checkHandler:onLimitChanged},{id:"300",text:"300 KiB/s",group:"max_upload_speed",checked:false,checkHandler:onLimitChanged},{id:"-1",text:_("Unlimited"),group:"max_upload_speed",checked:false,checkHandler:onLimitChanged},"-",{id:"other",text:_("Other"),group:"max_upload_speed",checked:false,checkHandler:onLimitChanged}]});Deluge.Menus.FilePriorities=new Ext.menu.Menu({id:"filePrioritiesMenu",items:[{id:"expandAll",text:_("Expand All"),icon:"/icons/expand_all.png"},"-",{id:"no_download",text:_("Do Not Download"),icon:"/icons/no_download.png",filePriority:0},{id:"normal",text:_("Normal Priority"),icon:"/icons/normal.png",filePriority:1},{id:"high",text:_("High Priority"),icon:"/icons/high.png",filePriority:2},{id:"highest",text:_("Highest Priority"),icon:"/icons/highest.png",filePriority:5}]});function onLimitChanged(b,a){if(b.id=="other"){}else{config={};config[b.group]=b.id;Deluge.Client.core.set_config(config,{success:function(){Deluge.UI.update()}})}}(function(){Events=Ext.extend(Ext.util.Observable,{constructor:function(){Events.superclass.constructor.call(this)},addListener:function(a,c,b,d){this.addEvents(a);Events.superclass.addListener.call(this,a,c,b,d)}});Events.prototype.on=Events.prototype.addListener;Events.prototype.fire=Events.prototype.fireEvent;Deluge.Events=new Events()})();Deluge.OptionsManager=function(a){this.changed={};this.options={};Deluge.OptionsManager.superclass.constructor.call(this)};Ext.extend(Deluge.OptionsManager,Ext.util.Observable,{addOptions:function(b,a){this.options[b]=a},getChanged:function(a){return(this.changed[a])?this.changed[a]:{}},getDefault:function(b,a){return this.options[b][a]},hasChanged:function(b,a){return(this.changed[b]&&!Ext.isEmpty(this.changed[b][a]))},resetOptions:function(a){if(!this.changed[a]){return}delete this.changed[a]},setOption:function(c,a,b){if(!this.changed[c]){this.changed[c]={}}if(this.options[c][a]==b){if(!Ext.isEmpty(this.changed[c][a])){delete this.changed[c][a]}return}if(Ext.type(this.options[c][a])!=Ext.type(b)){switch(Ext.type(this.options[c][a])){case"string":b=String(b);break;case"number":b=Number(b);break;case"boolean":b=Boolean(b);break}}this.changed[c][a]=b},setOptions:function(c,a){if(!this.changed[c]){this.changed[c]={}}for(var b in a){this.setOption(c,b,a[b])}},updateOption:function(c,a,b){this.options[c][a]=b},updateOptions:function(c,a){if(!this.options[c]){this.addOptions(c,a)}else{for(var b in a){this.updateOption(c,b,a[b])}}}});Ext.namespace("Ext.deluge.add");Ext.deluge.add.OptionsPanel=Ext.extend(Ext.TabPanel,{constructor:function(a){a=Ext.apply({region:"south",margins:"5 5 5 5",activeTab:0,height:220},a);Ext.deluge.add.OptionsPanel.superclass.constructor.call(this,a)},initComponent:function(){Ext.deluge.add.OptionsPanel.superclass.initComponent.call(this);this.files=this.add(new Ext.tree.ColumnTree({layout:"fit",title:_("Files"),rootVisible:false,autoScroll:true,height:170,border:false,animate:false,columns:[{header:_("Filename"),width:275,dataIndex:"filename"},{header:_("Size"),width:80,dataIndex:"size"}],root:new Ext.tree.AsyncTreeNode({text:"Files"})}));new Ext.tree.TreeSorter(this.files,{folderSort:true});this.form=this.add({xtype:"form",labelWidth:1,frame:false,title:_("Options"),bodyStyle:"padding: 5px;",border:false,items:[{xtype:"fieldset",title:_("Download Location"),border:false,defaultType:"textfield",labelWidth:1,items:[{fieldLabel:"",labelSeperator:"",name:"download_location",width:330}]}]})},clear:function(){this.clearFiles()},clearFiles:function(){var a=this.files.getRootNode();if(!a.hasChildNodes()){return}a.cascade(function(b){if(!b.parentNode||!b.getOwnerTree()){return}b.remove()})},getDefaults:function(){var a=["add_paused","compact_allocation","download_location","max_connections_per_torrent","max_download_speed_per_torrent","max_upload_slots_per_torrent","max_upload_speed_per_torrent","prioritize_first_last_pieces"];Deluge.Client.core.get_config_values(a,{success:function(b){this.defaults=b;for(var c in b){var d=this.form.findField(c);if(!d){return}d.setValue(b[c])}var d=this.form.findField("compact_allocation");if(b.compact_allocation){d.items.get("compact_allocation_true").setValue(true);d.items.get("compact_allocation_false").setValue(false)}else{d.items.get("compact_allocation_false").setValue(true);d.items.get("compact_allocation_true").setValue(false)}},scope:this})}});Ext.deluge.add.Window=Ext.extend(Ext.Window,{initComponent:function(){Ext.deluge.add.Window.superclass.initComponent.call(this);this.addEvents("beforeadd","add")},createTorrentId:function(){return new Date().getTime()}});Ext.deluge.add.AddWindow=Ext.extend(Ext.deluge.add.Window,{torrents:{},constructor:function(a){a=Ext.apply({title:_("Add Torrents"),layout:"border",width:470,height:450,bodyStyle:"padding: 10px 5px;",buttonAlign:"right",closeAction:"hide",closable:true,plain:true,iconCls:"x-deluge-add-window-icon"},a);Ext.deluge.add.AddWindow.superclass.constructor.call(this,a)},initComponent:function(){Ext.deluge.add.AddWindow.superclass.initComponent.call(this);this.addButton(_("Cancel"),this.onCancel,this);this.addButton(_("Add"),this.onAdd,this);function a(c,d,b){if(b.data.info_hash){return String.format('
{0}
',c)}else{return String.format('
{0}
',c)}}this.grid=this.add({xtype:"grid",region:"center",store:new Ext.data.SimpleStore({fields:[{name:"info_hash",mapping:1},{name:"text",mapping:2}],id:0}),columns:[{id:"torrent",width:150,sortable:true,renderer:a,dataIndex:"text"}],stripeRows:true,selModel:new Ext.grid.RowSelectionModel({singleSelect:true,listeners:{rowselect:{fn:this.onSelect,scope:this}}}),hideHeaders:true,autoExpandColumn:"torrent",deferredRender:false,autoScroll:true,margins:"5 5 5 5",bbar:new Ext.Toolbar({items:[{id:"file",cls:"x-btn-text-icon",iconCls:"x-deluge-add-file",text:_("File"),handler:this.onFile,scope:this},{id:"url",cls:"x-btn-text-icon",text:_("Url"),icon:"/icons/add_url.png",handler:this.onUrl,scope:this},{id:"infohash",cls:"x-btn-text-icon",text:_("Infohash"),icon:"/icons/add_magnet.png",disabled:true},"->",{id:"remove",cls:"x-btn-text-icon",text:_("Remove"),icon:"/icons/remove.png",handler:this.onRemove,scope:this}]})});this.options=this.add(new Ext.deluge.add.OptionsPanel());this.on("show",this.onShow,this)},clear:function(){this.torrents={};this.grid.getStore().removeAll();this.options.clear()},onAdd:function(){torrents=[];for(var b in this.torrents){var a=this.torrents[b];torrents.push({path:a.filename,options:{}})}Deluge.Client.web.add_torrents(torrents,{success:function(c){}});this.clear();this.hide()},onCancel:function(){this.clear();this.hide()},onFile:function(){this.file.show()},onRemove:function(){var a=this.grid.getSelectionModel();if(!a.hasSelection()){return}var b=a.getSelected();delete this.torrents[b.id];this.grid.getStore().remove(b);this.options.clear()},onSelect:function(e,f,c){var d=this.torrents[c.get("info_hash")];function b(k,h){for(var g in k){var j=k[g];if(Ext.type(j)=="object"){var l=new Ext.tree.TreeNode({text:g});b(j,l);h.appendChild(l)}else{h.appendChild(new Ext.tree.TreeNode({filename:g,text:g,size:fsize(j[0]),leaf:true,checked:j[1],iconCls:"x-deluge-file",uiProvider:Ext.tree.ColumnNodeUI}))}}}this.options.clearFiles();var a=this.options.files.getRootNode();b(d.files_tree,a);a.firstChild.expand()},onShow:function(){if(!this.url){this.url=new Ext.deluge.add.UrlWindow();this.url.on("beforeadd",this.onTorrentBeforeAdd,this);this.url.on("add",this.onTorrentAdd,this)}if(!this.file){this.file=new Ext.deluge.add.FileWindow();this.file.on("beforeadd",this.onTorrentBeforeAdd,this);this.file.on("add",this.onTorrentAdd,this)}},onTorrentBeforeAdd:function(b,c){var a=this.grid.getStore();a.loadData([[b,null,c]],true)},onTorrentAdd:function(a,c){if(!c){Ext.MessageBox.show({title:_("Error"),msg:_("Not a valid torrent"),buttons:Ext.MessageBox.OK,modal:false,icon:Ext.MessageBox.ERROR,iconCls:"x-deluge-icon-error"});return}var b=this.grid.getStore().getById(a);b.set("info_hash",c.info_hash);b.set("text",c.name);this.grid.getStore().commitChanges();this.torrents[c.info_hash]=c},onUrl:function(a,b){this.url.show()}});Deluge.Add=new Ext.deluge.add.AddWindow();Ext.deluge.add.FileWindow=Ext.extend(Ext.deluge.add.Window,{constructor:function(a){a=Ext.apply({layout:"fit",width:350,height:115,bodyStyle:"padding: 10px 5px;",buttonAlign:"center",closeAction:"hide",modal:true,plain:true,title:_("Add from File"),iconCls:"x-deluge-add-file",buttons:[{text:_("Add"),handler:this.onAdd,scope:this}]},a);Ext.deluge.add.UrlWindow.superclass.constructor.call(this,a)},initComponent:function(){Ext.deluge.add.UrlWindow.superclass.initComponent.call(this);this.form=this.add(new Ext.form.FormPanel({baseCls:"x-plain",labelWidth:55,autoHeight:true,fileUpload:true,items:[{xtype:"fileuploadfield",id:"torrentFile",emptyText:_("Select a torrent"),fieldLabel:_("File"),name:"file",buttonCfg:{text:_("Browse")+"..."}}]}))},onAdd:function(c,b){if(this.form.getForm().isValid()){this.torrentId=this.createTorrentId();this.form.getForm().submit({url:"/upload",waitMsg:_("Uploading your torrent..."),success:this.onUploadSuccess,scope:this});var a=this.form.getForm().findField("torrentFile").value;this.fireEvent("beforeadd",this.torrentId,a)}},onGotInfo:function(d,c,a,b){d.filename=b.options.filename;this.fireEvent("add",this.torrentId,d)},onUploadSuccess:function(c,b){this.hide();var a=b.result.toString();this.form.getForm().findField("torrentFile").setValue("");Deluge.Client.web.get_torrent_info(a,{success:this.onGotInfo,scope:this,filename:a})}});Ext.deluge.add.UrlWindow=Ext.extend(Ext.deluge.add.Window,{constructor:function(a){a=Ext.apply({layout:"fit",width:350,height:115,bodyStyle:"padding: 10px 5px;",buttonAlign:"center",closeAction:"hide",modal:true,plain:true,title:_("Add from Url"),iconCls:"x-deluge-add-url-window-icon",buttons:[{text:_("Add"),handler:this.onAdd,scope:this}]},a);Ext.deluge.add.UrlWindow.superclass.constructor.call(this,a)},initComponent:function(){Ext.deluge.add.UrlWindow.superclass.initComponent.call(this);this.form=this.add(new Ext.form.FormPanel({defaultType:"textfield",baseCls:"x-plain",labelWidth:55,items:[{fieldLabel:_("Url"),id:"url",name:"url",inputType:"url",anchor:"100%",listeners:{specialkey:{fn:this.onAdd,scope:this}}}]}))},onAdd:function(d,c){if(d.id=="url"&&c.getKey()!=c.ENTER){return}var d=this.form.items.get("url");var b=d.getValue();var a=this.createTorrentId();Deluge.Client.web.download_torrent_from_url(b,{success:this.onDownload,scope:this,torrentId:a});this.hide();this.fireEvent("beforeadd",a,b)},onDownload:function(a,c,d,b){this.form.items.get("url").setValue("");Deluge.Client.web.get_torrent_info(a,{success:this.onGotInfo,scope:this,filename:a,torrentId:b.options.torrentId})},onGotInfo:function(d,c,a,b){d.filename=b.options.filename;this.fireEvent("add",b.options.torrentId,d)}});Ext.namespace("Ext.ux.util");(function(){Ext.ux.util.RpcClient=Ext.extend(Ext.util.Observable,{_components:[],_methods:[],_requests:{},_url:null,_optionKeys:["scope","success","failure"],constructor:function(a){Ext.ux.util.RpcClient.superclass.constructor.call(this,a);this._url=a.url||null;this._id=0;this.addEvents("connected");this.reloadMethods()},reloadMethods:function(){Ext.each(this._components,function(a){delete this[a]},this);this._execute("system.listMethods",{success:this._setMethods,scope:this})},_execute:function(c,a){a=a||{};a.params=a.params||[];a.id=this._id;var b=Ext.encode({method:c,params:a.params,id:a.id});this._id++;return Ext.Ajax.request({url:this._url,method:"POST",success:this._onSuccess,failure:this._onFailure,scope:this,jsonData:b,options:a})},_onFailure:function(b,a){var c=a.options;errorObj={id:c.id,result:null,error:"HTTP"+b.status};if(Ext.type(c.failure)!="function"){return}if(c.scope){c.failure.call(c.scope,responseObj.error,responseObj,b)}else{c.failure(responseObj.error,responseObj,b)}},_onSuccess:function(c,a){var b=Ext.decode(c.responseText);var d=a.options;if(b.error){if(Ext.type(d.failure)!="function"){return}if(d.scope){d.failure.call(d.scope,b.error,b,c,a)}else{d.failure(b.error,b,c,a)}}else{if(Ext.type(d.success)!="function"){return}if(d.scope){d.success.call(d.scope,b.result,b,c,a)}else{d.success(b.result,b,c,a)}}},_parseArgs:function(c){var e=[];Ext.each(c,function(f){e.push(f)});var b=e[e.length-1];if(Ext.type(b)=="object"){var d=Ext.keys(b),a=false;Ext.each(this._optionKeys,function(f){if(d.indexOf(f)>-1){a=true}});if(a){e.remove(b)}else{b={}}}else{b={}}b.params=e;return b},_setMethods:function(b){var d={},a=this;Ext.each(b,function(h){var g=h.split(".");var e=d[g[0]]||{};var f=function(){var j=a._parseArgs(arguments);return a._execute(h,j)};e[g[1]]=f;d[g[0]]=e});for(var c in d){a[c]=d[c]}this._components=Ext.keys(d);this.fireEvent("connected",this)}})})();(function(){var a=function(c,d,b){return c+":"+b.data.port};Ext.deluge.ConnectionManager=Ext.extend(Ext.Window,{layout:"fit",width:300,height:220,bodyStyle:"padding: 10px 5px;",buttonAlign:"right",closeAction:"hide",closable:true,plain:true,title:_("Connection Manager"),iconCls:"x-deluge-connect-window-icon",initComponent:function(){Ext.deluge.ConnectionManager.superclass.initComponent.call(this);this.on({hide:this.onHide,show:this.onShow});Deluge.Events.on("login",this.onLogin,this);Deluge.Events.on("logout",this.onLogout,this);this.addButton(_("Close"),this.onClose,this);this.addButton(_("Connect"),this.onConnect,this);this.grid=this.add({xtype:"grid",store:new Ext.data.SimpleStore({fields:[{name:"status",mapping:3},{name:"host",mapping:1},{name:"port",mapping:2},{name:"version",mapping:4}],id:0}),columns:[{header:_("Status"),width:65,sortable:true,renderer:fplain,dataIndex:"status"},{id:"host",header:_("Host"),width:150,sortable:true,renderer:a,dataIndex:"host"},{header:_("Version"),width:75,sortable:true,renderer:fplain,dataIndex:"version"}],stripeRows:true,selModel:new Ext.grid.RowSelectionModel({singleSelect:true,listeners:{rowselect:{fn:this.onSelect,scope:this}}}),autoExpandColumn:"host",deferredRender:false,autoScroll:true,margins:"0 0 0 0",bbar:new Ext.Toolbar({items:[{id:"add",cls:"x-btn-text-icon",text:_("Add"),icon:"/icons/add.png",handler:this.onAdd,scope:this},{id:"remove",cls:"x-btn-text-icon",text:_("Remove"),icon:"/icons/remove.png",handler:this.onRemove,scope:this},"->",{id:"stop",cls:"x-btn-text-icon",text:_("Stop Daemon"),icon:"/icons/error.png",handler:this.onStop,scope:this}]})})},disconnect:function(){Deluge.Events.fire("disconnect")},runCheck:function(c,b){c=c||this.onGetHosts;b=b||this;Deluge.Client.web.get_hosts({success:c,scope:b})},onAdd:function(b,c){},onAddHost:function(){var e=Deluge.Connections.Add.items.first();var d=e.items.get("host").getValue();var b=e.items.get("port").getValue();var f=e.items.get("username").getValue();var c=e.items.get("_password").getValue();Deluge.Client.web.add_host(d,b,f,c,{onSuccess:function(g){if(!g[0]){Ext.MessageBox.show({title:_("Error"),msg:"Unable to add host: "+g[1],buttons:Ext.MessageBox.OK,modal:false,icon:Ext.MessageBox.ERROR,iconCls:"x-deluge-icon-error"})}else{this.runCheck()}Deluge.Connections.Add.hide()}})},onAddWindowHide:function(){var b=Deluge.Connections.Add.items.first();b.items.get("host").reset();b.items.get("port").reset();b.items.get("username").reset();b.items.get("_password").reset()},onClose:function(b){if(this.running){window.clearInterval(this.running)}this.hide()},onConnect:function(c){var b=this.grid.getSelectionModel().getSelected();if(!b){return}if(b.get("status")==_("Connected")){Deluge.Client.web.disconnect({success:function(e){this.runCheck();Deluge.Events.fire("disconnect")},scope:this})}else{var d=b.id;Deluge.Client.web.connect(d,{success:function(e){Deluge.Client.reloadMethods();Deluge.Client.on("connected",function(f){Deluge.Events.fire("connect")},this,{single:true})}});if(this.running){window.clearInterval(this.running)}this.hide()}},onGetHosts:function(b){this.grid.getStore().loadData(b);var c=this.grid.getSelectionModel();c.selectRow(this.selectedRow)},onLogin:function(){Deluge.Client.web.connected({success:function(b){if(b){Deluge.Events.fire("connect")}else{this.show()}},scope:this})},onLogout:function(){this.disconnect();if(!this.hidden&&this.rendered){this.hide()}},onRemove:function(c){var b=Deluge.Connections.Grid.getSelectionModel().getSelected();Deluge.Client.web.remove_host(b.id,{onSuccess:function(d){if(!d){Ext.MessageBox.show({title:_("Error"),msg:d[1],buttons:Ext.MessageBox.OK,modal:false,icon:Ext.MessageBox.ERROR,iconCls:"x-deluge-icon-error"})}else{Deluge.Connections.Grid.store.remove(b)}}})},onSelect:function(c,e,b){this.selectedRow=e;var d=this.buttons[1];if(b.get("status")==_("Connected")){d.setText(_("Disconnect"))}else{d.setText(_("Connect"))}},onShow:function(){this.runCheck();this.running=window.setInterval(this.runCheck,2000)},onStop:function(c,d){var b=this.grid.getSelectionModel().getSelected();Deluge.Client.web.stop_daemon(b.id,{success:function(e){if(!e[0]){Ext.MessageBox.show({title:_("Error"),msg:e[1],buttons:Ext.MessageBox.OK,modal:false,icon:Ext.MessageBox.ERROR,iconCls:"x-deluge-icon-error"})}}})}});Deluge.ConnectionManager=new Ext.deluge.ConnectionManager()})();(function(){Ext.namespace("Ext.deluge.details");Ext.deluge.details.TabPanel=Ext.extend(Ext.TabPanel,{constructor:function(a){a=Ext.apply({region:"south",id:"torrentDetails",split:true,height:220,minSize:100,collapsible:true,margins:"0 5 5 5",activeTab:0},a);Ext.deluge.details.TabPanel.superclass.constructor.call(this,a)},clear:function(){this.items.each(function(a){if(a.clear){a.clear.defer(100,a);a.disable()}})},update:function(a){var b=Deluge.Torrents.getSelected();if(!b){this.clear();return}this.items.each(function(c){c.enable()});a=a||this.getActiveTab();if(a.update){a.update(b.id)}},onRender:function(b,a){Ext.deluge.details.TabPanel.superclass.onRender.call(this,b,a);Deluge.Events.on("disconnect",this.clear,this);Deluge.Torrents.on("rowclick",this.onTorrentsClick,this);this.on("tabchange",this.onTabChange,this);Deluge.Torrents.getSelectionModel().on("selectionchange",function(c){if(!c.hasSelection()){this.clear()}},this)},onTabChange:function(a,b){this.update(b)},onTorrentsClick:function(a,c,b){this.update()}});Deluge.Details=new Ext.deluge.details.TabPanel()})();Ext.deluge.details.StatusTab=Ext.extend(Ext.Panel,{title:_("Status"),autoScroll:true,onRender:function(b,a){Ext.deluge.details.StatusTab.superclass.onRender.call(this,b,a);this.progressBar=this.add({xtype:"fullprogressbar",cls:"x-deluge-status-progressbar"});this.status=this.add({cls:"x-deluge-status",id:"deluge-details-status",border:false,width:1000,listeners:{render:{fn:function(c){c.load({url:"/render/tab_status.html",text:_("Loading")+"..."});c.getUpdater().on("update",this.onPanelUpdate,this)},scope:this}}})},clear:function(){this.progressBar.updateProgress(0," ");for(var a in this.fields){this.fields[a].innerHTML=""}},update:function(a){if(!this.fields){this.getFields()}Deluge.Client.core.get_torrent_status(a,Deluge.Keys.Status,{success:this.onRequestComplete,scope:this})},onPanelUpdate:function(b,a){this.fields={};Ext.each(Ext.query("dd",this.status.body.dom),function(c){this.fields[c.className]=c},this)},onRequestComplete:function(a){seeders=a.total_seeds>-1?a.num_seeds+" ("+a.total_seeds+")":a.num_seeds;peers=a.total_peers>-1?a.num_peers+" ("+a.total_peers+")":a.num_peers;var b={downloaded:fsize(a.total_done)+" ("+fsize(a.total_payload_download)+")",uploaded:fsize(a.total_uploaded)+" ("+fsize(a.total_payload_upload)+")",share:a.ratio.toFixed(3),announce:ftime(a.next_announce),tracker_status:a.tracker_status,downspeed:fspeed(a.download_payload_rate),upspeed:fspeed(a.upload_payload_rate),eta:ftime(a.eta),pieces:a.num_pieces+" ("+fsize(a.piece_length)+")",seeders:seeders,peers:peers,avail:a.distributed_copies.toFixed(3),active_time:ftime(a.active_time),seeding_time:ftime(a.seeding_time),seed_rank:a.seed_rank,time_added:fdate(a.time_added)};b.auto_managed=_((a.is_auto_managed)?"True":"False");for(var c in this.fields){this.fields[c].innerHTML=b[c]}var d=a.state+" "+a.progress.toFixed(2)+"%";this.progressBar.updateProgress(a.progress,d)}});Deluge.Details.add(new Ext.deluge.details.StatusTab());Ext.deluge.details.DetailsTab=Ext.extend(Ext.Panel,{title:_("Details"),bodyStyle:"padding 5px",onRender:function(b,a){Ext.deluge.details.DetailsTab.superclass.onRender.call(this,b,a);this.load({url:"/render/tab_details.html",text:_("Loading")+"..."});this.body.setStyle("padding","5px");this.getUpdater().on("update",this.onPanelUpdate,this)},clear:function(){if(!this.fields){return}for(var a in this.fields){this.fields[a].innerHTML=""}},update:function(a){Deluge.Client.core.get_torrent_status(a,Deluge.Keys.Details,{success:this.onRequestComplete,scope:this,torrentId:a})},onPanelUpdate:function(b,a){this.fields={};Ext.each(Ext.query("dd",this.body.dom),function(c){this.fields[c.className]=c},this)},onRequestComplete:function(c,a){var b={torrent_name:c.name,hash:a.torrentId,path:c.save_path,size:fsize(c.total_size),files:c.num_files,status:c.tracker_status,tracker:c.tracker,comment:c.comment};for(var d in this.fields){this.fields[d].innerHTML=b[d]}}});Deluge.Details.add(new Ext.deluge.details.DetailsTab());(function(){function b(d){var c=d*100;return Deluge.progressBar(c,this.width-50,c.toFixed(2)+"%",0)}function a(c){return String.format('
{1}
',FILE_PRIORITY_CSS[c],_(FILE_PRIORITY[c]))}Ext.deluge.details.FilesTab=Ext.extend(Ext.tree.ColumnTree,{constructor:function(c){c=Ext.apply({title:_("Files"),rootVisible:false,autoScroll:true,selModel:new Ext.tree.MultiSelectionModel(),columns:[{header:_("Filename"),width:330,dataIndex:"filename"},{header:_("Size"),width:150,dataIndex:"size",renderer:fsize},{header:_("Progress"),width:150,dataIndex:"progress",renderer:b},{header:_("Priority"),width:150,dataIndex:"priority",renderer:a}],root:new Ext.tree.TreeNode({text:"Files"})},c);Ext.deluge.details.FilesTab.superclass.constructor.call(this,c)},onRender:function(d,c){Ext.deluge.details.FilesTab.superclass.onRender.call(this,d,c);Deluge.Menus.FilePriorities.on("itemclick",this.onItemClick,this);this.on("contextmenu",this.onContextMenu,this);this.sorter=new Ext.tree.TreeSorter(this,{folderSort:true})},clear:function(){var c=this.getRootNode();if(!c.hasChildNodes()){return}c.cascade(function(e){var d=e.parentNode;if(!d){return}if(!d.ownerTree){return}d.removeChild(e)})},update:function(c){if(this.torrentId!=c){this.clear();this.torrentId=c}Deluge.Client.web.get_torrent_files(c,{success:this.onRequestComplete,scope:this,torrentId:c})},onContextMenu:function(d,f){f.stopEvent();var c=this.getSelectionModel();if(c.getSelectedNodes().length<2){c.clearSelections();d.select()}Deluge.Menus.FilePriorities.showAt(f.getPoint())},onItemClick:function(k,j){switch(k.id){case"expandAll":this.expandAll();break;default:var h={};function c(e){if(Ext.isEmpty(e.attributes.fileIndex)){return}h[e.attributes.fileIndex]=e.attributes.priority}this.getRootNode().cascade(c);var d=this.getSelectionModel().getSelectedNodes();Ext.each(d,function(e){if(Ext.isEmpty(e.attributes.fileIndex)){return}h[e.attributes.fileIndex]=k.filePriority});var g=new Array(Ext.keys(h).length);for(var f in h){g[f]=h[f]}Deluge.Client.core.set_torrent_file_priorities(this.torrentId,g,{success:function(){Ext.each(d,function(e){e.setColumnValue(3,k.filePriority)})},scope:this});break}},onRequestComplete:function(f,e){function d(k,h){for(var g in k){var j=k[g];var l=h.findChild("id",g);if(Ext.type(j)=="object"){if(!l){l=new Ext.tree.TreeNode({id:g,text:g});h.appendChild(l)}d(j,l)}else{if(!l){l=new Ext.tree.ColumnTreeNode({id:g,filename:g,text:g,fileIndex:j[0],size:j[1],progress:j[2],priority:j[3],leaf:true,iconCls:"x-deluge-file",uiProvider:Ext.tree.ColumnNodeUI});h.appendChild(l)}l.setColumnValue(1,j[1]);l.setColumnValue(2,j[2]);l.setColumnValue(3,j[3])}}}var c=this.getRootNode();d(f,c);c.firstChild.expand()}});Deluge.Details.add(new Ext.deluge.details.FilesTab())})();(function(){function a(e){return String.format('',e)}function c(g,h,f){var e=(f.data.seed==1024)?"x-deluge-seed":"x-deluge-peer";return String.format('
{1}
',e,g)}function d(g){var e=(g*100).toFixed(0);var f=new Number(this.style.match(/\w+:\s*(\d+)\w+/)[1]).toFixed(0)-8;return Deluge.progressBar(e,f,e+"%")}function b(g){var e=g.match(/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\:(\d+)/);var f=0;var h=[e[1],e[2],e[3],e[4]];Ext.each(h,function(k,j){k=parseInt(k);f=f|k<<((3-j)*8)});return f}Ext.deluge.details.PeersTab=Ext.extend(Ext.grid.GridPanel,{constructor:function(e){e=Ext.apply({title:_("Peers"),cls:"x-deluge-peers",store:new Ext.data.SimpleStore({fields:[{name:"country"},{name:"address",sortType:b},{name:"client"},{name:"progress",type:"float"},{name:"downspeed",type:"int"},{name:"upspeed",type:"int"},{name:"seed",type:"int"}],id:0}),columns:[{header:" ",width:30,sortable:true,renderer:a,dataIndex:"country"},{header:"Address",width:125,sortable:true,renderer:c,dataIndex:"address"},{header:"Client",width:125,sortable:true,renderer:fplain,dataIndex:"client"},{header:"Progress",width:150,sortable:true,renderer:d,dataIndex:"progress"},{header:"Down Speed",width:100,sortable:true,renderer:fspeed,dataIndex:"downspeed"},{header:"Up Speed",width:100,sortable:true,renderer:fspeed,dataIndex:"upspeed"}],stripeRows:true,deferredRender:false,autoScroll:true},e);Ext.deluge.details.PeersTab.superclass.constructor.call(this,e)},onRender:function(f,e){Ext.deluge.details.PeersTab.superclass.onRender.call(this,f,e)},clear:function(){this.getStore().loadData([])},update:function(e){Deluge.Client.core.get_torrent_status(e,Deluge.Keys.Peers,{success:this.onRequestComplete,scope:this})},onRequestComplete:function(g,f){if(!g){return}var e=new Array();Ext.each(g.peers,function(h){e.push([h.country,h.ip,h.client,h.progress,h.down_speed,h.up_speed,h.seed])},this);this.getStore().loadData(e)}});Deluge.Details.add(new Ext.deluge.details.PeersTab())})();Ext.deluge.details.OptionsTab=Ext.extend(Ext.form.FormPanel,{constructor:function(a){a=Ext.apply({autoScroll:true,bodyStyle:"padding: 5px;",border:false,cls:"x-deluge-options",defaults:{autoHeight:true,labelWidth:1,defaultType:"checkbox"},deferredRender:false,layout:"column",title:_("Options")},a);Ext.deluge.details.OptionsTab.superclass.constructor.call(this,a)},initComponent:function(){Ext.deluge.details.OptionsTab.superclass.initComponent.call(this);this.fieldsets={},this.fields={};this.optionsManager=new Deluge.OptionsManager();this.fieldsets.bandwidth=this.add({xtype:"fieldset",defaultType:"uxspinner",bodyStyle:"padding: 5px",layout:"table",layoutConfig:{columns:3},labelWidth:150,style:"margin-left: 10px; margin-right: 5px; padding: 5px",title:_("Bandwidth"),width:250});this.fieldsets.bandwidth.add({xtype:"label",text:_("Max Download Speed"),forId:"max_download_speed",cls:"x-deluge-options-label"});this.fields.max_download_speed=this.fieldsets.bandwidth.add({id:"max_download_speed",name:"max_download_speed",width:70,stragegy:new Ext.ux.form.Spinner.NumberStrategy({minValue:-1,maxValue:99999}),listeners:{spin:{fn:this.onFieldChange,scope:this},keypress:{fn:this.onFieldChange,scope:this}}});this.fieldsets.bandwidth.add({xtype:"label",text:_("KiB/s"),style:"margin-left: 10px"});this.fieldsets.bandwidth.add({xtype:"label",text:_("Max Upload Speed"),forId:"max_upload_speed",cls:"x-deluge-options-label"});this.fields.max_upload_speed=this.fieldsets.bandwidth.add({id:"max_upload_speed",name:"max_upload_speed",width:70,value:-1,stragegy:new Ext.ux.form.Spinner.NumberStrategy({minValue:-1,maxValue:99999,incrementValue:1}),listeners:{spin:{fn:this.onFieldChange,scope:this},keypress:{fn:this.onFieldChange,scope:this}}});this.fieldsets.bandwidth.add({xtype:"label",text:_("KiB/s"),style:"margin-left: 10px"});this.fieldsets.bandwidth.add({xtype:"label",text:_("Max Connections"),forId:"max_connections",cls:"x-deluge-options-label"});this.fields.max_connections=this.fieldsets.bandwidth.add({id:"max_connections",name:"max_connections",width:70,value:-1,stragegy:new Ext.ux.form.Spinner.NumberStrategy({minValue:-1,maxValue:99999,incrementValue:1}),listeners:{spin:{fn:this.onFieldChange,scope:this},keypress:{fn:this.onFieldChange,scope:this}},colspan:2});this.fieldsets.bandwidth.add({xtype:"label",text:_("Max Upload Slots"),forId:"max_upload_slots",cls:"x-deluge-options-label"});this.fields.max_upload_slots=this.fieldsets.bandwidth.add({id:"max_upload_slots",name:"max_upload_slots",width:70,value:-1,stragegy:new Ext.ux.form.Spinner.NumberStrategy({minValue:-1,maxValue:99999,incrementValue:1}),listeners:{spin:{fn:this.onFieldChange,scope:this},keypress:{fn:this.onFieldChange,scope:this}},colspan:2});this.fieldsets.queue=this.add({xtype:"fieldset",title:_("Queue"),style:"margin-left: 5px; margin-right: 5px; padding: 5px",width:210,layout:"table",layoutConfig:{columns:2},labelWidth:0,defaults:{fieldLabel:"",labelSeparator:""}});this.fields.is_auto_managed=this.fieldsets.queue.add({fieldLabel:"",labelSeparator:"",id:"is_auto_managed",boxLabel:_("Auto Managed"),width:200,listeners:{check:{fn:this.onFieldChange,scope:this}},colspan:2});this.fields.stop_at_ratio=this.fieldsets.queue.add({fieldLabel:"",labelSeparator:"",id:"stop_at_ratio",width:110,boxLabel:_("Stop seed at ratio"),listeners:{check:{fn:this.onFieldChange,scope:this}}});this.fields.stop_ratio=this.fieldsets.queue.add({xtype:"uxspinner",id:"stop_ratio",name:"stop_ratio",width:50,value:-1,stragegy:new Ext.ux.form.Spinner.NumberStrategy({minValue:-1,maxValue:99999,incrementValue:1}),listeners:{spin:{fn:this.onFieldChange,scope:this},keypress:{fn:this.onFieldChange,scope:this}}});this.fields.remove_at_ratio=this.fieldsets.queue.add({fieldLabel:"",labelSeparator:"",id:"remove_at_ratio",bodyStyle:"padding-left: 10px",boxLabel:_("Remove at ratio"),listeners:{check:{fn:this.onFieldChange,scope:this}},colspan:2});this.fields.move_completed=this.fieldsets.queue.add({fieldLabel:"",labelSeparator:"",id:"move_completed",boxLabel:_("Move Completed"),listeners:{check:{fn:this.onFieldChange,scope:this}},colspan:2});this.rightColumn=this.add({border:false,autoHeight:true,style:"margin-left: 5px",width:200});this.fieldsets.general=this.rightColumn.add({xtype:"fieldset",autoHeight:true,defaultType:"checkbox",title:_("General"),layout:"form"});this.fields["private"]=this.fieldsets.general.add({fieldLabel:"",labelSeparator:"",boxLabel:_("Private"),id:"private",listeners:{check:{fn:this.onFieldChange,scope:this}}});this.fields.prioritize_first_last=this.fieldsets.general.add({fieldLabel:"",labelSeparator:"",boxLabel:_("Prioritize First/Last"),id:"prioritize_first_last",listeners:{check:{fn:this.onFieldChange,scope:this}}});this.buttonPanel=this.rightColumn.add({layout:"column",xtype:"panel",border:false});this.buttonPanel.add({xtype:"panel",border:false}).add({id:"edit_trackers",xtype:"button",text:_("Edit Trackers"),cls:"x-btn-text-icon",iconCls:"x-deluge-edit-trackers",border:false,width:100,handler:this.onEditTrackers,scope:this});this.buttonPanel.add({xtype:"panel",border:false}).add({id:"apply",xtype:"button",text:_("Apply"),style:"margin-left: 10px;",border:false,width:100,handler:this.onApply,scope:this})},onRender:function(b,a){Ext.deluge.details.OptionsTab.superclass.onRender.call(this,b,a);this.layout=new Ext.layout.ColumnLayout();this.layout.setContainer(this);this.doLayout()},clear:function(){this.fields.max_download_speed.setValue(0);this.fields.max_upload_speed.setValue(0);this.fields.max_connections.setValue(0);this.fields.max_upload_slots.setValue(0);this.fields.is_auto_managed.setValue(false);this.fields.stop_at_ratio.setValue(false);this.fields.remove_at_ratio.setValue(false);this.fields["private"].setValue(false);this.fields.prioritize_first_last.setValue(false)},reset:function(){if(this.torrentId){this.optionsManager.resetOptions(this.torrentId)}},update:function(a){this.torrentId=a;Deluge.Client.core.get_torrent_status(a,Deluge.Keys.Options,{success:this.onRequestComplete,scope:this})},onApply:function(){var b=this.optionsManager.getChanged(this.torrentId);if(!Ext.isEmpty(b.prioritize_first_last)){var a=b.prioritize_first_last;Deluge.Client.core.set_torrent_prioritize_first_last(this.torrentId,a,{success:function(){this.optionsManager.updateOption(this.torrentId,"prioritize_first_last",a)},scope:this})}Deluge.Client.core.set_torrent_options([this.torrentId],b,{success:function(){this.optionsManager.updateOptions(this.torrentId,b);this.optionsManager.resetOptions(this.torrentId)},scope:this})},onEditTrackers:function(){Deluge.EditTrackers.show()},onFieldChange:function(a){if(a.getValue()!=this.optionsManager.getDefault(this.torrentId,a.id)){this.optionsManager.setOption(this.torrentId,a.id,a.getValue())}},onRequestComplete:function(c,a){this.optionsManager.updateOptions(this.torrentId,c);for(var b in c){if(this.fields[b]&&!this.optionsManager.hasChanged(this.torrentId,b)){if(!this.fields[b].disabled){this.fields[b].setValue(c[b])}}}}});Deluge.Details.add(new Ext.deluge.details.OptionsTab());(function(){Ext.deluge.AddTracker=Ext.extend(Ext.Window,{constructor:function(a){a=Ext.apply({title:_("Add Tracker"),width:375,height:150,bodyStyle:"padding: 5px",layout:"fit",buttonAlign:"right",closeAction:"hide",closable:true,iconCls:"x-deluge-edit-trackers",plain:true,resizable:false},a);Ext.deluge.AddTracker.superclass.constructor.call(this,a)},initComponent:function(){Ext.deluge.AddTracker.superclass.initComponent.call(this);this.addButton(_("Cancel"),this.onCancel,this);this.addButton(_("Add"),this.onAdd,this);this.addEvents("add");this.form=this.add({xtype:"form",defaultType:"textarea",baseCls:"x-plain",labelWidth:55,items:[{fieldLabel:_("Trackers"),name:"trackers",anchor:"100%"}]})},onCancel:function(){this.form.getForm().findField("trackers").setValue("");this.hide()},onAdd:function(){var b=this.form.getForm().findField("trackers").getValue();b=b.split("\n");var a=[];Ext.each(b,function(c){if(Ext.form.VTypes.url(c)){a.push(c)}},this);this.fireEvent("add",a);this.hide();this.form.getForm().findField("trackers").setValue("")}});Ext.deluge.EditTracker=Ext.extend(Ext.Window,{constructor:function(a){a=Ext.apply({title:_("Edit Tracker"),width:375,height:110,bodyStyle:"padding: 5px",layout:"fit",buttonAlign:"right",closeAction:"hide",closable:true,iconCls:"x-deluge-edit-trackers",plain:true,resizable:false},a);Ext.deluge.EditTracker.superclass.constructor.call(this,a)},initComponent:function(){Ext.deluge.EditTracker.superclass.initComponent.call(this);this.addButton(_("Cancel"),this.onCancel,this);this.addButton(_("Save"),this.onSave,this);this.on("hide",this.onHide,this);this.form=this.add({xtype:"form",defaultType:"textfield",baseCls:"x-plain",labelWidth:55,items:[{fieldLabel:_("Tracker"),name:"tracker",anchor:"100%"}]})},show:function(a){Ext.deluge.EditTracker.superclass.show.call(this);this.record=a;this.form.getForm().findField("tracker").setValue(a.data.url)},onCancel:function(){this.hide()},onHide:function(){this.form.getForm().findField("tracker").setValue("")},onSave:function(){var a=this.form.getForm().findField("tracker").getValue();this.record.set("url",a);this.record.commit();this.hide()}});Ext.deluge.EditTrackers=Ext.extend(Ext.Window,{constructor:function(a){a=Ext.apply({title:_("Edit Trackers"),width:350,height:220,bodyStyle:"padding: 5px",layout:"fit",buttonAlign:"right",closeAction:"hide",closable:true,iconCls:"x-deluge-edit-trackers",plain:true,resizable:true},a);Ext.deluge.EditTrackers.superclass.constructor.call(this,a)},initComponent:function(){Ext.deluge.EditTrackers.superclass.initComponent.call(this);this.addButton(_("Cancel"),this.onCancel,this);this.addButton(_("Ok"),this.onOk,this);this.addEvents("save");this.on("show",this.onShow,this);this.on("save",this.onSave,this);this.addWindow=new Ext.deluge.AddTracker();this.addWindow.on("add",this.onAddTrackers,this);this.editWindow=new Ext.deluge.EditTracker();this.grid=this.add({xtype:"grid",store:new Ext.data.SimpleStore({fields:[{name:"tier",mapping:0},{name:"url",mapping:1}]}),columns:[{header:_("Tier"),width:50,sortable:true,renderer:fplain,dataIndex:"tier"},{id:"tracker",header:_("Tracker"),sortable:true,renderer:fplain,dataIndex:"url"}],stripeRows:true,selModel:new Ext.grid.RowSelectionModel({singleSelect:true,listeners:{selectionchange:{fn:this.onSelect,scope:this}}}),autoExpandColumn:"tracker",deferredRender:false,autoScroll:true,margins:"0 0 0 0",bbar:new Ext.Toolbar({items:[{cls:"x-btn-text-icon",text:_("Up"),icon:"/icons/up.png",handler:this.onUp,scope:this},{cls:"x-btn-text-icon",text:_("Down"),icon:"/icons/down.png",handler:this.onDown,scope:this},"->",{cls:"x-btn-text-icon",text:_("Add"),icon:"/icons/add.png",handler:this.onAdd,scope:this},{cls:"x-btn-text-icon",text:_("Edit"),icon:"/icons/edit_trackers.png",handler:this.onEdit,scope:this},{cls:"x-btn-text-icon",text:_("Remove"),icon:"/icons/remove.png",handler:this.onRemove,scope:this}]})})},onAdd:function(){this.addWindow.show()},onAddTrackers:function(b){var a=this.grid.getStore();Ext.each(b,function(d){var e=false,c=-1;a.each(function(f){if(f.get("tier")>c){c=f.get("tier")}if(d==f.get("tracker")){e=true;return false}},this);if(!e){a.loadData([[c+1,d]],true)}},this)},onCancel:function(){this.hide()},onEdit:function(){var a=this.grid.getSelectionModel().getSelected();this.editWindow.show(a)},onHide:function(){this.grid.getStore().removeAll()},onOk:function(){var a=[];this.grid.getStore().each(function(b){a.push({tier:b.get("tier"),url:b.get("url")})},this);Deluge.Client.core.set_torrent_trackers(this.torrentId,a,{failure:this.onSaveFail,scope:this});this.hide()},onRemove:function(){var a=this.grid.getSelectionModel().getSelected();this.grid.getStore().remove(a)},onRequestComplete:function(a){var b=[];Ext.each(a.trackers,function(c){b.push([c.tier,c.url])});this.grid.getStore().loadData(b)},onSaveFail:function(){},onSelect:function(a){if(a.hasSelection()){this.grid.getBottomToolbar().items.get(4).enable()}},onShow:function(){this.grid.getBottomToolbar().items.get(4).disable();var a=Deluge.Torrents.getSelected();this.torrentId=a.id;Deluge.Client.core.get_torrent_status(a.id,["trackers"],{success:this.onRequestComplete,scope:this})}});Deluge.EditTrackers=new Ext.deluge.EditTrackers()})();Deluge.Keys={Grid:["queue","name","total_size","state","progress","num_seeds","total_seeds","num_peers","total_peers","download_payload_rate","upload_payload_rate","eta","ratio","distributed_copies","is_auto_managed","time_added","tracker_host"],Status:["total_done","total_payload_download","total_uploaded","total_payload_upload","next_announce","tracker_status","num_pieces","piece_length","is_auto_managed","active_time","seeding_time","seed_rank"],Files:["files","file_progress","file_priorities"],Peers:["peers","seeds"],Details:["name","save_path","total_size","num_files","tracker_status","tracker","comment"],Options:["max_download_speed","max_upload_speed","max_connections","max_upload_slots","is_auto_managed","stop_at_ratio","stop_ratio","remove_at_ratio","private","prioritize_first_last"]};Ext.each(Deluge.Keys.Grid,function(a){Deluge.Keys.Status.push(a)});(function(){Ext.deluge.LoginWindow=Ext.extend(Ext.Window,{firstShow:true,constructor:function(a){a=Ext.apply({layout:"fit",width:300,height:120,bodyStyle:"padding: 10px 5px;",buttonAlign:"center",closeAction:"hide",closable:false,modal:true,plain:true,resizable:false,title:_("Login"),iconCls:"x-deluge-login-window-icon"},a);Ext.deluge.LoginWindow.superclass.constructor.call(this,a)},initComponent:function(){Ext.deluge.LoginWindow.superclass.initComponent.call(this);Deluge.Events.on("logout",this.onLogout,this);this.on("show",this.onShow,this);this.on("beforeshow",this.onBeforeShow,this);this.addButton({text:_("Login"),handler:this.onLogin,scope:this});this.loginForm=this.add({xtype:"form",defaultType:"textfield",id:"loginForm",baseCls:"x-plain",labelWidth:55,items:[{fieldLabel:_("Password"),id:"password",name:"password",inputType:"password",anchor:"100%",listeners:{specialkey:{fn:this.onKey,scope:this}}}]})},onKey:function(b,a){if(a.getKey()==13){this.onLogin()}},onLogin:function(){var a=this.loginForm.items.get("password");Deluge.Client.auth.login(a.getValue(),{success:function(b){if(b){Deluge.Events.fire("login");this.hide();a.setRawValue("");Deluge.UI.cookies.set("session",b)}else{Ext.MessageBox.show({title:_("Login Failed"),msg:_("You entered an incorrect password"),buttons:Ext.MessageBox.OK,modal:false,fn:function(){a.focus()},icon:Ext.MessageBox.WARNING,iconCls:"x-deluge-icon-warning"})}},scope:this})},onLogout:function(){var a=Deluge.UI.cookies.get("session",false);if(a){Deluge.Client.auth.delete_session(a,{success:function(b){Deluge.UI.cookies.clear("session");this.show()},scope:this})}},onBeforeShow:function(){var a=Deluge.UI.cookies.get("session",false);if(a){Deluge.Client.auth.check_session(a,{success:function(b){if(b){Deluge.Events.fire("login");this.loginForm.items.get("password").setRawValue("");this.hide()}else{Deluge.UI.cookies.clear("session");this.show()}},failure:function(b){Deluge.UI.cookies.clear("session");this.show()},scope:this});return false}},onShow:function(){var a=this.loginForm.items.get("password");a.focus(false,150)}});Deluge.Login=new Ext.deluge.LoginWindow()})();(function(){Ext.deluge.PreferencesWindow=Ext.extend(Ext.Window,{constructor:function(a){a=Ext.apply({layout:"border",width:485,height:500,buttonAlign:"right",closeAction:"hide",closable:true,iconCls:"x-deluge-preferences",plain:true,resizable:true,title:_("Preferences"),buttons:[{text:_("Close"),handler:this.onCloseButtonClick,scope:this},{text:_("Apply")},{text:_("Ok")}],currentPage:false,items:[{xtype:"grid",region:"west",title:_("Categories"),store:new Ext.data.SimpleStore({fields:[{name:"name",mapping:0}]}),columns:[{id:"name",renderer:fplain,dataIndex:"name"}],sm:new Ext.grid.RowSelectionModel({singleSelect:true,listeners:{rowselect:{fn:this.onPageSelect,scope:this}}}),hideHeaders:true,autoExpandColumn:"name",deferredRender:false,autoScroll:true,margins:"5 0 5 5",cmargins:"5 0 5 5",width:120,collapsible:true},{region:"center",header:false,layout:"fit",height:400,margins:"5 5 5 5",cmargins:"5 5 5 5"}]},a);Ext.deluge.PreferencesWindow.superclass.constructor.call(this,a)},initComponent:function(){Ext.deluge.PreferencesWindow.superclass.initComponent.call(this);this.categoriesGrid=this.items.get(0);this.configPanel=this.items.get(1);this.pages={};this.on("show",this.onShow,this)},onCloseButtonClick:function(){this.hide()},addPage:function(c){var a=this.categoriesGrid.getStore();var b=c.title;a.loadData([[b]],true);c.bodyStyle="margin: 5px";this.pages[b]=this.configPanel.add(c);this.pages[b].hide()},onPageSelect:function(a,d,c){if(this.currentPage){this.currentPage.hide()}var b=c.get("name");this.pages[b].show();this.currentPage=this.pages[b];this.configPanel.doLayout()},onShow:function(){if(!this.categoriesGrid.getSelectionModel().hasSelection()){this.categoriesGrid.getSelectionModel().selectFirstRow()}}});Deluge.Preferences=new Ext.deluge.PreferencesWindow()})();Deluge.Preferences.addPage({border:false,title:_("Downloads"),xtype:"form",layout:"form",items:[{xtype:"fieldset",border:false,title:_("Folders"),labelWidth:140,defaultType:"textfield",autoHeight:true,items:[{name:"download_location",fieldLabel:_("Download to"),width:125},{name:"move_completed",fieldLabel:_("Move completed to"),width:125},{name:"copy_torrent_files",fieldLabel:_("Copy of .torrent files to"),width:125}]},{xtype:"fieldset",border:false,title:_("Allocation"),autoHeight:true,labelWidth:1,defaultType:"radio",items:[{name:"compact_allocation",labelSeparator:"",boxLabel:_("Compact")},{name:"compact_allocation",labelSeparator:"",boxLabel:_("Full")}]},{xtype:"fieldset",border:false,title:_("Options"),autoHeight:true,labelWidth:1,defaultType:"checkbox",items:[{name:"prioritize_first_last",labelSeparator:"",boxLabel:_("Prioritize first and last pieces of torrent")},{name:"add_paused",labelSeparator:"",boxLabel:_("Add torrents in Paused state")}]}]});Deluge.Preferences.addPage({border:false,title:_("Bandwidth"),xtype:"form",layout:"form",labelWidth:10,items:[{xtype:"fieldset",border:false,title:_("Global Bandwidth Usage"),autoHeight:true,labelWidth:200,style:"margin-bottom: 0px; padding-bottom: 0px;",defaultType:"uxspinner",items:[{name:"max_connections",fieldLabel:_("Maximum Connections"),width:60,value:-1},{name:"max_upload_slots",fieldLabel:_("Maximum Upload Slots"),width:60,value:-1},{name:"max_download_speed",fieldLabel:_("Maximum Download Speed (KiB/s)"),width:60,value:-1},{name:"max_upload_speed",fieldLabel:_("Maximum Upload Speed (KiB/s)"),width:60,value:-1},{name:"max_half_open_connections",fieldLabel:_("Maximum Half-Open Connections"),width:60,value:-1},{name:"max_connections_per_second",fieldLabel:_("Maximum Connection Attempts per Second"),width:60,value:-1}]},{xtype:"fieldset",border:false,title:"",autoHeight:true,style:"padding-top: 0px; margin-top: 0px; margin-bottom: 0px;",items:[{xtype:"checkbox",name:"ignore_local",fieldLabel:"",labelSeparator:"",boxLabel:_("Ignore limits on local network"),value:-1},{xtype:"checkbox",name:"limit_ip_overhead",fieldLabel:"",labelSeparator:"",boxLabel:_("Rate limit IP overhead"),value:-1}]},{xtype:"fieldset",border:false,title:_("Per Torrent Bandwidth Usage"),autoHeight:true,labelWidth:200,defaultType:"uxspinner",items:[{name:"max_connections_per_torrent",fieldLabel:_("Maximum Connections"),width:60,value:-1},{name:"max_upload_slots_per_torrent",fieldLabel:_("Maximum Upload Slots"),width:60,value:-1},{name:"max_download_speed_per_torrent",fieldLabel:_("Maximum Download Speed (KiB/s)"),width:60,value:-1},{name:"max_upload_speed_per_torrent",fieldLabel:_("Maximum Upload Speed (KiB/s)"),width:60,value:-1}]}]});Deluge.Preferences.addPage({border:false,title:_("Interface"),xtype:"form",layout:"form",items:[{xtype:"fieldset",border:false,title:_("Window"),autoHeight:true,labelWidth:1,items:[{xtype:"checkbox",fieldLabel:"",labelSeparator:"",boxLabel:_("Show session speed in titlebar"),id:"show_session_speed"}]},{xtype:"fieldset",border:false,title:_("Sidebar"),autoHeight:true,labelWidth:1,items:[{xtype:"checkbox",fieldLabel:"",labelSeparator:"",boxLabel:_("Hide filters with zero torrents"),id:"hide_sidebar_zero"}]},{xtype:"fieldset",border:false,title:_("Password"),autoHeight:true,defaultType:"textfield",items:[{fieldLabel:"New Password",inputType:"password",id:"new_password"},{inputType:"password",fieldLabel:"Confirm Password",id:"confirm_password"}]}]});Deluge.Preferences.addPage({border:false,title:_("Daemon"),xtype:"form",layout:"form",items:[{xtype:"fieldset",border:false,title:_("Port"),autoHeight:true,defaultType:"uxspinner",items:[{fieldLabel:_("Daemon port"),id:"daemon_port"}]},{xtype:"fieldset",border:false,title:_("Connections"),autoHeight:true,labelWidth:1,defaultType:"checkbox",items:[{fieldLabel:"",labelSeparator:"",boxLabel:_("Allow Remote Connections"),id:"allow_remote"}]},{xtype:"fieldset",border:false,title:_("Other"),autoHeight:true,labelWidth:1,defaultType:"checkbox",items:[{fieldLabel:"",labelSeparator:"",height:40,boxLabel:_("Periodically check the website for new releases"),id:"new_releases"}]}]});(function(){function a(d,f,c){var b=d.toLowerCase().replace(".","_");var e="";if(c.store.id=="tracker_host"){if(d!="Error"){e=String.format("url(/tracker/{0})",d)}else{b=null}}if(e){return String.format('
{0} ({1})
',d,c.data.count,e)}else{if(b){return String.format('
{0} ({1})
',d,c.data.count,b)}else{return String.format('
{0} ({1})
',d,c.data.count)}}}Ext.deluge.Sidebar=Ext.extend(Ext.Panel,{panels:{},selected:null,constructor:function(b){b=Ext.apply({id:"sidebar",region:"west",cls:"deluge-sidebar",title:_("Filters"),layout:"accordion",split:true,width:200,minSize:175,collapsible:true,margins:"5 0 0 5",cmargins:"5 0 0 5"},b);Ext.deluge.Sidebar.superclass.constructor.call(this,b)},initComponent:function(){Ext.deluge.Sidebar.superclass.initComponent.call(this);Deluge.Events.on("disconnect",this.onDisconnect,this)},createFilter:function(e,d){var c=new Ext.data.SimpleStore({id:e,fields:[{name:"filter"},{name:"count"}]});var g=e.replace("_"," ");var f=g.split(" ");g="";Ext.each(f,function(h){firstLetter=h.substring(0,1);firstLetter=firstLetter.toUpperCase();h=firstLetter+h.substring(1);g+=h+" "});var b=new Ext.grid.GridPanel({id:e+"-panel",store:c,title:_(g),columns:[{id:"filter",sortable:false,renderer:a,dataIndex:"filter"}],stripeRows:false,selModel:new Ext.grid.RowSelectionModel({singleSelect:true,listeners:{rowselect:{fn:this.onFilterSelect,scope:this}}}),hideHeaders:true,autoExpandColumn:"filter",deferredRender:false,autoScroll:true});if(Deluge.config.sidebar_show_zero==false){d=this.removeZero(d)}c.loadData(d);this.add(b);this.doLayout();this.panels[e]=b;if(!this.selected){b.getSelectionModel().selectFirstRow();this.selected={row:0,filter:d[0][0],panel:b}}},getFilters:function(){var c={};if(!this.selected){return c}if(!this.selected.filter||!this.selected.panel){return c}var b=this.selected.panel.store.id;if(b=="state"&&this.selected.filter=="All"){return c}c[b]=this.selected.filter;return c},onDisconnect:function(){Ext.each(Ext.getKeys(this.panels),function(b){this.remove(b+"-panel")},this);this.panels={};this.selected=null},onFilterSelect:function(c,d,b){if(!this.selected){needsUpdate=true}else{if(this.selected.row!=d){needsUpdate=true}else{needsUpdate=false}}this.selected={row:d,filter:b.get("filter"),panel:this.panels[b.store.id]};if(needsUpdate){Deluge.UI.update()}},removeZero:function(b){var c=[];Ext.each(b,function(d){if(d[1]>0){c.push(d)}});return c},update:function(d){for(var c in d){var b=d[c];if(Ext.getKeys(this.panels).indexOf(c)>-1){this.updateFilter(c,b)}else{this.createFilter(c,b)}}Ext.each(Ext.keys(this.panels),function(e){if(Ext.keys(d).indexOf(e)==-1){this.panels[e]}})},updateFilter:function(c,b){if(Deluge.config.sidebar_show_zero==false){b=this.removeZero(b)}this.panels[c].store.loadData(b);if(this.selected&&this.selected.panel==this.panels[c]){this.panels[c].getSelectionModel().selectRow(this.selected.row)}}});Deluge.Sidebar=new Ext.deluge.Sidebar()})();(function(){Ext.deluge.Statusbar=Ext.extend(Ext.StatusBar,{constructor:function(a){a=Ext.apply({id:"deluge-statusbar",defaultIconCls:"x-not-connected",defaultText:_("Not Connected")},a);Ext.deluge.Statusbar.superclass.constructor.call(this,a)},initComponent:function(){Ext.deluge.Statusbar.superclass.initComponent.call(this);Deluge.Events.on("connect",this.onConnect,this);Deluge.Events.on("disconnect",this.onDisconnect,this)},createButtons:function(){this.add({id:"statusbar-connections",text:" ",cls:"x-btn-text-icon",iconCls:"x-deluge-connections",menu:Deluge.Menus.Connections},"-",{id:"statusbar-downspeed",text:" ",cls:"x-btn-text-icon",iconCls:"x-deluge-downloading",menu:Deluge.Menus.Download},"-",{id:"statusbar-upspeed",text:" ",cls:"x-btn-text-icon",iconCls:"x-deluge-seeding",menu:Deluge.Menus.Upload},"-",{id:"statusbar-traffic",text:" ",cls:"x-btn-text-icon",iconCls:"x-deluge-traffic"},"-",{id:"statusbar-dht",text:" ",cls:"x-btn-text-icon",iconCls:"x-deluge-dht"});this.created=true},onConnect:function(){this.setStatus({iconCls:"x-connected",text:""});if(!this.created){this.createButtons()}else{this.items.each(function(a){a.show();a.enable()})}},onDisconnect:function(){this.clearStatus({useDefaults:true});this.items.each(function(a){a.hide();a.disable()})},update:function(b){function d(e){return e+" KiB/s"}var a=function(g,f){var h=this.items.get("statusbar-"+g);if(f.limit.value==-1){var k=(f.value.formatter)?f.value.formatter(f.value.value):f.value.value}else{var j=(f.value.formatter)?f.value.formatter(f.value.value):f.value.value;var e=(f.limit.formatter)?f.limit.formatter(f.limit.value):f.limit.value;var k=String.format(f.format,j,e)}h.setText(k)}.bind(this);a("connections",{value:{value:b.num_connections},limit:{value:b.max_num_connections},format:"{0} ({1})"});a("downspeed",{value:{value:b.download_rate,formatter:Deluge.Formatters.speed},limit:{value:b.max_download,formatter:d},format:"{0} ({1})"});a("upspeed",{value:{value:b.upload_rate,formatter:Deluge.Formatters.speed},limit:{value:b.max_upload,formatter:d},format:"{0} ({1})"});a("traffic",{value:{value:b.payload_download_rate,formatter:Deluge.Formatters.speed},limit:{value:b.payload_upload_rate,formatter:Deluge.Formatters.speed},format:"{0}/{1}"});this.items.get("statusbar-dht").setText(b.dht_nodes);function c(g,e){var f=g.items.get(e);if(!f){f=g.items.get("other")}f.setChecked(true)}c(Deluge.Menus.Connections,b.max_num_connections);c(Deluge.Menus.Download,b.max_download);c(Deluge.Menus.Upload,b.max_upload)}});Deluge.Statusbar=new Ext.deluge.Statusbar()})();(function(){Ext.deluge.Toolbar=Ext.extend(Ext.Toolbar,{constructor:function(a){a=Ext.apply({items:[{id:"create",cls:"x-btn-text-icon",disabled:true,text:_("Create"),icon:"/icons/create.png",handler:this.onTorrentAction},{id:"add",cls:"x-btn-text-icon",disabled:true,text:_("Add"),icon:"/icons/add.png",handler:this.onTorrentAdd},{id:"remove",cls:"x-btn-text-icon",disabled:true,text:_("Remove"),icon:"/icons/remove.png",handler:this.onTorrentAction},"|",{id:"pause",cls:"x-btn-text-icon",disabled:true,text:_("Pause"),icon:"/icons/pause.png",handler:this.onTorrentAction},{id:"resume",cls:"x-btn-text-icon",disabled:true,text:_("Resume"),icon:"/icons/start.png",handler:this.onTorrentAction},"|",{id:"up",cls:"x-btn-text-icon",disabled:true,text:_("Up"),icon:"/icons/up.png",handler:this.onTorrentAction},{id:"down",cls:"x-btn-text-icon",disabled:true,text:_("Down"),icon:"/icons/down.png",handler:this.onTorrentAction},"|",{id:"preferences",cls:"x-btn-text-icon",text:_("Preferences"),icon:"/icons/preferences.png",handler:this.onPreferencesClick,scope:this},{id:"connectionman",cls:"x-btn-text-icon",text:_("Connection Manager"),iconCls:"x-deluge-connections",handler:this.onConnectionManagerClick,scope:this},"->",{id:"help",cls:"x-btn-text-icon",disabled:true,icon:"/icons/help.png",text:_("Help"),handler:this.onHelpClick,scope:this},{id:"logout",cls:"x-btn-text-icon",icon:"/icons/logout.png",disabled:true,text:_("Logout"),handler:this.onLogout,scope:this}]},a);Ext.deluge.Toolbar.superclass.constructor.call(this,a)},connectedButtons:["add","remove","pause","resume","up","down"],initComponent:function(){Ext.deluge.Toolbar.superclass.initComponent.call(this);Deluge.Events.on("connect",this.onConnect,this);Deluge.Events.on("login",this.onLogin,this)},onConnect:function(){Ext.each(this.connectedButtons,function(a){this.items.get(a).enable()},this)},onDisconnect:function(){Ext.each(this.connectedButtons,function(a){this.items.get(a).disable()},this)},onLogin:function(){this.items.get("logout").enable()},onLogout:function(){this.items.get("logout").disable();Deluge.Events.fire("logout");Deluge.Login.show()},onConnectionManagerClick:function(){Deluge.ConnectionManager.show()},onPreferencesClick:function(){Deluge.Preferences.show()},onTorrentAction:function(c){var b=Deluge.Torrents.getSelections();var a=[];Ext.each(b,function(d){a.push(d.id)});switch(c.id){case"remove":Deluge.Events.fire("torrentRemoved",a);Deluge.Client.core.remove_torrent(a,null,{success:function(){Deluge.UI.update()}});break;case"pause":case"resume":Deluge.Client.core[c.id+"_torrent"](a,{success:function(){Deluge.UI.update()}});break;case"up":case"down":Deluge.Client.core["queue_"+c.id](a,{success:function(){Deluge.UI.update()}});break}},onTorrentAdd:function(){Deluge.Add.show()}});Deluge.Toolbar=new Ext.deluge.Toolbar()})();(function(){function f(j){return(j==-1)?"":j+1}function b(k,l,j){return String.format('
{1}
',j.data.state.toLowerCase(),k)}function h(j){if(!j){return}return fspeed(j)}function c(m,n,l){m=new Number(m);var j=m;var o=l.data.state+" "+m.toFixed(2)+"%";var k=new Number(this.style.match(/\w+:\s*(\d+)\w+/)[1])-8;return Deluge.progressBar(m,k,o)}function e(k,l,j){if(j.data.total_seeds>-1){return String.format("{0} ({1})",k,j.data.total_seeds)}else{return k}}function g(k,l,j){if(j.data.total_peers>-1){return String.format("{0} ({1})",k,j.data.total_peers)}else{return k}}function d(k,l,j){return new Number(k).toFixed(3)}function a(k,l,j){return String.format('
{0}
',k)}Ext.deluge.TorrentGrid=Ext.extend(Ext.grid.GridPanel,{constructor:function(j){j=Ext.apply({id:"torrentGrid",store:new Ext.data.SimpleStore({fields:[{name:"queue"},{name:"name"},{name:"size",type:"int"},{name:"state"},{name:"progress",type:"float"},{name:"seeds",type:"int"},{name:"total_seeds",type:"int"},{name:"peers",type:"int"},{name:"total_peers",type:"int"},{name:"downspeed",type:"int"},{name:"upspeed",type:"int"},{name:"eta",type:"int"},{name:"ratio",type:"float"},{name:"avail",type:"float"},{name:"added",type:"int"},{name:"tracker"}],id:16}),columns:[{id:"queue",header:_("#"),width:30,sortable:true,renderer:f,dataIndex:"queue"},{id:"name",header:_("Name"),width:150,sortable:true,renderer:b,dataIndex:"name"},{header:_("Size"),width:75,sortable:true,renderer:fsize,dataIndex:"size"},{header:_("Progress"),width:150,sortable:true,renderer:c,dataIndex:"progress"},{header:_("Seeders"),width:60,sortable:true,renderer:e,dataIndex:"seeds"},{header:_("Peers"),width:60,sortable:true,renderer:g,dataIndex:"peers"},{header:_("Down Speed"),width:80,sortable:true,renderer:h,dataIndex:"downspeed"},{header:_("Up Speed"),width:80,sortable:true,renderer:h,dataIndex:"upspeed"},{header:_("ETA"),width:60,sortable:true,renderer:ftime,dataIndex:"eta"},{header:_("Ratio"),width:60,sortable:true,renderer:d,dataIndex:"ratio"},{header:_("Avail"),width:60,sortable:true,renderer:d,dataIndex:"avail"},{header:_("Added"),width:80,sortable:true,renderer:fdate,dataIndex:"added"},{header:_("Tracker"),width:120,sortable:true,renderer:a,dataIndex:"tracker"}],region:"center",cls:"deluge-torrents",stripeRows:true,autoExpandColumn:"name",deferredRender:false,autoScroll:true,margins:"5 5 0 0"},j);Ext.deluge.TorrentGrid.superclass.constructor.call(this,j)},initComponent:function(){Ext.deluge.TorrentGrid.superclass.initComponent.call(this);Deluge.Events.on("torrentRemoved",this.onTorrentRemoved,this);this.on("rowcontextmenu",function(j,m,l){l.stopEvent();var k=j.getSelectionModel();if(!k.hasSelection()){k.selectRow(m)}Deluge.Menus.Torrent.showAt(l.getPoint())})},getTorrent:function(j){return this.getStore().getAt(j)},getSelected:function(){return this.getSelectionModel().getSelected()},getSelections:function(){return this.getSelectionModel().getSelections()},update:function(n){var l=this.getStore();for(var k in n){var j=l.getById(k);var p=n[k];if(!j){var o=[p.queue,p.name,p.total_size,p.state,p.progress,p.num_seeds,p.total_seeds,p.num_peers,p.total_peers,p.download_payload_rate,p.upload_payload_rate,p.eta,p.ratio,p.distributed_copies,p.time_added,p.tracker_host,k];l.loadData([o],true)}else{j.set("queue",p.queue);j.set("name",p.name);j.set("size",p.total_size);j.set("state",p.state);j.set("progress",p.progress);j.set("seeds",p.num_seeds);j.set("total_seeds",p.total_seeds);j.set("peers",p.num_peers);j.set("total_peers",p.total_peers);j.set("downspeed",p.download_payload_rate);j.set("upspeed",p.upload_payload_rate);j.set("eta",p.eta);j.set("ratio",p.ratio);j.set("avail",p.distributed_copies);j.set("added",p.time_added);j.set("tracker",p.tracker_host);j.commit()}}var m=Ext.keys(n);l.each(function(q){if(m.indexOf(q.id)==-1){l.remove(q)}},this)},onTorrentRemoved:function(k){var j=this.getSelectionModel();Ext.each(k,function(m){var l=this.getStore().getById(m);if(j.isSelected(l)){j.deselectRow(this.getStore().indexOf(l))}this.getStore().remove(l)},this)}});Deluge.Torrents=new Ext.deluge.TorrentGrid()})();Deluge.UI={cookies:new Ext.state.CookieProvider(),errorCount:0,initialize:function(){Ext.state.Manager.setProvider(this.cookies);this.MainPanel=new Ext.Panel({id:"mainPanel",iconCls:"x-deluge-main-panel",title:"Deluge",layout:"border",tbar:Deluge.Toolbar,items:[Deluge.Sidebar,Deluge.Details,Deluge.Torrents],bbar:Deluge.Statusbar});this.Viewport=new Ext.Viewport({layout:"fit",items:[this.MainPanel]});Deluge.Events.on("connect",this.onConnect,this);Deluge.Events.on("disconnect",this.onDisconnect,this);Deluge.Client=new Ext.ux.util.RpcClient({url:"/json"});Deluge.Client.on("connected",function(a){Deluge.Login.show()});this.update=this.update.bind(this)},update:function(){var a=Deluge.Sidebar.getFilters();Deluge.Client.web.update_ui(Deluge.Keys.Grid,a,{success:this.onUpdate,failure:this.onUpdateError,scope:this});Deluge.Details.update();Deluge.Client.web.connected({success:this.onConnectedCheck,scope:this})},onConnectedCheck:function(a){if(!a){Deluge.Events.fire("disconnect")}},onUpdateError:function(a){if(this.errorCount==2){Ext.MessageBox.show({title:"Lost Connection",msg:"The connection to the webserver has been lost!",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.ERROR})}this.errorCount++},onUpdate:function(a){Deluge.Torrents.update(a.torrents);Deluge.Statusbar.update(a.stats);Deluge.Sidebar.update(a.filters);this.errorCount=0},onConnect:function(){if(!this.running){this.running=setInterval(this.update,2000);this.update()}},onDisconnect:function(){this.stop()},stop:function(){if(this.running){clearInterval(this.running);this.running=false;Deluge.Torrents.getStore().loadData([])}}};Ext.onReady(function(a){Deluge.UI.initialize()}); \ No newline at end of file +Ext.namespace("Ext.deluge");(function(){Ext.apply(Function.prototype,{bind:function(b){var a=this;return function(){return a.apply(b,arguments)}}});Ext.apply(Ext,{keys:function(b){var a=[];for(i in b){if(b.hasOwnProperty(i)){a.push(i)}}return a},splat:function(b){var a=Ext.type(b);return(a)?((a!="array")?[b]:b):[]}});Ext.getKeys=Ext.keys})();(function(){var a='
{0}
{0}
';Deluge.progressBar=function(d,f,h,b){b=Ext.value(b,10);var c=((f/100)*d).toFixed(0);var e=c-1;var g=((c-b)>0?c-b:0);return String.format(a,h,f,e,g)}})();FILE_PRIORITY={0:"Do Not Download",1:"Normal Priority",2:"High Priority",5:"Highest Priority","Do Not Download":0,"Normal Priority":1,"High Priority":2,"Highest Priority":5};FILE_PRIORITY_CSS={0:"x-no-download",1:"x-normal-download",2:"x-high-download",5:"x-highest-download"};Deluge.Formatters={date:function(c){function b(d,e){var f=d+"";while(f.length0){return b+"m "+d+"s"}else{return b+"m"}}else{c=c/60}if(c<24){var a=Math.floor(c);var b=Math.round(60*(c-a));if(b>0){return a+"h "+b+"m"}else{return a+"h"}}else{c=c/24}var e=Math.floor(c);var a=Math.round(24*(c-e));if(a>0){return e+"d "+a+"h"}else{return e+"d"}},plain:function(a){return a}};var fsize=Deluge.Formatters.size;var fspeed=Deluge.Formatters.speed;var ftime=Deluge.Formatters.timeRemaining;var fdate=Deluge.Formatters.date;var fplain=Deluge.Formatters.plain;Deluge.Menus={onTorrentAction:function(c,d){var b=Deluge.Torrents.getSelections();var a=[];Ext.each(b,function(e){a.push(e.id)});switch(c.id){case"pause":case"resume":Deluge.Client.core[c.id+"_torrent"](a,{success:function(){Deluge.UI.update()}});break;case"top":case"up":case"down":case"bottom":Deluge.Client.core["queue_"+c.id](a,{success:function(){Deluge.UI.update()}});break;case"edit_trackers":Deluge.EditTrackers.show();break;case"update":Deluge.Client.core.force_reannounce(a,{success:function(){Deluge.UI.update()}});break;case"remove":Deluge.Events.fire("torrentRemoved",a);Deluge.Client.core.remove_torrent(a,null,{success:function(){Deluge.UI.update()}});break;case"recheck":Deluge.Client.core.force_recheck(a,{success:function(){Deluge.UI.update()}});break}}};Deluge.Menus.Torrent=new Ext.menu.Menu({id:"torrentMenu",items:[{id:"pause",text:_("Pause"),icon:"/icons/pause.png",handler:Deluge.Menus.onTorrentAction,scope:Deluge.Menus},{id:"resume",text:_("Resume"),icon:"/icons/start.png",handler:Deluge.Menus.onTorrentAction,scope:Deluge.Menus},"-",{id:"options",text:_("Options"),icon:"/icons/preferences.png",menu:new Ext.menu.Menu({items:[{text:_("D/L Speed Limit"),iconCls:"x-deluge-downloading",menu:new Ext.menu.Menu({items:[{text:_("5 KiB/s")},{text:_("10 KiB/s")},{text:_("30 KiB/s")},{text:_("80 KiB/s")},{text:_("300 KiB/s")},{text:_("Unlimited")}]})},{text:_("U/L Speed Limit"),iconCls:"x-deluge-seeding",menu:new Ext.menu.Menu({items:[{text:_("5 KiB/s")},{text:_("10 KiB/s")},{text:_("30 KiB/s")},{text:_("80 KiB/s")},{text:_("300 KiB/s")},{text:_("Unlimited")}]})},{text:_("Connection Limit"),iconCls:"x-deluge-connections",menu:new Ext.menu.Menu({items:[{text:_("50")},{text:_("100")},{text:_("200")},{text:_("300")},{text:_("500")},{text:_("Unlimited")}]})},{text:_("Upload Slot Limit"),icon:"/icons/upload_slots.png",menu:new Ext.menu.Menu({items:[{text:_("0")},{text:_("1")},{text:_("2")},{text:_("3")},{text:_("5")},{text:_("Unlimited")}]})},{id:"auto_managed",text:_("Auto Managed"),checked:false}]})},"-",{text:_("Queue"),icon:"/icons/queue.png",menu:new Ext.menu.Menu({items:[{id:"top",text:_("Top"),icon:"/icons/top.png",handler:Deluge.Menus.onTorrentAction,scope:Deluge.Menus},{id:"up",text:_("Up"),icon:"/icons/up.png",handler:Deluge.Menus.onTorrentAction,scope:Deluge.Menus},{id:"down",text:_("Down"),icon:"/icons/down.png",handler:Deluge.Menus.onTorrentAction,scope:Deluge.Menus},{id:"bottom",text:_("Bottom"),icon:"/icons/bottom.png",handler:Deluge.Menus.onTorrentAction,scope:Deluge.Menus}]})},"-",{id:"update",text:_("Update Tracker"),icon:"/icons/update.png",handler:Deluge.Menus.onTorrentAction,scope:Deluge.Menus},{id:"edit_trackers",text:_("Edit Trackers"),icon:"/icons/edit_trackers.png",handler:Deluge.Menus.onTorrentAction,scope:Deluge.Menus},"-",{id:"remove",text:_("Remove Torrent"),icon:"/icons/remove.png",handler:Deluge.Menus.onTorrentAction,scope:Deluge.Menus},"-",{id:"recheck",text:_("Force Recheck"),icon:"/icons/recheck.png",handler:Deluge.Menus.onTorrentAction,scope:Deluge.Menus},{id:"move",text:_("Move Storage"),icon:"/icons/move.png",handler:Deluge.Menus.onTorrentAction,scope:Deluge.Menus}]});Deluge.Menus.Connections=new Ext.menu.Menu({id:"connectionsMenu",items:[{id:"50",text:"50",group:"max_connections_global",checked:false,checkHandler:onLimitChanged},{id:"100",text:"100",group:"max_connections_global",checked:false,checkHandler:onLimitChanged},{id:"200",text:"200",group:"max_connections_global",checked:false,checkHandler:onLimitChanged},{id:"300",text:"300",group:"max_connections_global",checked:false,checkHandler:onLimitChanged},{id:"500",text:"500",group:"max_connections_global",checked:false,checkHandler:onLimitChanged},{id:"-1",text:_("Unlimited"),group:"max_connections_global",checked:false,checkHandler:onLimitChanged},"-",{id:"other",text:_("Other"),group:"max_connections_global",checked:false,checkHandler:onLimitChanged}]});Deluge.Menus.Download=new Ext.menu.Menu({id:"downspeedMenu",items:[{id:"5",text:"5 KiB/s",group:"max_download_speed",checked:false,checkHandler:onLimitChanged},{id:"10",text:"10 KiB/s",group:"max_download_speed",checked:false,checkHandler:onLimitChanged},{id:"30",text:"30 KiB/s",group:"max_download_speed",checked:false,checkHandler:onLimitChanged},{id:"80",text:"80 KiB/s",group:"max_download_speed",checked:false,checkHandler:onLimitChanged},{id:"300",text:"300 KiB/s",group:"max_download_speed",checked:false,checkHandler:onLimitChanged},{id:"-1",text:_("Unlimited"),group:"max_download_speed",checked:false,checkHandler:onLimitChanged},"-",{id:"other",text:_("Other"),group:"max_download_speed",checked:false,checkHandler:onLimitChanged}]});Deluge.Menus.Upload=new Ext.menu.Menu({id:"upspeedMenu",items:[{id:"5",text:"5 KiB/s",group:"max_upload_speed",checked:false,checkHandler:onLimitChanged},{id:"10",text:"10 KiB/s",group:"max_upload_speed",checked:false,checkHandler:onLimitChanged},{id:"30",text:"30 KiB/s",group:"max_upload_speed",checked:false,checkHandler:onLimitChanged},{id:"80",text:"80 KiB/s",group:"max_upload_speed",checked:false,checkHandler:onLimitChanged},{id:"300",text:"300 KiB/s",group:"max_upload_speed",checked:false,checkHandler:onLimitChanged},{id:"-1",text:_("Unlimited"),group:"max_upload_speed",checked:false,checkHandler:onLimitChanged},"-",{id:"other",text:_("Other"),group:"max_upload_speed",checked:false,checkHandler:onLimitChanged}]});Deluge.Menus.FilePriorities=new Ext.menu.Menu({id:"filePrioritiesMenu",items:[{id:"expandAll",text:_("Expand All"),icon:"/icons/expand_all.png"},"-",{id:"no_download",text:_("Do Not Download"),icon:"/icons/no_download.png",filePriority:0},{id:"normal",text:_("Normal Priority"),icon:"/icons/normal.png",filePriority:1},{id:"high",text:_("High Priority"),icon:"/icons/high.png",filePriority:2},{id:"highest",text:_("Highest Priority"),icon:"/icons/highest.png",filePriority:5}]});function onLimitChanged(b,a){if(b.id=="other"){}else{config={};config[b.group]=b.id;Deluge.Client.core.set_config(config,{success:function(){Deluge.UI.update()}})}}(function(){Events=Ext.extend(Ext.util.Observable,{constructor:function(){Events.superclass.constructor.call(this)},addListener:function(a,c,b,d){this.addEvents(a);Events.superclass.addListener.call(this,a,c,b,d)}});Events.prototype.on=Events.prototype.addListener;Events.prototype.fire=Events.prototype.fireEvent;Deluge.Events=new Events()})();Deluge.OptionsManager=Ext.extend(Ext.util.Observable,{constructor:function(a){this.changed={};this.options={};Deluge.OptionsManager.superclass.constructor.call(this);this.addEvents({add:true,changed:true,reset:true})},addOptions:function(b,a){this.options[b]=a},getChanged:function(a){return(this.changed[a])?this.changed[a]:{}},getDefault:function(b,a){return this.options[b][a]},getValue:function(b,a){return(this.hasChanged(b,a))?this.changed[b][a]:this.options[b][a]},hasChanged:function(b,a){return(this.changed[b]&&!Ext.isEmpty(this.changed[b][a]))},resetOptions:function(a){if(!this.changed[a]){return}delete this.changed[a]},setOption:function(d,b,c){if(!this.changed[d]){this.changed[d]={}}var a=this.getValue(d,b);if(this.options[d][b]==c){if(!Ext.isEmpty(this.changed[d][b])){delete this.changed[d][b]}this.fireEvent("changed",d,b,c,a);return}if(Ext.type(this.options[d][b])!=Ext.type(c)){switch(Ext.type(this.options[d][b])){case"string":c=String(c);break;case"number":c=Number(c);break;case"boolean":c=Boolean(c);break}}this.changed[d][b]=c;this.fireEvent("changed",d,b,c,a)},setOptions:function(c,a){if(!this.changed[c]){this.changed[c]={}}for(var b in a){this.setOption(c,b,a[b])}},updateOption:function(c,a,b){this.options[c][a]=b},updateOptions:function(c,a){if(!this.options[c]){this.addOptions(c,a)}else{for(var b in a){this.updateOption(c,b,a[b])}}}});Ext.namespace("Ext.deluge.add");Ext.deluge.add.OptionsPanel=Ext.extend(Ext.TabPanel,{constructor:function(a){a=Ext.apply({region:"south",margins:"5 5 5 5",activeTab:0,height:220},a);Ext.deluge.add.OptionsPanel.superclass.constructor.call(this,a)},initComponent:function(){Ext.deluge.add.OptionsPanel.superclass.initComponent.call(this);this.files=this.add(new Ext.tree.ColumnTree({layout:"fit",title:_("Files"),rootVisible:false,autoScroll:true,height:170,border:false,animate:false,columns:[{header:_("Filename"),width:275,dataIndex:"filename"},{header:_("Size"),width:80,dataIndex:"size"}],root:new Ext.tree.AsyncTreeNode({text:"Files"})}));new Ext.tree.TreeSorter(this.files,{folderSort:true});this.form=this.add({xtype:"form",labelWidth:1,frame:false,title:_("Options"),bodyStyle:"padding: 5px;",border:false,items:[{xtype:"fieldset",title:_("Download Location"),border:false,defaultType:"textfield",labelWidth:1,items:[{fieldLabel:"",labelSeperator:"",name:"download_location",width:330}]}]})},clear:function(){this.clearFiles()},clearFiles:function(){var a=this.files.getRootNode();if(!a.hasChildNodes()){return}a.cascade(function(b){if(!b.parentNode||!b.getOwnerTree()){return}b.remove()})},getDefaults:function(){var a=["add_paused","compact_allocation","download_location","max_connections_per_torrent","max_download_speed_per_torrent","max_upload_slots_per_torrent","max_upload_speed_per_torrent","prioritize_first_last_pieces"];Deluge.Client.core.get_config_values(a,{success:function(b){this.defaults=b;for(var c in b){var d=this.form.findField(c);if(!d){return}d.setValue(b[c])}var d=this.form.findField("compact_allocation");if(b.compact_allocation){d.items.get("compact_allocation_true").setValue(true);d.items.get("compact_allocation_false").setValue(false)}else{d.items.get("compact_allocation_false").setValue(true);d.items.get("compact_allocation_true").setValue(false)}},scope:this})}});Ext.deluge.add.Window=Ext.extend(Ext.Window,{initComponent:function(){Ext.deluge.add.Window.superclass.initComponent.call(this);this.addEvents("beforeadd","add")},createTorrentId:function(){return new Date().getTime()}});Ext.deluge.add.AddWindow=Ext.extend(Ext.deluge.add.Window,{torrents:{},constructor:function(a){a=Ext.apply({title:_("Add Torrents"),layout:"border",width:470,height:450,bodyStyle:"padding: 10px 5px;",buttonAlign:"right",closeAction:"hide",closable:true,plain:true,iconCls:"x-deluge-add-window-icon"},a);Ext.deluge.add.AddWindow.superclass.constructor.call(this,a)},initComponent:function(){Ext.deluge.add.AddWindow.superclass.initComponent.call(this);this.addButton(_("Cancel"),this.onCancel,this);this.addButton(_("Add"),this.onAdd,this);function a(c,d,b){if(b.data.info_hash){return String.format('
{0}
',c)}else{return String.format('
{0}
',c)}}this.grid=this.add({xtype:"grid",region:"center",store:new Ext.data.SimpleStore({fields:[{name:"info_hash",mapping:1},{name:"text",mapping:2}],id:0}),columns:[{id:"torrent",width:150,sortable:true,renderer:a,dataIndex:"text"}],stripeRows:true,selModel:new Ext.grid.RowSelectionModel({singleSelect:true,listeners:{rowselect:{fn:this.onSelect,scope:this}}}),hideHeaders:true,autoExpandColumn:"torrent",deferredRender:false,autoScroll:true,margins:"5 5 5 5",bbar:new Ext.Toolbar({items:[{id:"file",cls:"x-btn-text-icon",iconCls:"x-deluge-add-file",text:_("File"),handler:this.onFile,scope:this},{id:"url",cls:"x-btn-text-icon",text:_("Url"),icon:"/icons/add_url.png",handler:this.onUrl,scope:this},{id:"infohash",cls:"x-btn-text-icon",text:_("Infohash"),icon:"/icons/add_magnet.png",disabled:true},"->",{id:"remove",cls:"x-btn-text-icon",text:_("Remove"),icon:"/icons/remove.png",handler:this.onRemove,scope:this}]})});this.options=this.add(new Ext.deluge.add.OptionsPanel());this.on("show",this.onShow,this)},clear:function(){this.torrents={};this.grid.getStore().removeAll();this.options.clear()},onAdd:function(){torrents=[];for(var b in this.torrents){var a=this.torrents[b];torrents.push({path:a.filename,options:{}})}Deluge.Client.web.add_torrents(torrents,{success:function(c){}});this.clear();this.hide()},onCancel:function(){this.clear();this.hide()},onFile:function(){this.file.show()},onRemove:function(){var a=this.grid.getSelectionModel();if(!a.hasSelection()){return}var b=a.getSelected();delete this.torrents[b.id];this.grid.getStore().remove(b);this.options.clear()},onSelect:function(e,f,c){var d=this.torrents[c.get("info_hash")];function b(k,h){for(var g in k){var j=k[g];if(Ext.type(j)=="object"){var l=new Ext.tree.TreeNode({text:g});b(j,l);h.appendChild(l)}else{h.appendChild(new Ext.tree.TreeNode({filename:g,text:g,size:fsize(j[0]),leaf:true,checked:j[1],iconCls:"x-deluge-file",uiProvider:Ext.tree.ColumnNodeUI}))}}}this.options.clearFiles();var a=this.options.files.getRootNode();b(d.files_tree,a);a.firstChild.expand()},onShow:function(){if(!this.url){this.url=new Ext.deluge.add.UrlWindow();this.url.on("beforeadd",this.onTorrentBeforeAdd,this);this.url.on("add",this.onTorrentAdd,this)}if(!this.file){this.file=new Ext.deluge.add.FileWindow();this.file.on("beforeadd",this.onTorrentBeforeAdd,this);this.file.on("add",this.onTorrentAdd,this)}},onTorrentBeforeAdd:function(b,c){var a=this.grid.getStore();a.loadData([[b,null,c]],true)},onTorrentAdd:function(a,c){if(!c){Ext.MessageBox.show({title:_("Error"),msg:_("Not a valid torrent"),buttons:Ext.MessageBox.OK,modal:false,icon:Ext.MessageBox.ERROR,iconCls:"x-deluge-icon-error"});return}var b=this.grid.getStore().getById(a);b.set("info_hash",c.info_hash);b.set("text",c.name);this.grid.getStore().commitChanges();this.torrents[c.info_hash]=c},onUrl:function(a,b){this.url.show()}});Deluge.Add=new Ext.deluge.add.AddWindow();Ext.deluge.add.FileWindow=Ext.extend(Ext.deluge.add.Window,{constructor:function(a){a=Ext.apply({layout:"fit",width:350,height:115,bodyStyle:"padding: 10px 5px;",buttonAlign:"center",closeAction:"hide",modal:true,plain:true,title:_("Add from File"),iconCls:"x-deluge-add-file",buttons:[{text:_("Add"),handler:this.onAdd,scope:this}]},a);Ext.deluge.add.UrlWindow.superclass.constructor.call(this,a)},initComponent:function(){Ext.deluge.add.UrlWindow.superclass.initComponent.call(this);this.form=this.add(new Ext.form.FormPanel({baseCls:"x-plain",labelWidth:55,autoHeight:true,fileUpload:true,items:[{xtype:"fileuploadfield",id:"torrentFile",emptyText:_("Select a torrent"),fieldLabel:_("File"),name:"file",buttonCfg:{text:_("Browse")+"..."}}]}))},onAdd:function(c,b){if(this.form.getForm().isValid()){this.torrentId=this.createTorrentId();this.form.getForm().submit({url:"/upload",waitMsg:_("Uploading your torrent..."),success:this.onUploadSuccess,scope:this});var a=this.form.getForm().findField("torrentFile").value;this.fireEvent("beforeadd",this.torrentId,a)}},onGotInfo:function(d,c,a,b){d.filename=b.options.filename;this.fireEvent("add",this.torrentId,d)},onUploadSuccess:function(c,b){this.hide();var a=b.result.toString();this.form.getForm().findField("torrentFile").setValue("");Deluge.Client.web.get_torrent_info(a,{success:this.onGotInfo,scope:this,filename:a})}});Ext.deluge.add.UrlWindow=Ext.extend(Ext.deluge.add.Window,{constructor:function(a){a=Ext.apply({layout:"fit",width:350,height:115,bodyStyle:"padding: 10px 5px;",buttonAlign:"center",closeAction:"hide",modal:true,plain:true,title:_("Add from Url"),iconCls:"x-deluge-add-url-window-icon",buttons:[{text:_("Add"),handler:this.onAdd,scope:this}]},a);Ext.deluge.add.UrlWindow.superclass.constructor.call(this,a)},initComponent:function(){Ext.deluge.add.UrlWindow.superclass.initComponent.call(this);this.form=this.add(new Ext.form.FormPanel({defaultType:"textfield",baseCls:"x-plain",labelWidth:55,items:[{fieldLabel:_("Url"),id:"url",name:"url",inputType:"url",anchor:"100%",listeners:{specialkey:{fn:this.onAdd,scope:this}}}]}))},onAdd:function(d,c){if(d.id=="url"&&c.getKey()!=c.ENTER){return}var d=this.form.items.get("url");var b=d.getValue();var a=this.createTorrentId();Deluge.Client.web.download_torrent_from_url(b,{success:this.onDownload,scope:this,torrentId:a});this.hide();this.fireEvent("beforeadd",a,b)},onDownload:function(a,c,d,b){this.form.items.get("url").setValue("");Deluge.Client.web.get_torrent_info(a,{success:this.onGotInfo,scope:this,filename:a,torrentId:b.options.torrentId})},onGotInfo:function(d,c,a,b){d.filename=b.options.filename;this.fireEvent("add",b.options.torrentId,d)}});Ext.namespace("Ext.ux.util");(function(){Ext.ux.util.RpcClient=Ext.extend(Ext.util.Observable,{_components:[],_methods:[],_requests:{},_url:null,_optionKeys:["scope","success","failure"],constructor:function(a){Ext.ux.util.RpcClient.superclass.constructor.call(this,a);this._url=a.url||null;this._id=0;this.addEvents("connected");this.reloadMethods()},reloadMethods:function(){Ext.each(this._components,function(a){delete this[a]},this);this._execute("system.listMethods",{success:this._setMethods,scope:this})},_execute:function(c,a){a=a||{};a.params=a.params||[];a.id=this._id;var b=Ext.encode({method:c,params:a.params,id:a.id});this._id++;return Ext.Ajax.request({url:this._url,method:"POST",success:this._onSuccess,failure:this._onFailure,scope:this,jsonData:b,options:a})},_onFailure:function(b,a){var c=a.options;errorObj={id:c.id,result:null,error:"HTTP"+b.status};if(Ext.type(c.failure)!="function"){return}if(c.scope){c.failure.call(c.scope,responseObj.error,responseObj,b)}else{c.failure(responseObj.error,responseObj,b)}},_onSuccess:function(c,a){var b=Ext.decode(c.responseText);var d=a.options;if(b.error){if(Ext.type(d.failure)!="function"){return}if(d.scope){d.failure.call(d.scope,b.error,b,c,a)}else{d.failure(b.error,b,c,a)}}else{if(Ext.type(d.success)!="function"){return}if(d.scope){d.success.call(d.scope,b.result,b,c,a)}else{d.success(b.result,b,c,a)}}},_parseArgs:function(c){var e=[];Ext.each(c,function(f){e.push(f)});var b=e[e.length-1];if(Ext.type(b)=="object"){var d=Ext.keys(b),a=false;Ext.each(this._optionKeys,function(f){if(d.indexOf(f)>-1){a=true}});if(a){e.remove(b)}else{b={}}}else{b={}}b.params=e;return b},_setMethods:function(b){var d={},a=this;Ext.each(b,function(h){var g=h.split(".");var e=d[g[0]]||{};var f=function(){var j=a._parseArgs(arguments);return a._execute(h,j)};e[g[1]]=f;d[g[0]]=e});for(var c in d){a[c]=d[c]}this._components=Ext.keys(d);this.fireEvent("connected",this)}})})();(function(){var a=function(c,d,b){return c+":"+b.data.port};Ext.deluge.ConnectionManager=Ext.extend(Ext.Window,{layout:"fit",width:300,height:220,bodyStyle:"padding: 10px 5px;",buttonAlign:"right",closeAction:"hide",closable:true,plain:true,title:_("Connection Manager"),iconCls:"x-deluge-connect-window-icon",initComponent:function(){Ext.deluge.ConnectionManager.superclass.initComponent.call(this);this.on({hide:this.onHide,show:this.onShow});Deluge.Events.on("login",this.onLogin,this);Deluge.Events.on("logout",this.onLogout,this);this.addButton(_("Close"),this.onClose,this);this.addButton(_("Connect"),this.onConnect,this);this.grid=this.add({xtype:"grid",store:new Ext.data.SimpleStore({fields:[{name:"status",mapping:3},{name:"host",mapping:1},{name:"port",mapping:2},{name:"version",mapping:4}],id:0}),columns:[{header:_("Status"),width:65,sortable:true,renderer:fplain,dataIndex:"status"},{id:"host",header:_("Host"),width:150,sortable:true,renderer:a,dataIndex:"host"},{header:_("Version"),width:75,sortable:true,renderer:fplain,dataIndex:"version"}],stripeRows:true,selModel:new Ext.grid.RowSelectionModel({singleSelect:true,listeners:{rowselect:{fn:this.onSelect,scope:this}}}),autoExpandColumn:"host",deferredRender:false,autoScroll:true,margins:"0 0 0 0",bbar:new Ext.Toolbar({items:[{id:"add",cls:"x-btn-text-icon",text:_("Add"),icon:"/icons/add.png",handler:this.onAdd,scope:this},{id:"remove",cls:"x-btn-text-icon",text:_("Remove"),icon:"/icons/remove.png",handler:this.onRemove,scope:this},"->",{id:"stop",cls:"x-btn-text-icon",text:_("Stop Daemon"),icon:"/icons/error.png",handler:this.onStop,scope:this}]})})},disconnect:function(){Deluge.Events.fire("disconnect")},runCheck:function(c,b){c=c||this.onGetHosts;b=b||this;Deluge.Client.web.get_hosts({success:c,scope:b})},onAdd:function(b,c){},onAddHost:function(){var e=Deluge.Connections.Add.items.first();var d=e.items.get("host").getValue();var b=e.items.get("port").getValue();var f=e.items.get("username").getValue();var c=e.items.get("_password").getValue();Deluge.Client.web.add_host(d,b,f,c,{onSuccess:function(g){if(!g[0]){Ext.MessageBox.show({title:_("Error"),msg:"Unable to add host: "+g[1],buttons:Ext.MessageBox.OK,modal:false,icon:Ext.MessageBox.ERROR,iconCls:"x-deluge-icon-error"})}else{this.runCheck()}Deluge.Connections.Add.hide()}})},onAddWindowHide:function(){var b=Deluge.Connections.Add.items.first();b.items.get("host").reset();b.items.get("port").reset();b.items.get("username").reset();b.items.get("_password").reset()},onClose:function(b){if(this.running){window.clearInterval(this.running)}this.hide()},onConnect:function(c){var b=this.grid.getSelectionModel().getSelected();if(!b){return}if(b.get("status")==_("Connected")){Deluge.Client.web.disconnect({success:function(e){this.runCheck();Deluge.Events.fire("disconnect")},scope:this})}else{var d=b.id;Deluge.Client.web.connect(d,{success:function(e){Deluge.Client.reloadMethods();Deluge.Client.on("connected",function(f){Deluge.Events.fire("connect")},this,{single:true})}});if(this.running){window.clearInterval(this.running)}this.hide()}},onGetHosts:function(b){this.grid.getStore().loadData(b);var c=this.grid.getSelectionModel();c.selectRow(this.selectedRow)},onLogin:function(){Deluge.Client.web.connected({success:function(b){if(b){Deluge.Events.fire("connect")}else{this.show()}},scope:this})},onLogout:function(){this.disconnect();if(!this.hidden&&this.rendered){this.hide()}},onRemove:function(c){var b=Deluge.Connections.Grid.getSelectionModel().getSelected();Deluge.Client.web.remove_host(b.id,{onSuccess:function(d){if(!d){Ext.MessageBox.show({title:_("Error"),msg:d[1],buttons:Ext.MessageBox.OK,modal:false,icon:Ext.MessageBox.ERROR,iconCls:"x-deluge-icon-error"})}else{Deluge.Connections.Grid.store.remove(b)}}})},onSelect:function(c,e,b){this.selectedRow=e;var d=this.buttons[1];if(b.get("status")==_("Connected")){d.setText(_("Disconnect"))}else{d.setText(_("Connect"))}},onShow:function(){this.runCheck();this.running=window.setInterval(this.runCheck,2000)},onStop:function(c,d){var b=this.grid.getSelectionModel().getSelected();Deluge.Client.web.stop_daemon(b.id,{success:function(e){if(!e[0]){Ext.MessageBox.show({title:_("Error"),msg:e[1],buttons:Ext.MessageBox.OK,modal:false,icon:Ext.MessageBox.ERROR,iconCls:"x-deluge-icon-error"})}}})}});Deluge.ConnectionManager=new Ext.deluge.ConnectionManager()})();(function(){Ext.namespace("Ext.deluge.details");Ext.deluge.details.TabPanel=Ext.extend(Ext.TabPanel,{constructor:function(a){a=Ext.apply({region:"south",id:"torrentDetails",split:true,height:220,minSize:100,collapsible:true,margins:"0 5 5 5",activeTab:0},a);Ext.deluge.details.TabPanel.superclass.constructor.call(this,a)},clear:function(){this.items.each(function(a){if(a.clear){a.clear.defer(100,a);a.disable()}})},update:function(a){var b=Deluge.Torrents.getSelected();if(!b){this.clear();return}this.items.each(function(c){if(c.disabled){c.enable()}});a=a||this.getActiveTab();if(a.update){a.update(b.id)}},onRender:function(b,a){Ext.deluge.details.TabPanel.superclass.onRender.call(this,b,a);Deluge.Events.on("disconnect",this.clear,this);Deluge.Torrents.on("rowclick",this.onTorrentsClick,this);this.on("tabchange",this.onTabChange,this);Deluge.Torrents.getSelectionModel().on("selectionchange",function(c){if(!c.hasSelection()){this.clear()}},this)},onTabChange:function(a,b){this.update(b)},onTorrentsClick:function(a,c,b){this.update()}});Deluge.Details=new Ext.deluge.details.TabPanel()})();Ext.deluge.details.StatusTab=Ext.extend(Ext.Panel,{title:_("Status"),autoScroll:true,onRender:function(b,a){Ext.deluge.details.StatusTab.superclass.onRender.call(this,b,a);this.progressBar=this.add({xtype:"fullprogressbar",cls:"x-deluge-status-progressbar"});this.status=this.add({cls:"x-deluge-status",id:"deluge-details-status",border:false,width:1000,listeners:{render:{fn:function(c){c.load({url:"/render/tab_status.html",text:_("Loading")+"..."});c.getUpdater().on("update",this.onPanelUpdate,this)},scope:this}}})},clear:function(){this.progressBar.updateProgress(0," ");for(var a in this.fields){this.fields[a].innerHTML=""}},update:function(a){if(!this.fields){this.getFields()}Deluge.Client.core.get_torrent_status(a,Deluge.Keys.Status,{success:this.onRequestComplete,scope:this})},onPanelUpdate:function(b,a){this.fields={};Ext.each(Ext.query("dd",this.status.body.dom),function(c){this.fields[c.className]=c},this)},onRequestComplete:function(a){seeders=a.total_seeds>-1?a.num_seeds+" ("+a.total_seeds+")":a.num_seeds;peers=a.total_peers>-1?a.num_peers+" ("+a.total_peers+")":a.num_peers;var b={downloaded:fsize(a.total_done)+" ("+fsize(a.total_payload_download)+")",uploaded:fsize(a.total_uploaded)+" ("+fsize(a.total_payload_upload)+")",share:a.ratio.toFixed(3),announce:ftime(a.next_announce),tracker_status:a.tracker_status,downspeed:fspeed(a.download_payload_rate),upspeed:fspeed(a.upload_payload_rate),eta:ftime(a.eta),pieces:a.num_pieces+" ("+fsize(a.piece_length)+")",seeders:seeders,peers:peers,avail:a.distributed_copies.toFixed(3),active_time:ftime(a.active_time),seeding_time:ftime(a.seeding_time),seed_rank:a.seed_rank,time_added:fdate(a.time_added)};b.auto_managed=_((a.is_auto_managed)?"True":"False");for(var c in this.fields){this.fields[c].innerHTML=b[c]}var d=a.state+" "+a.progress.toFixed(2)+"%";this.progressBar.updateProgress(a.progress,d)}});Deluge.Details.add(new Ext.deluge.details.StatusTab());Ext.deluge.details.DetailsTab=Ext.extend(Ext.Panel,{title:_("Details"),bodyStyle:"padding 5px",onRender:function(b,a){Ext.deluge.details.DetailsTab.superclass.onRender.call(this,b,a);this.load({url:"/render/tab_details.html",text:_("Loading")+"..."});this.body.setStyle("padding","5px");this.getUpdater().on("update",this.onPanelUpdate,this)},clear:function(){if(!this.fields){return}for(var a in this.fields){this.fields[a].innerHTML=""}},update:function(a){Deluge.Client.core.get_torrent_status(a,Deluge.Keys.Details,{success:this.onRequestComplete,scope:this,torrentId:a})},onPanelUpdate:function(b,a){this.fields={};Ext.each(Ext.query("dd",this.body.dom),function(c){this.fields[c.className]=c},this)},onRequestComplete:function(c,a){var b={torrent_name:c.name,hash:a.torrentId,path:c.save_path,size:fsize(c.total_size),files:c.num_files,status:c.tracker_status,tracker:c.tracker,comment:c.comment};for(var d in this.fields){this.fields[d].innerHTML=b[d]}}});Deluge.Details.add(new Ext.deluge.details.DetailsTab());(function(){function b(d){var c=d*100;return Deluge.progressBar(c,this.width-50,c.toFixed(2)+"%",0)}function a(c){return String.format('
{1}
',FILE_PRIORITY_CSS[c],_(FILE_PRIORITY[c]))}Ext.deluge.details.FilesTab=Ext.extend(Ext.tree.ColumnTree,{constructor:function(c){c=Ext.apply({title:_("Files"),rootVisible:false,autoScroll:true,selModel:new Ext.tree.MultiSelectionModel(),columns:[{header:_("Filename"),width:330,dataIndex:"filename"},{header:_("Size"),width:150,dataIndex:"size",renderer:fsize},{header:_("Progress"),width:150,dataIndex:"progress",renderer:b},{header:_("Priority"),width:150,dataIndex:"priority",renderer:a}],root:new Ext.tree.TreeNode({text:"Files"})},c);Ext.deluge.details.FilesTab.superclass.constructor.call(this,c)},onRender:function(d,c){Ext.deluge.details.FilesTab.superclass.onRender.call(this,d,c);Deluge.Menus.FilePriorities.on("itemclick",this.onItemClick,this);this.on("contextmenu",this.onContextMenu,this);this.sorter=new Ext.tree.TreeSorter(this,{folderSort:true})},clear:function(){var c=this.getRootNode();if(!c.hasChildNodes()){return}c.cascade(function(e){var d=e.parentNode;if(!d){return}if(!d.ownerTree){return}d.removeChild(e)})},update:function(c){if(this.torrentId!=c){this.clear();this.torrentId=c}Deluge.Client.web.get_torrent_files(c,{success:this.onRequestComplete,scope:this,torrentId:c})},onContextMenu:function(d,f){f.stopEvent();var c=this.getSelectionModel();if(c.getSelectedNodes().length<2){c.clearSelections();d.select()}Deluge.Menus.FilePriorities.showAt(f.getPoint())},onItemClick:function(k,j){switch(k.id){case"expandAll":this.expandAll();break;default:var h={};function c(e){if(Ext.isEmpty(e.attributes.fileIndex)){return}h[e.attributes.fileIndex]=e.attributes.priority}this.getRootNode().cascade(c);var d=this.getSelectionModel().getSelectedNodes();Ext.each(d,function(e){if(Ext.isEmpty(e.attributes.fileIndex)){return}h[e.attributes.fileIndex]=k.filePriority});var g=new Array(Ext.keys(h).length);for(var f in h){g[f]=h[f]}Deluge.Client.core.set_torrent_file_priorities(this.torrentId,g,{success:function(){Ext.each(d,function(e){e.setColumnValue(3,k.filePriority)})},scope:this});break}},onRequestComplete:function(f,e){function d(k,h){for(var g in k){var j=k[g];var l=h.findChild("id",g);if(Ext.type(j)=="object"){if(!l){l=new Ext.tree.TreeNode({id:g,text:g});h.appendChild(l)}d(j,l)}else{if(!l){l=new Ext.tree.ColumnTreeNode({id:g,filename:g,text:g,fileIndex:j[0],size:j[1],progress:j[2],priority:j[3],leaf:true,iconCls:"x-deluge-file",uiProvider:Ext.tree.ColumnNodeUI});h.appendChild(l)}l.setColumnValue(1,j[1]);l.setColumnValue(2,j[2]);l.setColumnValue(3,j[3])}}}var c=this.getRootNode();d(f,c);c.firstChild.expand()}});Deluge.Details.add(new Ext.deluge.details.FilesTab())})();(function(){function a(e){return String.format('',e)}function c(g,h,f){var e=(f.data.seed==1024)?"x-deluge-seed":"x-deluge-peer";return String.format('
{1}
',e,g)}function d(g){var e=(g*100).toFixed(0);var f=new Number(this.style.match(/\w+:\s*(\d+)\w+/)[1]).toFixed(0)-8;return Deluge.progressBar(e,f,e+"%")}function b(g){var e=g.match(/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\:(\d+)/);var f=0;var h=[e[1],e[2],e[3],e[4]];Ext.each(h,function(k,j){k=parseInt(k);f=f|k<<((3-j)*8)});return f}Ext.deluge.details.PeersTab=Ext.extend(Ext.grid.GridPanel,{constructor:function(e){e=Ext.apply({title:_("Peers"),cls:"x-deluge-peers",store:new Ext.data.SimpleStore({fields:[{name:"country"},{name:"address",sortType:b},{name:"client"},{name:"progress",type:"float"},{name:"downspeed",type:"int"},{name:"upspeed",type:"int"},{name:"seed",type:"int"}],id:0}),columns:[{header:" ",width:30,sortable:true,renderer:a,dataIndex:"country"},{header:"Address",width:125,sortable:true,renderer:c,dataIndex:"address"},{header:"Client",width:125,sortable:true,renderer:fplain,dataIndex:"client"},{header:"Progress",width:150,sortable:true,renderer:d,dataIndex:"progress"},{header:"Down Speed",width:100,sortable:true,renderer:fspeed,dataIndex:"downspeed"},{header:"Up Speed",width:100,sortable:true,renderer:fspeed,dataIndex:"upspeed"}],stripeRows:true,deferredRender:false,autoScroll:true},e);Ext.deluge.details.PeersTab.superclass.constructor.call(this,e)},onRender:function(f,e){Ext.deluge.details.PeersTab.superclass.onRender.call(this,f,e)},clear:function(){this.getStore().loadData([])},update:function(e){Deluge.Client.core.get_torrent_status(e,Deluge.Keys.Peers,{success:this.onRequestComplete,scope:this})},onRequestComplete:function(g,f){if(!g){return}var e=new Array();Ext.each(g.peers,function(h){e.push([h.country,h.ip,h.client,h.progress,h.down_speed,h.up_speed,h.seed])},this);this.getStore().loadData(e)}});Deluge.Details.add(new Ext.deluge.details.PeersTab())})();Ext.deluge.details.OptionsTab=Ext.extend(Ext.form.FormPanel,{constructor:function(a){a=Ext.apply({autoScroll:true,bodyStyle:"padding: 5px;",border:false,cls:"x-deluge-options",defaults:{autoHeight:true,labelWidth:1,defaultType:"checkbox"},deferredRender:false,layout:"column",title:_("Options")},a);Ext.deluge.details.OptionsTab.superclass.constructor.call(this,a)},initComponent:function(){Ext.deluge.details.OptionsTab.superclass.initComponent.call(this);this.fieldsets={},this.fields={};this.optionsManager=new Deluge.OptionsManager();this.optionsManager.on("changed",this.onOptionChanged,this);this.fieldsets.bandwidth=this.add({xtype:"fieldset",defaultType:"uxspinner",bodyStyle:"padding: 5px",layout:"table",layoutConfig:{columns:3},labelWidth:150,style:"margin-left: 10px; margin-right: 5px; padding: 5px",title:_("Bandwidth"),width:250});this.fieldsets.bandwidth.add({xtype:"label",text:_("Max Download Speed"),forId:"max_download_speed",cls:"x-deluge-options-label"});this.fields.max_download_speed=this.fieldsets.bandwidth.add({id:"max_download_speed",name:"max_download_speed",width:70,stragegy:new Ext.ux.form.Spinner.NumberStrategy({minValue:-1,maxValue:99999}),listeners:{spin:{fn:this.onFieldChange,scope:this},keypress:{fn:this.onFieldChange,scope:this}}});this.fieldsets.bandwidth.add({xtype:"label",text:_("KiB/s"),style:"margin-left: 10px"});this.fieldsets.bandwidth.add({xtype:"label",text:_("Max Upload Speed"),forId:"max_upload_speed",cls:"x-deluge-options-label"});this.fields.max_upload_speed=this.fieldsets.bandwidth.add({id:"max_upload_speed",name:"max_upload_speed",width:70,value:-1,stragegy:new Ext.ux.form.Spinner.NumberStrategy({minValue:-1,maxValue:99999,incrementValue:1}),listeners:{spin:{fn:this.onFieldChange,scope:this},keypress:{fn:this.onFieldChange,scope:this}}});this.fieldsets.bandwidth.add({xtype:"label",text:_("KiB/s"),style:"margin-left: 10px"});this.fieldsets.bandwidth.add({xtype:"label",text:_("Max Connections"),forId:"max_connections",cls:"x-deluge-options-label"});this.fields.max_connections=this.fieldsets.bandwidth.add({id:"max_connections",name:"max_connections",width:70,value:-1,stragegy:new Ext.ux.form.Spinner.NumberStrategy({minValue:-1,maxValue:99999,incrementValue:1}),listeners:{spin:{fn:this.onFieldChange,scope:this},keypress:{fn:this.onFieldChange,scope:this}},colspan:2});this.fieldsets.bandwidth.add({xtype:"label",text:_("Max Upload Slots"),forId:"max_upload_slots",cls:"x-deluge-options-label"});this.fields.max_upload_slots=this.fieldsets.bandwidth.add({id:"max_upload_slots",name:"max_upload_slots",width:70,value:-1,stragegy:new Ext.ux.form.Spinner.NumberStrategy({minValue:-1,maxValue:99999,incrementValue:1}),listeners:{spin:{fn:this.onFieldChange,scope:this},keypress:{fn:this.onFieldChange,scope:this}},colspan:2});this.fieldsets.queue=this.add({xtype:"fieldset",title:_("Queue"),style:"margin-left: 5px; margin-right: 5px; padding: 5px",width:210,layout:"table",layoutConfig:{columns:2},labelWidth:0,defaults:{fieldLabel:"",labelSeparator:""}});this.fields.is_auto_managed=this.fieldsets.queue.add({fieldLabel:"",labelSeparator:"",id:"is_auto_managed",boxLabel:_("Auto Managed"),width:200,listeners:{check:{fn:this.onFieldChange,scope:this}},colspan:2});this.fields.stop_at_ratio=this.fieldsets.queue.add({fieldLabel:"",labelSeparator:"",id:"stop_at_ratio",width:110,boxLabel:_("Stop seed at ratio"),listeners:{check:{fn:this.onFieldChange,scope:this}}});this.fields.stop_ratio=this.fieldsets.queue.add({xtype:"uxspinner",id:"stop_ratio",name:"stop_ratio",disabled:true,width:50,value:2,stragegy:new Ext.ux.form.Spinner.NumberStrategy({minValue:-1,maxValue:99999,incrementValue:1}),listeners:{spin:{fn:this.onFieldChange,scope:this},keypress:{fn:this.onFieldChange,scope:this}}});this.fields.remove_at_ratio=this.fieldsets.queue.add({fieldLabel:"",labelSeparator:"",id:"remove_at_ratio",bodyStyle:"padding-left: 10px",boxLabel:_("Remove at ratio"),disabled:true,listeners:{check:{fn:this.onFieldChange,scope:this}},colspan:2});this.fields.move_completed=this.fieldsets.queue.add({fieldLabel:"",labelSeparator:"",id:"move_completed",boxLabel:_("Move Completed"),listeners:{check:{fn:this.onFieldChange,scope:this}},colspan:2});this.rightColumn=this.add({border:false,autoHeight:true,style:"margin-left: 5px",width:200});this.fieldsets.general=this.rightColumn.add({xtype:"fieldset",autoHeight:true,defaultType:"checkbox",title:_("General"),layout:"form"});this.fields["private"]=this.fieldsets.general.add({fieldLabel:"",labelSeparator:"",boxLabel:_("Private"),id:"private",listeners:{check:{fn:this.onFieldChange,scope:this}}});this.fields.prioritize_first_last=this.fieldsets.general.add({fieldLabel:"",labelSeparator:"",boxLabel:_("Prioritize First/Last"),id:"prioritize_first_last",listeners:{check:{fn:this.onFieldChange,scope:this}}});this.buttonPanel=this.rightColumn.add({layout:"column",xtype:"panel",border:false});this.buttonPanel.add({xtype:"panel",border:false}).add({id:"edit_trackers",xtype:"button",text:_("Edit Trackers"),cls:"x-btn-text-icon",iconCls:"x-deluge-edit-trackers",border:false,width:100,handler:this.onEditTrackers,scope:this});this.buttonPanel.add({xtype:"panel",border:false}).add({id:"apply",xtype:"button",text:_("Apply"),style:"margin-left: 10px;",border:false,width:100,handler:this.onApply,scope:this})},onRender:function(b,a){Ext.deluge.details.OptionsTab.superclass.onRender.call(this,b,a);this.layout=new Ext.layout.ColumnLayout();this.layout.setContainer(this);this.doLayout()},clear:function(){this.fields.max_download_speed.setValue(0);this.fields.max_upload_speed.setValue(0);this.fields.max_connections.setValue(0);this.fields.max_upload_slots.setValue(0);this.fields.is_auto_managed.setValue(false);this.fields.stop_at_ratio.setValue(false);this.fields.remove_at_ratio.setValue(false);this.fields["private"].setValue(false);this.fields.prioritize_first_last.setValue(false)},reset:function(){if(this.torrentId){this.optionsManager.resetOptions(this.torrentId)}},update:function(a){this.torrentId=a;Deluge.Client.core.get_torrent_status(a,Deluge.Keys.Options,{success:this.onRequestComplete,scope:this})},onApply:function(){var b=this.optionsManager.getChanged(this.torrentId);if(!Ext.isEmpty(b.prioritize_first_last)){var a=b.prioritize_first_last;Deluge.Client.core.set_torrent_prioritize_first_last(this.torrentId,a,{success:function(){this.optionsManager.updateOption(this.torrentId,"prioritize_first_last",a)},scope:this})}Deluge.Client.core.set_torrent_options([this.torrentId],b,{success:function(){this.optionsManager.updateOptions(this.torrentId,b);this.optionsManager.resetOptions(this.torrentId)},scope:this})},onEditTrackers:function(){Deluge.EditTrackers.show()},onFieldChange:function(a){this.optionsManager.setOption(this.torrentId,a.id,a.getValue())},onOptionChanged:function(d,b,c,a){if(b=="stop_at_ratio"){this.fields.remove_at_ratio.setDisabled(!c);this.fields.stop_ratio.setDisabled(!c)}},onRequestComplete:function(c,a){this.fields["private"].setDisabled(!c["private"]);delete c["private"];this.optionsManager.updateOptions(this.torrentId,c);for(var b in c){if(this.fields[b]&&!this.optionsManager.hasChanged(this.torrentId,b)){if(!this.fields[b].disabled){this.fields[b].setValue(c[b])}}}}});Deluge.Details.add(new Ext.deluge.details.OptionsTab());(function(){Ext.deluge.AddTracker=Ext.extend(Ext.Window,{constructor:function(a){a=Ext.apply({title:_("Add Tracker"),width:375,height:150,bodyStyle:"padding: 5px",layout:"fit",buttonAlign:"right",closeAction:"hide",closable:true,iconCls:"x-deluge-edit-trackers",plain:true,resizable:false},a);Ext.deluge.AddTracker.superclass.constructor.call(this,a)},initComponent:function(){Ext.deluge.AddTracker.superclass.initComponent.call(this);this.addButton(_("Cancel"),this.onCancel,this);this.addButton(_("Add"),this.onAdd,this);this.addEvents("add");this.form=this.add({xtype:"form",defaultType:"textarea",baseCls:"x-plain",labelWidth:55,items:[{fieldLabel:_("Trackers"),name:"trackers",anchor:"100%"}]})},onCancel:function(){this.form.getForm().findField("trackers").setValue("");this.hide()},onAdd:function(){var b=this.form.getForm().findField("trackers").getValue();b=b.split("\n");var a=[];Ext.each(b,function(c){if(Ext.form.VTypes.url(c)){a.push(c)}},this);this.fireEvent("add",a);this.hide();this.form.getForm().findField("trackers").setValue("")}});Ext.deluge.EditTracker=Ext.extend(Ext.Window,{constructor:function(a){a=Ext.apply({title:_("Edit Tracker"),width:375,height:110,bodyStyle:"padding: 5px",layout:"fit",buttonAlign:"right",closeAction:"hide",closable:true,iconCls:"x-deluge-edit-trackers",plain:true,resizable:false},a);Ext.deluge.EditTracker.superclass.constructor.call(this,a)},initComponent:function(){Ext.deluge.EditTracker.superclass.initComponent.call(this);this.addButton(_("Cancel"),this.onCancel,this);this.addButton(_("Save"),this.onSave,this);this.on("hide",this.onHide,this);this.form=this.add({xtype:"form",defaultType:"textfield",baseCls:"x-plain",labelWidth:55,items:[{fieldLabel:_("Tracker"),name:"tracker",anchor:"100%"}]})},show:function(a){Ext.deluge.EditTracker.superclass.show.call(this);this.record=a;this.form.getForm().findField("tracker").setValue(a.data.url)},onCancel:function(){this.hide()},onHide:function(){this.form.getForm().findField("tracker").setValue("")},onSave:function(){var a=this.form.getForm().findField("tracker").getValue();this.record.set("url",a);this.record.commit();this.hide()}});Ext.deluge.EditTrackers=Ext.extend(Ext.Window,{constructor:function(a){a=Ext.apply({title:_("Edit Trackers"),width:350,height:220,bodyStyle:"padding: 5px",layout:"fit",buttonAlign:"right",closeAction:"hide",closable:true,iconCls:"x-deluge-edit-trackers",plain:true,resizable:true},a);Ext.deluge.EditTrackers.superclass.constructor.call(this,a)},initComponent:function(){Ext.deluge.EditTrackers.superclass.initComponent.call(this);this.addButton(_("Cancel"),this.onCancel,this);this.addButton(_("Ok"),this.onOk,this);this.addEvents("save");this.on("show",this.onShow,this);this.on("save",this.onSave,this);this.addWindow=new Ext.deluge.AddTracker();this.addWindow.on("add",this.onAddTrackers,this);this.editWindow=new Ext.deluge.EditTracker();this.grid=this.add({xtype:"grid",store:new Ext.data.SimpleStore({fields:[{name:"tier",mapping:0},{name:"url",mapping:1}]}),columns:[{header:_("Tier"),width:50,sortable:true,renderer:fplain,dataIndex:"tier"},{id:"tracker",header:_("Tracker"),sortable:true,renderer:fplain,dataIndex:"url"}],stripeRows:true,selModel:new Ext.grid.RowSelectionModel({singleSelect:true,listeners:{selectionchange:{fn:this.onSelect,scope:this}}}),autoExpandColumn:"tracker",deferredRender:false,autoScroll:true,margins:"0 0 0 0",bbar:new Ext.Toolbar({items:[{cls:"x-btn-text-icon",text:_("Up"),icon:"/icons/up.png",handler:this.onUp,scope:this},{cls:"x-btn-text-icon",text:_("Down"),icon:"/icons/down.png",handler:this.onDown,scope:this},"->",{cls:"x-btn-text-icon",text:_("Add"),icon:"/icons/add.png",handler:this.onAdd,scope:this},{cls:"x-btn-text-icon",text:_("Edit"),icon:"/icons/edit_trackers.png",handler:this.onEdit,scope:this},{cls:"x-btn-text-icon",text:_("Remove"),icon:"/icons/remove.png",handler:this.onRemove,scope:this}]})})},onAdd:function(){this.addWindow.show()},onAddTrackers:function(b){var a=this.grid.getStore();Ext.each(b,function(d){var e=false,c=-1;a.each(function(f){if(f.get("tier")>c){c=f.get("tier")}if(d==f.get("tracker")){e=true;return false}},this);if(!e){a.loadData([[c+1,d]],true)}},this)},onCancel:function(){this.hide()},onEdit:function(){var a=this.grid.getSelectionModel().getSelected();this.editWindow.show(a)},onHide:function(){this.grid.getStore().removeAll()},onOk:function(){var a=[];this.grid.getStore().each(function(b){a.push({tier:b.get("tier"),url:b.get("url")})},this);Deluge.Client.core.set_torrent_trackers(this.torrentId,a,{failure:this.onSaveFail,scope:this});this.hide()},onRemove:function(){var a=this.grid.getSelectionModel().getSelected();this.grid.getStore().remove(a)},onRequestComplete:function(a){var b=[];Ext.each(a.trackers,function(c){b.push([c.tier,c.url])});this.grid.getStore().loadData(b)},onSaveFail:function(){},onSelect:function(a){if(a.hasSelection()){this.grid.getBottomToolbar().items.get(4).enable()}},onShow:function(){this.grid.getBottomToolbar().items.get(4).disable();var a=Deluge.Torrents.getSelected();this.torrentId=a.id;Deluge.Client.core.get_torrent_status(a.id,["trackers"],{success:this.onRequestComplete,scope:this})}});Deluge.EditTrackers=new Ext.deluge.EditTrackers()})();Deluge.Keys={Grid:["queue","name","total_size","state","progress","num_seeds","total_seeds","num_peers","total_peers","download_payload_rate","upload_payload_rate","eta","ratio","distributed_copies","is_auto_managed","time_added","tracker_host"],Status:["total_done","total_payload_download","total_uploaded","total_payload_upload","next_announce","tracker_status","num_pieces","piece_length","is_auto_managed","active_time","seeding_time","seed_rank"],Files:["files","file_progress","file_priorities"],Peers:["peers","seeds"],Details:["name","save_path","total_size","num_files","tracker_status","tracker","comment"],Options:["max_download_speed","max_upload_speed","max_connections","max_upload_slots","is_auto_managed","stop_at_ratio","stop_ratio","remove_at_ratio","private","prioritize_first_last"]};Ext.each(Deluge.Keys.Grid,function(a){Deluge.Keys.Status.push(a)});(function(){Ext.deluge.LoginWindow=Ext.extend(Ext.Window,{firstShow:true,constructor:function(a){a=Ext.apply({layout:"fit",width:300,height:120,bodyStyle:"padding: 10px 5px;",buttonAlign:"center",closeAction:"hide",closable:false,modal:true,plain:true,resizable:false,title:_("Login"),iconCls:"x-deluge-login-window-icon"},a);Ext.deluge.LoginWindow.superclass.constructor.call(this,a)},initComponent:function(){Ext.deluge.LoginWindow.superclass.initComponent.call(this);Deluge.Events.on("logout",this.onLogout,this);this.on("show",this.onShow,this);this.on("beforeshow",this.onBeforeShow,this);this.addButton({text:_("Login"),handler:this.onLogin,scope:this});this.loginForm=this.add({xtype:"form",defaultType:"textfield",id:"loginForm",baseCls:"x-plain",labelWidth:55,items:[{fieldLabel:_("Password"),id:"password",name:"password",inputType:"password",anchor:"100%",listeners:{specialkey:{fn:this.onKey,scope:this}}}]})},onKey:function(b,a){if(a.getKey()==13){this.onLogin()}},onLogin:function(){var a=this.loginForm.items.get("password");Deluge.Client.auth.login(a.getValue(),{success:function(b){if(b){Deluge.Events.fire("login");this.hide();a.setRawValue("");Deluge.UI.cookies.set("session",b)}else{Ext.MessageBox.show({title:_("Login Failed"),msg:_("You entered an incorrect password"),buttons:Ext.MessageBox.OK,modal:false,fn:function(){a.focus()},icon:Ext.MessageBox.WARNING,iconCls:"x-deluge-icon-warning"})}},scope:this})},onLogout:function(){var a=Deluge.UI.cookies.get("session",false);if(a){Deluge.Client.auth.delete_session(a,{success:function(b){Deluge.UI.cookies.clear("session");this.show()},scope:this})}},onBeforeShow:function(){var a=Deluge.UI.cookies.get("session",false);if(a){Deluge.Client.auth.check_session(a,{success:function(b){if(b){Deluge.Events.fire("login");this.loginForm.items.get("password").setRawValue("");this.hide()}else{Deluge.UI.cookies.clear("session");this.show()}},failure:function(b){Deluge.UI.cookies.clear("session");this.show()},scope:this});return false}},onShow:function(){var a=this.loginForm.items.get("password");a.focus(false,150)}});Deluge.Login=new Ext.deluge.LoginWindow()})();(function(){Ext.deluge.PreferencesWindow=Ext.extend(Ext.Window,{constructor:function(a){a=Ext.apply({layout:"border",width:485,height:500,buttonAlign:"right",closeAction:"hide",closable:true,iconCls:"x-deluge-preferences",plain:true,resizable:true,title:_("Preferences"),buttons:[{text:_("Close"),handler:this.onCloseButtonClick,scope:this},{text:_("Apply")},{text:_("Ok")}],currentPage:false,items:[{xtype:"grid",region:"west",title:_("Categories"),store:new Ext.data.SimpleStore({fields:[{name:"name",mapping:0}]}),columns:[{id:"name",renderer:fplain,dataIndex:"name"}],sm:new Ext.grid.RowSelectionModel({singleSelect:true,listeners:{rowselect:{fn:this.onPageSelect,scope:this}}}),hideHeaders:true,autoExpandColumn:"name",deferredRender:false,autoScroll:true,margins:"5 0 5 5",cmargins:"5 0 5 5",width:120,collapsible:true},{region:"center",header:false,layout:"fit",height:400,margins:"5 5 5 5",cmargins:"5 5 5 5"}]},a);Ext.deluge.PreferencesWindow.superclass.constructor.call(this,a)},initComponent:function(){Ext.deluge.PreferencesWindow.superclass.initComponent.call(this);this.categoriesGrid=this.items.get(0);this.configPanel=this.items.get(1);this.pages={};this.on("show",this.onShow,this)},onCloseButtonClick:function(){this.hide()},addPage:function(c){var a=this.categoriesGrid.getStore();var b=c.title;a.loadData([[b]],true);c.bodyStyle="margin: 5px";this.pages[b]=this.configPanel.add(c);this.pages[b].hide()},onPageSelect:function(a,d,c){if(this.currentPage){this.currentPage.hide()}var b=c.get("name");this.pages[b].show();this.currentPage=this.pages[b];this.configPanel.doLayout()},onShow:function(){if(!this.categoriesGrid.getSelectionModel().hasSelection()){this.categoriesGrid.getSelectionModel().selectFirstRow()}}});Deluge.Preferences=new Ext.deluge.PreferencesWindow()})();Deluge.Preferences.addPage({border:false,title:_("Downloads"),xtype:"form",layout:"form",items:[{xtype:"fieldset",border:false,title:_("Folders"),labelWidth:140,defaultType:"textfield",autoHeight:true,items:[{name:"download_location",fieldLabel:_("Download to"),width:125},{name:"move_completed",fieldLabel:_("Move completed to"),width:125},{name:"copy_torrent_files",fieldLabel:_("Copy of .torrent files to"),width:125}]},{xtype:"fieldset",border:false,title:_("Allocation"),autoHeight:true,labelWidth:1,defaultType:"radio",items:[{name:"compact_allocation",labelSeparator:"",boxLabel:_("Compact")},{name:"compact_allocation",labelSeparator:"",boxLabel:_("Full")}]},{xtype:"fieldset",border:false,title:_("Options"),autoHeight:true,labelWidth:1,defaultType:"checkbox",items:[{name:"prioritize_first_last",labelSeparator:"",boxLabel:_("Prioritize first and last pieces of torrent")},{name:"add_paused",labelSeparator:"",boxLabel:_("Add torrents in Paused state")}]}]});Deluge.Preferences.addPage({border:false,title:_("Bandwidth"),xtype:"form",layout:"form",labelWidth:10,items:[{xtype:"fieldset",border:false,title:_("Global Bandwidth Usage"),autoHeight:true,labelWidth:200,style:"margin-bottom: 0px; padding-bottom: 0px;",defaultType:"uxspinner",items:[{name:"max_connections",fieldLabel:_("Maximum Connections"),width:60,value:-1},{name:"max_upload_slots",fieldLabel:_("Maximum Upload Slots"),width:60,value:-1},{name:"max_download_speed",fieldLabel:_("Maximum Download Speed (KiB/s)"),width:60,value:-1},{name:"max_upload_speed",fieldLabel:_("Maximum Upload Speed (KiB/s)"),width:60,value:-1},{name:"max_half_open_connections",fieldLabel:_("Maximum Half-Open Connections"),width:60,value:-1},{name:"max_connections_per_second",fieldLabel:_("Maximum Connection Attempts per Second"),width:60,value:-1}]},{xtype:"fieldset",border:false,title:"",autoHeight:true,style:"padding-top: 0px; margin-top: 0px; margin-bottom: 0px;",items:[{xtype:"checkbox",name:"ignore_local",fieldLabel:"",labelSeparator:"",boxLabel:_("Ignore limits on local network"),value:-1},{xtype:"checkbox",name:"limit_ip_overhead",fieldLabel:"",labelSeparator:"",boxLabel:_("Rate limit IP overhead"),value:-1}]},{xtype:"fieldset",border:false,title:_("Per Torrent Bandwidth Usage"),autoHeight:true,labelWidth:200,defaultType:"uxspinner",items:[{name:"max_connections_per_torrent",fieldLabel:_("Maximum Connections"),width:60,value:-1},{name:"max_upload_slots_per_torrent",fieldLabel:_("Maximum Upload Slots"),width:60,value:-1},{name:"max_download_speed_per_torrent",fieldLabel:_("Maximum Download Speed (KiB/s)"),width:60,value:-1},{name:"max_upload_speed_per_torrent",fieldLabel:_("Maximum Upload Speed (KiB/s)"),width:60,value:-1}]}]});Deluge.Preferences.addPage({border:false,title:_("Interface"),xtype:"form",layout:"form",items:[{xtype:"fieldset",border:false,title:_("Window"),autoHeight:true,labelWidth:1,items:[{xtype:"checkbox",fieldLabel:"",labelSeparator:"",boxLabel:_("Show session speed in titlebar"),id:"show_session_speed"}]},{xtype:"fieldset",border:false,title:_("Sidebar"),autoHeight:true,labelWidth:1,items:[{xtype:"checkbox",fieldLabel:"",labelSeparator:"",boxLabel:_("Hide filters with zero torrents"),id:"hide_sidebar_zero"}]},{xtype:"fieldset",border:false,title:_("Password"),autoHeight:true,defaultType:"textfield",items:[{fieldLabel:"New Password",inputType:"password",id:"new_password"},{inputType:"password",fieldLabel:"Confirm Password",id:"confirm_password"}]}]});Deluge.Preferences.addPage({border:false,title:_("Daemon"),xtype:"form",layout:"form",items:[{xtype:"fieldset",border:false,title:_("Port"),autoHeight:true,defaultType:"uxspinner",items:[{fieldLabel:_("Daemon port"),id:"daemon_port"}]},{xtype:"fieldset",border:false,title:_("Connections"),autoHeight:true,labelWidth:1,defaultType:"checkbox",items:[{fieldLabel:"",labelSeparator:"",boxLabel:_("Allow Remote Connections"),id:"allow_remote"}]},{xtype:"fieldset",border:false,title:_("Other"),autoHeight:true,labelWidth:1,defaultType:"checkbox",items:[{fieldLabel:"",labelSeparator:"",height:40,boxLabel:_("Periodically check the website for new releases"),id:"new_releases"}]}]});(function(){function a(d,f,c){var b=d.toLowerCase().replace(".","_");var e="";if(c.store.id=="tracker_host"){if(d!="Error"){e=String.format("url(/tracker/{0})",d)}else{b=null}}if(e){return String.format('
{0} ({1})
',d,c.data.count,e)}else{if(b){return String.format('
{0} ({1})
',d,c.data.count,b)}else{return String.format('
{0} ({1})
',d,c.data.count)}}}Ext.deluge.Sidebar=Ext.extend(Ext.Panel,{panels:{},selected:null,constructor:function(b){b=Ext.apply({id:"sidebar",region:"west",cls:"deluge-sidebar",title:_("Filters"),layout:"accordion",split:true,width:200,minSize:175,collapsible:true,margins:"5 0 0 5",cmargins:"5 0 0 5"},b);Ext.deluge.Sidebar.superclass.constructor.call(this,b)},initComponent:function(){Ext.deluge.Sidebar.superclass.initComponent.call(this);Deluge.Events.on("disconnect",this.onDisconnect,this)},createFilter:function(e,d){var c=new Ext.data.SimpleStore({id:e,fields:[{name:"filter"},{name:"count"}]});var g=e.replace("_"," ");var f=g.split(" ");g="";Ext.each(f,function(h){firstLetter=h.substring(0,1);firstLetter=firstLetter.toUpperCase();h=firstLetter+h.substring(1);g+=h+" "});var b=new Ext.grid.GridPanel({id:e+"-panel",store:c,title:_(g),columns:[{id:"filter",sortable:false,renderer:a,dataIndex:"filter"}],stripeRows:false,selModel:new Ext.grid.RowSelectionModel({singleSelect:true,listeners:{rowselect:{fn:this.onFilterSelect,scope:this}}}),hideHeaders:true,autoExpandColumn:"filter",deferredRender:false,autoScroll:true});if(Deluge.config.sidebar_show_zero==false){d=this.removeZero(d)}c.loadData(d);this.add(b);this.doLayout();this.panels[e]=b;if(!this.selected){b.getSelectionModel().selectFirstRow();this.selected={row:0,filter:d[0][0],panel:b}}},getFilters:function(){var c={};if(!this.selected){return c}if(!this.selected.filter||!this.selected.panel){return c}var b=this.selected.panel.store.id;if(b=="state"&&this.selected.filter=="All"){return c}c[b]=this.selected.filter;return c},onDisconnect:function(){Ext.each(Ext.getKeys(this.panels),function(b){this.remove(b+"-panel")},this);this.panels={};this.selected=null},onFilterSelect:function(c,d,b){if(!this.selected){needsUpdate=true}else{if(this.selected.row!=d){needsUpdate=true}else{needsUpdate=false}}this.selected={row:d,filter:b.get("filter"),panel:this.panels[b.store.id]};if(needsUpdate){Deluge.UI.update()}},removeZero:function(b){var c=[];Ext.each(b,function(d){if(d[1]>0){c.push(d)}});return c},update:function(d){for(var c in d){var b=d[c];if(Ext.getKeys(this.panels).indexOf(c)>-1){this.updateFilter(c,b)}else{this.createFilter(c,b)}}Ext.each(Ext.keys(this.panels),function(e){if(Ext.keys(d).indexOf(e)==-1){this.panels[e]}})},updateFilter:function(c,b){if(Deluge.config.sidebar_show_zero==false){b=this.removeZero(b)}this.panels[c].store.loadData(b);if(this.selected&&this.selected.panel==this.panels[c]){this.panels[c].getSelectionModel().selectRow(this.selected.row)}}});Deluge.Sidebar=new Ext.deluge.Sidebar()})();(function(){Ext.deluge.Statusbar=Ext.extend(Ext.StatusBar,{constructor:function(a){a=Ext.apply({id:"deluge-statusbar",defaultIconCls:"x-not-connected",defaultText:_("Not Connected")},a);Ext.deluge.Statusbar.superclass.constructor.call(this,a)},initComponent:function(){Ext.deluge.Statusbar.superclass.initComponent.call(this);Deluge.Events.on("connect",this.onConnect,this);Deluge.Events.on("disconnect",this.onDisconnect,this)},createButtons:function(){this.add({id:"statusbar-connections",text:" ",cls:"x-btn-text-icon",iconCls:"x-deluge-connections",menu:Deluge.Menus.Connections},"-",{id:"statusbar-downspeed",text:" ",cls:"x-btn-text-icon",iconCls:"x-deluge-downloading",menu:Deluge.Menus.Download},"-",{id:"statusbar-upspeed",text:" ",cls:"x-btn-text-icon",iconCls:"x-deluge-seeding",menu:Deluge.Menus.Upload},"-",{id:"statusbar-traffic",text:" ",cls:"x-btn-text-icon",iconCls:"x-deluge-traffic"},"-",{id:"statusbar-dht",text:" ",cls:"x-btn-text-icon",iconCls:"x-deluge-dht"});this.created=true},onConnect:function(){this.setStatus({iconCls:"x-connected",text:""});if(!this.created){this.createButtons()}else{this.items.each(function(a){a.show();a.enable()})}},onDisconnect:function(){this.clearStatus({useDefaults:true});this.items.each(function(a){a.hide();a.disable()})},update:function(b){function d(e){return e+" KiB/s"}var a=function(g,f){var h=this.items.get("statusbar-"+g);if(f.limit.value==-1){var k=(f.value.formatter)?f.value.formatter(f.value.value):f.value.value}else{var j=(f.value.formatter)?f.value.formatter(f.value.value):f.value.value;var e=(f.limit.formatter)?f.limit.formatter(f.limit.value):f.limit.value;var k=String.format(f.format,j,e)}h.setText(k)}.bind(this);a("connections",{value:{value:b.num_connections},limit:{value:b.max_num_connections},format:"{0} ({1})"});a("downspeed",{value:{value:b.download_rate,formatter:Deluge.Formatters.speed},limit:{value:b.max_download,formatter:d},format:"{0} ({1})"});a("upspeed",{value:{value:b.upload_rate,formatter:Deluge.Formatters.speed},limit:{value:b.max_upload,formatter:d},format:"{0} ({1})"});a("traffic",{value:{value:b.payload_download_rate,formatter:Deluge.Formatters.speed},limit:{value:b.payload_upload_rate,formatter:Deluge.Formatters.speed},format:"{0}/{1}"});this.items.get("statusbar-dht").setText(b.dht_nodes);function c(g,e){var f=g.items.get(e);if(!f){f=g.items.get("other")}f.setChecked(true)}c(Deluge.Menus.Connections,b.max_num_connections);c(Deluge.Menus.Download,b.max_download);c(Deluge.Menus.Upload,b.max_upload)}});Deluge.Statusbar=new Ext.deluge.Statusbar()})();(function(){Ext.deluge.Toolbar=Ext.extend(Ext.Toolbar,{constructor:function(a){a=Ext.apply({items:[{id:"create",cls:"x-btn-text-icon",disabled:true,text:_("Create"),icon:"/icons/create.png",handler:this.onTorrentAction},{id:"add",cls:"x-btn-text-icon",disabled:true,text:_("Add"),icon:"/icons/add.png",handler:this.onTorrentAdd},{id:"remove",cls:"x-btn-text-icon",disabled:true,text:_("Remove"),icon:"/icons/remove.png",handler:this.onTorrentAction},"|",{id:"pause",cls:"x-btn-text-icon",disabled:true,text:_("Pause"),icon:"/icons/pause.png",handler:this.onTorrentAction},{id:"resume",cls:"x-btn-text-icon",disabled:true,text:_("Resume"),icon:"/icons/start.png",handler:this.onTorrentAction},"|",{id:"up",cls:"x-btn-text-icon",disabled:true,text:_("Up"),icon:"/icons/up.png",handler:this.onTorrentAction},{id:"down",cls:"x-btn-text-icon",disabled:true,text:_("Down"),icon:"/icons/down.png",handler:this.onTorrentAction},"|",{id:"preferences",cls:"x-btn-text-icon",text:_("Preferences"),icon:"/icons/preferences.png",handler:this.onPreferencesClick,scope:this},{id:"connectionman",cls:"x-btn-text-icon",text:_("Connection Manager"),iconCls:"x-deluge-connections",handler:this.onConnectionManagerClick,scope:this},"->",{id:"help",cls:"x-btn-text-icon",disabled:true,icon:"/icons/help.png",text:_("Help"),handler:this.onHelpClick,scope:this},{id:"logout",cls:"x-btn-text-icon",icon:"/icons/logout.png",disabled:true,text:_("Logout"),handler:this.onLogout,scope:this}]},a);Ext.deluge.Toolbar.superclass.constructor.call(this,a)},connectedButtons:["add","remove","pause","resume","up","down"],initComponent:function(){Ext.deluge.Toolbar.superclass.initComponent.call(this);Deluge.Events.on("connect",this.onConnect,this);Deluge.Events.on("login",this.onLogin,this)},onConnect:function(){Ext.each(this.connectedButtons,function(a){this.items.get(a).enable()},this)},onDisconnect:function(){Ext.each(this.connectedButtons,function(a){this.items.get(a).disable()},this)},onLogin:function(){this.items.get("logout").enable()},onLogout:function(){this.items.get("logout").disable();Deluge.Events.fire("logout");Deluge.Login.show()},onConnectionManagerClick:function(){Deluge.ConnectionManager.show()},onPreferencesClick:function(){Deluge.Preferences.show()},onTorrentAction:function(c){var b=Deluge.Torrents.getSelections();var a=[];Ext.each(b,function(d){a.push(d.id)});switch(c.id){case"remove":Deluge.Events.fire("torrentRemoved",a);Deluge.Client.core.remove_torrent(a,null,{success:function(){Deluge.UI.update()}});break;case"pause":case"resume":Deluge.Client.core[c.id+"_torrent"](a,{success:function(){Deluge.UI.update()}});break;case"up":case"down":Deluge.Client.core["queue_"+c.id](a,{success:function(){Deluge.UI.update()}});break}},onTorrentAdd:function(){Deluge.Add.show()}});Deluge.Toolbar=new Ext.deluge.Toolbar()})();(function(){function f(j){return(j==-1)?"":j+1}function b(k,l,j){return String.format('
{1}
',j.data.state.toLowerCase(),k)}function h(j){if(!j){return}return fspeed(j)}function c(m,n,l){m=new Number(m);var j=m;var o=l.data.state+" "+m.toFixed(2)+"%";var k=new Number(this.style.match(/\w+:\s*(\d+)\w+/)[1])-8;return Deluge.progressBar(m,k,o)}function e(k,l,j){if(j.data.total_seeds>-1){return String.format("{0} ({1})",k,j.data.total_seeds)}else{return k}}function g(k,l,j){if(j.data.total_peers>-1){return String.format("{0} ({1})",k,j.data.total_peers)}else{return k}}function d(k,l,j){return new Number(k).toFixed(3)}function a(k,l,j){return String.format('
{0}
',k)}Ext.deluge.TorrentGrid=Ext.extend(Ext.grid.GridPanel,{constructor:function(j){j=Ext.apply({id:"torrentGrid",store:new Ext.data.SimpleStore({fields:[{name:"queue"},{name:"name"},{name:"size",type:"int"},{name:"state"},{name:"progress",type:"float"},{name:"seeds",type:"int"},{name:"total_seeds",type:"int"},{name:"peers",type:"int"},{name:"total_peers",type:"int"},{name:"downspeed",type:"int"},{name:"upspeed",type:"int"},{name:"eta",type:"int"},{name:"ratio",type:"float"},{name:"avail",type:"float"},{name:"added",type:"int"},{name:"tracker"}],id:16}),columns:[{id:"queue",header:_("#"),width:30,sortable:true,renderer:f,dataIndex:"queue"},{id:"name",header:_("Name"),width:150,sortable:true,renderer:b,dataIndex:"name"},{header:_("Size"),width:75,sortable:true,renderer:fsize,dataIndex:"size"},{header:_("Progress"),width:150,sortable:true,renderer:c,dataIndex:"progress"},{header:_("Seeders"),width:60,sortable:true,renderer:e,dataIndex:"seeds"},{header:_("Peers"),width:60,sortable:true,renderer:g,dataIndex:"peers"},{header:_("Down Speed"),width:80,sortable:true,renderer:h,dataIndex:"downspeed"},{header:_("Up Speed"),width:80,sortable:true,renderer:h,dataIndex:"upspeed"},{header:_("ETA"),width:60,sortable:true,renderer:ftime,dataIndex:"eta"},{header:_("Ratio"),width:60,sortable:true,renderer:d,dataIndex:"ratio"},{header:_("Avail"),width:60,sortable:true,renderer:d,dataIndex:"avail"},{header:_("Added"),width:80,sortable:true,renderer:fdate,dataIndex:"added"},{header:_("Tracker"),width:120,sortable:true,renderer:a,dataIndex:"tracker"}],region:"center",cls:"deluge-torrents",stripeRows:true,autoExpandColumn:"name",deferredRender:false,autoScroll:true,margins:"5 5 0 0"},j);Ext.deluge.TorrentGrid.superclass.constructor.call(this,j)},initComponent:function(){Ext.deluge.TorrentGrid.superclass.initComponent.call(this);Deluge.Events.on("torrentRemoved",this.onTorrentRemoved,this);this.on("rowcontextmenu",function(j,m,l){l.stopEvent();var k=j.getSelectionModel();if(!k.hasSelection()){k.selectRow(m)}Deluge.Menus.Torrent.showAt(l.getPoint())})},getTorrent:function(j){return this.getStore().getAt(j)},getSelected:function(){return this.getSelectionModel().getSelected()},getSelections:function(){return this.getSelectionModel().getSelections()},update:function(n){var l=this.getStore();for(var k in n){var j=l.getById(k);var p=n[k];if(!j){var o=[p.queue,p.name,p.total_size,p.state,p.progress,p.num_seeds,p.total_seeds,p.num_peers,p.total_peers,p.download_payload_rate,p.upload_payload_rate,p.eta,p.ratio,p.distributed_copies,p.time_added,p.tracker_host,k];l.loadData([o],true)}else{j.set("queue",p.queue);j.set("name",p.name);j.set("size",p.total_size);j.set("state",p.state);j.set("progress",p.progress);j.set("seeds",p.num_seeds);j.set("total_seeds",p.total_seeds);j.set("peers",p.num_peers);j.set("total_peers",p.total_peers);j.set("downspeed",p.download_payload_rate);j.set("upspeed",p.upload_payload_rate);j.set("eta",p.eta);j.set("ratio",p.ratio);j.set("avail",p.distributed_copies);j.set("added",p.time_added);j.set("tracker",p.tracker_host);j.commit()}}var m=Ext.keys(n);l.each(function(q){if(m.indexOf(q.id)==-1){l.remove(q)}},this)},onTorrentRemoved:function(k){var j=this.getSelectionModel();Ext.each(k,function(m){var l=this.getStore().getById(m);if(j.isSelected(l)){j.deselectRow(this.getStore().indexOf(l))}this.getStore().remove(l)},this)}});Deluge.Torrents=new Ext.deluge.TorrentGrid()})();Deluge.UI={cookies:new Ext.state.CookieProvider(),errorCount:0,initialize:function(){Ext.state.Manager.setProvider(this.cookies);this.MainPanel=new Ext.Panel({id:"mainPanel",iconCls:"x-deluge-main-panel",title:"Deluge",layout:"border",tbar:Deluge.Toolbar,items:[Deluge.Sidebar,Deluge.Details,Deluge.Torrents],bbar:Deluge.Statusbar});this.Viewport=new Ext.Viewport({layout:"fit",items:[this.MainPanel]});Deluge.Events.on("connect",this.onConnect,this);Deluge.Events.on("disconnect",this.onDisconnect,this);Deluge.Client=new Ext.ux.util.RpcClient({url:"/json"});Deluge.Client.on("connected",function(a){Deluge.Login.show()});this.update=this.update.bind(this)},update:function(){var a=Deluge.Sidebar.getFilters();Deluge.Client.web.update_ui(Deluge.Keys.Grid,a,{success:this.onUpdate,failure:this.onUpdateError,scope:this});Deluge.Details.update();Deluge.Client.web.connected({success:this.onConnectedCheck,scope:this})},onConnectedCheck:function(a){if(!a){Deluge.Events.fire("disconnect")}},onUpdateError:function(a){if(this.errorCount==2){Ext.MessageBox.show({title:"Lost Connection",msg:"The connection to the webserver has been lost!",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.ERROR})}this.errorCount++},onUpdate:function(a){Deluge.Torrents.update(a.torrents);Deluge.Statusbar.update(a.stats);Deluge.Sidebar.update(a.filters);this.errorCount=0},onConnect:function(){if(!this.running){this.running=setInterval(this.update,2000);this.update()}},onDisconnect:function(){this.stop()},stop:function(){if(this.running){clearInterval(this.running);this.running=false;Deluge.Torrents.getStore().loadData([])}}};Ext.onReady(function(a){Deluge.UI.initialize()}); \ No newline at end of file