diff --git a/src/properties/proplistdelegate.h b/src/properties/proplistdelegate.h index 6169e1505..8ad63f050 100644 --- a/src/properties/proplistdelegate.h +++ b/src/properties/proplistdelegate.h @@ -74,26 +74,31 @@ public: QItemDelegate::drawDisplay(painter, opt, option.rect, misc::friendlyUnit(index.data().toLongLong())); break; case PROGRESS:{ - QStyleOptionProgressBarV2 newopt; - qreal progress = index.data().toDouble()*100.; - newopt.rect = opt.rect; - // We don't want to display 100% unless - // the torrent is really complete - if(progress > 99.94 && progress < 100.) - progress = 99.9; - newopt.text = QString(QByteArray::number(progress, 'f', 1))+QString::fromUtf8("%"); - newopt.progress = (int)progress; - newopt.maximum = 100; - newopt.minimum = 0; - newopt.state |= QStyle::State_Enabled; - newopt.textVisible = true; + if (index.data().toDouble() >= 0) { + QStyleOptionProgressBarV2 newopt; + qreal progress = index.data().toDouble()*100.; + newopt.rect = opt.rect; + // We don't want to display 100% unless + // the torrent is really complete + if(progress > 99.94 && progress < 100.) + progress = 99.9; + newopt.text = QString(QByteArray::number(progress, 'f', 1))+QString::fromUtf8("%"); + newopt.progress = (int)progress; + newopt.maximum = 100; + newopt.minimum = 0; + newopt.state |= QStyle::State_Enabled; + newopt.textVisible = true; #ifndef Q_WS_WIN - QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt, painter); + QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt, painter); #else - // XXX: To avoid having the progress text on the right of the bar - QPlastiqueStyle st; - st.drawControl(QStyle::CE_ProgressBar, &newopt, painter, 0); + // XXX: To avoid having the progress text on the right of the bar + QPlastiqueStyle st; + st.drawControl(QStyle::CE_ProgressBar, &newopt, painter, 0); #endif + } else { + // Do not display anything if the file is disabled (progress == -1) + QItemDelegate::drawBackground(painter, opt, index); + } break; } case PRIORITY: { diff --git a/src/torrentfilesmodel.h b/src/torrentfilesmodel.h index aac58060c..aae512ed5 100644 --- a/src/torrentfilesmodel.h +++ b/src/torrentfilesmodel.h @@ -194,7 +194,7 @@ public: qreal getProgress() const { if(getPriority() == 0) - return 0.; + return -1; qulonglong size = getSize(); if(size > 0) return total_done/(float)getSize(); @@ -313,6 +313,8 @@ public: } QVariant data(int column) const { + if(column == COL_PROGRESS) + return getProgress(); return itemData.value(column); }