mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-03 06:02:29 -06:00
@@ -25,8 +25,6 @@
|
||||
* modify file(s), you may extend this exception to your version of the file(s),
|
||||
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||
* exception statement from your version.
|
||||
*
|
||||
* Contact : chris@qbittorrent.org
|
||||
*/
|
||||
|
||||
#include "pluginselectdlg.h"
|
||||
@@ -41,11 +39,11 @@
|
||||
#include <QMimeData>
|
||||
#include <QTableView>
|
||||
|
||||
#include "autoexpandabledialog.h"
|
||||
#include "base/net/downloadhandler.h"
|
||||
#include "base/net/downloadmanager.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "autoexpandabledialog.h"
|
||||
#include "guiiconprovider.h"
|
||||
#include "pluginsourcedlg.h"
|
||||
#include "searchwidget.h"
|
||||
@@ -252,7 +250,7 @@ QList<QTreeWidgetItem*> PluginSelectDlg::findItemsWithUrl(QString url)
|
||||
return res;
|
||||
}
|
||||
|
||||
QTreeWidgetItem* PluginSelectDlg::findItemWithID(QString id)
|
||||
QTreeWidgetItem *PluginSelectDlg::findItemWithID(QString id)
|
||||
{
|
||||
for (int i = 0; i < m_ui->pluginsTree->topLevelItemCount(); ++i) {
|
||||
QTreeWidgetItem *item = m_ui->pluginsTree->topLevelItem(i);
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
* modify file(s), you may extend this exception to your version of the file(s),
|
||||
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||
* exception statement from your version.
|
||||
*
|
||||
* Contact : chris@qbittorrent.org
|
||||
*/
|
||||
|
||||
#ifndef PLUGINSELECTDLG_H
|
||||
@@ -45,7 +43,7 @@ namespace Ui
|
||||
class PluginSelectDlg;
|
||||
}
|
||||
|
||||
class PluginSelectDlg: public QDialog
|
||||
class PluginSelectDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -54,7 +52,7 @@ public:
|
||||
~PluginSelectDlg();
|
||||
|
||||
QList<QTreeWidgetItem*> findItemsWithUrl(QString url);
|
||||
QTreeWidgetItem* findItemWithID(QString id);
|
||||
QTreeWidgetItem *findItemWithID(QString id);
|
||||
|
||||
protected:
|
||||
void dropEvent(QDropEvent *event);
|
||||
@@ -67,7 +65,7 @@ private slots:
|
||||
void on_closeButton_clicked();
|
||||
void togglePluginState(QTreeWidgetItem*, int);
|
||||
void setRowColor(int row, QString color);
|
||||
void displayContextMenu(const QPoint& pos);
|
||||
void displayContextMenu(const QPoint &pos);
|
||||
void enableSelection(bool enable);
|
||||
void askForLocalPlugin();
|
||||
void askForPluginUrl();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2006 Christophe Dumez
|
||||
* Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -24,8 +24,6 @@
|
||||
* modify file(s), you may extend this exception to your version of the file(s),
|
||||
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||
* exception statement from your version.
|
||||
*
|
||||
* Contact : chris@qbittorrent.org
|
||||
*/
|
||||
|
||||
#include "pluginsourcedlg.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2006 Christophe Dumez
|
||||
* Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -24,8 +24,6 @@
|
||||
* modify file(s), you may extend this exception to your version of the file(s),
|
||||
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||
* exception statement from your version.
|
||||
*
|
||||
* Contact : chris@qbittorrent.org
|
||||
*/
|
||||
|
||||
#ifndef PLUGINSOURCEDLG_H
|
||||
@@ -38,7 +36,7 @@ namespace Ui
|
||||
class PluginSourceDlg;
|
||||
}
|
||||
|
||||
class PluginSourceDlg: public QDialog
|
||||
class PluginSourceDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2006 Christophe Dumez
|
||||
* Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -24,8 +24,6 @@
|
||||
* modify file(s), you may extend this exception to your version of the file(s),
|
||||
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||
* exception statement from your version.
|
||||
*
|
||||
* Contact : chris@qbittorrent.org
|
||||
*/
|
||||
|
||||
#ifndef SEARCHLISTDELEGATE_H
|
||||
@@ -33,7 +31,7 @@
|
||||
|
||||
#include <QItemDelegate>
|
||||
|
||||
class SearchListDelegate: public QItemDelegate
|
||||
class SearchListDelegate : public QItemDelegate
|
||||
{
|
||||
public:
|
||||
explicit SearchListDelegate(QObject *parent);
|
||||
@@ -42,4 +40,4 @@ public:
|
||||
QWidget *createEditor(QWidget *, const QStyleOptionViewItem &, const QModelIndex &) const override;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // SEARCHLISTDELEGATE_H
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2013 sledgehammer999 <hammered999@gmail.com>
|
||||
* Copyright (C) 2013 sledgehammer999 <sledgehammer999@qbittorrent.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -123,10 +123,10 @@ bool SearchSortModel::lessThan(const QModelIndex &left, const QModelIndex &right
|
||||
|
||||
bool SearchSortModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
|
||||
{
|
||||
const QAbstractItemModel* const sourceModel = this->sourceModel();
|
||||
const QAbstractItemModel *const sourceModel = this->sourceModel();
|
||||
if (m_isNameFilterEnabled && !m_searchTerm.isEmpty()) {
|
||||
QString name = sourceModel->data(sourceModel->index(sourceRow, NAME, sourceParent)).toString();
|
||||
for (const QString& word: m_searchTermWords) {
|
||||
for (const QString &word: m_searchTermWords) {
|
||||
int i = name.indexOf(word, 0, Qt::CaseInsensitive);
|
||||
if (i == -1) {
|
||||
return false;
|
||||
@@ -134,26 +134,26 @@ bool SearchSortModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceP
|
||||
}
|
||||
}
|
||||
|
||||
if (m_minSize > 0 || m_maxSize >= 0) {
|
||||
if ((m_minSize > 0) || (m_maxSize >= 0)) {
|
||||
qlonglong size = sourceModel->data(sourceModel->index(sourceRow, SIZE, sourceParent)).toLongLong();
|
||||
if ((m_minSize > 0 && size < m_minSize)
|
||||
|| (m_maxSize > 0 && size > m_maxSize)) {
|
||||
if (((m_minSize > 0) && (size < m_minSize))
|
||||
|| ((m_maxSize > 0) && (size > m_maxSize))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_minSeeds > 0 || m_maxSeeds >= 0) {
|
||||
if ((m_minSeeds > 0) || (m_maxSeeds >= 0)) {
|
||||
int seeds = sourceModel->data(sourceModel->index(sourceRow, SEEDS, sourceParent)).toInt();
|
||||
if ((m_minSeeds > 0 && seeds < m_minSeeds)
|
||||
|| (m_maxSeeds > 0 && seeds > m_maxSeeds)) {
|
||||
if (((m_minSeeds > 0) && (seeds < m_minSeeds))
|
||||
|| ((m_maxSeeds > 0) && (seeds > m_maxSeeds))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_minLeeches > 0 || m_maxLeeches >= 0) {
|
||||
if ((m_minLeeches > 0) || (m_maxLeeches >= 0)) {
|
||||
int leeches = sourceModel->data(sourceModel->index(sourceRow, LEECHES, sourceParent)).toInt();
|
||||
if ((m_minLeeches > 0 && leeches < m_minLeeches)
|
||||
|| (m_maxLeeches > 0 && leeches > m_maxLeeches)) {
|
||||
if (((m_minLeeches > 0) && (leeches < m_minLeeches))
|
||||
|| ((m_maxLeeches > 0) && (leeches > m_maxLeeches))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2013 sledgehammer999 <hammered999@gmail.com>
|
||||
* Copyright (C) 2013 sledgehammer999 <sledgehammer999@qbittorrent.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -33,7 +33,7 @@
|
||||
#include <QStringList>
|
||||
#include "base/utils/string.h"
|
||||
|
||||
class SearchSortModel: public QSortFilterProxyModel
|
||||
class SearchSortModel : public QSortFilterProxyModel
|
||||
{
|
||||
using base = QSortFilterProxyModel;
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
explicit SearchSortModel(QObject *parent = nullptr);
|
||||
|
||||
void enableNameFilter(bool enabled);
|
||||
void setNameFilter(const QString& searchTerm = QString());
|
||||
void setNameFilter(const QString &searchTerm = QString());
|
||||
|
||||
//! \brief Sets parameters for filtering by size
|
||||
//! \param minSize minimal size in bytes
|
||||
|
||||
@@ -102,7 +102,7 @@ SearchTab::SearchTab(SearchHandler *searchHandler, QWidget *parent)
|
||||
m_ui->resultsBrowser->setAllColumnsShowFocus(true);
|
||||
m_ui->resultsBrowser->setSortingEnabled(true);
|
||||
|
||||
//Ensure that at least one column is visible at all times
|
||||
// Ensure that at least one column is visible at all times
|
||||
bool atLeastOne = false;
|
||||
for (unsigned int i = 0; i < SearchSortModel::DL_LINK; i++) {
|
||||
if (!m_ui->resultsBrowser->isColumnHidden(i)) {
|
||||
@@ -112,9 +112,9 @@ SearchTab::SearchTab(SearchHandler *searchHandler, QWidget *parent)
|
||||
}
|
||||
if (!atLeastOne)
|
||||
m_ui->resultsBrowser->setColumnHidden(SearchSortModel::NAME, false);
|
||||
//To also mitigate the above issue, we have to resize each column when
|
||||
//its size is 0, because explicitly 'showing' the column isn't enough
|
||||
//in the above scenario.
|
||||
// To also mitigate the above issue, we have to resize each column when
|
||||
// its size is 0, because explicitly 'showing' the column isn't enough
|
||||
// in the above scenario.
|
||||
for (unsigned int i = 0; i < SearchSortModel::DL_LINK; i++)
|
||||
if ((m_ui->resultsBrowser->columnWidth(i) <= 0) && !m_ui->resultsBrowser->isColumnHidden(i))
|
||||
m_ui->resultsBrowser->resizeColumnToContents(i);
|
||||
@@ -229,7 +229,7 @@ void SearchTab::copyTorrentURLs()
|
||||
|
||||
if (!urls.empty()) {
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
clipboard->setText(urls.join("\n"));
|
||||
clipboard->setText(urls.join('\n'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,7 +327,7 @@ void SearchTab::fillFilterComboBoxes()
|
||||
|
||||
QVariant selectedMode = static_cast<int>(nameFilteringModeSetting().value());
|
||||
int index = m_ui->filterMode->findData(selectedMode);
|
||||
m_ui->filterMode->setCurrentIndex(index == -1 ? 0 : index);
|
||||
m_ui->filterMode->setCurrentIndex((index == -1) ? 0 : index);
|
||||
}
|
||||
|
||||
QString SearchTab::statusText(SearchTab::Status st)
|
||||
|
||||
@@ -34,9 +34,9 @@
|
||||
#define ENGINE_URL_COLUMN 4
|
||||
#define URL_COLUMN 5
|
||||
|
||||
class QHeaderView;
|
||||
class QLabel;
|
||||
class QModelIndex;
|
||||
class QHeaderView;
|
||||
class QStandardItem;
|
||||
class QStandardItemModel;
|
||||
class QVBoxLayout;
|
||||
@@ -44,8 +44,8 @@ class QVBoxLayout;
|
||||
template <typename T> class CachedSettingValue;
|
||||
|
||||
class SearchHandler;
|
||||
class SearchSortModel;
|
||||
class SearchListDelegate;
|
||||
class SearchSortModel;
|
||||
struct SearchResult;
|
||||
|
||||
namespace Ui
|
||||
@@ -110,7 +110,7 @@ private:
|
||||
void setRowColor(int row, const QColor &color);
|
||||
|
||||
static QString statusText(Status st);
|
||||
static CachedSettingValue<NameFilteringMode>& nameFilteringModeSetting();
|
||||
static CachedSettingValue<NameFilteringMode> &nameFilteringModeSetting();
|
||||
|
||||
Ui::SearchTab *m_ui;
|
||||
SearchHandler *m_searchHandler;
|
||||
|
||||
@@ -254,7 +254,7 @@ void SearchWidget::tabChanged(int index)
|
||||
{
|
||||
// when we switch from a tab that is not empty to another that is empty
|
||||
// the download button doesn't have to be available
|
||||
m_currentSearchTab = (index < 0 ? nullptr : m_allTabs.at(m_ui->tabWidget->currentIndex()));
|
||||
m_currentSearchTab = ((index < 0) ? nullptr : m_allTabs.at(m_ui->tabWidget->currentIndex()));
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
@@ -308,10 +308,14 @@ void SearchWidget::on_searchButton_clicked()
|
||||
}
|
||||
|
||||
QStringList plugins;
|
||||
if (selectedPlugin() == "all") plugins = SearchPluginManager::instance()->allPlugins();
|
||||
else if (selectedPlugin() == "enabled") plugins = SearchPluginManager::instance()->enabledPlugins();
|
||||
else if (selectedPlugin() == "multi") plugins = SearchPluginManager::instance()->enabledPlugins();
|
||||
else plugins << selectedPlugin();
|
||||
if (selectedPlugin() == "all")
|
||||
plugins = SearchPluginManager::instance()->allPlugins();
|
||||
else if (selectedPlugin() == "enabled")
|
||||
plugins = SearchPluginManager::instance()->enabledPlugins();
|
||||
else if (selectedPlugin() == "multi")
|
||||
plugins = SearchPluginManager::instance()->enabledPlugins();
|
||||
else
|
||||
plugins << selectedPlugin();
|
||||
|
||||
qDebug("Search with category: %s", qUtf8Printable(selectedCategory()));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user