diff options
Diffstat (limited to 'deluge/ui/web/js/deluge-all/details/FilesTab.js')
-rw-r--r-- | deluge/ui/web/js/deluge-all/details/FilesTab.js | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/deluge/ui/web/js/deluge-all/details/FilesTab.js b/deluge/ui/web/js/deluge-all/details/FilesTab.js index 061ed7950..3d0de06dc 100644 --- a/deluge/ui/web/js/deluge-all/details/FilesTab.js +++ b/deluge/ui/web/js/deluge-all/details/FilesTab.js @@ -1,7 +1,7 @@ /*! * Deluge.details.FilesTab.js - * - * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> + * + * Copyright (c) Damien Churchill 2009-2011 <damoxc@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,8 +29,19 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ - -Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { + +Ext.define('Deluge.data.File', { + extend: 'Ext.data.Model', + fields: [ + {name: 'filename', type: 'string'}, + {name: 'size', type: 'int'}, + {name: 'progress', type: 'float'} + ] +}); + +Ext.define('Deluge.details.FilesTab', { + + extend: 'Ext.tree.Panel', title: _('Files'), @@ -45,18 +56,19 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { header: _('Size'), width: 150, dataIndex: 'size', - tpl: new Ext.XTemplate('{size:this.fsize}', { + tpl: Ext.create('Ext.XTemplate', '{size:this.fsize}', { fsize: function(v) { return fsize(v); } }) }, { - xtype: 'tgrendercolumn', header: _('Progress'), width: 150, dataIndex: 'progress', - renderer: function(v) { - var progress = v * 100; - return Deluge.progressBar(progress, this.col.width, progress.toFixed(2) + '%', 0); - } + tpl: Ext.create('Ext.XTemplate', '{progress:this.progress}', { + progress: function(v) { + var progress = v * 100; + return Deluge.progressBar(progress, this.col.width, progress.toFixed(2) + '%', 0); + } + }) }, { header: _('Priority'), width: 150, @@ -74,13 +86,8 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { } }) }], - - selModel: new Ext.tree.MultiSelectionModel(), - initComponent: function() { - Deluge.details.FilesTab.superclass.initComponent.call(this); - this.setRootNode(new Ext.tree.TreeNode({text: 'Files'})); - }, + multiSelect: true, clear: function() { var root = this.getRootNode(); @@ -130,7 +137,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { this.clear(); this.torrentId = torrentId; } - + deluge.client.web.get_torrent_files(torrentId, { success: this.onRequestComplete, scope: this, @@ -163,7 +170,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { folderSort: true }); }, - + onContextMenu: function(node, e) { e.stopEvent(); var selModel = this.getSelectionModel(); @@ -173,7 +180,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { } deluge.menus.filePriorities.showAt(e.getPoint()); }, - + onItemClick: function(baseItem, e) { switch (baseItem.id) { case 'expandAll': @@ -200,7 +207,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { return; } }); - + var priorities = new Array(Ext.keys(indexes).length); for (var index in indexes) { priorities[index] = indexes[index]; @@ -217,7 +224,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { break; } }, - + onRequestComplete: function(files, options) { if (!this.getRootNode().hasChildNodes()) { this.createFileTree(files); |