mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
Properly add torrent with new tags
First, an attempt is made to add new tags to the Session. Closes #15105.
This commit is contained in:
parent
50ddfea617
commit
6070b41c9b
1 changed files with 11 additions and 10 deletions
|
@ -838,17 +838,13 @@ bool Session::hasTag(const QString &tag) const
|
||||||
|
|
||||||
bool Session::addTag(const QString &tag)
|
bool Session::addTag(const QString &tag)
|
||||||
{
|
{
|
||||||
if (!isValidTag(tag))
|
if (!isValidTag(tag) || hasTag(tag))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!hasTag(tag))
|
m_tags.insert(tag);
|
||||||
{
|
m_storedTags = m_tags.values();
|
||||||
m_tags.insert(tag);
|
emit tagAdded(tag);
|
||||||
m_storedTags = m_tags.values();
|
return true;
|
||||||
emit tagAdded(tag);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Session::removeTag(const QString &tag)
|
bool Session::removeTag(const QString &tag)
|
||||||
|
@ -2056,7 +2052,6 @@ LoadTorrentParams Session::initLoadTorrentParams(const AddTorrentParams &addTorr
|
||||||
LoadTorrentParams loadTorrentParams;
|
LoadTorrentParams loadTorrentParams;
|
||||||
|
|
||||||
loadTorrentParams.name = addTorrentParams.name;
|
loadTorrentParams.name = addTorrentParams.name;
|
||||||
loadTorrentParams.tags = addTorrentParams.tags;
|
|
||||||
loadTorrentParams.firstLastPiecePriority = addTorrentParams.firstLastPiecePriority;
|
loadTorrentParams.firstLastPiecePriority = addTorrentParams.firstLastPiecePriority;
|
||||||
loadTorrentParams.hasSeedStatus = addTorrentParams.skipChecking; // do not react on 'torrent_finished_alert' when skipping
|
loadTorrentParams.hasSeedStatus = addTorrentParams.skipChecking; // do not react on 'torrent_finished_alert' when skipping
|
||||||
loadTorrentParams.contentLayout = addTorrentParams.contentLayout.value_or(torrentContentLayout());
|
loadTorrentParams.contentLayout = addTorrentParams.contentLayout.value_or(torrentContentLayout());
|
||||||
|
@ -2081,6 +2076,12 @@ LoadTorrentParams Session::initLoadTorrentParams(const AddTorrentParams &addTorr
|
||||||
else
|
else
|
||||||
loadTorrentParams.category = addTorrentParams.category;
|
loadTorrentParams.category = addTorrentParams.category;
|
||||||
|
|
||||||
|
for (const QString &tag : addTorrentParams.tags)
|
||||||
|
{
|
||||||
|
if (hasTag(tag) || addTag(tag))
|
||||||
|
loadTorrentParams.tags.insert(tag);
|
||||||
|
}
|
||||||
|
|
||||||
return loadTorrentParams;
|
return loadTorrentParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue