Browse Source

Show error status when a torrent is missing files.

adaptive-webui-19844
sledgehammer999 10 years ago
parent
commit
d66273b10a
  1. 9
      src/qtlibtorrent/torrentmodel.cpp
  2. 2
      src/qtlibtorrent/torrentmodel.h
  3. 3
      src/transferlistdelegate.cpp
  4. 8
      src/transferlistsortmodel.cpp

9
src/qtlibtorrent/torrentmodel.cpp

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

2
src/qtlibtorrent/torrentmodel.h

@ -48,7 +48,7 @@ class TorrentModelItem : public QObject {
Q_OBJECT Q_OBJECT
public: 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}; 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: public:

3
src/transferlistdelegate.cpp

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

8
src/transferlistsortmodel.cpp

@ -217,13 +217,15 @@ bool TransferListSortModel::matchStatusFilter(int sourceRow, const QModelIndex &
case TorrentFilter::COMPLETED: case TorrentFilter::COMPLETED:
return (state == TorrentModelItem::STATE_SEEDING || state == TorrentModelItem::STATE_STALLED_UP return (state == TorrentModelItem::STATE_SEEDING || state == TorrentModelItem::STATE_STALLED_UP
|| state == TorrentModelItem::STATE_PAUSED_UP || state == TorrentModelItem::STATE_CHECKING_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: 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: 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: case TorrentFilter::ACTIVE:
if (state == TorrentModelItem::STATE_STALLED_DL) { if (state == TorrentModelItem::STATE_STALLED_DL) {

Loading…
Cancel
Save