Implement torrent tags editing dialog

PR #18797.
This commit is contained in:
Vladimir Golovnev
2023-04-03 10:36:28 +03:00
committed by GitHub
parent b55d4b1733
commit d40be79c69
11 changed files with 615 additions and 4 deletions

View File

@@ -60,6 +60,7 @@
#include "base/utils/misc.h"
#include "lineedit.h"
#include "raisedmessagebox.h"
#include "torrenttagsdialog.h"
#include "ui_addnewtorrentdialog.h"
#include "uithememanager.h"
@@ -368,10 +369,23 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP
for (const QString &category : asConst(categories))
{
if (category != defaultCategory && category != m_torrentParams.category)
if ((category != defaultCategory) && (category != m_torrentParams.category))
m_ui->categoryComboBox->addItem(category);
}
m_ui->tagsLineEdit->setText(m_torrentParams.tags.join(u", "_qs));
connect(m_ui->tagsEditButton, &QAbstractButton::clicked, this, [this]
{
auto *dlg = new TorrentTagsDialog(m_torrentParams.tags, this);
dlg->setAttribute(Qt::WA_DeleteOnClose);
connect(dlg, &TorrentTagsDialog::accepted, this, [this, dlg]
{
m_torrentParams.tags = dlg->tags();
m_ui->tagsLineEdit->setText(m_torrentParams.tags.join(u", "_qs));
});
dlg->open();
});
// Torrent content filtering
m_filterLine->setPlaceholderText(tr("Filter files..."));
m_filterLine->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);