From 1696fd11036d00466bc18ed80761cd9615a86796 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Thu, 23 Feb 2012 00:46:29 +0000 Subject: [PATCH] Updated Changelog and compressed js --- ChangeLog | 79 ++++++++++---------- deluge/ui/web/js/deluge-all-debug.js | 103 ++++++++++++++++++--------- deluge/ui/web/js/deluge-all.js | 12 ++-- 3 files changed, 120 insertions(+), 74 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6d3ba06c4..84d456d47 100644 --- a/ChangeLog +++ b/ChangeLog @@ -43,54 +43,61 @@ === Deluge 1.3.4 (In Development) === ==== Core ==== - * #1921: Free disk space reporting incorrectly in FreeBSD - * #1964: Fix unhandled UnpicklingErrors - * #1967: Fix unhandled IndexError when trying to open a non-json conf file + * #1921: Free disk space reporting incorrectly in FreeBSD + * #1964: Fix unhandled UnpicklingErrors + * #1967: Fix unhandled IndexError when trying to open a non-json conf file + * Fix setting daemon listen interface from command line ==== GtkUI ==== - * #1918: Fix Drag'n'Drop not working in Windows - * #1941: Increase maximum Cache Size to 999999 (15GiB) - * #1940: File & folder renaming issue when using Add Torrent dialog in Windows - * LP#821577: Fix UnpicklingError when external selection dragged onto Files Tab - * #1934: Fix Unicode error in AddTorrent Dialog - * #1957: Fix keyerror when adding columns for non-latin languages - * #1969: Fix menu item 'Quit & Shutdown' still available when not connected to daemon - * #1895: Fix Files Tab showing wrong files due to torrent_info race condition - * #2010: Move speed text in titlebar to the beginning - * #2032: Wait for client to shutdown/disconnect before stopping reactor - * Fix compatibility with Python 2.5 - * Fix collapsed treeview in Create Torrent dialog + * #1918: Fix Drag'n'Drop not working in Windows + * #1941: Increase maximum Cache Size to 999999 (15GiB) + * #1940: File & folder renaming issue when using Add Torrent dialog in Windows + * LP#821577: Fix UnpicklingError when external selection dragged onto Files Tab + * #1934: Fix Unicode error in AddTorrent Dialog + * #1957: Fix keyerror when adding columns for non-latin languages + * #1969: Fix menu item 'Quit & Shutdown' still available when not connected to daemon + * #1895: Fix Files Tab showing wrong files due to torrent_info race condition + * #2010: Move speed text in titlebar to the beginning + * #2032: Wait for client to shutdown/disconnect before stopping reactor + * Fix compatibility with Python 2.5 + * Fix collapsed treeview in Create Torrent dialog + * Ignore unmaximise event when window isn't visible ==== WebUI ==== - * Fix Webui files-tab menu setting wrong priority - * Update to ExtJS 3.4.0 - * #1960: Fix statustab showing total_payload_download for upload as well - * Remove uneeded Titlebar to save space - * Fix clipped Browse button in WebUI - * #1915: Fix being unable to stop the status bar from autohiding - * Fix password box focus issue in Firefox - * Fix plugin uploads from behind a reverse proxy - * #2010: Move speed text in titlebar to the beginning - * #1936: Fix Referenced before assignment error in json_api - * Changes are now applied when clicking OK in Preferences - * Added Download,Uploaded,Down Limit, Up Limit & Seeder/Peeds columns - * Add magnet uri support to Add Url - * Add keymaps for torrents - Ctrl-A (select all) and Delete - + * Fix Webui files-tab menu setting wrong priority + * Update to ExtJS 3.4.0 + * #1960: Fix statustab showing total_payload_download for upload as well + * Remove uneeded Titlebar to save space + * Fix clipped Browse button in WebUI + * #1915: Fix being unable to stop the status bar from autohiding + * Fix password box focus issue in Firefox + * Fix plugin uploads from behind a reverse proxy + * #2010: Move speed text in titlebar to the beginning + * #1936: Fix Referenced before assignment error in json_api + * Changes are now applied when clicking OK in Preferences + * Added Download,Uploaded,Down Limit, Up Limit & Seeder/Peeds columns + * Add magnet uri support to Add Url + * Add keymaps for torrents - Ctrl-A (select all) and Delete + * #2037: Fix 'Add Torrents' torrents list not scrolling ==== Console ==== - * #1953: Fix flickering on every update - * #1954: Fix 'invalid literal for float' when setting listen interface + * #1953: Fix flickering on every update + * #1954: Fix 'invalid literal for float' when setting listen interface ==== Label ==== - * #1961: Add missing 'All' filter option + * #1961: Add missing 'All' filter option + * #2035: Fix label options dialog in webui + * #2036: Fix newly added labels not being sorted in torrent right click menu ==== Notification ==== - * #1905: Fix no email sent to second email address - * #1898: Fix email notifications not including date/time they were sent + * #1905: Fix no email sent to second email address + * #1898: Fix email notifications not including date/time they were sent ==== Scheduler ==== - * Add plugin page for WebUi + * Add plugin page for WebUi + +==== AutoAdd ==== + Added watch folder support for '.magnet' text file containing single or multiple magnet uris === Deluge 1.3.3 (22 July 2011) === ==== Core ==== diff --git a/deluge/ui/web/js/deluge-all-debug.js b/deluge/ui/web/js/deluge-all-debug.js index 5573e5b67..390f3f970 100644 --- a/deluge/ui/web/js/deluge-all-debug.js +++ b/deluge/ui/web/js/deluge-all-debug.js @@ -1438,7 +1438,7 @@ Deluge.add.Window = Ext.extend(Ext.Window, { }); /*! * Deluge.add.AddWindow.js - * + * * Copyright (c) Damien Churchill 2009-2010 * * This program is free software; you can redistribute it and/or modify @@ -1488,7 +1488,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { this.addButton(_('Cancel'), this.onCancelClick, this); this.addButton(_('Add'), this.onAddClick, this); - + function torrentRenderer(value, p, r) { if (r.data['info_hash']) { return String.format('
{0}
', value); @@ -1511,7 +1511,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { sortable: true, renderer: torrentRenderer, dataIndex: 'text' - }], + }], stripeRows: true, singleSelect: true, listeners: { @@ -1522,6 +1522,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { }, hideHeaders: true, autoExpandColumn: 'torrent', + height: '100%', autoScroll: true }); @@ -1552,7 +1553,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { }] }) }); - + this.optionsPanel = this.add(new Deluge.add.OptionsPanel()); this.on('hide', this.onHide, this); this.on('show', this.onShow, this); @@ -1603,16 +1604,14 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { var torrent = this.list.getSelectedRecords()[0]; this.list.getStore().remove(torrent); this.optionsPanel.clear(); - + if (this.torrents && this.torrents[torrent.id]) delete this.torrents[torrent.id]; }, onSelect: function(list, selections) { - if (selections.length) { + if (selections.length) { var record = this.list.getRecord(selections[0]); this.optionsPanel.setTorrent(record.get('info_hash')); - this.optionsPanel.files.setDisabled(false); - this.optionsPanel.form.setDisabled(false); } else { this.optionsPanel.files.setDisabled(true); this.optionsPanel.form.setDisabled(true); @@ -1631,7 +1630,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { this.file.on('beforeadd', this.onTorrentBeforeAdd, this); this.file.on('add', this.onTorrentAdd, this); } - + this.optionsPanel.form.getDefaults(); }, @@ -1657,6 +1656,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { r.set('text', info['name']); this.list.getStore().commitChanges(); this.optionsPanel.addTorrent(info); + this.list.select(r); } }, @@ -1929,7 +1929,7 @@ Deluge.add.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { Ext.namespace('Ext.deluge.add'); /*! * Deluge.add.OptionsPanel.js - * + * * Copyright (c) Damien Churchill 2009-2010 * * This program is free software; you can redistribute it and/or modify @@ -1990,7 +1990,7 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { Ext.each(Ext.keys(fileIndexes), function(index) { priorities[index] = fileIndexes[index]; }); - + var oldId = this.form.optionsManager.changeId(torrent['info_hash'], true); this.form.optionsManager.setDefault('file_priorities', priorities); this.form.optionsManager.changeId(oldId, true); @@ -2020,23 +2020,34 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { this.torrentId = torrentId; this.form.optionsManager.changeId(torrentId); - + this.files.clearFiles(); var root = this.files.getRootNode(); var priorities = this.form.optionsManager.get('file_priorities'); - this.walkFileTree(this.torrents[torrentId]['files_tree'], function(filename, type, entry, parentNode) { - var node = new Ext.tree.TreeNode({ - download: (entry.index) ? priorities[entry.index] : true, - filename: filename, - fileindex: entry.index, - leaf: type != 'dir', - size: entry.length - }); - parentNode.appendChild(node); - if (type == 'dir') return node; - }, this, root); - root.firstChild.expand(); + this.form.setDisabled(false); + + if (this.torrents[torrentId]['files_tree']) { + this.walkFileTree(this.torrents[torrentId]['files_tree'], function(filename, type, entry, parentNode) { + var node = new Ext.tree.TreeNode({ + download: (entry.index) ? priorities[entry.index] : true, + filename: filename, + fileindex: entry.index, + leaf: type != 'dir', + size: entry.length + }); + parentNode.appendChild(node); + if (type == 'dir') return node; + }, this, root); + root.firstChild.expand(); + this.files.setDisabled(false); + this.files.show(); + } else { + // Files tab is empty so show options tab + this.form.show(); + this.files.setDisabled(true); + } + }, walkFileTree: function(files, callback, scope, parentNode) { @@ -2049,7 +2060,7 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { } else { var ret = callback(filename, type, entry, parentNode); } - + if (type == 'dir') this.walkFileTree(entry, callback, scope, ret); } }, @@ -2071,7 +2082,7 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { }, this); } else { this.files.setDownload(nodes[0], oldValue, true); - } + } }, scope: this, icon: Ext.MessageBox.QUESTION @@ -2353,17 +2364,27 @@ Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, { var cookies = this.cookieField.getValue(); var torrentId = this.createTorrentId(); - deluge.client.web.download_torrent_from_url(url, cookies, { - success: this.onDownload, - scope: this, - torrentId: torrentId - }); + if (url.substring(0,20) == 'magnet:?xt=urn:btih:') { + deluge.client.web.get_magnet_info(url, { + success: this.onGotInfo, + scope: this, + filename: url, + torrentId: torrentId + }); + } else { + deluge.client.web.download_torrent_from_url(url, cookies, { + success: this.onDownload, + scope: this, + torrentId: torrentId + }); + } + this.hide(); + this.urlField.setValue(''); this.fireEvent('beforeadd', torrentId, url); }, onDownload: function(filename, obj, resp, req) { - this.urlField.setValue(''); deluge.client.web.get_torrent_info(filename, { success: this.onGotInfo, scope: this, @@ -8839,6 +8860,7 @@ Deluge.Toolbar = Ext.extend(Ext.Toolbar, { function trackerRenderer(value, p, r) { return String.format('
{0}
', value); } + function etaSorter(eta) { return eta * -1; } @@ -9048,11 +9070,28 @@ Deluge.Toolbar = Ext.extend(Ext.Toolbar, { ] }, + keys: [{ + key: 'a', + ctrl: true, + stopEvent: true, + handler: function() { + deluge.torrents.getSelectionModel().selectAll(); + } + }, { + key: [46], + stopEvent: true, + handler: function() { + ids = deluge.torrents.getSelectedIds(); + deluge.removeWindow.show(ids); + } + }], + constructor: function(config) { config = Ext.apply({ id: 'torrentGrid', store: new Ext.data.JsonStore(this.meta), columns: this.columns, + keys: this.keys, region: 'center', cls: 'deluge-torrents', stripeRows: true, diff --git a/deluge/ui/web/js/deluge-all.js b/deluge/ui/web/js/deluge-all.js index 4876d8615..7348b402f 100644 --- a/deluge/ui/web/js/deluge-all.js +++ b/deluge/ui/web/js/deluge-all.js @@ -288,7 +288,7 @@ Ext.ns("Deluge.details");Deluge.details.StatusTab=Ext.extend(Ext.Panel,{title:_( Ext.ns("Deluge.add");Deluge.add.Window=Ext.extend(Ext.Window,{initComponent:function(){Deluge.add.Window.superclass.initComponent.call(this);this.addEvents("beforeadd","add")},createTorrentId:function(){return new Date().getTime()}}); /* * Deluge.add.AddWindow.js - * + * * Copyright (c) Damien Churchill 2009-2010 * * This program is free software; you can redistribute it and/or modify @@ -317,7 +317,7 @@ Ext.ns("Deluge.add");Deluge.add.Window=Ext.extend(Ext.Window,{initComponent:func * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.namespace("Deluge.add");Deluge.add.AddWindow=Ext.extend(Deluge.add.Window,{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",initComponent:function(){Deluge.add.AddWindow.superclass.initComponent.call(this);this.addButton(_("Cancel"),this.onCancelClick,this);this.addButton(_("Add"),this.onAddClick,this);function a(c,d,b){if(b.data.info_hash){return String.format('
{0}
',c)}else{return String.format('
{0}
',c)}}this.list=new Ext.list.ListView({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,singleSelect:true,listeners:{selectionchange:{fn:this.onSelect,scope:this}},hideHeaders:true,autoExpandColumn:"torrent",autoScroll:true});this.add({region:"center",items:[this.list],margins:"5 5 5 5",bbar:new Ext.Toolbar({items:[{iconCls:"x-deluge-add-file",text:_("File"),handler:this.onFile,scope:this},{text:_("Url"),iconCls:"icon-add-url",handler:this.onUrl,scope:this},{text:_("Infohash"),iconCls:"icon-add-magnet",disabled:true},"->",{text:_("Remove"),iconCls:"icon-remove",handler:this.onRemove,scope:this}]})});this.optionsPanel=this.add(new Deluge.add.OptionsPanel());this.on("hide",this.onHide,this);this.on("show",this.onShow,this)},clear:function(){this.list.getStore().removeAll();this.optionsPanel.clear()},onAddClick:function(){var a=[];if(!this.list){return}this.list.getStore().each(function(b){var c=b.get("info_hash");a.push({path:this.optionsPanel.getFilename(c),options:this.optionsPanel.getOptions(c)})},this);deluge.client.web.add_torrents(a,{success:function(b){}});this.clear();this.hide()},onCancelClick:function(){this.clear();this.hide()},onFile:function(){if(!this.file){this.file=new Deluge.add.FileWindow()}this.file.show()},onHide:function(){this.optionsPanel.setActiveTab(0);this.optionsPanel.files.setDisabled(true);this.optionsPanel.form.setDisabled(true)},onRemove:function(){if(!this.list.getSelectionCount()){return}var a=this.list.getSelectedRecords()[0];this.list.getStore().remove(a);this.optionsPanel.clear();if(this.torrents&&this.torrents[a.id]){delete this.torrents[a.id]}},onSelect:function(c,b){if(b.length){var a=this.list.getRecord(b[0]);this.optionsPanel.setTorrent(a.get("info_hash"));this.optionsPanel.files.setDisabled(false);this.optionsPanel.form.setDisabled(false)}else{this.optionsPanel.files.setDisabled(true);this.optionsPanel.form.setDisabled(true)}},onShow:function(){if(!this.url){this.url=new Deluge.add.UrlWindow();this.url.on("beforeadd",this.onTorrentBeforeAdd,this);this.url.on("add",this.onTorrentAdd,this)}if(!this.file){this.file=new Deluge.add.FileWindow();this.file.on("beforeadd",this.onTorrentBeforeAdd,this);this.file.on("add",this.onTorrentAdd,this)}this.optionsPanel.form.getDefaults()},onTorrentBeforeAdd:function(b,c){var a=this.list.getStore();a.loadData([[b,null,c]],true)},onTorrentAdd:function(a,c){var b=this.list.getStore().getById(a);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"});this.list.getStore().remove(b)}else{b.set("info_hash",c.info_hash);b.set("text",c.name);this.list.getStore().commitChanges();this.optionsPanel.addTorrent(c)}},onUrl:function(a,b){this.url.show()}}); +Ext.namespace("Deluge.add");Deluge.add.AddWindow=Ext.extend(Deluge.add.Window,{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",initComponent:function(){Deluge.add.AddWindow.superclass.initComponent.call(this);this.addButton(_("Cancel"),this.onCancelClick,this);this.addButton(_("Add"),this.onAddClick,this);function a(c,d,b){if(b.data.info_hash){return String.format('
{0}
',c)}else{return String.format('
{0}
',c)}}this.list=new Ext.list.ListView({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,singleSelect:true,listeners:{selectionchange:{fn:this.onSelect,scope:this}},hideHeaders:true,autoExpandColumn:"torrent",height:"100%",autoScroll:true});this.add({region:"center",items:[this.list],margins:"5 5 5 5",bbar:new Ext.Toolbar({items:[{iconCls:"x-deluge-add-file",text:_("File"),handler:this.onFile,scope:this},{text:_("Url"),iconCls:"icon-add-url",handler:this.onUrl,scope:this},{text:_("Infohash"),iconCls:"icon-add-magnet",disabled:true},"->",{text:_("Remove"),iconCls:"icon-remove",handler:this.onRemove,scope:this}]})});this.optionsPanel=this.add(new Deluge.add.OptionsPanel());this.on("hide",this.onHide,this);this.on("show",this.onShow,this)},clear:function(){this.list.getStore().removeAll();this.optionsPanel.clear()},onAddClick:function(){var a=[];if(!this.list){return}this.list.getStore().each(function(b){var c=b.get("info_hash");a.push({path:this.optionsPanel.getFilename(c),options:this.optionsPanel.getOptions(c)})},this);deluge.client.web.add_torrents(a,{success:function(b){}});this.clear();this.hide()},onCancelClick:function(){this.clear();this.hide()},onFile:function(){if(!this.file){this.file=new Deluge.add.FileWindow()}this.file.show()},onHide:function(){this.optionsPanel.setActiveTab(0);this.optionsPanel.files.setDisabled(true);this.optionsPanel.form.setDisabled(true)},onRemove:function(){if(!this.list.getSelectionCount()){return}var a=this.list.getSelectedRecords()[0];this.list.getStore().remove(a);this.optionsPanel.clear();if(this.torrents&&this.torrents[a.id]){delete this.torrents[a.id]}},onSelect:function(c,b){if(b.length){var a=this.list.getRecord(b[0]);this.optionsPanel.setTorrent(a.get("info_hash"))}else{this.optionsPanel.files.setDisabled(true);this.optionsPanel.form.setDisabled(true)}},onShow:function(){if(!this.url){this.url=new Deluge.add.UrlWindow();this.url.on("beforeadd",this.onTorrentBeforeAdd,this);this.url.on("add",this.onTorrentAdd,this)}if(!this.file){this.file=new Deluge.add.FileWindow();this.file.on("beforeadd",this.onTorrentBeforeAdd,this);this.file.on("add",this.onTorrentAdd,this)}this.optionsPanel.form.getDefaults()},onTorrentBeforeAdd:function(b,c){var a=this.list.getStore();a.loadData([[b,null,c]],true)},onTorrentAdd:function(a,c){var b=this.list.getStore().getById(a);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"});this.list.getStore().remove(b)}else{b.set("info_hash",c.info_hash);b.set("text",c.name);this.list.getStore().commitChanges();this.optionsPanel.addTorrent(c);this.list.select(b)}},onUrl:function(a,b){this.url.show()}}); /* * Deluge.add.File.js * @@ -416,7 +416,7 @@ Ext.ns("Deluge.add");Deluge.add.FilesTab=Ext.extend(Ext.ux.tree.TreeGrid,{layout Ext.namespace("Ext.deluge.add"); /* * Deluge.add.OptionsPanel.js - * + * * Copyright (c) Damien Churchill 2009-2010 * * This program is free software; you can redistribute it and/or modify @@ -445,7 +445,7 @@ Ext.namespace("Ext.deluge.add"); * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.ns("Deluge.add");Deluge.add.OptionsPanel=Ext.extend(Ext.TabPanel,{torrents:{},region:"south",margins:"5 5 5 5",activeTab:0,height:220,initComponent:function(){Deluge.add.OptionsPanel.superclass.initComponent.call(this);this.files=this.add(new Deluge.add.FilesTab());this.form=this.add(new Deluge.add.OptionsTab());this.files.on("fileschecked",this.onFilesChecked,this)},addTorrent:function(c){this.torrents[c.info_hash]=c;var b={};this.walkFileTree(c.files_tree,function(e,g,h,f){if(g!="file"){return}b[h.index]=h.download},this);var a=[];Ext.each(Ext.keys(b),function(e){a[e]=b[e]});var d=this.form.optionsManager.changeId(c.info_hash,true);this.form.optionsManager.setDefault("file_priorities",a);this.form.optionsManager.changeId(d,true)},clear:function(){this.files.clearFiles();this.form.optionsManager.resetAll()},getFilename:function(a){return this.torrents[a]["filename"]},getOptions:function(a){var c=this.form.optionsManager.changeId(a,true);var b=this.form.optionsManager.get();this.form.optionsManager.changeId(c,true);Ext.each(b.file_priorities,function(e,d){b.file_priorities[d]=(e)?1:0});return b},setTorrent:function(b){if(!b){return}this.torrentId=b;this.form.optionsManager.changeId(b);this.files.clearFiles();var a=this.files.getRootNode();var c=this.form.optionsManager.get("file_priorities");this.walkFileTree(this.torrents[b]["files_tree"],function(e,f,h,d){var g=new Ext.tree.TreeNode({download:(h.index)?c[h.index]:true,filename:e,fileindex:h.index,leaf:f!="dir",size:h.length});d.appendChild(g);if(f=="dir"){return g}},this,a);a.firstChild.expand()},walkFileTree:function(g,h,e,a){for(var b in g.contents){var f=g.contents[b];var d=f.type;if(e){var c=h.apply(e,[b,d,f,a])}else{var c=h(b,d,f,a)}if(d=="dir"){this.walkFileTree(f,h,e,c)}}},onFilesChecked:function(a,c,b){if(this.form.optionsManager.get("compact_allocation")){Ext.Msg.show({title:_("Unable to set file priority!"),msg:_("File prioritization is unavailable when using Compact allocation. Would you like to switch to Full allocation?"),buttons:Ext.Msg.YESNO,fn:function(d){if(d=="yes"){this.form.optionsManager.update("compact_allocation",false);Ext.each(a,function(f){if(f.attributes.fileindex<0){return}var e=this.form.optionsManager.get("file_priorities");e[f.attributes.fileindex]=c;this.form.optionsManager.update("file_priorities",e)},this)}else{this.files.setDownload(a[0],b,true)}},scope:this,icon:Ext.MessageBox.QUESTION})}else{Ext.each(a,function(e){if(e.attributes.fileindex<0){return}var d=this.form.optionsManager.get("file_priorities");d[e.attributes.fileindex]=c;this.form.optionsManager.update("file_priorities",d)},this)}}}); +Ext.ns("Deluge.add");Deluge.add.OptionsPanel=Ext.extend(Ext.TabPanel,{torrents:{},region:"south",margins:"5 5 5 5",activeTab:0,height:220,initComponent:function(){Deluge.add.OptionsPanel.superclass.initComponent.call(this);this.files=this.add(new Deluge.add.FilesTab());this.form=this.add(new Deluge.add.OptionsTab());this.files.on("fileschecked",this.onFilesChecked,this)},addTorrent:function(c){this.torrents[c.info_hash]=c;var b={};this.walkFileTree(c.files_tree,function(e,g,h,f){if(g!="file"){return}b[h.index]=h.download},this);var a=[];Ext.each(Ext.keys(b),function(e){a[e]=b[e]});var d=this.form.optionsManager.changeId(c.info_hash,true);this.form.optionsManager.setDefault("file_priorities",a);this.form.optionsManager.changeId(d,true)},clear:function(){this.files.clearFiles();this.form.optionsManager.resetAll()},getFilename:function(a){return this.torrents[a]["filename"]},getOptions:function(a){var c=this.form.optionsManager.changeId(a,true);var b=this.form.optionsManager.get();this.form.optionsManager.changeId(c,true);Ext.each(b.file_priorities,function(e,d){b.file_priorities[d]=(e)?1:0});return b},setTorrent:function(b){if(!b){return}this.torrentId=b;this.form.optionsManager.changeId(b);this.files.clearFiles();var a=this.files.getRootNode();var c=this.form.optionsManager.get("file_priorities");this.form.setDisabled(false);if(this.torrents[b]["files_tree"]){this.walkFileTree(this.torrents[b]["files_tree"],function(e,f,h,d){var g=new Ext.tree.TreeNode({download:(h.index)?c[h.index]:true,filename:e,fileindex:h.index,leaf:f!="dir",size:h.length});d.appendChild(g);if(f=="dir"){return g}},this,a);a.firstChild.expand();this.files.setDisabled(false);this.files.show()}else{this.form.show();this.files.setDisabled(true)}},walkFileTree:function(g,h,e,a){for(var b in g.contents){var f=g.contents[b];var d=f.type;if(e){var c=h.apply(e,[b,d,f,a])}else{var c=h(b,d,f,a)}if(d=="dir"){this.walkFileTree(f,h,e,c)}}},onFilesChecked:function(a,c,b){if(this.form.optionsManager.get("compact_allocation")){Ext.Msg.show({title:_("Unable to set file priority!"),msg:_("File prioritization is unavailable when using Compact allocation. Would you like to switch to Full allocation?"),buttons:Ext.Msg.YESNO,fn:function(d){if(d=="yes"){this.form.optionsManager.update("compact_allocation",false);Ext.each(a,function(f){if(f.attributes.fileindex<0){return}var e=this.form.optionsManager.get("file_priorities");e[f.attributes.fileindex]=c;this.form.optionsManager.update("file_priorities",e)},this)}else{this.files.setDownload(a[0],b,true)}},scope:this,icon:Ext.MessageBox.QUESTION})}else{Ext.each(a,function(e){if(e.attributes.fileindex<0){return}var d=this.form.optionsManager.get("file_priorities");d[e.attributes.fileindex]=c;this.form.optionsManager.update("file_priorities",d)},this)}}}); /* * Deluge.add.OptionsPanel.js * @@ -509,7 +509,7 @@ Ext.ns("Deluge.add");Deluge.add.OptionsTab=Ext.extend(Ext.form.FormPanel,{title: * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.namespace("Deluge.add");Deluge.add.UrlWindow=Ext.extend(Deluge.add.Window,{title:_("Add from Url"),modal:true,plain:true,layout:"fit",width:350,height:155,buttonAlign:"center",closeAction:"hide",bodyStyle:"padding: 10px 5px;",iconCls:"x-deluge-add-url-window-icon",initComponent:function(){Deluge.add.UrlWindow.superclass.initComponent.call(this);this.addButton(_("Add"),this.onAddClick,this);var a=this.add({xtype:"form",defaultType:"textfield",baseCls:"x-plain",labelWidth:55});this.urlField=a.add({fieldLabel:_("Url"),id:"url",name:"url",width:"97%"});this.urlField.on("specialkey",this.onAdd,this);this.cookieField=a.add({fieldLabel:_("Cookies"),id:"cookies",name:"cookies",width:"97%"});this.cookieField.on("specialkey",this.onAdd,this)},onAddClick:function(f,d){if((f.id=="url"||f.id=="cookies")&&d.getKey()!=d.ENTER){return}var f=this.urlField;var b=f.getValue();var c=this.cookieField.getValue();var a=this.createTorrentId();deluge.client.web.download_torrent_from_url(b,c,{success:this.onDownload,scope:this,torrentId:a});this.hide();this.fireEvent("beforeadd",a,b)},onDownload:function(a,c,d,b){this.urlField.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("Deluge.add");Deluge.add.UrlWindow=Ext.extend(Deluge.add.Window,{title:_("Add from Url"),modal:true,plain:true,layout:"fit",width:350,height:155,buttonAlign:"center",closeAction:"hide",bodyStyle:"padding: 10px 5px;",iconCls:"x-deluge-add-url-window-icon",initComponent:function(){Deluge.add.UrlWindow.superclass.initComponent.call(this);this.addButton(_("Add"),this.onAddClick,this);var a=this.add({xtype:"form",defaultType:"textfield",baseCls:"x-plain",labelWidth:55});this.urlField=a.add({fieldLabel:_("Url"),id:"url",name:"url",width:"97%"});this.urlField.on("specialkey",this.onAdd,this);this.cookieField=a.add({fieldLabel:_("Cookies"),id:"cookies",name:"cookies",width:"97%"});this.cookieField.on("specialkey",this.onAdd,this)},onAddClick:function(f,d){if((f.id=="url"||f.id=="cookies")&&d.getKey()!=d.ENTER){return}var f=this.urlField;var b=f.getValue();var c=this.cookieField.getValue();var a=this.createTorrentId();if(b.substring(0,20)=="magnet:?xt=urn:btih:"){deluge.client.web.get_magnet_info(b,{success:this.onGotInfo,scope:this,filename:b,torrentId:a})}else{deluge.client.web.download_torrent_from_url(b,c,{success:this.onDownload,scope:this,torrentId:a})}this.hide();this.urlField.setValue("");this.fireEvent("beforeadd",a,b)},onDownload:function(a,c,d,b){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)}}); /* * Deluge.preferences.BandwidthPage.js * @@ -1757,7 +1757,7 @@ Deluge.Toolbar=Ext.extend(Ext.Toolbar,{constructor:function(a){a=Ext.apply({item * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -(function(){function c(l){return(l==-1)?"":l+1}function f(m,n,l){return String.format('
{1}
',l.data.state.toLowerCase(),m)}function g(l){if(!l){return}return fspeed(l)}function i(l){if(l==-1){return""}return fspeed(l*1024)}function k(q,s,o){q=new Number(q);var l=q;var t=o.data.state+" "+q.toFixed(2)+"%";if(this.style){var n=this.style}else{var n=s.style}var m=new Number(n.match(/\w+:\s*(\d+)\w+/)[1]);return Deluge.progressBar(q,m-8,t)}function a(m,n,l){if(l.data.total_seeds>-1){return String.format("{0} ({1})",m,l.data.total_seeds)}else{return m}}function e(m,n,l){if(l.data.total_peers>-1){return String.format("{0} ({1})",m,l.data.total_peers)}else{return m}}function b(m,n,l){return(m<0)?"∞":parseFloat(new Number(m).toFixed(3))}function d(m,n,l){return String.format('
{0}
',m)}function h(l){return l*-1}function j(l){return l>0?fdate(l):"Never"}Deluge.TorrentGrid=Ext.extend(Ext.grid.GridPanel,{torrents:{},columns:[{id:"queue",header:_("#"),width:30,sortable:true,renderer:c,dataIndex:"queue"},{id:"name",header:_("Name"),width:150,sortable:true,renderer:f,dataIndex:"name"},{header:_("Size"),width:75,sortable:true,renderer:fsize,dataIndex:"total_size"},{header:_("Progress"),width:150,sortable:true,renderer:k,dataIndex:"progress"},{header:_("Seeders"),hidden:true,width:60,sortable:true,renderer:a,dataIndex:"num_seeds"},{header:_("Peers"),hidden:true,width:60,sortable:true,renderer:e,dataIndex:"num_peers"},{header:_("Down Speed"),width:80,sortable:true,renderer:g,dataIndex:"download_payload_rate"},{header:_("Up Speed"),width:80,sortable:true,renderer:g,dataIndex:"upload_payload_rate"},{header:_("ETA"),width:60,sortable:true,renderer:ftime,dataIndex:"eta"},{header:_("Ratio"),hidden:true,width:60,sortable:true,renderer:b,dataIndex:"ratio"},{header:_("Avail"),hidden:true,width:60,sortable:true,renderer:b,dataIndex:"distributed_copies"},{header:_("Added"),hidden:true,width:80,sortable:true,renderer:fdate,dataIndex:"time_added"},{header:_("Last Seen Complete"),width:80,sortable:true,renderer:j,dataIndex:"last_seen_complete"},{header:_("Tracker"),hidden:true,width:120,sortable:true,renderer:d,dataIndex:"tracker_host"},{header:_("Save Path"),hidden:true,width:120,sortable:true,renderer:fplain,dataIndex:"save_path"},{header:_("Owner"),width:80,sortable:true,renderer:fplain,dataIndex:"owner"},{header:_("Public"),hidden:true,width:80,sortable:true,renderer:fplain,dataIndex:"public"},{header:_("Shared"),hidden:true,width:80,sortable:true,renderer:fplain,dataIndex:"shared"},{header:_("Downloaded"),hidden:true,width:75,sortable:true,renderer:fsize,dataIndex:"total_done"},{header:_("Uploaded"),hidden:true,width:75,sortable:true,renderer:fsize,dataIndex:"total_uploaded"},{header:_("Down Limit"),hidden:true,width:75,sortable:true,renderer:i,dataIndex:"max_download_speed"},{header:_("Up Limit"),hidden:true,width:75,sortable:true,renderer:i,dataIndex:"max_upload_speed"},{header:_("Seeders")+"/"+_("Peers"),hidden:true,width:75,sortable:true,renderer:b,dataIndex:"seeds_peers_ratio"}],meta:{root:"torrents",idProperty:"id",fields:[{name:"queue",sortType:Deluge.data.SortTypes.asQueuePosition},{name:"name"},{name:"total_size",type:"int"},{name:"state"},{name:"progress",type:"float"},{name:"num_seeds",type:"int"},{name:"total_seeds",type:"int"},{name:"num_peers",type:"int"},{name:"total_peers",type:"int"},{name:"download_payload_rate",type:"int"},{name:"upload_payload_speed",type:"int"},{name:"eta",type:"int",sortType:h},{name:"ratio",type:"float"},{name:"distributed_copies",type:"float"},{name:"time_added",type:"int"},{name:"tracker_host"},{name:"save_path"},{name:"total_done",type:"int"},{name:"total_uploaded",type:"int"},{name:"max_download_speed",type:"int"},{name:"max_upload_speed",type:"int"},{name:"seeds_peers_ratio",type:"float"}]},constructor:function(l){l=Ext.apply({id:"torrentGrid",store:new Ext.data.JsonStore(this.meta),columns:this.columns,region:"center",cls:"deluge-torrents",stripeRows:true,autoExpandColumn:"name",autoExpandMin:150,deferredRender:false,autoScroll:true,margins:"5 5 0 0",stateful:true,view:new Ext.ux.grid.BufferView({rowHeight:26,scrollDelay:false})},l);Deluge.TorrentGrid.superclass.constructor.call(this,l)},initComponent:function(){Deluge.TorrentGrid.superclass.initComponent.call(this);deluge.events.on("torrentRemoved",this.onTorrentRemoved,this);deluge.events.on("disconnect",this.onDisconnect,this);this.on("rowcontextmenu",function(l,o,n){n.stopEvent();var m=l.getSelectionModel();if(!m.hasSelection()){m.selectRow(o)}deluge.menus.torrent.showAt(n.getPoint())})},getTorrent:function(l){return this.getStore().getAt(l)},getSelected:function(){return this.getSelectionModel().getSelected()},getSelections:function(){return this.getSelectionModel().getSelections()},getSelectedId:function(){return this.getSelectionModel().getSelected().id},getSelectedIds:function(){var l=[];Ext.each(this.getSelectionModel().getSelections(),function(m){l.push(m.id)});return l},update:function(o,m){var q=this.getStore();if(m){q.removeAll();this.torrents={}}var p=[];for(var r in o){var u=o[r];if(this.torrents[r]){var n=q.getById(r);n.beginEdit();for(var l in u){if(n.get(l)!=u[l]){n.set(l,u[l])}}n.endEdit()}else{var n=new Deluge.data.Torrent(u);n.id=r;this.torrents[r]=1;p.push(n)}}q.add(p);q.each(function(t){if(!o[t.id]){q.remove(t);delete this.torrents[t.id]}},this);q.commitChanges();var s=q.getSortState();if(!s){return}q.sort(s.field,s.direction)},onDisconnect:function(){this.getStore().removeAll();this.torrents={}},onTorrentRemoved:function(m){var l=this.getSelectionModel();Ext.each(m,function(o){var n=this.getStore().getById(o);if(l.isSelected(n)){l.deselectRow(this.getStore().indexOf(n))}this.getStore().remove(n);delete this.torrents[o]},this)}});deluge.torrents=new Deluge.TorrentGrid()})(); +(function(){function c(l){return(l==-1)?"":l+1}function f(m,n,l){return String.format('
{1}
',l.data.state.toLowerCase(),m)}function g(l){if(!l){return}return fspeed(l)}function i(l){if(l==-1){return""}return fspeed(l*1024)}function k(q,s,o){q=new Number(q);var l=q;var t=o.data.state+" "+q.toFixed(2)+"%";if(this.style){var n=this.style}else{var n=s.style}var m=new Number(n.match(/\w+:\s*(\d+)\w+/)[1]);return Deluge.progressBar(q,m-8,t)}function a(m,n,l){if(l.data.total_seeds>-1){return String.format("{0} ({1})",m,l.data.total_seeds)}else{return m}}function e(m,n,l){if(l.data.total_peers>-1){return String.format("{0} ({1})",m,l.data.total_peers)}else{return m}}function b(m,n,l){return(m<0)?"∞":parseFloat(new Number(m).toFixed(3))}function d(m,n,l){return String.format('
{0}
',m)}function h(l){return l*-1}function j(l){return l>0?fdate(l):"Never"}Deluge.TorrentGrid=Ext.extend(Ext.grid.GridPanel,{torrents:{},columns:[{id:"queue",header:_("#"),width:30,sortable:true,renderer:c,dataIndex:"queue"},{id:"name",header:_("Name"),width:150,sortable:true,renderer:f,dataIndex:"name"},{header:_("Size"),width:75,sortable:true,renderer:fsize,dataIndex:"total_size"},{header:_("Progress"),width:150,sortable:true,renderer:k,dataIndex:"progress"},{header:_("Seeders"),hidden:true,width:60,sortable:true,renderer:a,dataIndex:"num_seeds"},{header:_("Peers"),hidden:true,width:60,sortable:true,renderer:e,dataIndex:"num_peers"},{header:_("Down Speed"),width:80,sortable:true,renderer:g,dataIndex:"download_payload_rate"},{header:_("Up Speed"),width:80,sortable:true,renderer:g,dataIndex:"upload_payload_rate"},{header:_("ETA"),width:60,sortable:true,renderer:ftime,dataIndex:"eta"},{header:_("Ratio"),hidden:true,width:60,sortable:true,renderer:b,dataIndex:"ratio"},{header:_("Avail"),hidden:true,width:60,sortable:true,renderer:b,dataIndex:"distributed_copies"},{header:_("Added"),hidden:true,width:80,sortable:true,renderer:fdate,dataIndex:"time_added"},{header:_("Last Seen Complete"),width:80,sortable:true,renderer:j,dataIndex:"last_seen_complete"},{header:_("Tracker"),hidden:true,width:120,sortable:true,renderer:d,dataIndex:"tracker_host"},{header:_("Save Path"),hidden:true,width:120,sortable:true,renderer:fplain,dataIndex:"save_path"},{header:_("Owner"),width:80,sortable:true,renderer:fplain,dataIndex:"owner"},{header:_("Public"),hidden:true,width:80,sortable:true,renderer:fplain,dataIndex:"public"},{header:_("Shared"),hidden:true,width:80,sortable:true,renderer:fplain,dataIndex:"shared"},{header:_("Downloaded"),hidden:true,width:75,sortable:true,renderer:fsize,dataIndex:"total_done"},{header:_("Uploaded"),hidden:true,width:75,sortable:true,renderer:fsize,dataIndex:"total_uploaded"},{header:_("Down Limit"),hidden:true,width:75,sortable:true,renderer:i,dataIndex:"max_download_speed"},{header:_("Up Limit"),hidden:true,width:75,sortable:true,renderer:i,dataIndex:"max_upload_speed"},{header:_("Seeders")+"/"+_("Peers"),hidden:true,width:75,sortable:true,renderer:b,dataIndex:"seeds_peers_ratio"}],meta:{root:"torrents",idProperty:"id",fields:[{name:"queue",sortType:Deluge.data.SortTypes.asQueuePosition},{name:"name"},{name:"total_size",type:"int"},{name:"state"},{name:"progress",type:"float"},{name:"num_seeds",type:"int"},{name:"total_seeds",type:"int"},{name:"num_peers",type:"int"},{name:"total_peers",type:"int"},{name:"download_payload_rate",type:"int"},{name:"upload_payload_speed",type:"int"},{name:"eta",type:"int",sortType:h},{name:"ratio",type:"float"},{name:"distributed_copies",type:"float"},{name:"time_added",type:"int"},{name:"tracker_host"},{name:"save_path"},{name:"total_done",type:"int"},{name:"total_uploaded",type:"int"},{name:"max_download_speed",type:"int"},{name:"max_upload_speed",type:"int"},{name:"seeds_peers_ratio",type:"float"}]},keys:[{key:"a",ctrl:true,stopEvent:true,handler:function(){deluge.torrents.getSelectionModel().selectAll()}},{key:[46],stopEvent:true,handler:function(){ids=deluge.torrents.getSelectedIds();deluge.removeWindow.show(ids)}}],constructor:function(l){l=Ext.apply({id:"torrentGrid",store:new Ext.data.JsonStore(this.meta),columns:this.columns,keys:this.keys,region:"center",cls:"deluge-torrents",stripeRows:true,autoExpandColumn:"name",autoExpandMin:150,deferredRender:false,autoScroll:true,margins:"5 5 0 0",stateful:true,view:new Ext.ux.grid.BufferView({rowHeight:26,scrollDelay:false})},l);Deluge.TorrentGrid.superclass.constructor.call(this,l)},initComponent:function(){Deluge.TorrentGrid.superclass.initComponent.call(this);deluge.events.on("torrentRemoved",this.onTorrentRemoved,this);deluge.events.on("disconnect",this.onDisconnect,this);this.on("rowcontextmenu",function(l,o,n){n.stopEvent();var m=l.getSelectionModel();if(!m.hasSelection()){m.selectRow(o)}deluge.menus.torrent.showAt(n.getPoint())})},getTorrent:function(l){return this.getStore().getAt(l)},getSelected:function(){return this.getSelectionModel().getSelected()},getSelections:function(){return this.getSelectionModel().getSelections()},getSelectedId:function(){return this.getSelectionModel().getSelected().id},getSelectedIds:function(){var l=[];Ext.each(this.getSelectionModel().getSelections(),function(m){l.push(m.id)});return l},update:function(o,m){var q=this.getStore();if(m){q.removeAll();this.torrents={}}var p=[];for(var r in o){var u=o[r];if(this.torrents[r]){var n=q.getById(r);n.beginEdit();for(var l in u){if(n.get(l)!=u[l]){n.set(l,u[l])}}n.endEdit()}else{var n=new Deluge.data.Torrent(u);n.id=r;this.torrents[r]=1;p.push(n)}}q.add(p);q.each(function(t){if(!o[t.id]){q.remove(t);delete this.torrents[t.id]}},this);q.commitChanges();var s=q.getSortState();if(!s){return}q.sort(s.field,s.direction)},onDisconnect:function(){this.getStore().removeAll();this.torrents={}},onTorrentRemoved:function(m){var l=this.getSelectionModel();Ext.each(m,function(o){var n=this.getStore().getById(o);if(l.isSelected(n)){l.deselectRow(this.getStore().indexOf(n))}this.getStore().remove(n);delete this.torrents[o]},this)}});deluge.torrents=new Deluge.TorrentGrid()})(); /* * Deluge.UI.js *