Implement gateway for adding new torrents

PR #19355.
This commit is contained in:
Vladimir Golovnev
2023-08-14 18:17:56 +03:00
committed by GitHub
parent e4313d6651
commit dcf3e97291
42 changed files with 933 additions and 639 deletions

View File

@@ -39,7 +39,6 @@
#include <QShortcut>
#include <QString>
#include "base/bittorrent/session.h"
#include "base/global.h"
#include "base/net/downloadmanager.h"
#include "base/preferences.h"
@@ -47,17 +46,17 @@
#include "base/rss/rss_feed.h"
#include "base/rss/rss_folder.h"
#include "base/rss/rss_session.h"
#include "gui/addnewtorrentdialog.h"
#include "gui/autoexpandabledialog.h"
#include "gui/interfaces/iguiapplication.h"
#include "gui/uithememanager.h"
#include "articlelistwidget.h"
#include "automatedrssdownloader.h"
#include "feedlistwidget.h"
#include "ui_rsswidget.h"
RSSWidget::RSSWidget(QWidget *parent)
: QWidget(parent)
, m_ui(new Ui::RSSWidget)
RSSWidget::RSSWidget(IGUIApplication *app, QWidget *parent)
: GUIApplicationComponent(app, parent)
, m_ui {new Ui::RSSWidget}
{
m_ui->setupUi(this);
@@ -370,13 +369,7 @@ void RSSWidget::downloadSelectedTorrents()
// Mark as read
article->markAsRead();
if (!article->torrentUrl().isEmpty())
{
if (AddNewTorrentDialog::isEnabled())
AddNewTorrentDialog::show(article->torrentUrl(), window());
else
BitTorrent::Session::instance()->addTorrent(article->torrentUrl());
}
app()->addTorrentManager()->addTorrent(article->torrentUrl());
}
}

View File

@@ -1,6 +1,6 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2017 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2017-2023 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
* Copyright (C) 2006 Arnaud Demaiziere <arnaud@qbittorrent.org>
*
@@ -32,6 +32,8 @@
#include <QWidget>
#include "gui/guiapplicationcomponent.h"
class QListWidgetItem;
class QTreeWidgetItem;
@@ -43,14 +45,14 @@ namespace Ui
class RSSWidget;
}
class RSSWidget : public QWidget
class RSSWidget final : public GUIApplicationComponent<QWidget>
{
Q_OBJECT
Q_DISABLE_COPY_MOVE(RSSWidget)
public:
RSSWidget(QWidget *parent);
~RSSWidget();
explicit RSSWidget(IGUIApplication *app, QWidget *parent = nullptr);
~RSSWidget() override;
public slots:
void deleteSelectedItems();