mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-04 14:42:29 -06:00
@@ -3151,7 +3151,7 @@ void SessionImpl::exportTorrentFile(const Torrent *torrent, const Path &folderPa
|
||||
while (newTorrentPath.exists())
|
||||
{
|
||||
// Append number to torrent name to make it unique
|
||||
torrentExportFilename = u"%1 %2.torrent"_s.arg(validName).arg(++counter);
|
||||
torrentExportFilename = u"%1 (%2).torrent"_s.arg(validName).arg(++counter);
|
||||
newTorrentPath = folderPath / Path(torrentExportFilename);
|
||||
}
|
||||
|
||||
@@ -5651,6 +5651,25 @@ void SessionImpl::fetchPendingAlerts(const lt::time_duration time)
|
||||
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
|
||||
{
|
||||
return m_torrentContentLayout;
|
||||
@@ -5667,28 +5686,26 @@ void SessionImpl::readAlerts()
|
||||
fetchPendingAlerts();
|
||||
|
||||
Q_ASSERT(m_loadedTorrents.isEmpty());
|
||||
Q_ASSERT(m_receivedAddTorrentAlertsCount == 0);
|
||||
|
||||
if (!isRestored())
|
||||
m_loadedTorrents.reserve(MAX_PROCESSING_RESUMEDATA_COUNT);
|
||||
|
||||
int previousAlertType = -1;
|
||||
qsizetype alertSequenceSize = 0;
|
||||
for (const lt::alert *a : m_alerts)
|
||||
handleAlert(a);
|
||||
|
||||
if (m_receivedAddTorrentAlertsCount > 0)
|
||||
{
|
||||
emit addTorrentAlertsReceived(m_receivedAddTorrentAlertsCount);
|
||||
m_receivedAddTorrentAlertsCount = 0;
|
||||
|
||||
if (!m_loadedTorrents.isEmpty())
|
||||
const int alertType = a->type();
|
||||
if ((alertType != previousAlertType) && (previousAlertType != -1))
|
||||
{
|
||||
if (isRestored())
|
||||
m_torrentsQueueChanged = true;
|
||||
|
||||
emit torrentsLoaded(m_loadedTorrents);
|
||||
m_loadedTorrents.clear();
|
||||
endAlertSequence(previousAlertType, alertSequenceSize);
|
||||
alertSequenceSize = 0;
|
||||
}
|
||||
|
||||
handleAlert(a);
|
||||
++alertSequenceSize;
|
||||
previousAlertType = alertType;
|
||||
}
|
||||
endAlertSequence(previousAlertType, alertSequenceSize);
|
||||
|
||||
// Some torrents may become "finished" after different alerts handling.
|
||||
processPendingFinishedTorrents();
|
||||
@@ -5696,8 +5713,6 @@ void SessionImpl::readAlerts()
|
||||
|
||||
void SessionImpl::handleAddTorrentAlert(const lt::add_torrent_alert *alert)
|
||||
{
|
||||
++m_receivedAddTorrentAlertsCount;
|
||||
|
||||
if (alert->error)
|
||||
{
|
||||
const QString msg = QString::fromStdString(alert->message());
|
||||
|
||||
@@ -607,6 +607,7 @@ namespace BitTorrent
|
||||
void populateAdditionalTrackersFromURL();
|
||||
|
||||
void fetchPendingAlerts(lt::time_duration time = lt::time_duration::zero());
|
||||
void endAlertSequence(int alertType, qsizetype alertCount);
|
||||
|
||||
void moveTorrentStorage(const MoveStorageJob &job) const;
|
||||
void handleMoveTorrentStorageJobFinished(const Path &newPath);
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Http
|
||||
inline const QString HEADER_X_CONTENT_TYPE_OPTIONS = u"x-content-type-options"_s;
|
||||
inline const QString HEADER_X_FORWARDED_FOR = u"x-forwarded-for"_s;
|
||||
inline const QString HEADER_X_FORWARDED_HOST = u"x-forwarded-host"_s;
|
||||
inline const QString HEADER_X_FORWARDED_PROTO = u"X-forwarded-proto"_s;
|
||||
inline const QString HEADER_X_FORWARDED_PROTO = u"x-forwarded-proto"_s;
|
||||
inline const QString HEADER_X_FRAME_OPTIONS = u"x-frame-options"_s;
|
||||
inline const QString HEADER_X_XSS_PROTECTION = u"x-xss-protection"_s;
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace
|
||||
QPointer<SearchPluginManager> SearchPluginManager::m_instance = nullptr;
|
||||
|
||||
SearchPluginManager::SearchPluginManager()
|
||||
: m_updateUrl(u"https://searchplugins.qbittorrent.org/nova3/engines/"_s)
|
||||
: m_updateUrl(u"https://raw.githubusercontent.com/qbittorrent/search-plugins/refs/heads/master/nova3/engines/"_s)
|
||||
{
|
||||
Q_ASSERT(!m_instance); // only one instance is allowed
|
||||
m_instance = this;
|
||||
|
||||
@@ -104,7 +104,7 @@ bool Utils::Fs::smartRemoveEmptyFolderTree(const Path &path)
|
||||
if (!dir.isEmpty(QDir::Dirs | QDir::NoDotAndDotDot))
|
||||
continue;
|
||||
|
||||
const QStringList tmpFileList = dir.entryList(QDir::Files);
|
||||
const QStringList tmpFileList = dir.entryList(QDir::Files | QDir::Hidden);
|
||||
|
||||
// deleteFilesList contains unwanted files, usually created by the OS
|
||||
// temp files on linux usually end with '~', e.g. `filename~`
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace
|
||||
|
||||
RandomLayer()
|
||||
{
|
||||
if (::getrandom(nullptr, 0, 0) < 0)
|
||||
if (unsigned char buf = 0; ::getrandom(&buf, sizeof(buf), 0) < 0)
|
||||
{
|
||||
if (errno == ENOSYS)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user