mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-14 01:03:08 -07:00
Drop implicit conversions between InfoHash and QString
This commit is contained in:
parent
752eb58ec0
commit
8cfd803222
13 changed files with 72 additions and 68 deletions
|
@ -1802,7 +1802,7 @@ bool Session::deleteTorrent(const InfoHash &hash, const DeleteOption deleteOptio
|
|||
TorrentImpl *const torrent = m_torrents.take(hash);
|
||||
if (!torrent) return false;
|
||||
|
||||
qDebug("Deleting torrent with hash: %s", qUtf8Printable(torrent->hash()));
|
||||
qDebug("Deleting torrent with hash: %s", qUtf8Printable(torrent->hash().toString()));
|
||||
emit torrentAboutToBeRemoved(torrent);
|
||||
|
||||
// Remove it from session
|
||||
|
@ -1856,8 +1856,8 @@ bool Session::deleteTorrent(const InfoHash &hash, const DeleteOption deleteOptio
|
|||
}
|
||||
|
||||
// Remove it from torrent resume directory
|
||||
const QString resumedataFile = QString::fromLatin1("%1.fastresume").arg(torrent->hash());
|
||||
const QString metadataFile = QString::fromLatin1("%1.torrent").arg(torrent->hash());
|
||||
const QString resumedataFile = QString::fromLatin1("%1.fastresume").arg(torrent->hash().toString());
|
||||
const QString metadataFile = QString::fromLatin1("%1.torrent").arg(torrent->hash().toString());
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
QMetaObject::invokeMethod(m_resumeDataSavingManager, [this, resumedataFile, metadataFile]()
|
||||
{
|
||||
|
@ -2254,7 +2254,7 @@ bool Session::downloadMetadata(const MagnetUri &magnetUri)
|
|||
if (m_downloadedMetadata.contains(hash)) return false;
|
||||
|
||||
qDebug("Adding torrent to preload metadata...");
|
||||
qDebug(" -> Hash: %s", qUtf8Printable(hash));
|
||||
qDebug(" -> Hash: %s", qUtf8Printable(hash.toString()));
|
||||
qDebug(" -> Name: %s", qUtf8Printable(name));
|
||||
|
||||
lt::add_torrent_params p = magnetUri.addTorrentParams();
|
||||
|
@ -2270,7 +2270,7 @@ bool Session::downloadMetadata(const MagnetUri &magnetUri)
|
|||
p.max_connections = maxConnectionsPerTorrent();
|
||||
p.max_uploads = maxUploadsPerTorrent();
|
||||
|
||||
const QString savePath = Utils::Fs::tempPath() + static_cast<QString>(hash);
|
||||
const QString savePath = Utils::Fs::tempPath() + hash.toString();
|
||||
p.save_path = Utils::Fs::toNativePath(savePath).toStdString();
|
||||
|
||||
// Forced start
|
||||
|
@ -2303,7 +2303,7 @@ void Session::exportTorrentFile(const Torrent *torrent, TorrentExportFolder fold
|
|||
((folder == TorrentExportFolder::Finished) && !finishedTorrentExportDirectory().isEmpty()));
|
||||
|
||||
const QString validName = Utils::Fs::toValidFileSystemName(torrent->name());
|
||||
const QString torrentFilename = QString::fromLatin1("%1.torrent").arg(torrent->hash());
|
||||
const QString torrentFilename = QString::fromLatin1("%1.torrent").arg(torrent->hash().toString());
|
||||
QString torrentExportFilename = QString::fromLatin1("%1.torrent").arg(validName);
|
||||
const QString torrentPath = QDir(m_resumeFolderPath).absoluteFilePath(torrentFilename);
|
||||
const QDir exportPath(folder == TorrentExportFolder::Regular ? torrentExportDirectory() : finishedTorrentExportDirectory());
|
||||
|
@ -2376,7 +2376,7 @@ void Session::saveTorrentsQueue() const
|
|||
// We require actual (non-cached) queue position here!
|
||||
const int queuePos = static_cast<LTUnderlyingType<lt::queue_position_t>>(torrent->nativeHandle().queue_position());
|
||||
if (queuePos >= 0)
|
||||
queue[queuePos] = torrent->hash();
|
||||
queue[queuePos] = torrent->hash().toString();
|
||||
}
|
||||
|
||||
QByteArray data;
|
||||
|
@ -3856,7 +3856,7 @@ void Session::handleTorrentMetadataReceived(TorrentImpl *const torrent)
|
|||
{
|
||||
// Save metadata
|
||||
const QDir resumeDataDir {m_resumeFolderPath};
|
||||
const QString torrentFileName {QString {"%1.torrent"}.arg(torrent->hash())};
|
||||
const QString torrentFileName {QString {"%1.torrent"}.arg(torrent->hash().toString())};
|
||||
try
|
||||
{
|
||||
torrent->info().saveToFile(resumeDataDir.absoluteFilePath(torrentFileName));
|
||||
|
@ -3936,7 +3936,7 @@ 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->hash());
|
||||
const QString filename = QString::fromLatin1("%1.fastresume").arg(torrent->hash().toString());
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
QMetaObject::invokeMethod(m_resumeDataSavingManager
|
||||
, [this, filename, data]() { m_resumeDataSavingManager->save(filename, data); });
|
||||
|
@ -4014,7 +4014,7 @@ void Session::moveTorrentStorage(const MoveStorageJob &job) const
|
|||
{
|
||||
const InfoHash infoHash = job.torrentHandle.info_hash();
|
||||
const TorrentImpl *torrent = m_torrents.value(infoHash);
|
||||
const QString torrentName = (torrent ? torrent->name() : QString {infoHash});
|
||||
const QString torrentName = (torrent ? torrent->name() : infoHash.toString());
|
||||
LogMsg(tr("Moving \"%1\" to \"%2\"...").arg(torrentName, job.path));
|
||||
|
||||
job.torrentHandle.move_storage(job.path.toUtf8().constData()
|
||||
|
@ -4587,7 +4587,7 @@ void Session::createTorrent(const lt::torrent_handle &nativeHandle)
|
|||
{
|
||||
// Backup torrent file
|
||||
const QDir resumeDataDir {m_resumeFolderPath};
|
||||
const QString torrentFileName {QString {"%1.torrent"}.arg(torrent->hash())};
|
||||
const QString torrentFileName {QString::fromLatin1("%1.torrent").arg(torrent->hash().toString())};
|
||||
try
|
||||
{
|
||||
torrent->info().saveToFile(resumeDataDir.absoluteFilePath(torrentFileName));
|
||||
|
@ -4925,7 +4925,7 @@ void Session::handleStorageMovedAlert(const lt::storage_moved_alert *p)
|
|||
|
||||
const InfoHash infoHash = currentJob.torrentHandle.info_hash();
|
||||
TorrentImpl *torrent = m_torrents.value(infoHash);
|
||||
const QString torrentName = (torrent ? torrent->name() : QString {infoHash});
|
||||
const QString torrentName = (torrent ? torrent->name() : infoHash.toString());
|
||||
LogMsg(tr("\"%1\" is successfully moved to \"%2\".").arg(torrentName, newPath));
|
||||
|
||||
handleMoveTorrentStorageJobFinished();
|
||||
|
@ -4940,7 +4940,7 @@ void Session::handleStorageMovedFailedAlert(const lt::storage_moved_failed_alert
|
|||
|
||||
const InfoHash infoHash = currentJob.torrentHandle.info_hash();
|
||||
TorrentImpl *torrent = m_torrents.value(infoHash);
|
||||
const QString torrentName = (torrent ? torrent->name() : QString {infoHash});
|
||||
const QString torrentName = (torrent ? torrent->name() : infoHash.toString());
|
||||
const QString currentLocation = QString::fromStdString(p->handle.status(lt::torrent_handle::query_save_path).save_path);
|
||||
const QString errorMessage = QString::fromStdString(p->message());
|
||||
LogMsg(tr("Failed to move \"%1\" from \"%2\" to \"%3\". Reason: %4.")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue