diff --git a/src/base/bittorrent/torrenthandle.cpp b/src/base/bittorrent/torrenthandle.cpp index 0a52254b3..3f4227e61 100644 --- a/src/base/bittorrent/torrenthandle.cpp +++ b/src/base/bittorrent/torrenthandle.cpp @@ -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 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() 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 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 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 diff --git a/src/base/bittorrent/torrenthandle.h b/src/base/bittorrent/torrenthandle.h index 8cdcfe02e..0e057f24d 100644 --- a/src/base/bittorrent/torrenthandle.h +++ b/src/base/bittorrent/torrenthandle.h @@ -140,7 +140,9 @@ namespace BitTorrent CheckingUploading, CheckingDownloading, +#if LIBTORRENT_VERSION_NUM < 10100 QueuedForChecking, +#endif CheckingResumeData, PausedDownloading, diff --git a/src/gui/torrentmodel.cpp b/src/gui/torrentmodel.cpp index d18c3c627..2971f0107 100644 --- a/src/gui/torrentmodel.cpp +++ b/src/gui/torrentmodel.cpp @@ -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) 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 diff --git a/src/gui/transferlistdelegate.cpp b/src/gui/transferlistdelegate.cpp index fc5d404d8..eb1f8adde 100644 --- a/src/gui/transferlistdelegate.cpp +++ b/src/gui/transferlistdelegate.cpp @@ -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;