From bf0319f7b2eab2b9fdc775c5a61d40230755254c Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Wed, 11 Nov 2015 00:32:49 +0200 Subject: [PATCH] Fix status string for errored torrents. --- src/core/bittorrent/torrenthandle.cpp | 7 ++++++- src/core/bittorrent/torrenthandle.h | 1 + src/gui/torrentmodel.cpp | 2 ++ src/gui/transferlistdelegate.cpp | 5 ++++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/core/bittorrent/torrenthandle.cpp b/src/core/bittorrent/torrenthandle.cpp index 9af65834b..633d663d4 100644 --- a/src/core/bittorrent/torrenthandle.cpp +++ b/src/core/bittorrent/torrenthandle.cpp @@ -80,6 +80,8 @@ QString TorrentState::toString() const switch (m_value) { case Error: return QLatin1String("error"); + case MissingFiles: + return QLatin1String("missingFiles"); case Uploading: return QLatin1String("uploading"); case PausedUploading: @@ -625,6 +627,7 @@ bool TorrentHandle::isDownloading() const || m_state == TorrentState::PausedDownloading || m_state == TorrentState::QueuedDownloading || m_state == TorrentState::ForcedDownloading + || m_state == TorrentState::MissingFiles || m_state == TorrentState::Error; } @@ -723,7 +726,9 @@ TorrentState TorrentHandle::state() const void TorrentHandle::updateState() { if (isPaused()) { - if (hasError() || hasMissingFiles()) + if (hasMissingFiles()) + m_state = TorrentState::MissingFiles; + else if (hasError()) m_state = TorrentState::Error; else m_state = isSeed() ? TorrentState::PausedUploading : TorrentState::PausedDownloading; diff --git a/src/core/bittorrent/torrenthandle.h b/src/core/bittorrent/torrenthandle.h index ced4ee598..7eb65a4c6 100644 --- a/src/core/bittorrent/torrenthandle.h +++ b/src/core/bittorrent/torrenthandle.h @@ -139,6 +139,7 @@ namespace BitTorrent PausedDownloading, PausedUploading, + MissingFiles, Error }; diff --git a/src/gui/torrentmodel.cpp b/src/gui/torrentmodel.cpp index 8d293f874..7c6c84759 100644 --- a/src/gui/torrentmodel.cpp +++ b/src/gui/torrentmodel.cpp @@ -342,6 +342,7 @@ QIcon getIconByState(BitTorrent::TorrentState state) case BitTorrent::TorrentState::CheckingResumeData: return getCheckingIcon(); case BitTorrent::TorrentState::Unknown: + case BitTorrent::TorrentState::MissingFiles: case BitTorrent::TorrentState::Error: return getErrorIcon(); default: @@ -384,6 +385,7 @@ QColor getColorByState(BitTorrent::TorrentState state) else return QColor(79, 148, 205); // Steel Blue 3 case BitTorrent::TorrentState::Error: + case BitTorrent::TorrentState::MissingFiles: return QColor(255, 0, 0); // red case BitTorrent::TorrentState::QueuedDownloading: case BitTorrent::TorrentState::QueuedUploading: diff --git a/src/gui/transferlistdelegate.cpp b/src/gui/transferlistdelegate.cpp index aeaf59b1e..06ec193f2 100644 --- a/src/gui/transferlistdelegate.cpp +++ b/src/gui/transferlistdelegate.cpp @@ -135,8 +135,11 @@ void TransferListDelegate::paint(QPainter * painter, const QStyleOptionViewItem case BitTorrent::TorrentState::PausedUploading: display = tr("Completed"); break; + case BitTorrent::TorrentState::MissingFiles: + display = tr("Missing Files"); + break; case BitTorrent::TorrentState::Error: - display = tr("Missing Files"); + display = tr("Errored", "torrent status, the torrent has an error"); break; default: display = "";