Show error status when a torrent is missing files.

This commit is contained in:
sledgehammer999 2015-01-31 19:53:38 +02:00
parent 45b2432513
commit d66273b10a
4 changed files with 18 additions and 6 deletions

View file

@ -100,8 +100,12 @@ void TorrentModelItem::refreshStatus(libtorrent::torrent_status const& status) {
TorrentModelItem::State TorrentModelItem::state() const {
try {
// Pause or Queued
if (m_torrent.is_paused(m_lastStatus))
return m_torrent.is_seed(m_lastStatus) ? STATE_PAUSED_UP : STATE_PAUSED_DL;
if (m_torrent.is_paused(m_lastStatus)) {
if (TorrentPersistentData::instance()->getHasMissingFiles(misc::toQString(m_lastStatus.info_hash)))
return STATE_PAUSED_MISSING;
else
return m_torrent.is_seed(m_lastStatus) ? STATE_PAUSED_UP : STATE_PAUSED_DL;
}
if (m_torrent.is_queued(m_lastStatus)
&& m_lastStatus.state != torrent_status::queued_for_checking
@ -158,6 +162,7 @@ QIcon TorrentModelItem::getIconByState(State state) {
case STATE_QUEUED_FASTCHECK:
return get_checking_icon();
case STATE_INVALID:
case STATE_PAUSED_MISSING:
return get_error_icon();
default:
Q_ASSERT(false);
@ -178,6 +183,7 @@ QColor TorrentModelItem::getColorByState(State state) {
return QColor(255, 165, 0); // orange
case STATE_PAUSED_DL:
case STATE_PAUSED_UP:
case STATE_PAUSED_MISSING:
return QColor(255, 0, 0); // red
case STATE_QUEUED_DL:
case STATE_QUEUED_UP:
@ -551,6 +557,7 @@ TorrentStatusReport TorrentModel::getTorrentStatusReport() const
++report.nb_seeding;
break;
case TorrentModelItem::STATE_PAUSED_UP:
case TorrentModelItem::STATE_PAUSED_MISSING:
++report.nb_paused;
case TorrentModelItem::STATE_STALLED_UP:
case TorrentModelItem::STATE_CHECKING_UP:

View file

@ -48,7 +48,7 @@ class TorrentModelItem : public QObject {
Q_OBJECT
public:
enum State {STATE_DOWNLOADING, STATE_DOWNLOADING_META, STATE_ALLOCATING, STATE_STALLED_DL, STATE_STALLED_UP, STATE_SEEDING, STATE_PAUSED_DL, STATE_PAUSED_UP, STATE_QUEUED_DL, STATE_QUEUED_UP, STATE_CHECKING_UP, STATE_CHECKING_DL, STATE_QUEUED_CHECK, STATE_QUEUED_FASTCHECK, STATE_INVALID};
enum State {STATE_DOWNLOADING, STATE_DOWNLOADING_META, STATE_ALLOCATING, STATE_STALLED_DL, STATE_STALLED_UP, STATE_SEEDING, STATE_PAUSED_DL, STATE_PAUSED_UP, STATE_PAUSED_MISSING, STATE_QUEUED_DL, STATE_QUEUED_UP, STATE_CHECKING_UP, STATE_CHECKING_DL, STATE_QUEUED_CHECK, STATE_QUEUED_FASTCHECK, STATE_INVALID};
enum Column {TR_NAME, TR_PRIORITY, TR_SIZE, TR_TOTAL_SIZE, TR_PROGRESS, TR_STATUS, TR_SEEDS, TR_PEERS, TR_DLSPEED, TR_UPSPEED, TR_ETA, TR_RATIO, TR_LABEL, TR_ADD_DATE, TR_SEED_DATE, TR_TRACKER, TR_DLLIMIT, TR_UPLIMIT, TR_AMOUNT_DOWNLOADED, TR_AMOUNT_UPLOADED, TR_AMOUNT_LEFT, TR_TIME_ELAPSED, TR_SAVE_PATH, TR_COMPLETED, TR_RATIO_LIMIT, TR_SEEN_COMPLETE_DATE, TR_LAST_ACTIVITY, NB_COLUMNS};
public:

View file

@ -101,6 +101,9 @@ void TransferListDelegate::paint(QPainter * painter, const QStyleOptionViewItem
case TorrentModelItem::STATE_PAUSED_UP:
display = tr("Paused");
break;
case TorrentModelItem::STATE_PAUSED_MISSING:
display = tr("Missing Files");
break;
case TorrentModelItem::STATE_QUEUED_DL:
case TorrentModelItem::STATE_QUEUED_UP:
display = tr("Queued", "i.e. torrent is queued");

View file

@ -217,13 +217,15 @@ bool TransferListSortModel::matchStatusFilter(int sourceRow, const QModelIndex &
case TorrentFilter::COMPLETED:
return (state == TorrentModelItem::STATE_SEEDING || state == TorrentModelItem::STATE_STALLED_UP
|| state == TorrentModelItem::STATE_PAUSED_UP || state == TorrentModelItem::STATE_CHECKING_UP
|| state == TorrentModelItem::STATE_QUEUED_UP);
|| state == TorrentModelItem::STATE_PAUSED_MISSING || state == TorrentModelItem::STATE_QUEUED_UP);
case TorrentFilter::PAUSED:
return (state == TorrentModelItem::STATE_PAUSED_UP || state == TorrentModelItem::STATE_PAUSED_DL);
return (state == TorrentModelItem::STATE_PAUSED_UP || state == TorrentModelItem::STATE_PAUSED_DL
|| state == TorrentModelItem::STATE_PAUSED_MISSING);
case TorrentFilter::RESUMED:
return (state != TorrentModelItem::STATE_PAUSED_UP && state != TorrentModelItem::STATE_PAUSED_DL);
return (state != TorrentModelItem::STATE_PAUSED_UP && state != TorrentModelItem::STATE_PAUSED_DL
&& state != TorrentModelItem::STATE_PAUSED_MISSING);
case TorrentFilter::ACTIVE:
if (state == TorrentModelItem::STATE_STALLED_DL) {