Browse Source

Fix status string for errored torrents.

adaptive-webui-19844
sledgehammer999 9 years ago
parent
commit
bf0319f7b2
  1. 7
      src/core/bittorrent/torrenthandle.cpp
  2. 1
      src/core/bittorrent/torrenthandle.h
  3. 2
      src/gui/torrentmodel.cpp
  4. 5
      src/gui/transferlistdelegate.cpp

7
src/core/bittorrent/torrenthandle.cpp

@ -80,6 +80,8 @@ QString TorrentState::toString() const
switch (m_value) { switch (m_value) {
case Error: case Error:
return QLatin1String("error"); return QLatin1String("error");
case MissingFiles:
return QLatin1String("missingFiles");
case Uploading: case Uploading:
return QLatin1String("uploading"); return QLatin1String("uploading");
case PausedUploading: case PausedUploading:
@ -625,6 +627,7 @@ bool TorrentHandle::isDownloading() const
|| 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; || m_state == TorrentState::Error;
} }
@ -723,7 +726,9 @@ TorrentState TorrentHandle::state() const
void TorrentHandle::updateState() void TorrentHandle::updateState()
{ {
if (isPaused()) { if (isPaused()) {
if (hasError() || hasMissingFiles()) if (hasMissingFiles())
m_state = TorrentState::MissingFiles;
else if (hasError())
m_state = TorrentState::Error; m_state = TorrentState::Error;
else else
m_state = isSeed() ? TorrentState::PausedUploading : TorrentState::PausedDownloading; m_state = isSeed() ? TorrentState::PausedUploading : TorrentState::PausedDownloading;

1
src/core/bittorrent/torrenthandle.h

@ -139,6 +139,7 @@ namespace BitTorrent
PausedDownloading, PausedDownloading,
PausedUploading, PausedUploading,
MissingFiles,
Error Error
}; };

2
src/gui/torrentmodel.cpp

@ -342,6 +342,7 @@ QIcon getIconByState(BitTorrent::TorrentState state)
case BitTorrent::TorrentState::CheckingResumeData: case BitTorrent::TorrentState::CheckingResumeData:
return getCheckingIcon(); return getCheckingIcon();
case BitTorrent::TorrentState::Unknown: case BitTorrent::TorrentState::Unknown:
case BitTorrent::TorrentState::MissingFiles:
case BitTorrent::TorrentState::Error: case BitTorrent::TorrentState::Error:
return getErrorIcon(); return getErrorIcon();
default: default:
@ -384,6 +385,7 @@ QColor getColorByState(BitTorrent::TorrentState state)
else else
return QColor(79, 148, 205); // Steel Blue 3 return QColor(79, 148, 205); // Steel Blue 3
case BitTorrent::TorrentState::Error: case BitTorrent::TorrentState::Error:
case BitTorrent::TorrentState::MissingFiles:
return QColor(255, 0, 0); // red return QColor(255, 0, 0); // red
case BitTorrent::TorrentState::QueuedDownloading: case BitTorrent::TorrentState::QueuedDownloading:
case BitTorrent::TorrentState::QueuedUploading: case BitTorrent::TorrentState::QueuedUploading:

5
src/gui/transferlistdelegate.cpp

@ -135,9 +135,12 @@ void TransferListDelegate::paint(QPainter * painter, const QStyleOptionViewItem
case BitTorrent::TorrentState::PausedUploading: case BitTorrent::TorrentState::PausedUploading:
display = tr("Completed"); display = tr("Completed");
break; break;
case BitTorrent::TorrentState::Error: case BitTorrent::TorrentState::MissingFiles:
display = tr("Missing Files"); display = tr("Missing Files");
break; break;
case BitTorrent::TorrentState::Error:
display = tr("Errored", "torrent status, the torrent has an error");
break;
default: default:
display = ""; display = "";
} }

Loading…
Cancel
Save