Browse Source

New view for errored torrents.

adaptive-webui-19844
sledgehammer999 9 years ago
parent
commit
9718b7d9ba
  1. 2
      src/core/bittorrent/session.cpp
  2. 1
      src/core/bittorrent/session.h
  3. 10
      src/core/bittorrent/torrenthandle.cpp
  4. 1
      src/core/bittorrent/torrenthandle.h
  5. 5
      src/core/torrentfilter.cpp
  6. 4
      src/core/torrentfilter.h
  7. 4
      src/gui/transferlistfilterswidget.cpp

2
src/core/bittorrent/session.cpp

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

1
src/core/bittorrent/session.h

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

10
src/core/bittorrent/torrenthandle.cpp

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

1
src/core/bittorrent/torrenthandle.h

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

5
src/core/torrentfilter.cpp

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

4
src/core/torrentfilter.h

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

4
src/gui/transferlistfilterswidget.cpp

@ -137,6 +137,9 @@ StatusFiltersWidget::StatusFiltersWidget(QWidget *parent, TransferListWidget *tr
QListWidgetItem *inactive = new QListWidgetItem(this); QListWidgetItem *inactive = new QListWidgetItem(this);
inactive->setData(Qt::DisplayRole, QVariant(tr("Inactive (0)"))); inactive->setData(Qt::DisplayRole, QVariant(tr("Inactive (0)")));
inactive->setData(Qt::DecorationRole, QIcon(":/icons/skin/filterinactive.png")); 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(); const Preferences* const pref = Preferences::instance();
setCurrentRow(pref->getTransSelFilter(), QItemSelectionModel::SelectCurrent); 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::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::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::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) {} void StatusFiltersWidget::showMenu(QPoint) {}

Loading…
Cancel
Save