Browse Source

Show torrent error message in transfer list

adaptive-webui-19844
Chocobo1 5 years ago
parent
commit
b6050463f4
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 3
      src/gui/transferlistdelegate.cpp
  2. 2
      src/gui/transferlistmodel.cpp

3
src/gui/transferlistdelegate.cpp

@ -100,7 +100,10 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem & @@ -100,7 +100,10 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
break;
case TransferListModel::TR_STATUS: {
const auto state = index.data().value<BitTorrent::TorrentState>();
const QString errorMsg = index.data(Qt::UserRole).toString();
QString display = getStatusString(state);
if (state == BitTorrent::TorrentState::Error)
display += (": " + errorMsg);
QItemDelegate::drawDisplay(painter, opt, opt.rect, display);
}
break;

2
src/gui/transferlistmodel.cpp

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

Loading…
Cancel
Save