mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 13:23:34 -07:00
Apply suggestions from code review
apply code review suggestions Co-authored-by: Vladimir Golovnev <glassez@yandex.ru>
This commit is contained in:
parent
6df4053fc6
commit
1e2d85a2d8
5 changed files with 13 additions and 18 deletions
|
@ -186,17 +186,17 @@ void Preferences::setAlternatingRowColors(const bool b)
|
|||
setValue(u"Preferences/General/AlternatingRowColors"_s, b);
|
||||
}
|
||||
|
||||
bool Preferences::useProgressBarFollowTextColor() const
|
||||
bool Preferences::getProgressBarFollowsTextColor() const
|
||||
{
|
||||
return value(u"Preferences/General/ProgressBarFollowTextColor"_s, false);
|
||||
return value(u"GUI/TransferList/ProgressBarFollowsTextColor"_s, false);
|
||||
}
|
||||
|
||||
void Preferences::setProgressBarFollowTextColor(const bool b)
|
||||
void Preferences::setProgressBarFollowsTextColor(const bool value)
|
||||
{
|
||||
if (b == useProgressBarFollowTextColor())
|
||||
if (value == getProgressBarFollowsTextColor())
|
||||
return;
|
||||
|
||||
setValue(u"Preferences/General/ProgressBarFollowTextColor"_s, b);
|
||||
setValue(u"GUI/TransferList/ProgressBarFollowsTextColor"_s, value);
|
||||
}
|
||||
|
||||
bool Preferences::getHideZeroValues() const
|
||||
|
|
|
@ -113,8 +113,8 @@ public:
|
|||
void showSpeedInTitleBar(bool show);
|
||||
bool useAlternatingRowColors() const;
|
||||
void setAlternatingRowColors(bool b);
|
||||
bool useProgressBarFollowTextColor() const;
|
||||
void setProgressBarFollowTextColor(bool b);
|
||||
bool getProgressBarFollowsTextColor() const;
|
||||
void setProgressBarFollowsTextColor(bool value);
|
||||
bool getHideZeroValues() const;
|
||||
void setHideZeroValues(bool b);
|
||||
int getHideZeroComboValues() const;
|
||||
|
|
|
@ -261,7 +261,7 @@ void OptionsDialog::loadBehaviorTabOptions()
|
|||
|
||||
m_ui->confirmDeletion->setChecked(pref->confirmTorrentDeletion());
|
||||
m_ui->checkAltRowColors->setChecked(pref->useAlternatingRowColors());
|
||||
m_ui->progressBarFollowTextColor->setChecked(pref->useProgressBarFollowTextColor());
|
||||
m_ui->checkProgressBarFollowsTextColor->setChecked(pref->getProgressBarFollowsTextColor());
|
||||
m_ui->checkHideZero->setChecked(pref->getHideZeroValues());
|
||||
m_ui->comboHideZero->setCurrentIndex(pref->getHideZeroComboValues());
|
||||
m_ui->comboHideZero->setEnabled(m_ui->checkHideZero->isChecked());
|
||||
|
@ -390,7 +390,7 @@ void OptionsDialog::loadBehaviorTabOptions()
|
|||
|
||||
connect(m_ui->confirmDeletion, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||
connect(m_ui->checkAltRowColors, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||
connect(m_ui->progressBarFollowTextColor, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||
connect(m_ui->checkProgressBarFollowsTextColor, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||
connect(m_ui->checkHideZero, &QAbstractButton::toggled, m_ui->comboHideZero, &QWidget::setEnabled);
|
||||
connect(m_ui->checkHideZero, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||
connect(m_ui->comboHideZero, qComboBoxCurrentIndexChanged, this, &ThisType::enableApplyButton);
|
||||
|
@ -485,7 +485,7 @@ void OptionsDialog::saveBehaviorTabOptions() const
|
|||
|
||||
pref->setConfirmTorrentDeletion(m_ui->confirmDeletion->isChecked());
|
||||
pref->setAlternatingRowColors(m_ui->checkAltRowColors->isChecked());
|
||||
pref->setProgressBarFollowTextColor(m_ui->progressBarFollowTextColor->isChecked());
|
||||
pref->setProgressBarFollowsTextColor(m_ui->checkProgressBarFollowsTextColor->isChecked());
|
||||
pref->setHideZeroValues(m_ui->checkHideZero->isChecked());
|
||||
pref->setHideZeroComboValues(m_ui->comboHideZero->currentIndex());
|
||||
|
||||
|
|
|
@ -298,7 +298,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="progressBarFollowTextColor">
|
||||
<widget class="QCheckBox" name="checkProgressBarFollowTextColor">
|
||||
<property name="text">
|
||||
<string extracomment="Progress bar color is based on text color.">Make progress bars follow text colors</string>
|
||||
</property>
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
|
||||
#include <QModelIndex>
|
||||
|
||||
#include "transferlistmodel.h"
|
||||
#include "base/preferences.h"
|
||||
#include "transferlistmodel.h"
|
||||
|
||||
TransferListDelegate::TransferListDelegate(QObject *parent)
|
||||
: QStyledItemDelegate {parent}
|
||||
|
@ -91,12 +91,7 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
|||
QStyleOptionViewItem customOption {option};
|
||||
customOption.state.setFlag(QStyle::State_Enabled, isEnableState(torrentState));
|
||||
|
||||
QColor color = {};
|
||||
|
||||
if (Preferences::instance()->useProgressBarFollowTextColor())
|
||||
{
|
||||
color = index.data(Qt::ForegroundRole).value<QColor>();
|
||||
}
|
||||
const QColor color = Preferences::instance()->getProgressBarFollowsTextColor() ? index.data(Qt::ForegroundRole).value<QColor>() : QColor();
|
||||
|
||||
m_progressBarPainter.paint(painter, customOption, index.data().toString(), progress, color);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue