diff --git a/src/base/preferences.cpp b/src/base/preferences.cpp index 79e6125e4..7081a659d 100644 --- a/src/base/preferences.cpp +++ b/src/base/preferences.cpp @@ -283,6 +283,16 @@ void Preferences::setHideZeroValues(bool b) setValue("Preferences/General/HideZeroValues", b); } +int Preferences::getHideZeroComboValues() const +{ + return value("Preferences/General/HideZeroComboValues", 0).toInt(); +} + +void Preferences::setHideZeroComboValues(int n) +{ + setValue("Preferences/General/HideZeroComboValues", n); +} + bool Preferences::useRandomPort() const { return value("Preferences/General/UseRandomPort", false).toBool(); diff --git a/src/base/preferences.h b/src/base/preferences.h index acf0a254c..ca29ab46b 100644 --- a/src/base/preferences.h +++ b/src/base/preferences.h @@ -134,6 +134,8 @@ public: void setAlternatingRowColors(bool b); bool getHideZeroValues() const; void setHideZeroValues(bool b); + int getHideZeroComboValues() const; + void setHideZeroComboValues(int n); bool useRandomPort() const; void setRandomPort(bool b); bool systrayIntegration() const; diff --git a/src/gui/options.ui b/src/gui/options.ui index 7733b2fdb..1144033b0 100644 --- a/src/gui/options.ui +++ b/src/gui/options.ui @@ -163,7 +163,7 @@ 0 0 480 - 698 + 702 @@ -258,11 +258,42 @@ - - - Hide zero and infinity values - - + + + + + Hide zero and infinity values + + + + + + + + Always + + + + + Paused torrents only + + + + + + + + Qt::Horizontal + + + + 0 + 0 + + + + + diff --git a/src/gui/options_imp.cpp b/src/gui/options_imp.cpp index 37de68ca0..7f200cd4e 100644 --- a/src/gui/options_imp.cpp +++ b/src/gui/options_imp.cpp @@ -142,6 +142,7 @@ options_imp::options_imp(QWidget *parent) connect(confirmDeletion, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkAltRowColors, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkHideZero, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); + connect(comboHideZero, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton())); connect(checkShowSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkCloseToSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkMinimizeToSysTray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); @@ -394,6 +395,7 @@ void options_imp::saveOptions() pref->setConfirmTorrentDeletion(confirmDeletion->isChecked()); pref->setAlternatingRowColors(checkAltRowColors->isChecked()); pref->setHideZeroValues(checkHideZero->isChecked()); + pref->setHideZeroComboValues(comboHideZero->currentIndex()); pref->setSystrayIntegration(systrayIntegration()); pref->setTrayIconStyle(TrayIcon::Style(comboTrayIcon->currentIndex())); pref->setCloseToTray(closeToTray()); @@ -576,6 +578,7 @@ void options_imp::loadOptions() confirmDeletion->setChecked(pref->confirmTorrentDeletion()); checkAltRowColors->setChecked(pref->useAlternatingRowColors()); checkHideZero->setChecked(pref->getHideZeroValues()); + comboHideZero->setCurrentIndex(pref->getHideZeroComboValues()); checkShowSplash->setChecked(!pref->isSplashScreenDisabled()); checkStartMinimized->setChecked(pref->startMinimized()); diff --git a/src/gui/transferlistdelegate.cpp b/src/gui/transferlistdelegate.cpp index 9ab172418..72dc0cb70 100644 --- a/src/gui/transferlistdelegate.cpp +++ b/src/gui/transferlistdelegate.cpp @@ -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);