mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-21 08:09:35 +08:00
Improve performance of updating 'progress' column
This commit is contained in:
parent
884ca03624
commit
b6c6b70915
@ -32,6 +32,7 @@
|
||||
**************************************************************/
|
||||
|
||||
var DynamicTableHeaderContextMenuClass = null;
|
||||
var ProgressColumnWidth = -1;
|
||||
|
||||
var DynamicTable = new Class({
|
||||
|
||||
@ -851,25 +852,34 @@ var TorrentsTable = new Class({
|
||||
|
||||
if (td.getChildren('div').length) {
|
||||
var div = td.getChildren('div')[0];
|
||||
var newWidth = td.offsetWidth - 5;
|
||||
if (div.lastWidth !== newWidth) {
|
||||
div.setWidth(newWidth);
|
||||
div.lastWidth = newWidth;
|
||||
if (td.resized) {
|
||||
td.resized = false;
|
||||
div.setWidth(ProgressColumnWidth - 5);
|
||||
}
|
||||
if (div.getValue() != progressFormated)
|
||||
div.setValue(progressFormated);
|
||||
}
|
||||
else
|
||||
else {
|
||||
if (ProgressColumnWidth < 0)
|
||||
ProgressColumnWidth = td.offsetWidth;
|
||||
td.adopt(new ProgressBar(progressFormated.toFloat(), {
|
||||
'width' : td.offsetWidth - 5
|
||||
'width' : ProgressColumnWidth - 5
|
||||
}));
|
||||
td.resized = false;
|
||||
}
|
||||
};
|
||||
|
||||
this.columns['progress'].onResize = function (columnName) {
|
||||
var pos = this.getColumnPos(columnName);
|
||||
var trs = this.tableBody.getElements('tr');
|
||||
for (var i = 0; i < trs.length; i++)
|
||||
this.columns[columnName].updateTd(trs[i].getElements('td')[pos], this.rows.get(trs[i].rowId));
|
||||
ProgressColumnWidth = -1;
|
||||
for (var i = 0; i < trs.length; i++) {
|
||||
var td = trs[i].getElements('td')[pos];
|
||||
if (ProgressColumnWidth < 0)
|
||||
ProgressColumnWidth = td.offsetWidth;
|
||||
td.resized = true;
|
||||
this.columns[columnName].updateTd(td, this.rows.get(trs[i].rowId));
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
// num_seeds
|
||||
|
Loading…
Reference in New Issue
Block a user