mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
parent
26ff9150a2
commit
4f5302adf8
@ -217,7 +217,7 @@ void SearchJobWidget::downloadTorrents()
|
|||||||
downloadTorrent(rowIndex);
|
downloadTorrent(rowIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchJobWidget::openTorrentPages()
|
void SearchJobWidget::openTorrentPages() const
|
||||||
{
|
{
|
||||||
const QModelIndexList rows {m_ui->resultsBrowser->selectionModel()->selectedRows()};
|
const QModelIndexList rows {m_ui->resultsBrowser->selectionModel()->selectedRows()};
|
||||||
for (const QModelIndex &rowIndex : rows) {
|
for (const QModelIndex &rowIndex : rows) {
|
||||||
@ -228,21 +228,35 @@ void SearchJobWidget::openTorrentPages()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchJobWidget::copyTorrentURLs()
|
void SearchJobWidget::copyTorrentURLs() const
|
||||||
{
|
{
|
||||||
const QModelIndexList rows {m_ui->resultsBrowser->selectionModel()->selectedRows()};
|
copyField(SearchSortModel::DESC_LINK);
|
||||||
QStringList urls;
|
|
||||||
for (const QModelIndex &rowIndex : rows) {
|
|
||||||
const QString descrLink = m_proxyModel->data(
|
|
||||||
m_proxyModel->index(rowIndex.row(), SearchSortModel::DESC_LINK)).toString();
|
|
||||||
if (!descrLink.isEmpty())
|
|
||||||
urls << descrLink;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!urls.empty()) {
|
void SearchJobWidget::copyTorrentDownloadLinks() const
|
||||||
QClipboard *clipboard = QApplication::clipboard();
|
{
|
||||||
clipboard->setText(urls.join('\n'));
|
copyField(SearchSortModel::DL_LINK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SearchJobWidget::copyTorrentNames() const
|
||||||
|
{
|
||||||
|
copyField(SearchSortModel::NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SearchJobWidget::copyField(const int column) const
|
||||||
|
{
|
||||||
|
const QModelIndexList rows {m_ui->resultsBrowser->selectionModel()->selectedRows()};
|
||||||
|
QStringList list;
|
||||||
|
|
||||||
|
for (const QModelIndex &rowIndex : rows) {
|
||||||
|
const QString field = m_proxyModel->data(
|
||||||
|
m_proxyModel->index(rowIndex.row(), column)).toString();
|
||||||
|
if (!field.isEmpty())
|
||||||
|
list << field;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!list.empty())
|
||||||
|
QApplication::clipboard()->setText(list.join('\n'));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchJobWidget::setStatus(Status value)
|
void SearchJobWidget::setStatus(Status value)
|
||||||
@ -385,8 +399,20 @@ void SearchJobWidget::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
GuiIconProvider::instance()->getIcon("application-x-mswinurl"), tr("Open description page"));
|
GuiIconProvider::instance()->getIcon("application-x-mswinurl"), tr("Open description page"));
|
||||||
connect(openDescriptionAction, &QAction::triggered, this, &SearchJobWidget::openTorrentPages);
|
connect(openDescriptionAction, &QAction::triggered, this, &SearchJobWidget::openTorrentPages);
|
||||||
|
|
||||||
const QAction *copyDescriptionAction = menu->addAction(
|
QMenu *copySubMenu = menu->addMenu(
|
||||||
GuiIconProvider::instance()->getIcon("edit-copy"), tr("Copy description page URL"));
|
GuiIconProvider::instance()->getIcon("edit-copy"), tr("Copy"));
|
||||||
|
|
||||||
|
const QAction *copyNamesAction = copySubMenu->addAction(
|
||||||
|
GuiIconProvider::instance()->getIcon("edit-copy"), tr("Name"));
|
||||||
|
connect(copyNamesAction, &QAction::triggered, this, &SearchJobWidget::copyTorrentNames);
|
||||||
|
|
||||||
|
const QAction *copyDownloadLinkAction = copySubMenu->addAction(
|
||||||
|
GuiIconProvider::instance()->getIcon("edit-copy"), tr("Download link"));
|
||||||
|
connect(copyDownloadLinkAction, &QAction::triggered
|
||||||
|
, this, &SearchJobWidget::copyTorrentDownloadLinks);
|
||||||
|
|
||||||
|
const QAction *copyDescriptionAction = copySubMenu->addAction(
|
||||||
|
GuiIconProvider::instance()->getIcon("edit-copy"), tr("Description page URL"));
|
||||||
connect(copyDescriptionAction, &QAction::triggered, this, &SearchJobWidget::copyTorrentURLs);
|
connect(copyDescriptionAction, &QAction::triggered, this, &SearchJobWidget::copyTorrentURLs);
|
||||||
|
|
||||||
menu->popup(event->globalPos());
|
menu->popup(event->globalPos());
|
||||||
|
@ -82,10 +82,6 @@ public:
|
|||||||
|
|
||||||
void cancelSearch();
|
void cancelSearch();
|
||||||
|
|
||||||
void downloadTorrents();
|
|
||||||
void openTorrentPages();
|
|
||||||
void copyTorrentURLs();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void resultsCountUpdated();
|
void resultsCountUpdated();
|
||||||
void statusChanged();
|
void statusChanged();
|
||||||
@ -114,6 +110,13 @@ private:
|
|||||||
QHeaderView *header() const;
|
QHeaderView *header() const;
|
||||||
void setRowColor(int row, const QColor &color);
|
void setRowColor(int row, const QColor &color);
|
||||||
|
|
||||||
|
void downloadTorrents();
|
||||||
|
void openTorrentPages() const;
|
||||||
|
void copyTorrentURLs() const;
|
||||||
|
void copyTorrentDownloadLinks() const;
|
||||||
|
void copyTorrentNames() const;
|
||||||
|
void copyField(int column) const;
|
||||||
|
|
||||||
static QString statusText(Status st);
|
static QString statusText(Status st);
|
||||||
static CachedSettingValue<NameFilteringMode> &nameFilteringModeSetting();
|
static CachedSettingValue<NameFilteringMode> &nameFilteringModeSetting();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user