mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 07:27:22 -06:00
Raise minimum supported Qt version to 5.12
This commit is contained in:
committed by
sledgehammer999
parent
8cae8ad5c5
commit
4037143f4e
@@ -55,13 +55,8 @@ AsyncFileStorage::~AsyncFileStorage()
|
||||
|
||||
void AsyncFileStorage::store(const QString &fileName, const QByteArray &data)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
QMetaObject::invokeMethod(this, [this, data, fileName]() { store_impl(fileName, data); }
|
||||
, Qt::QueuedConnection);
|
||||
#else
|
||||
QMetaObject::invokeMethod(this, "store_impl", Qt::QueuedConnection
|
||||
, Q_ARG(QString, fileName), Q_ARG(QByteArray, data));
|
||||
#endif
|
||||
}
|
||||
|
||||
QDir AsyncFileStorage::storageDir() const
|
||||
|
||||
@@ -1111,11 +1111,7 @@ void Session::initializeNativeSession()
|
||||
|
||||
m_nativeSession->set_alert_notify([this]()
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
QMetaObject::invokeMethod(this, &Session::readAlerts, Qt::QueuedConnection);
|
||||
#else
|
||||
QMetaObject::invokeMethod(this, "readAlerts", Qt::QueuedConnection);
|
||||
#endif
|
||||
});
|
||||
|
||||
// Enabling plugins
|
||||
@@ -1854,18 +1850,13 @@ bool Session::deleteTorrent(const TorrentID &id, const DeleteOption deleteOption
|
||||
}
|
||||
|
||||
// Remove it from torrent resume directory
|
||||
const QString resumedataFile = QString::fromLatin1("%1.fastresume").arg(torrent->id().toString());
|
||||
const QString metadataFile = QString::fromLatin1("%1.torrent").arg(torrent->id().toString());
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
const QString resumedataFile = QString::fromLatin1("%1.fastresume").arg(torrent->id());
|
||||
const QString metadataFile = QString::fromLatin1("%1.torrent").arg(torrent->id());
|
||||
QMetaObject::invokeMethod(m_resumeDataSavingManager, [this, resumedataFile, metadataFile]()
|
||||
{
|
||||
m_resumeDataSavingManager->remove(resumedataFile);
|
||||
m_resumeDataSavingManager->remove(metadataFile);
|
||||
});
|
||||
#else
|
||||
QMetaObject::invokeMethod(m_resumeDataSavingManager, "remove", Q_ARG(QString, resumedataFile));
|
||||
QMetaObject::invokeMethod(m_resumeDataSavingManager, "remove", Q_ARG(QString, metadataFile));
|
||||
#endif
|
||||
|
||||
delete torrent;
|
||||
return true;
|
||||
@@ -2228,16 +2219,10 @@ void Session::findIncompleteFiles(const TorrentInfo &torrentInfo, const QString
|
||||
const QStringList originalFileNames = torrentInfo.filePaths();
|
||||
const QString completeSavePath = savePath;
|
||||
const QString incompleteSavePath = (isTempPathEnabled() ? torrentTempPath(torrentInfo) : QString {});
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
QMetaObject::invokeMethod(m_fileSearcher, [=]()
|
||||
{
|
||||
m_fileSearcher->search(searchId, originalFileNames, completeSavePath, incompleteSavePath);
|
||||
});
|
||||
#else
|
||||
QMetaObject::invokeMethod(m_fileSearcher, "search"
|
||||
, Q_ARG(BitTorrent::TorrentID, searchId), Q_ARG(QStringList, originalFileNames)
|
||||
, Q_ARG(QString, completeSavePath), Q_ARG(QString, incompleteSavePath));
|
||||
#endif
|
||||
}
|
||||
|
||||
// Add a torrent to libtorrent session in hidden mode
|
||||
@@ -2387,24 +2372,15 @@ void Session::saveTorrentsQueue() const
|
||||
data += (torrentID.toLatin1() + '\n');
|
||||
|
||||
const QString filename = QLatin1String {"queue"};
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
QMetaObject::invokeMethod(m_resumeDataSavingManager
|
||||
, [this, data, filename]() { m_resumeDataSavingManager->save(filename, data); });
|
||||
#else
|
||||
QMetaObject::invokeMethod(m_resumeDataSavingManager, "save"
|
||||
, Q_ARG(QString, filename), Q_ARG(QByteArray, data));
|
||||
#endif
|
||||
}
|
||||
|
||||
void Session::removeTorrentsQueue() const
|
||||
{
|
||||
const QString filename = QLatin1String {"queue"};
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
QMetaObject::invokeMethod(m_resumeDataSavingManager
|
||||
, [this, filename]() { m_resumeDataSavingManager->remove(filename); });
|
||||
#else
|
||||
QMetaObject::invokeMethod(m_resumeDataSavingManager, "remove", Q_ARG(QString, filename));
|
||||
#endif
|
||||
}
|
||||
|
||||
void Session::setDefaultSavePath(QString path)
|
||||
@@ -3952,14 +3928,9 @@ void Session::handleTorrentResumeDataReady(TorrentImpl *const torrent, const std
|
||||
// Separated thread is used for the blocking IO which results in slow processing of many torrents.
|
||||
// Copying lt::entry objects around isn't cheap.
|
||||
|
||||
const QString filename = QString::fromLatin1("%1.fastresume").arg(torrent->id().toString());
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
const QString filename = QString::fromLatin1("%1.fastresume").arg(torrent->id());
|
||||
QMetaObject::invokeMethod(m_resumeDataSavingManager
|
||||
, [this, filename, data]() { m_resumeDataSavingManager->save(filename, data); });
|
||||
#else
|
||||
QMetaObject::invokeMethod(m_resumeDataSavingManager, "save"
|
||||
, Q_ARG(QString, filename), Q_ARG(std::shared_ptr<lt::entry>, data));
|
||||
#endif
|
||||
}
|
||||
|
||||
void Session::handleTorrentTrackerReply(TorrentImpl *const torrent, const QString &trackerUrl)
|
||||
@@ -4118,15 +4089,9 @@ void Session::configureDeferred()
|
||||
{
|
||||
if (m_deferredConfigureScheduled)
|
||||
return;
|
||||
m_deferredConfigureScheduled = true;
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
QMetaObject::invokeMethod(this
|
||||
, qOverload<>(&Session::configure)
|
||||
, Qt::QueuedConnection);
|
||||
#else
|
||||
QMetaObject::invokeMethod(this, "configure", Qt::QueuedConnection);
|
||||
#endif
|
||||
m_deferredConfigureScheduled = true;
|
||||
QMetaObject::invokeMethod(this, qOverload<>(&Session::configure), Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
// Enable IP Filtering
|
||||
|
||||
@@ -790,8 +790,3 @@ namespace BitTorrent
|
||||
static Session *m_instance;
|
||||
};
|
||||
}
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 10, 0))
|
||||
Q_DECLARE_METATYPE(std::shared_ptr<lt::entry>)
|
||||
const int sharedPtrLtEntryTypeID = qRegisterMetaType<std::shared_ptr<lt::entry>>();
|
||||
#endif
|
||||
|
||||
@@ -492,11 +492,7 @@ void TorrentInfo::addRootFolder()
|
||||
const QString extension = Utils::Fs::fileExtension(originalName);
|
||||
const QString rootFolder = extension.isEmpty()
|
||||
? originalName
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
: originalName.chopped(extension.size() + 1);
|
||||
#else
|
||||
: originalName.left(originalName.size() - (extension.size() + 1));
|
||||
#endif
|
||||
const std::string rootPrefix = Utils::Fs::toNativePath(rootFolder + QLatin1Char {'/'}).toStdString();
|
||||
lt::file_storage files = m_nativeInfo->files();
|
||||
files.set_name(rootFolder.toStdString());
|
||||
|
||||
@@ -863,7 +863,7 @@ void Preferences::setAutoRunProgram(const QString &program)
|
||||
setValue("AutoRun/program", program);
|
||||
}
|
||||
|
||||
#if defined(Q_OS_WIN) && (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
#if defined(Q_OS_WIN)
|
||||
bool Preferences::isAutoRunConsoleEnabled() const
|
||||
{
|
||||
return value("AutoRun/ConsoleEnabled", false).toBool();
|
||||
|
||||
@@ -248,7 +248,7 @@ public:
|
||||
void setAutoRunEnabled(bool enabled);
|
||||
QString getAutoRunProgram() const;
|
||||
void setAutoRunProgram(const QString &program);
|
||||
#if defined(Q_OS_WIN) && (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
#if defined(Q_OS_WIN)
|
||||
bool isAutoRunConsoleEnabled() const;
|
||||
void setAutoRunConsoleEnabled(bool enabled);
|
||||
#endif
|
||||
|
||||
@@ -547,13 +547,8 @@ Parser::Parser(const QString lastBuildDate)
|
||||
|
||||
void Parser::parse(const QByteArray &feedData)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
QMetaObject::invokeMethod(this, [this, feedData]() { parse_impl(feedData); }
|
||||
, Qt::QueuedConnection);
|
||||
#else
|
||||
QMetaObject::invokeMethod(this, "parse_impl", Qt::QueuedConnection
|
||||
, Q_ARG(QByteArray, feedData));
|
||||
#endif
|
||||
}
|
||||
|
||||
// read and create items from a rss document
|
||||
|
||||
@@ -78,11 +78,7 @@ QString Utils::Fs::toUniformPath(const QString &path)
|
||||
QString Utils::Fs::fileExtension(const QString &filename)
|
||||
{
|
||||
const QString name = filename.endsWith(QB_EXT)
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
? filename.chopped(QB_EXT.length())
|
||||
#else
|
||||
? filename.left(filename.length() - QB_EXT.length())
|
||||
#endif
|
||||
: filename;
|
||||
return QMimeDatabase().suffixForFileName(name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user