Introduce helper function to join values as string

PR #20130.
This commit is contained in:
Chocobo1
2023-12-19 00:08:37 +08:00
committed by GitHub
parent 9d90141c29
commit 073ca4267c
17 changed files with 188 additions and 77 deletions

View File

@@ -854,7 +854,7 @@ namespace
query.bindValue(DB_COLUMN_NAME.placeholder, m_resumeData.name);
query.bindValue(DB_COLUMN_CATEGORY.placeholder, m_resumeData.category);
query.bindValue(DB_COLUMN_TAGS.placeholder, (m_resumeData.tags.isEmpty()
? QString() : QStringList(m_resumeData.tags.cbegin(), m_resumeData.tags.cend()).join(u","_s)));
? QString() : Utils::String::joinIntoString(m_resumeData.tags, u","_s)));
query.bindValue(DB_COLUMN_CONTENT_LAYOUT.placeholder, Utils::String::fromEnum(m_resumeData.contentLayout));
query.bindValue(DB_COLUMN_RATIO_LIMIT.placeholder, static_cast<int>(m_resumeData.ratioLimit * 1000));
query.bindValue(DB_COLUMN_SEEDING_TIME_LIMIT.placeholder, m_resumeData.seedingTimeLimit);

View File

@@ -552,8 +552,11 @@ SessionImpl::SessionImpl(QObject *parent)
}
const QStringList storedTags = m_storedTags.get();
m_tags.insert(storedTags.cbegin(), storedTags.cend());
std::erase_if(m_tags, [](const Tag &tag) { return !tag.isValid(); });
for (const QString &tagStr : storedTags)
{
if (const Tag tag {tagStr}; tag.isValid())
m_tags.insert(tag);
}
updateSeedingLimitTimer();
populateAdditionalTrackers();