mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 12:59:56 -07:00
Do not report any progress for disabled files (Closes #56731485)
This commit is contained in:
parent
39e1ebaa9b
commit
4ca665eb0c
2 changed files with 25 additions and 18 deletions
|
@ -74,6 +74,7 @@ public:
|
||||||
QItemDelegate::drawDisplay(painter, opt, option.rect, misc::friendlyUnit(index.data().toLongLong()));
|
QItemDelegate::drawDisplay(painter, opt, option.rect, misc::friendlyUnit(index.data().toLongLong()));
|
||||||
break;
|
break;
|
||||||
case PROGRESS:{
|
case PROGRESS:{
|
||||||
|
if (index.data().toDouble() >= 0) {
|
||||||
QStyleOptionProgressBarV2 newopt;
|
QStyleOptionProgressBarV2 newopt;
|
||||||
qreal progress = index.data().toDouble()*100.;
|
qreal progress = index.data().toDouble()*100.;
|
||||||
newopt.rect = opt.rect;
|
newopt.rect = opt.rect;
|
||||||
|
@ -94,6 +95,10 @@ public:
|
||||||
QPlastiqueStyle st;
|
QPlastiqueStyle st;
|
||||||
st.drawControl(QStyle::CE_ProgressBar, &newopt, painter, 0);
|
st.drawControl(QStyle::CE_ProgressBar, &newopt, painter, 0);
|
||||||
#endif
|
#endif
|
||||||
|
} else {
|
||||||
|
// Do not display anything if the file is disabled (progress == -1)
|
||||||
|
QItemDelegate::drawBackground(painter, opt, index);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PRIORITY: {
|
case PRIORITY: {
|
||||||
|
|
|
@ -194,7 +194,7 @@ public:
|
||||||
|
|
||||||
qreal getProgress() const {
|
qreal getProgress() const {
|
||||||
if(getPriority() == 0)
|
if(getPriority() == 0)
|
||||||
return 0.;
|
return -1;
|
||||||
qulonglong size = getSize();
|
qulonglong size = getSize();
|
||||||
if(size > 0)
|
if(size > 0)
|
||||||
return total_done/(float)getSize();
|
return total_done/(float)getSize();
|
||||||
|
@ -313,6 +313,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant data(int column) const {
|
QVariant data(int column) const {
|
||||||
|
if(column == COL_PROGRESS)
|
||||||
|
return getProgress();
|
||||||
return itemData.value(column);
|
return itemData.value(column);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue