diff --git a/deluge/ui/web/js/deluge-all-debug.js b/deluge/ui/web/js/deluge-all-debug.js index 40e776cfe..637a5595b 100644 --- a/deluge/ui/web/js/deluge-all-debug.js +++ b/deluge/ui/web/js/deluge-all-debug.js @@ -9154,7 +9154,7 @@ Deluge.Toolbar = Ext.extend(Ext.Toolbar, { this.on('rowcontextmenu', function(grid, rowIndex, e) { e.stopEvent(); var selection = grid.getSelectionModel(); - if (!selection.hasSelection()) { + if (!selection.isSelected(rowIndex)) { selection.selectRow(rowIndex); } deluge.menus.torrent.showAt(e.getPoint()); diff --git a/deluge/ui/web/js/deluge-all.js b/deluge/ui/web/js/deluge-all.js index 70608bf45..400613bb5 100644 --- a/deluge/ui/web/js/deluge-all.js +++ b/deluge/ui/web/js/deluge-all.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(k){return(k==-1)?"":k+1}function f(l,m,k){return String.format('
{1}
',k.data.state.toLowerCase(),l)}function g(k){if(!k){return}return fspeed(k)}function i(k){if(k==-1){return""}return fspeed(k*1024)}function j(o,q,n){o=new Number(o);var k=o;var s=n.data.state+" "+o.toFixed(2)+"%";if(this.style){var m=this.style}else{var m=q.style}var l=new Number(m.match(/\w+:\s*(\d+)\w+/)[1]);return Deluge.progressBar(o,l-8,s)}function a(l,m,k){if(k.data.total_seeds>-1){return String.format("{0} ({1})",l,k.data.total_seeds)}else{return l}}function e(l,m,k){if(k.data.total_peers>-1){return String.format("{0} ({1})",l,k.data.total_peers)}else{return l}}function b(l,m,k){return(l<0)?"∞":parseFloat(new Number(l).toFixed(3))}function d(l,m,k){return String.format('
{0}
',l)}function h(k){return k*-1}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:j,dataIndex:"progress"},{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:_("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:_("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:_("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:_("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",sortType:Deluge.data.SortTypes.asName},{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_rate",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(k){k=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})},k);Deluge.TorrentGrid.superclass.constructor.call(this,k)},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(k,n,m){m.stopEvent();var l=k.getSelectionModel();if(!l.hasSelection()){l.selectRow(n)}deluge.menus.torrent.showAt(m.getPoint())})},getTorrent:function(k){return this.getStore().getAt(k)},getSelected:function(){return this.getSelectionModel().getSelected()},getSelections:function(){return this.getSelectionModel().getSelections()},getSelectedId:function(){return this.getSelectionModel().getSelected().id},getSelectedIds:function(){var k=[];Ext.each(this.getSelectionModel().getSelections(),function(l){k.push(l.id)});return k},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(k){if(!o[k.id]){q.remove(k);delete this.torrents[k.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(l){var k=this.getSelectionModel();Ext.each(l,function(n){var m=this.getStore().getById(n);if(k.isSelected(m)){k.deselectRow(this.getStore().indexOf(m))}this.getStore().remove(m);delete this.torrents[n]},this)}});deluge.torrents=new Deluge.TorrentGrid()})(); +(function(){function c(k){return(k==-1)?"":k+1}function f(l,m,k){return String.format('
{1}
',k.data.state.toLowerCase(),l)}function g(k){if(!k){return}return fspeed(k)}function i(k){if(k==-1){return""}return fspeed(k*1024)}function j(o,q,n){o=new Number(o);var k=o;var s=n.data.state+" "+o.toFixed(2)+"%";if(this.style){var m=this.style}else{var m=q.style}var l=new Number(m.match(/\w+:\s*(\d+)\w+/)[1]);return Deluge.progressBar(o,l-8,s)}function a(l,m,k){if(k.data.total_seeds>-1){return String.format("{0} ({1})",l,k.data.total_seeds)}else{return l}}function e(l,m,k){if(k.data.total_peers>-1){return String.format("{0} ({1})",l,k.data.total_peers)}else{return l}}function b(l,m,k){return(l<0)?"∞":parseFloat(new Number(l).toFixed(3))}function d(l,m,k){return String.format('
{0}
',l)}function h(k){return k*-1}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:j,dataIndex:"progress"},{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:_("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:_("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:_("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:_("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",sortType:Deluge.data.SortTypes.asName},{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_rate",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(k){k=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})},k);Deluge.TorrentGrid.superclass.constructor.call(this,k)},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(k,n,m){m.stopEvent();var l=k.getSelectionModel();if(!l.isSelected(n)){l.selectRow(n)}deluge.menus.torrent.showAt(m.getPoint())})},getTorrent:function(k){return this.getStore().getAt(k)},getSelected:function(){return this.getSelectionModel().getSelected()},getSelections:function(){return this.getSelectionModel().getSelections()},getSelectedId:function(){return this.getSelectionModel().getSelected().id},getSelectedIds:function(){var k=[];Ext.each(this.getSelectionModel().getSelections(),function(l){k.push(l.id)});return k},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(k){if(!o[k.id]){q.remove(k);delete this.torrents[k.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(l){var k=this.getSelectionModel();Ext.each(l,function(n){var m=this.getStore().getById(n);if(k.isSelected(m)){k.deselectRow(this.getStore().indexOf(m))}this.getStore().remove(m);delete this.torrents[n]},this)}});deluge.torrents=new Deluge.TorrentGrid()})(); /* * Deluge.UI.js *