Browse Source

Fix constant status of '[F] Downloading'. Closes #7628.

adaptive-webui-19844
sledgehammer999 7 years ago
parent
commit
13f69a2245
No known key found for this signature in database
GPG Key ID: 6E4A2D025B7CC9A2
  1. 2
      src/gui/torrentmodel.cpp
  2. 14
      src/gui/transferlistsortmodel.cpp

2
src/gui/torrentmodel.cpp

@ -184,7 +184,7 @@ QVariant TorrentModel::data(const QModelIndex &index, int role) const @@ -184,7 +184,7 @@ QVariant TorrentModel::data(const QModelIndex &index, int role) const
case TR_PROGRESS:
return torrent->progress();
case TR_STATUS:
return static_cast<int>(torrent->state());
return QVariant::fromValue(torrent->state());
case TR_SEEDS:
return (role == Qt::DisplayRole) ? torrent->seedsCount() : torrent->totalSeedsCount();
case TR_PEERS:

14
src/gui/transferlistsortmodel.cpp

@ -98,6 +98,20 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex @@ -98,6 +98,20 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex
return (result < 0);
}
case TorrentModel::TR_STATUS: {
// QSortFilterProxyModel::lessThan() uses the < operator only for specific QVariant types
// so our custom type is outside that list.
// In this case QSortFilterProxyModel::lessThan() converts other types to QString and
// sorts them.
// Thus we can't use the code in the default label.
const BitTorrent::TorrentState leftValue = left.data().value<BitTorrent::TorrentState>();
const BitTorrent::TorrentState rightValue = right.data().value<BitTorrent::TorrentState>();
if (leftValue != rightValue)
return leftValue < rightValue;
return lowerPositionThan(left, right);
}
case TorrentModel::TR_ADD_DATE:
case TorrentModel::TR_SEED_DATE:
case TorrentModel::TR_SEEN_COMPLETE_DATE: {

Loading…
Cancel
Save