fix content tab progress bar color

This commit is contained in:
Mark 2025-07-06 17:01:43 +04:00
commit a1f561f2e5

View file

@ -34,7 +34,6 @@
#include <QPainter> #include <QPainter>
#include <QProgressBar> #include <QProgressBar>
#include "transferlistmodel.h"
#include "base/bittorrent/downloadpriority.h" #include "base/bittorrent/downloadpriority.h"
#include "base/bittorrent/torrent.h" #include "base/bittorrent/torrent.h"
#include "gui/torrentcontentmodel.h" #include "gui/torrentcontentmodel.h"
@ -141,12 +140,11 @@ void TorrentContentItemDelegate::paint(QPainter *painter, const QStyleOptionView
const int priority = index.sibling(index.row(), TorrentContentModelItem::COL_PRIO).data(TorrentContentModel::UnderlyingDataRole).toInt(); const int priority = index.sibling(index.row(), TorrentContentModelItem::COL_PRIO).data(TorrentContentModel::UnderlyingDataRole).toInt();
const bool isEnabled = static_cast<BitTorrent::DownloadPriority>(priority) != BitTorrent::DownloadPriority::Ignored; const bool isEnabled = static_cast<BitTorrent::DownloadPriority>(priority) != BitTorrent::DownloadPriority::Ignored;
const QModelIndex statusIndex = index.siblingAtColumn(TransferListModel::TR_STATUS);
const auto torrentState = statusIndex.data(TransferListModel::UnderlyingDataRole).value<BitTorrent::TorrentState>();
QStyleOptionViewItem customOption {option}; QStyleOptionViewItem customOption {option};
customOption.state.setFlag(QStyle::State_Enabled, isEnabled); customOption.state.setFlag(QStyle::State_Enabled, isEnabled);
BitTorrent::TorrentState torrentState = progress >= 100 ? BitTorrent::TorrentState::StalledUploading : BitTorrent::TorrentState::Downloading;
m_progressBarPainter.paint(painter, customOption, index.data().toString(), progress, torrentState); m_progressBarPainter.paint(painter, customOption, index.data().toString(), progress, torrentState);
} }
break; break;