mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-30 00:14:57 +00:00
Implement resizable progress bar in "Done" column
This commit is contained in:
parent
09cf93521f
commit
d50a7778fe
@ -344,6 +344,7 @@ var DynamicTable = new Class({
|
|||||||
column['updateTd'] = function (td, row) {
|
column['updateTd'] = function (td, row) {
|
||||||
td.innerHTML = this.getRowValue(row);
|
td.innerHTML = this.getRowValue(row);
|
||||||
};
|
};
|
||||||
|
column['onResize'] = null;
|
||||||
this.columns.push(column);
|
this.columns.push(column);
|
||||||
this.columns[name] = column;
|
this.columns[name] = column;
|
||||||
|
|
||||||
@ -430,6 +431,10 @@ var DynamicTable = new Class({
|
|||||||
for (var i = 0; i < trs.length; i++)
|
for (var i = 0; i < trs.length; i++)
|
||||||
trs[i].getElements('td')[pos].addClass('invisible');
|
trs[i].getElements('td')[pos].addClass('invisible');
|
||||||
}
|
}
|
||||||
|
if (this.columns[pos].onResize !== null)
|
||||||
|
{
|
||||||
|
this.columns[pos].onResize(columnName);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setSortedColumn : function (column) {
|
setSortedColumn : function (column) {
|
||||||
@ -846,15 +851,23 @@ var TorrentsTable = new Class({
|
|||||||
|
|
||||||
if (td.getChildren('div').length) {
|
if (td.getChildren('div').length) {
|
||||||
var div = td.getChildren('div')[0];
|
var div = td.getChildren('div')[0];
|
||||||
|
div.setWidth(td.offsetWidth - 5);
|
||||||
if (div.getValue() != progressFormated)
|
if (div.getValue() != progressFormated)
|
||||||
div.setValue(progressFormated);
|
div.setValue(progressFormated);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
td.adopt(new ProgressBar(progressFormated.toFloat(), {
|
td.adopt(new ProgressBar(progressFormated.toFloat(), {
|
||||||
'width' : 80
|
'width' : td.offsetWidth - 5
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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));
|
||||||
|
}.bind(this);
|
||||||
|
|
||||||
// num_seeds
|
// num_seeds
|
||||||
|
|
||||||
this.columns['num_seeds'].updateTd = function (td, row) {
|
this.columns['num_seeds'].updateTd = function (td, row) {
|
||||||
|
@ -59,6 +59,7 @@ var ProgressBar = new Class({
|
|||||||
obj.appendChild(obj.vals.light);
|
obj.appendChild(obj.vals.light);
|
||||||
obj.getValue = ProgressBar_getValue;
|
obj.getValue = ProgressBar_getValue;
|
||||||
obj.setValue = ProgressBar_setValue;
|
obj.setValue = ProgressBar_setValue;
|
||||||
|
obj.setWidth = ProgressBar_setWidth;
|
||||||
if (vals.width) obj.setValue(vals.value);
|
if (vals.width) obj.setValue(vals.value);
|
||||||
else setTimeout('ProgressBar_checkForParent("' + obj.id + '")', 1);
|
else setTimeout('ProgressBar_checkForParent("' + obj.id + '")', 1);
|
||||||
return obj;
|
return obj;
|
||||||
@ -84,6 +85,16 @@ function ProgressBar_setValue(value) {
|
|||||||
this.vals.light.setStyle('clip', 'rect(0,' + this.vals.width + 'px,' + this.vals.height + 'px,' + r + 'px)');
|
this.vals.light.setStyle('clip', 'rect(0,' + this.vals.width + 'px,' + this.vals.height + 'px,' + r + 'px)');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ProgressBar_setWidth(value) {
|
||||||
|
if (this.vals.width !== value) {
|
||||||
|
this.vals.width = value;
|
||||||
|
this.setStyle('width', value);
|
||||||
|
this.vals.dark.setStyle('width', value);
|
||||||
|
this.vals.light.setStyle('width', value);
|
||||||
|
this.setValue(this.vals.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function ProgressBar_checkForParent(id) {
|
function ProgressBar_checkForParent(id) {
|
||||||
var obj = $(id);
|
var obj = $(id);
|
||||||
if (!obj) return;
|
if (!obj) return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user