From 81def39d8c358587da93f2e4272ac4673933ab12 Mon Sep 17 00:00:00 2001 From: Thomas Piccirello <8296030+Piccirello@users.noreply.github.com> Date: Sat, 28 Sep 2024 00:37:36 -0700 Subject: [PATCH] WebUI: Support managing web seeds Closes #8475. PR #21055. --- src/gui/properties/propertieswidget.cpp | 20 +- src/webui/www/private/addwebseeds.html | 58 +++++ src/webui/www/private/editwebseed.html | 68 ++++++ src/webui/www/private/index.html | 6 + src/webui/www/private/scripts/dynamicTable.js | 11 +- .../www/private/scripts/prop-webseeds.js | 203 ++++++++++++------ src/webui/www/private/views/properties.html | 23 +- src/webui/www/webui.qrc | 2 + 8 files changed, 304 insertions(+), 87 deletions(-) create mode 100644 src/webui/www/private/addwebseeds.html create mode 100644 src/webui/www/private/editwebseed.html diff --git a/src/gui/properties/propertieswidget.cpp b/src/gui/properties/propertieswidget.cpp index c00feabec..664a4cf44 100644 --- a/src/gui/properties/propertieswidget.cpp +++ b/src/gui/properties/propertieswidget.cpp @@ -531,11 +531,11 @@ void PropertiesWidget::loadUrlSeeds() return; m_ui->listWebSeeds->clear(); - qDebug("Loading URL seeds"); + qDebug("Loading web seeds"); // Add url seeds for (const QUrl &urlSeed : urlSeeds) { - qDebug("Loading URL seed: %s", qUtf8Printable(urlSeed.toString())); + qDebug("Loading web seed: %s", qUtf8Printable(urlSeed.toString())); new QListWidgetItem(urlSeed.toString(), m_ui->listWebSeeds); } }); @@ -550,16 +550,16 @@ void PropertiesWidget::displayWebSeedListMenu() QMenu *menu = new QMenu(this); menu->setAttribute(Qt::WA_DeleteOnClose); - menu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_s), tr("New Web seed"), this, &PropertiesWidget::askWebSeed); + menu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_s), tr("Add web seed..."), this, &PropertiesWidget::askWebSeed); if (!rows.isEmpty()) { - menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_s, u"list-remove"_s), tr("Remove Web seed") + menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_s, u"list-remove"_s), tr("Remove web seed") , this, &PropertiesWidget::deleteSelectedUrlSeeds); menu->addSeparator(); - menu->addAction(UIThemeManager::instance()->getIcon(u"edit-copy"_s), tr("Copy Web seed URL") + menu->addAction(UIThemeManager::instance()->getIcon(u"edit-copy"_s), tr("Copy web seed URL") , this, &PropertiesWidget::copySelectedWebSeedsToClipboard); - menu->addAction(UIThemeManager::instance()->getIcon(u"edit-rename"_s), tr("Edit Web seed URL") + menu->addAction(UIThemeManager::instance()->getIcon(u"edit-rename"_s), tr("Edit web seed URL...") , this, &PropertiesWidget::editWebSeed); } @@ -607,14 +607,14 @@ void PropertiesWidget::askWebSeed() { bool ok = false; // Ask user for a new url seed - const QString urlSeed = AutoExpandableDialog::getText(this, tr("New URL seed", "New HTTP source"), - tr("New URL seed:"), QLineEdit::Normal, + const QString urlSeed = AutoExpandableDialog::getText(this, tr("Add web seed", "Add HTTP source"), + tr("Add web seed:"), QLineEdit::Normal, u"http://www."_s, &ok); if (!ok) return; qDebug("Adding %s web seed", qUtf8Printable(urlSeed)); if (!m_ui->listWebSeeds->findItems(urlSeed, Qt::MatchFixedString).empty()) { - QMessageBox::warning(this, u"qBittorrent"_s, tr("This URL seed is already in the list."), QMessageBox::Ok); + QMessageBox::warning(this, u"qBittorrent"_s, tr("This web seed is already in the list."), QMessageBox::Ok); return; } if (m_torrent) @@ -667,7 +667,7 @@ void PropertiesWidget::editWebSeed() if (!m_ui->listWebSeeds->findItems(newSeed, Qt::MatchFixedString).empty()) { QMessageBox::warning(this, u"qBittorrent"_s, - tr("This URL seed is already in the list."), + tr("This web seed is already in the list."), QMessageBox::Ok); return; } diff --git a/src/webui/www/private/addwebseeds.html b/src/webui/www/private/addwebseeds.html new file mode 100644 index 000000000..08b28bda6 --- /dev/null +++ b/src/webui/www/private/addwebseeds.html @@ -0,0 +1,58 @@ + + + + + + QBT_TR(Add web seeds)QBT_TR[CONTEXT=HttpServer] + + + + + + + +
+
+ + +
+ +
+ + + diff --git a/src/webui/www/private/editwebseed.html b/src/webui/www/private/editwebseed.html new file mode 100644 index 000000000..78b410d56 --- /dev/null +++ b/src/webui/www/private/editwebseed.html @@ -0,0 +1,68 @@ + + + + + + QBT_TR(Edit web seed)QBT_TR[CONTEXT=HttpServer] + + + + + + + +
+
+ +
+ +
+
+ +
+ + + diff --git a/src/webui/www/private/index.html b/src/webui/www/private/index.html index f8508db75..b168b81b3 100644 --- a/src/webui/www/private/index.html +++ b/src/webui/www/private/index.html @@ -244,6 +244,12 @@
  • QBT_TR(Copy IP:port)QBT_TR[CONTEXT=PeerListWidget] QBT_TR(Copy IP:port)QBT_TR[CONTEXT=PeerListWidget]
  • QBT_TR(Ban peer permanently)QBT_TR[CONTEXT=PeerListWidget] QBT_TR(Ban peer permanently)QBT_TR[CONTEXT=PeerListWidget]
  • +