mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-06 08:28:39 +00:00
partially working files tab added back in
This commit is contained in:
parent
c7635b0ff0
commit
d74050e7a6
5 changed files with 26 additions and 7 deletions
|
@ -40,7 +40,7 @@ Copyright:
|
||||||
return String.format('<div class="{0}">{1}</div>', FILE_PRIORITY_CSS[value], _(FILE_PRIORITY[value]));
|
return String.format('<div class="{0}">{1}</div>', FILE_PRIORITY_CSS[value], _(FILE_PRIORITY[value]));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ext.deluge.details.FilesTab = Ext.extend(Ext.tree.ColumnTree, {
|
Ext.deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, {
|
||||||
|
|
||||||
constructor: function(config) {
|
constructor: function(config) {
|
||||||
config = Ext.apply({
|
config = Ext.apply({
|
||||||
|
@ -54,16 +54,19 @@ Copyright:
|
||||||
width: 330,
|
width: 330,
|
||||||
dataIndex: 'filename'
|
dataIndex: 'filename'
|
||||||
}, {
|
}, {
|
||||||
|
xtype: 'tgcustomcolumn',
|
||||||
header: _('Size'),
|
header: _('Size'),
|
||||||
width: 150,
|
width: 150,
|
||||||
dataIndex: 'size',
|
dataIndex: 'size',
|
||||||
renderer: fsize
|
renderer: fsize
|
||||||
}, {
|
}, {
|
||||||
|
xtype: 'tgcustomcolumn',
|
||||||
header: _('Progress'),
|
header: _('Progress'),
|
||||||
width: 150,
|
width: 150,
|
||||||
dataIndex: 'progress',
|
dataIndex: 'progress',
|
||||||
renderer: fileProgressRenderer
|
renderer: fileProgressRenderer
|
||||||
}, {
|
}, {
|
||||||
|
xtype: 'tgcustomcolumn',
|
||||||
header: _('Priority'),
|
header: _('Priority'),
|
||||||
width: 150,
|
width: 150,
|
||||||
dataIndex: 'priority',
|
dataIndex: 'priority',
|
||||||
|
@ -74,8 +77,14 @@ Copyright:
|
||||||
text: 'Files'
|
text: 'Files'
|
||||||
})
|
})
|
||||||
}, config);
|
}, config);
|
||||||
|
|
||||||
Ext.deluge.details.FilesTab.superclass.constructor.call(this, config);
|
Ext.deluge.details.FilesTab.superclass.constructor.call(this, config);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
initComponent: function() {
|
||||||
|
|
||||||
|
Ext.deluge.details.FilesTab.superclass.initComponent.call(this);
|
||||||
|
},
|
||||||
|
|
||||||
onRender: function(ct, position) {
|
onRender: function(ct, position) {
|
||||||
Ext.deluge.details.FilesTab.superclass.onRender.call(this, ct, position);
|
Ext.deluge.details.FilesTab.superclass.onRender.call(this, ct, position);
|
||||||
|
@ -173,14 +182,15 @@ Copyright:
|
||||||
if (!child) {
|
if (!child) {
|
||||||
child = new Ext.tree.TreeNode({
|
child = new Ext.tree.TreeNode({
|
||||||
id: file,
|
id: file,
|
||||||
text: file
|
text: file,
|
||||||
|
filename: file
|
||||||
});
|
});
|
||||||
parent.appendChild(child);
|
parent.appendChild(child);
|
||||||
}
|
}
|
||||||
walk(item, child);
|
walk(item, child);
|
||||||
} else {
|
} else {
|
||||||
if (!child) {
|
if (!child) {
|
||||||
child = new Ext.tree.ColumnTreeNode({
|
child = new Ext.tree.TreeNode({
|
||||||
id: file,
|
id: file,
|
||||||
filename: file,
|
filename: file,
|
||||||
text: file, // this needs to be here for sorting
|
text: file, // this needs to be here for sorting
|
||||||
|
@ -190,13 +200,10 @@ Copyright:
|
||||||
priority: item[3],
|
priority: item[3],
|
||||||
leaf: true,
|
leaf: true,
|
||||||
iconCls: 'x-deluge-file',
|
iconCls: 'x-deluge-file',
|
||||||
uiProvider: Ext.tree.ColumnNodeUI
|
uiProvider: Ext.ux.tree.TreeGridNodeUI
|
||||||
});
|
});
|
||||||
parent.appendChild(child);
|
parent.appendChild(child);
|
||||||
}
|
}
|
||||||
child.setColumnValue(1, item[1]);
|
|
||||||
child.setColumnValue(2, item[2]);
|
|
||||||
child.setColumnValue(3, item[3]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,7 @@ Deluge.Formatters = {
|
||||||
* @returns {string} formatted string with KiB, MiB or GiB units.
|
* @returns {string} formatted string with KiB, MiB or GiB units.
|
||||||
*/
|
*/
|
||||||
size: function(bytes) {
|
size: function(bytes) {
|
||||||
|
if (!bytes) return '';
|
||||||
bytes = bytes / 1024.0;
|
bytes = bytes / 1024.0;
|
||||||
|
|
||||||
if (bytes < 1024) { return bytes.toFixed(1) + ' KiB'; }
|
if (bytes < 1024) { return bytes.toFixed(1) + ' KiB'; }
|
||||||
|
|
|
@ -12,4 +12,5 @@ add_file "TreeGridColumnResizer.js"
|
||||||
add_file "TreeGridNodeUI.js"
|
add_file "TreeGridNodeUI.js"
|
||||||
add_file "TreeGridLoader.js"
|
add_file "TreeGridLoader.js"
|
||||||
add_file "TreeGridColumns.js"
|
add_file "TreeGridColumns.js"
|
||||||
|
add_file "TreeGridCustomColumn.js"
|
||||||
add_file "TreeGrid.js"
|
add_file "TreeGrid.js"
|
||||||
|
|
9
deluge/ui/web/js/ext-extensions/TreeGridCustomColumn.js
Normal file
9
deluge/ui/web/js/ext-extensions/TreeGridCustomColumn.js
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
Ext.tree.CustomColumn = Ext.extend(Ext.tree.Column, {
|
||||||
|
|
||||||
|
constructor: function(c) {
|
||||||
|
c.tpl = c.tpl || new Ext.XTemplate('{' + c.dataIndex + ':this.format}');
|
||||||
|
c.tpl.format = c.renderer;
|
||||||
|
Ext.tree.CustomColumn.superclass.constructor.call(this, c);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Ext.reg('tgcustomcolumn', Ext.tree.CustomColumn);
|
|
@ -331,6 +331,7 @@ class TopLevel(resource.Resource):
|
||||||
"/js/ext-extensions/TreeGridNodeUI.js",
|
"/js/ext-extensions/TreeGridNodeUI.js",
|
||||||
"/js/ext-extensions/TreeGridLoader.js",
|
"/js/ext-extensions/TreeGridLoader.js",
|
||||||
"/js/ext-extensions/TreeGridColumns.js",
|
"/js/ext-extensions/TreeGridColumns.js",
|
||||||
|
"/js/ext-extensions/TreeGridCustomColumn.js",
|
||||||
"/js/ext-extensions/TreeGrid.js",
|
"/js/ext-extensions/TreeGrid.js",
|
||||||
"/config.js",
|
"/config.js",
|
||||||
"/gettext.js",
|
"/gettext.js",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue