mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-26 11:16:20 +03:00
Properly pre-select the selected torrent's current ratio limiting options in UpDownRatioDlg dialogs. Fixes #7352
This commit is contained in:
parent
15babe97ea
commit
f27e75e8fa
4 changed files with 19 additions and 33 deletions
|
@ -3383,7 +3383,7 @@ bool Session::isKnownTorrent(const InfoHash &hash) const
|
|||
|
||||
void Session::updateSeedingLimitTimer()
|
||||
{
|
||||
if ((globalMaxRatio() == -1) && !hasPerTorrentRatioLimit()
|
||||
if ((globalMaxRatio() == TorrentHandle::NO_RATIO_LIMIT) && !hasPerTorrentRatioLimit()
|
||||
&& (globalMaxSeedingMinutes() == TorrentHandle::NO_SEEDING_TIME_LIMIT) && !hasPerTorrentSeedingTimeLimit()) {
|
||||
if (m_seedingLimitTimer->isActive())
|
||||
m_seedingLimitTimer->stop();
|
||||
|
|
|
@ -1180,38 +1180,20 @@ qreal TorrentHandle::distributedCopies() const
|
|||
return m_nativeStatus.distributed_copies;
|
||||
}
|
||||
|
||||
qreal TorrentHandle::maxRatio(bool *usesGlobalRatio) const
|
||||
qreal TorrentHandle::maxRatio() const
|
||||
{
|
||||
qreal ratioLimit = m_ratioLimit;
|
||||
if (m_ratioLimit == USE_GLOBAL_RATIO)
|
||||
return m_session->globalMaxRatio();
|
||||
|
||||
if (ratioLimit == USE_GLOBAL_RATIO) {
|
||||
ratioLimit = m_session->globalMaxRatio();
|
||||
if (usesGlobalRatio)
|
||||
*usesGlobalRatio = true;
|
||||
}
|
||||
else {
|
||||
if (usesGlobalRatio)
|
||||
*usesGlobalRatio = false;
|
||||
}
|
||||
|
||||
return ratioLimit;
|
||||
return m_ratioLimit;
|
||||
}
|
||||
|
||||
int TorrentHandle::maxSeedingTime(bool *usesGlobalSeedingTime) const
|
||||
int TorrentHandle::maxSeedingTime() const
|
||||
{
|
||||
int seedingTimeLimit = m_seedingTimeLimit;
|
||||
if (m_seedingTimeLimit == USE_GLOBAL_SEEDING_TIME)
|
||||
return m_session->globalMaxSeedingMinutes();
|
||||
|
||||
if (seedingTimeLimit == USE_GLOBAL_SEEDING_TIME) {
|
||||
seedingTimeLimit = m_session->globalMaxSeedingMinutes();
|
||||
if (usesGlobalSeedingTime)
|
||||
*usesGlobalSeedingTime = true;
|
||||
}
|
||||
else {
|
||||
if (usesGlobalSeedingTime)
|
||||
*usesGlobalSeedingTime = false;
|
||||
}
|
||||
|
||||
return seedingTimeLimit;
|
||||
return m_seedingTimeLimit;
|
||||
}
|
||||
|
||||
qreal TorrentHandle::realRatio() const
|
||||
|
@ -1688,7 +1670,7 @@ void TorrentHandle::handleSaveResumeDataAlert(libtorrent::save_resume_data_alert
|
|||
}
|
||||
resumeData["qBt-savePath"] = m_useAutoTMM ? "" : Profile::instance().toPortablePath(m_savePath).toStdString();
|
||||
resumeData["qBt-ratioLimit"] = QString::number(m_ratioLimit).toStdString();
|
||||
resumeData["qBt-seedingTimeLimit"] = QString::number(m_seedingTimeLimit).toStdString();
|
||||
resumeData["qBt-seedingTimeLimit"] = m_seedingTimeLimit;
|
||||
resumeData["qBt-category"] = m_category.toStdString();
|
||||
resumeData["qBt-tags"] = setToEntryList(m_tags);
|
||||
resumeData["qBt-name"] = m_name.toStdString();
|
||||
|
|
|
@ -328,8 +328,8 @@ namespace BitTorrent
|
|||
QBitArray downloadingPieces() const;
|
||||
QVector<int> pieceAvailability() const;
|
||||
qreal distributedCopies() const;
|
||||
qreal maxRatio(bool *usesGlobalRatio = 0) const;
|
||||
int maxSeedingTime(bool *usesGlobalSeedingTime = 0) const;
|
||||
qreal maxRatio() const;
|
||||
int maxSeedingTime() const;
|
||||
qreal realRatio() const;
|
||||
int uploadPayloadRate() const;
|
||||
int downloadPayloadRate() const;
|
||||
|
|
|
@ -627,14 +627,18 @@ void TransferListWidget::setMaxRatioSelectedTorrents()
|
|||
const QList<BitTorrent::TorrentHandle *> torrents = getSelectedTorrents();
|
||||
if (torrents.isEmpty()) return;
|
||||
|
||||
bool useGlobalValue = true;
|
||||
qreal currentMaxRatio = BitTorrent::Session::instance()->globalMaxRatio();
|
||||
if (torrents.count() == 1)
|
||||
currentMaxRatio = torrents[0]->maxRatio(&useGlobalValue);
|
||||
currentMaxRatio = torrents[0]->maxRatio();
|
||||
|
||||
int currentMaxSeedingTime = BitTorrent::Session::instance()->globalMaxSeedingMinutes();
|
||||
if (torrents.count() == 1)
|
||||
currentMaxSeedingTime = torrents[0]->maxSeedingTime(&useGlobalValue);
|
||||
currentMaxSeedingTime = torrents[0]->maxSeedingTime();
|
||||
|
||||
bool useGlobalValue = true;
|
||||
if (torrents.count() == 1)
|
||||
useGlobalValue = (torrents[0]->ratioLimit() == BitTorrent::TorrentHandle::USE_GLOBAL_RATIO)
|
||||
&& (torrents[0]->seedingTimeLimit() == BitTorrent::TorrentHandle::USE_GLOBAL_SEEDING_TIME);
|
||||
|
||||
UpDownRatioDlg dlg(useGlobalValue, currentMaxRatio, BitTorrent::TorrentHandle::MAX_RATIO,
|
||||
currentMaxSeedingTime, BitTorrent::TorrentHandle::MAX_SEEDING_TIME, this);
|
||||
|
|
Loading…
Reference in a new issue