Browse Source

Don't use deprecated torrent_status fields

adaptive-webui-19844
Vladimir Golovnev (Glassez) 8 years ago
parent
commit
5dc54aa224
  1. 21
      src/base/bittorrent/torrenthandle.cpp
  2. 2
      src/base/bittorrent/torrenthandle.h
  3. 4
      src/gui/torrentmodel.cpp
  4. 2
      src/gui/transferlistdelegate.cpp

21
src/base/bittorrent/torrenthandle.cpp

@ -147,8 +147,10 @@ QString TorrentState::toString() const @@ -147,8 +147,10 @@ QString TorrentState::toString() const
return QLatin1String("checkingDL");
case ForcedDownloading:
return QLatin1String("forcedDL");
#if LIBTORRENT_VERSION_NUM < 10100
case QueuedForChecking:
return QLatin1String("queuedForChecking");
#endif
case CheckingResumeData:
return QLatin1String("checkingResumeData");
default:
@ -658,9 +660,12 @@ bool TorrentHandle::isQueued() const @@ -658,9 +660,12 @@ bool TorrentHandle::isQueued() const
bool TorrentHandle::isChecking() const
{
return ((m_nativeStatus.state == libt::torrent_status::queued_for_checking)
|| (m_nativeStatus.state == libt::torrent_status::checking_files)
|| (m_nativeStatus.state == libt::torrent_status::checking_resume_data));
return ((m_nativeStatus.state == libt::torrent_status::checking_files)
|| (m_nativeStatus.state == libt::torrent_status::checking_resume_data)
#if LIBTORRENT_VERSION_NUM < 10100
|| (m_nativeStatus.state == libt::torrent_status::queued_for_checking)
#endif
);
}
bool TorrentHandle::isDownloading() const
@ -799,9 +804,11 @@ void TorrentHandle::updateState() @@ -799,9 +804,11 @@ void TorrentHandle::updateState()
case libt::torrent_status::allocating:
m_state = TorrentState::Allocating;
break;
#if LIBTORRENT_VERSION_NUM < 10100
case libt::torrent_status::queued_for_checking:
m_state = TorrentState::QueuedForChecking;
break;
#endif
case libt::torrent_status::checking_resume_data:
m_state = TorrentState::CheckingResumeData;
break;
@ -837,7 +844,11 @@ bool TorrentHandle::hasMissingFiles() const @@ -837,7 +844,11 @@ bool TorrentHandle::hasMissingFiles() const
bool TorrentHandle::hasError() const
{
#if LIBTORRENT_VERSION_NUM < 10100
return (m_nativeStatus.paused && !m_nativeStatus.error.empty());
#else
return (m_nativeStatus.paused && m_nativeStatus.errc);
#endif
}
bool TorrentHandle::hasFilteredPieces() const
@ -859,7 +870,11 @@ int TorrentHandle::queuePosition() const @@ -859,7 +870,11 @@ int TorrentHandle::queuePosition() const
QString TorrentHandle::error() const
{
#if LIBTORRENT_VERSION_NUM < 10100
return QString::fromStdString(m_nativeStatus.error);
#else
return QString::fromStdString(m_nativeStatus.errc.message());
#endif
}
qlonglong TorrentHandle::totalDownload() const

2
src/base/bittorrent/torrenthandle.h

@ -140,7 +140,9 @@ namespace BitTorrent @@ -140,7 +140,9 @@ namespace BitTorrent
CheckingUploading,
CheckingDownloading,
#if LIBTORRENT_VERSION_NUM < 10100
QueuedForChecking,
#endif
CheckingResumeData,
PausedDownloading,

4
src/gui/torrentmodel.cpp

@ -338,7 +338,9 @@ QIcon getIconByState(BitTorrent::TorrentState state) @@ -338,7 +338,9 @@ QIcon getIconByState(BitTorrent::TorrentState state)
return getQueuedIcon();
case BitTorrent::TorrentState::CheckingDownloading:
case BitTorrent::TorrentState::CheckingUploading:
#if LIBTORRENT_VERSION_NUM < 10100
case BitTorrent::TorrentState::QueuedForChecking:
#endif
case BitTorrent::TorrentState::CheckingResumeData:
return getCheckingIcon();
case BitTorrent::TorrentState::Unknown:
@ -391,7 +393,9 @@ QColor getColorByState(BitTorrent::TorrentState state) @@ -391,7 +393,9 @@ QColor getColorByState(BitTorrent::TorrentState state)
case BitTorrent::TorrentState::QueuedUploading:
case BitTorrent::TorrentState::CheckingDownloading:
case BitTorrent::TorrentState::CheckingUploading:
#if LIBTORRENT_VERSION_NUM < 10100
case BitTorrent::TorrentState::QueuedForChecking:
#endif
case BitTorrent::TorrentState::CheckingResumeData:
if (!dark)
return QColor(0, 128, 128); // Teal

2
src/gui/transferlistdelegate.cpp

@ -258,9 +258,11 @@ QString TransferListDelegate::getStatusString(const int state) const @@ -258,9 +258,11 @@ QString TransferListDelegate::getStatusString(const int state) const
case BitTorrent::TorrentState::CheckingUploading:
str = tr("Checking", "Torrent local data is being checked");
break;
#if LIBTORRENT_VERSION_NUM < 10100
case BitTorrent::TorrentState::QueuedForChecking:
str = tr("Queued for checking", "i.e. torrent is queued for hash checking");
break;
#endif
case BitTorrent::TorrentState::CheckingResumeData:
str = tr("Checking resume data", "used when loading the torrents from disk after qbt is launched. It checks the correctness of the .fastresume file. Normally it is completed in a fraction of a second, unless loading many many torrents.");
break;

Loading…
Cancel
Save