Add "Paused torrents only" option for "Hide zero and infinity values"

This commit is contained in:
Chocobo1 2016-02-01 20:19:28 +08:00
parent 1a010cbfc6
commit ee277bf126
5 changed files with 59 additions and 7 deletions

View file

@ -59,7 +59,13 @@ TransferListDelegate::TransferListDelegate(QObject *parent)
void TransferListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
{
painter->save();
const bool hideValues = Preferences::instance()->getHideZeroValues();
bool isHideState = true;
if (Preferences::instance()->getHideZeroComboValues() == 1) { // paused torrents only
QModelIndex stateIndex = index.sibling(index.row(), TorrentModel::TR_STATUS);
if (stateIndex.data().toInt() != BitTorrent::TorrentState::PausedDownloading)
isHideState = false;
}
const bool hideValues = Preferences::instance()->getHideZeroValues() & isHideState;
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
QItemDelegate::drawBackground(painter, opt, index);