New view for errored torrents.

This commit is contained in:
sledgehammer999 2015-11-11 08:51:22 +02:00
parent bf0319f7b2
commit 9718b7d9ba
7 changed files with 23 additions and 4 deletions

View file

@ -2387,6 +2387,8 @@ void Session::handleStateUpdateAlert(libt::state_update_alert *p)
++m_torrentStatusReport.nbActive;
if (torrent->isInactive())
++m_torrentStatusReport.nbInactive;
if (torrent->isErrored())
++m_torrentStatusReport.nbErrored;
}
emit torrentsUpdated();

View file

@ -134,6 +134,7 @@ namespace BitTorrent
uint nbInactive = 0;
uint nbPaused = 0;
uint nbResumed = 0;
uint nbErrored = 0;
};
class Session : public QObject

View file

@ -626,9 +626,7 @@ bool TorrentHandle::isDownloading() const
|| m_state == TorrentState::CheckingDownloading
|| m_state == TorrentState::PausedDownloading
|| m_state == TorrentState::QueuedDownloading
|| m_state == TorrentState::ForcedDownloading
|| m_state == TorrentState::MissingFiles
|| m_state == TorrentState::Error;
|| m_state == TorrentState::ForcedDownloading;
}
bool TorrentHandle::isUploading() const
@ -667,6 +665,12 @@ bool TorrentHandle::isInactive() const
return !isActive();
}
bool TorrentHandle::isErrored() const
{
return m_state == TorrentState::MissingFiles
|| m_state == TorrentState::Error;
}
bool TorrentHandle::isSeed() const
{
// Affected by bug http://code.rasterbar.com/libtorrent/ticket/402

View file

@ -252,6 +252,7 @@ namespace BitTorrent
bool isCompleted() const;
bool isActive() const;
bool isInactive() const;
bool isErrored() const;
bool isSequentialDownload() const;
bool hasFirstLastPiecePriority() const;
TorrentState state() const;

View file

@ -39,6 +39,7 @@ const TorrentFilter TorrentFilter::PausedTorrent(TorrentFilter::Paused);
const TorrentFilter TorrentFilter::ResumedTorrent(TorrentFilter::Resumed);
const TorrentFilter TorrentFilter::ActiveTorrent(TorrentFilter::Active);
const TorrentFilter TorrentFilter::InactiveTorrent(TorrentFilter::Inactive);
const TorrentFilter TorrentFilter::ErroredTorrent(TorrentFilter::Errored);
using BitTorrent::TorrentHandle;
using BitTorrent::TorrentState;
@ -91,6 +92,8 @@ bool TorrentFilter::setTypeByName(const QString &filter)
type = Active;
else if (filter == "inactive")
type = Inactive;
else if (filter == "errored")
type = Errored;
return setType(type);
}
@ -144,6 +147,8 @@ bool TorrentFilter::matchState(BitTorrent::TorrentHandle *const torrent) const
return torrent->isActive();
case Inactive:
return torrent->isInactive();
case Errored:
return torrent->isErrored();
default: // All
return true;
}

View file

@ -54,7 +54,8 @@ public:
Resumed,
Paused,
Active,
Inactive
Inactive,
Errored
};
static const QString AnyLabel;
@ -67,6 +68,7 @@ public:
static const TorrentFilter ResumedTorrent;
static const TorrentFilter ActiveTorrent;
static const TorrentFilter InactiveTorrent;
static const TorrentFilter ErroredTorrent;
TorrentFilter();
// label: pass empty string for "no label" or null string (QString()) for "any label"

View file

@ -137,6 +137,9 @@ StatusFiltersWidget::StatusFiltersWidget(QWidget *parent, TransferListWidget *tr
QListWidgetItem *inactive = new QListWidgetItem(this);
inactive->setData(Qt::DisplayRole, QVariant(tr("Inactive (0)")));
inactive->setData(Qt::DecorationRole, QIcon(":/icons/skin/filterinactive.png"));
QListWidgetItem *errored = new QListWidgetItem(this);
errored->setData(Qt::DisplayRole, QVariant(tr("Errored (0)")));
errored->setData(Qt::DecorationRole, QIcon(":/icons/skin/error.png"));
const Preferences* const pref = Preferences::instance();
setCurrentRow(pref->getTransSelFilter(), QItemSelectionModel::SelectCurrent);
@ -160,6 +163,7 @@ void StatusFiltersWidget::updateTorrentNumbers()
item(TorrentFilter::Resumed)->setData(Qt::DisplayRole, QVariant(tr("Resumed (%1)").arg(report.nbResumed)));
item(TorrentFilter::Active)->setData(Qt::DisplayRole, QVariant(tr("Active (%1)").arg(report.nbActive)));
item(TorrentFilter::Inactive)->setData(Qt::DisplayRole, QVariant(tr("Inactive (%1)").arg(report.nbInactive)));
item(TorrentFilter::Errored)->setData(Qt::DisplayRole, QVariant(tr("Errored (%1)").arg(report.nbErrored)));
}
void StatusFiltersWidget::showMenu(QPoint) {}