persist comment change

This commit is contained in:
HamletDuFromage 2025-07-24 12:38:56 +02:00
commit b16197f246
3 changed files with 8 additions and 0 deletions

View file

@ -236,6 +236,7 @@ BitTorrent::LoadResumeDataResult BitTorrent::BencodeResumeDataStorage::loadTorre
LoadTorrentParams torrentParams; LoadTorrentParams torrentParams;
torrentParams.category = fromLTString(resumeDataRoot.dict_find_string_value("qBt-category")); torrentParams.category = fromLTString(resumeDataRoot.dict_find_string_value("qBt-category"));
torrentParams.name = fromLTString(resumeDataRoot.dict_find_string_value("qBt-name")); torrentParams.name = fromLTString(resumeDataRoot.dict_find_string_value("qBt-name"));
torrentParams.comment = fromLTString(resumeDataRoot.dict_find_string_value("qBt-comment"));
torrentParams.hasFinishedStatus = resumeDataRoot.dict_find_int_value("qBt-seedStatus"); torrentParams.hasFinishedStatus = resumeDataRoot.dict_find_int_value("qBt-seedStatus");
torrentParams.firstLastPiecePriority = resumeDataRoot.dict_find_int_value("qBt-firstLastPiecePriority"); torrentParams.firstLastPiecePriority = resumeDataRoot.dict_find_int_value("qBt-firstLastPiecePriority");
torrentParams.seedingTimeLimit = resumeDataRoot.dict_find_int_value("qBt-seedingTimeLimit", Torrent::USE_GLOBAL_SEEDING_TIME); torrentParams.seedingTimeLimit = resumeDataRoot.dict_find_int_value("qBt-seedingTimeLimit", Torrent::USE_GLOBAL_SEEDING_TIME);
@ -437,6 +438,7 @@ void BitTorrent::BencodeResumeDataStorage::Worker::store(const TorrentID &id, co
data["qBt-category"] = resumeData.category.toStdString(); data["qBt-category"] = resumeData.category.toStdString();
data["qBt-tags"] = setToEntryList(resumeData.tags); data["qBt-tags"] = setToEntryList(resumeData.tags);
data["qBt-name"] = resumeData.name.toStdString(); data["qBt-name"] = resumeData.name.toStdString();
data["qBt-comment"] = resumeData.comment.toStdString();
data["qBt-seedStatus"] = resumeData.hasFinishedStatus; data["qBt-seedStatus"] = resumeData.hasFinishedStatus;
data["qBt-contentLayout"] = Utils::String::fromEnum(resumeData.contentLayout).toStdString(); data["qBt-contentLayout"] = Utils::String::fromEnum(resumeData.contentLayout).toStdString();
data["qBt-firstLastPiecePriority"] = resumeData.firstLastPiecePriority; data["qBt-firstLastPiecePriority"] = resumeData.firstLastPiecePriority;

View file

@ -50,6 +50,7 @@ namespace BitTorrent
TagSet tags; TagSet tags;
Path savePath; Path savePath;
Path downloadPath; Path downloadPath;
QString comment;
TorrentContentLayout contentLayout = TorrentContentLayout::Original; TorrentContentLayout contentLayout = TorrentContentLayout::Original;
TorrentOperatingMode operatingMode = TorrentOperatingMode::AutoManaged; TorrentOperatingMode operatingMode = TorrentOperatingMode::AutoManaged;
bool useAutoTMM = false; bool useAutoTMM = false;

View file

@ -367,6 +367,9 @@ TorrentImpl::TorrentImpl(SessionImpl *session, const lt::torrent_handle &nativeH
} }
} }
if (!params.comment.isEmpty())
m_comment = params.comment;
setStopCondition(params.stopCondition); setStopCondition(params.stopCondition);
const auto *extensionData = static_cast<ExtensionData *>(m_ltAddTorrentParams.userdata); const auto *extensionData = static_cast<ExtensionData *>(m_ltAddTorrentParams.userdata);
@ -2210,6 +2213,7 @@ void TorrentImpl::prepareResumeData(lt::add_torrent_params params)
.tags = m_tags, .tags = m_tags,
.savePath = (!m_useAutoTMM ? m_savePath : Path()), .savePath = (!m_useAutoTMM ? m_savePath : Path()),
.downloadPath = (!m_useAutoTMM ? m_downloadPath : Path()), .downloadPath = (!m_useAutoTMM ? m_downloadPath : Path()),
.comment = m_comment,
.contentLayout = m_contentLayout, .contentLayout = m_contentLayout,
.operatingMode = m_operatingMode, .operatingMode = m_operatingMode,
.useAutoTMM = m_useAutoTMM, .useAutoTMM = m_useAutoTMM,
@ -2963,4 +2967,5 @@ QFuture<std::invoke_result_t<Func>> TorrentImpl::invokeAsync(Func &&func) const
void TorrentImpl::setComment(const QString &comment) void TorrentImpl::setComment(const QString &comment)
{ {
m_comment = comment; m_comment = comment;
deferredRequestResumeData();
} }