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

@@ -33,6 +33,7 @@
#include "base/bittorrent/session.h"
#include "base/bittorrent/torrent.h"
#include "base/utils/compare.h"
#include "base/utils/string.h"
#include "flowlayout.h"
#include "fspathedit.h"
#include "torrenttagsdialog.h"
@@ -112,7 +113,7 @@ AddTorrentParamsWidget::AddTorrentParamsWidget(BitTorrent::AddTorrentParams addT
connect(dlg, &TorrentTagsDialog::accepted, this, [this, dlg]
{
m_addTorrentParams.tags = dlg->tags();
m_ui->tagsLineEdit->setText(QStringList(m_addTorrentParams.tags.cbegin(), m_addTorrentParams.tags.cend()).join(u", "_s));
m_ui->tagsLineEdit->setText(Utils::String::joinIntoString(m_addTorrentParams.tags, u", "_s));
});
dlg->open();
});
@@ -230,7 +231,7 @@ void AddTorrentParamsWidget::populate()
m_addTorrentParams.stopCondition = data.value<BitTorrent::Torrent::StopCondition>();
});
m_ui->tagsLineEdit->setText(QStringList(m_addTorrentParams.tags.cbegin(), m_addTorrentParams.tags.cend()).join(u", "_s));
m_ui->tagsLineEdit->setText(Utils::String::joinIntoString(m_addTorrentParams.tags, u", "_s));
m_ui->startTorrentComboBox->disconnect(this);
m_ui->startTorrentComboBox->setCurrentIndex(m_addTorrentParams.addPaused