mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 05:08:05 -06:00
Improve TorrentModel class.
This commit is contained in:
@@ -59,6 +59,7 @@ struct SessionPrivate
|
||||
|
||||
virtual void handleTorrentRatioLimitChanged(BitTorrent::TorrentHandle *const torrent) = 0;
|
||||
virtual void handleTorrentSavePathChanged(BitTorrent::TorrentHandle *const torrent) = 0;
|
||||
virtual void handleTorrentLabelChanged(BitTorrent::TorrentHandle *const torrent, const QString &oldLabel) = 0;
|
||||
virtual void handleTorrentMetadataReceived(BitTorrent::TorrentHandle *const torrent) = 0;
|
||||
virtual void handleTorrentPaused(BitTorrent::TorrentHandle *const torrent) = 0;
|
||||
virtual void handleTorrentResumed(BitTorrent::TorrentHandle *const torrent) = 0;
|
||||
|
||||
@@ -1631,6 +1631,11 @@ void Session::handleTorrentSavePathChanged(TorrentHandle *const torrent)
|
||||
emit torrentSavePathChanged(torrent);
|
||||
}
|
||||
|
||||
void Session::handleTorrentLabelChanged(TorrentHandle *const torrent, const QString &oldLabel)
|
||||
{
|
||||
emit torrentLabelChanged(torrent, oldLabel);
|
||||
}
|
||||
|
||||
void Session::handleTorrentTrackersAdded(TorrentHandle *const torrent, const QList<TrackerEntry> &newTrackers)
|
||||
{
|
||||
foreach (const TrackerEntry &newTracker, newTrackers)
|
||||
|
||||
@@ -195,6 +195,7 @@ namespace BitTorrent
|
||||
void torrentFinished(BitTorrent::TorrentHandle *const torrent);
|
||||
void torrentFinishedChecking(BitTorrent::TorrentHandle *const torrent);
|
||||
void torrentSavePathChanged(BitTorrent::TorrentHandle *const torrent);
|
||||
void torrentLabelChanged(BitTorrent::TorrentHandle *const torrent, const QString &oldLabel);
|
||||
void allTorrentsFinished();
|
||||
void metadataLoaded(const BitTorrent::TorrentInfo &info);
|
||||
void torrentMetadataLoaded(BitTorrent::TorrentHandle *const torrent);
|
||||
@@ -289,6 +290,7 @@ namespace BitTorrent
|
||||
QString tempPath() const;
|
||||
void handleTorrentRatioLimitChanged(TorrentHandle *const torrent);
|
||||
void handleTorrentSavePathChanged(TorrentHandle *const torrent);
|
||||
void handleTorrentLabelChanged(TorrentHandle *const torrent, const QString &oldLabel);
|
||||
void handleTorrentMetadataReceived(TorrentHandle *const torrent);
|
||||
void handleTorrentPaused(TorrentHandle *const torrent);
|
||||
void handleTorrentResumed(TorrentHandle *const torrent);
|
||||
|
||||
@@ -969,6 +969,14 @@ int TorrentHandle::timeSinceDownload() const
|
||||
return m_nativeStatus.time_since_download;
|
||||
}
|
||||
|
||||
int TorrentHandle::timeSinceActivity() const
|
||||
{
|
||||
if (m_nativeStatus.time_since_upload < m_nativeStatus.time_since_download)
|
||||
return m_nativeStatus.time_since_upload;
|
||||
else
|
||||
return m_nativeStatus.time_since_download;
|
||||
}
|
||||
|
||||
int TorrentHandle::downloadLimit() const
|
||||
{
|
||||
SAFE_RETURN(int, download_limit, -1)
|
||||
@@ -1117,9 +1125,11 @@ void TorrentHandle::setName(const QString &name)
|
||||
void TorrentHandle::setLabel(const QString &label)
|
||||
{
|
||||
if (m_label != label) {
|
||||
QString oldLabel = m_label;
|
||||
m_label = label;
|
||||
m_needSaveResumeData = true;
|
||||
adjustSavePath();
|
||||
m_session->handleTorrentLabelChanged(this, oldLabel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -241,6 +241,7 @@ namespace BitTorrent
|
||||
QDateTime completedTime() const;
|
||||
int timeSinceUpload() const;
|
||||
int timeSinceDownload() const;
|
||||
int timeSinceActivity() const;
|
||||
int downloadLimit() const;
|
||||
int uploadLimit() const;
|
||||
bool superSeeding() const;
|
||||
|
||||
Reference in New Issue
Block a user