mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-08 08:32:31 -06:00
Compare commits
2 Commits
62b5619bc1
...
d41012a285
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d41012a285 | ||
|
|
fb71c814ca |
@@ -5715,6 +5715,25 @@ void SessionImpl::fetchPendingAlerts(const lt::time_duration time)
|
|||||||
m_nativeSession->pop_alerts(&m_alerts);
|
m_nativeSession->pop_alerts(&m_alerts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SessionImpl::endAlertSequence(const int alertType, const qsizetype alertCount)
|
||||||
|
{
|
||||||
|
qDebug() << "End alert sequence. Alert:" << lt::alert_name(alertType) << "Count:" << alertCount;
|
||||||
|
|
||||||
|
if (alertType == lt::add_torrent_alert::alert_type)
|
||||||
|
{
|
||||||
|
emit addTorrentAlertsReceived(alertCount);
|
||||||
|
|
||||||
|
if (!m_loadedTorrents.isEmpty())
|
||||||
|
{
|
||||||
|
if (isRestored())
|
||||||
|
m_torrentsQueueChanged = true;
|
||||||
|
|
||||||
|
emit torrentsLoaded(m_loadedTorrents);
|
||||||
|
m_loadedTorrents.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TorrentContentLayout SessionImpl::torrentContentLayout() const
|
TorrentContentLayout SessionImpl::torrentContentLayout() const
|
||||||
{
|
{
|
||||||
return m_torrentContentLayout;
|
return m_torrentContentLayout;
|
||||||
@@ -5731,28 +5750,26 @@ void SessionImpl::readAlerts()
|
|||||||
fetchPendingAlerts();
|
fetchPendingAlerts();
|
||||||
|
|
||||||
Q_ASSERT(m_loadedTorrents.isEmpty());
|
Q_ASSERT(m_loadedTorrents.isEmpty());
|
||||||
Q_ASSERT(m_receivedAddTorrentAlertsCount == 0);
|
|
||||||
|
|
||||||
if (!isRestored())
|
if (!isRestored())
|
||||||
m_loadedTorrents.reserve(MAX_PROCESSING_RESUMEDATA_COUNT);
|
m_loadedTorrents.reserve(MAX_PROCESSING_RESUMEDATA_COUNT);
|
||||||
|
|
||||||
|
int previousAlertType = -1;
|
||||||
|
qsizetype alertSequenceSize = 0;
|
||||||
for (lt::alert *a : m_alerts)
|
for (lt::alert *a : m_alerts)
|
||||||
handleAlert(a);
|
|
||||||
|
|
||||||
if (m_receivedAddTorrentAlertsCount > 0)
|
|
||||||
{
|
{
|
||||||
emit addTorrentAlertsReceived(m_receivedAddTorrentAlertsCount);
|
const int alertType = a->type();
|
||||||
m_receivedAddTorrentAlertsCount = 0;
|
if ((alertType != previousAlertType) && (previousAlertType != -1))
|
||||||
|
|
||||||
if (!m_loadedTorrents.isEmpty())
|
|
||||||
{
|
{
|
||||||
if (isRestored())
|
endAlertSequence(previousAlertType, alertSequenceSize);
|
||||||
m_torrentsQueueChanged = true;
|
alertSequenceSize = 0;
|
||||||
|
|
||||||
emit torrentsLoaded(m_loadedTorrents);
|
|
||||||
m_loadedTorrents.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleAlert(a);
|
||||||
|
++alertSequenceSize;
|
||||||
|
previousAlertType = alertType;
|
||||||
}
|
}
|
||||||
|
endAlertSequence(previousAlertType, alertSequenceSize);
|
||||||
|
|
||||||
// Some torrents may become "finished" after different alerts handling.
|
// Some torrents may become "finished" after different alerts handling.
|
||||||
processPendingFinishedTorrents();
|
processPendingFinishedTorrents();
|
||||||
@@ -5760,8 +5777,6 @@ void SessionImpl::readAlerts()
|
|||||||
|
|
||||||
void SessionImpl::handleAddTorrentAlert(const lt::add_torrent_alert *alert)
|
void SessionImpl::handleAddTorrentAlert(const lt::add_torrent_alert *alert)
|
||||||
{
|
{
|
||||||
++m_receivedAddTorrentAlertsCount;
|
|
||||||
|
|
||||||
Q_ASSERT(!m_addTorrentAlertHandlers.isEmpty());
|
Q_ASSERT(!m_addTorrentAlertHandlers.isEmpty());
|
||||||
if (m_addTorrentAlertHandlers.isEmpty()) [[unlikely]]
|
if (m_addTorrentAlertHandlers.isEmpty()) [[unlikely]]
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -628,6 +628,7 @@ namespace BitTorrent
|
|||||||
void populateAdditionalTrackersFromURL();
|
void populateAdditionalTrackersFromURL();
|
||||||
|
|
||||||
void fetchPendingAlerts(lt::time_duration time = lt::time_duration::zero());
|
void fetchPendingAlerts(lt::time_duration time = lt::time_duration::zero());
|
||||||
|
void endAlertSequence(int alertType, qsizetype alertCount);
|
||||||
|
|
||||||
void moveTorrentStorage(const MoveStorageJob &job) const;
|
void moveTorrentStorage(const MoveStorageJob &job) const;
|
||||||
void handleMoveTorrentStorageJobFinished(const Path &newPath);
|
void handleMoveTorrentStorageJobFinished(const Path &newPath);
|
||||||
|
|||||||
@@ -511,7 +511,7 @@ void AddNewTorrentDialog::setCurrentContext(const std::shared_ptr<Context> conte
|
|||||||
{
|
{
|
||||||
m_ui->lblMetaLoading->setVisible(false);
|
m_ui->lblMetaLoading->setVisible(false);
|
||||||
m_ui->progMetaLoading->setVisible(false);
|
m_ui->progMetaLoading->setVisible(false);
|
||||||
m_ui->buttonSave->setVisible(false);
|
m_ui->buttonSave->setVisible(true);
|
||||||
setupTreeview();
|
setupTreeview();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -523,6 +523,7 @@ void AddNewTorrentDialog::setCurrentContext(const std::shared_ptr<Context> conte
|
|||||||
m_ui->labelDateData->setText(tr("Not Available", "This date is unavailable"));
|
m_ui->labelDateData->setText(tr("Not Available", "This date is unavailable"));
|
||||||
updateDiskSpaceLabel();
|
updateDiskSpaceLabel();
|
||||||
setMetadataProgressIndicator(true, tr("Retrieving metadata..."));
|
setMetadataProgressIndicator(true, tr("Retrieving metadata..."));
|
||||||
|
m_ui->buttonSave->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
TMMChanged(m_ui->comboTMM->currentIndex());
|
TMMChanged(m_ui->comboTMM->currentIndex());
|
||||||
|
|||||||
Reference in New Issue
Block a user