mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-23 00:47:21 -06:00
@@ -106,7 +106,7 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP
|
||||
setModal(true);
|
||||
#endif
|
||||
|
||||
auto session = BitTorrent::Session::instance();
|
||||
const auto *session = BitTorrent::Session::instance();
|
||||
|
||||
if (m_torrentParams.addPaused == TriStateBool::True)
|
||||
m_ui->startTorrentCheckBox->setChecked(false);
|
||||
@@ -233,7 +233,7 @@ void AddNewTorrentDialog::saveState()
|
||||
|
||||
void AddNewTorrentDialog::show(const QString &source, const BitTorrent::AddTorrentParams &inParams, QWidget *parent)
|
||||
{
|
||||
AddNewTorrentDialog *dlg = new AddNewTorrentDialog(inParams, parent);
|
||||
auto *dlg = new AddNewTorrentDialog(inParams, parent);
|
||||
|
||||
if (Net::DownloadManager::hasSupportedScheme(source)) {
|
||||
// Launch downloader
|
||||
|
||||
@@ -98,7 +98,7 @@ private:
|
||||
int indexOfSavePath(const QString &savePath);
|
||||
void loadState();
|
||||
void saveState();
|
||||
void setMetadataProgressIndicator(bool visibleIndicator, const QString &labelText = QString());
|
||||
void setMetadataProgressIndicator(bool visibleIndicator, const QString &labelText = {});
|
||||
void setupTreeview();
|
||||
void setCommentText(const QString &str) const;
|
||||
void setSavePath(const QString &newPath);
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
~AutoExpandableDialog();
|
||||
|
||||
static QString getText(QWidget *parent, const QString &title, const QString &label,
|
||||
QLineEdit::EchoMode mode = QLineEdit::Normal, const QString &text = QString(),
|
||||
QLineEdit::EchoMode mode = QLineEdit::Normal, const QString &text = {},
|
||||
bool *ok = nullptr, bool excludeExtension = false, Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -176,7 +176,7 @@ CategoryFilterModel::CategoryFilterModel(QObject *parent)
|
||||
, m_rootItem(new CategoryModelItem)
|
||||
{
|
||||
using namespace BitTorrent;
|
||||
auto session = Session::instance();
|
||||
const auto *session = Session::instance();
|
||||
|
||||
connect(session, &Session::categoryAdded, this, &CategoryFilterModel::categoryAdded);
|
||||
connect(session, &Session::categoryRemoved, this, &CategoryFilterModel::categoryRemoved);
|
||||
@@ -209,7 +209,7 @@ QVariant CategoryFilterModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid()) return {};
|
||||
|
||||
auto item = static_cast<CategoryModelItem *>(index.internalPointer());
|
||||
auto item = static_cast<const CategoryModelItem *>(index.internalPointer());
|
||||
|
||||
if ((index.column() == 0) && (role == Qt::DecorationRole)) {
|
||||
return GuiIconProvider::instance()->getIcon("inode-directory");
|
||||
@@ -384,8 +384,8 @@ void CategoryFilterModel::populate()
|
||||
{
|
||||
m_rootItem->clear();
|
||||
|
||||
auto session = BitTorrent::Session::instance();
|
||||
auto torrents = session->torrents();
|
||||
const auto *session = BitTorrent::Session::instance();
|
||||
const auto torrents = session->torrents();
|
||||
m_isSubcategoriesEnabled = session->isSubcategoriesEnabled();
|
||||
|
||||
const QString UID_ALL;
|
||||
@@ -413,7 +413,7 @@ void CategoryFilterModel::populate()
|
||||
if (!parent->hasChild(subcatName)) {
|
||||
new CategoryModelItem(
|
||||
parent, subcatName
|
||||
, std::count_if(torrents.begin(), torrents.end()
|
||||
, std::count_if(torrents.cbegin(), torrents.cend()
|
||||
, [subcat](Torrent *torrent) { return torrent->category() == subcat; }));
|
||||
}
|
||||
parent = parent->child(subcatName);
|
||||
|
||||
@@ -49,13 +49,13 @@ public:
|
||||
|
||||
static bool isSpecialItem(const QModelIndex &index);
|
||||
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = {}) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = {}) const override;
|
||||
QModelIndex parent(const QModelIndex &index) const override;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int rowCount(const QModelIndex &parent = {}) const override;
|
||||
|
||||
QModelIndex index(const QString &categoryName) const;
|
||||
QString categoryName(const QModelIndex &index) const;
|
||||
|
||||
@@ -91,7 +91,7 @@ CategoryFilterWidget::CategoryFilterWidget(QWidget *parent)
|
||||
QString CategoryFilterWidget::currentCategory() const
|
||||
{
|
||||
QModelIndex current;
|
||||
auto selectedRows = selectionModel()->selectedRows();
|
||||
const auto selectedRows = selectionModel()->selectedRows();
|
||||
if (!selectedRows.isEmpty())
|
||||
current = selectedRows.first();
|
||||
|
||||
@@ -114,7 +114,7 @@ void CategoryFilterWidget::showMenu(QPoint)
|
||||
, tr("Add category..."));
|
||||
connect(addAct, &QAction::triggered, this, &CategoryFilterWidget::addCategory);
|
||||
|
||||
auto selectedRows = selectionModel()->selectedRows();
|
||||
const auto selectedRows = selectionModel()->selectedRows();
|
||||
if (!selectedRows.empty() && !CategoryFilterModel::isSpecialItem(selectedRows.first())) {
|
||||
if (BitTorrent::Session::instance()->isSubcategoriesEnabled()) {
|
||||
QAction *addSubAct = menu.addAction(
|
||||
@@ -220,7 +220,7 @@ void CategoryFilterWidget::editCategory()
|
||||
|
||||
void CategoryFilterWidget::removeCategory()
|
||||
{
|
||||
auto selectedRows = selectionModel()->selectedRows();
|
||||
const auto selectedRows = selectionModel()->selectedRows();
|
||||
if (!selectedRows.empty() && !CategoryFilterModel::isSpecialItem(selectedRows.first())) {
|
||||
BitTorrent::Session::instance()->removeCategory(
|
||||
static_cast<CategoryFilterProxyModel *>(model())->categoryName(selectedRows.first()));
|
||||
|
||||
@@ -54,18 +54,18 @@ public:
|
||||
QList<QNetworkCookie> cookies() const;
|
||||
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = {}) const override;
|
||||
QModelIndex parent(const QModelIndex &index) const override;
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int rowCount(const QModelIndex &parent = {}) const override;
|
||||
int columnCount(const QModelIndex &parent = {}) const override;
|
||||
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
|
||||
bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
||||
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
||||
bool insertRows(int row, int count, const QModelIndex &parent = {}) override;
|
||||
bool removeRows(int row, int count, const QModelIndex &parent = {}) override;
|
||||
|
||||
private:
|
||||
mutable QList<QNetworkCookie> m_cookies;
|
||||
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
bool isExecutionLogEnabled() const;
|
||||
void setExecutionLogEnabled(bool value);
|
||||
int executionLogMsgTypes() const;
|
||||
void setExecutionLogMsgTypes(const int value);
|
||||
void setExecutionLogMsgTypes(int value);
|
||||
|
||||
// Notifications properties
|
||||
bool isNotificationsEnabled() const;
|
||||
@@ -209,7 +209,7 @@ private:
|
||||
bool event(QEvent *e) override;
|
||||
void displayRSSTab(bool enable);
|
||||
void displaySearchTab(bool enable);
|
||||
void createTorrentTriggered(const QString &path = QString());
|
||||
void createTorrentTriggered(const QString &path = {});
|
||||
void showStatusBar(bool show);
|
||||
|
||||
Ui::MainWindow *m_ui;
|
||||
|
||||
@@ -846,7 +846,7 @@ void OptionsDialog::loadOptions()
|
||||
m_ui->spinRSSRefreshInterval->setValue(RSS::Session::instance()->refreshInterval());
|
||||
m_ui->spinRSSMaxArticlesPerFeed->setValue(RSS::Session::instance()->maxArticlesPerFeed());
|
||||
|
||||
auto session = BitTorrent::Session::instance();
|
||||
const auto *session = BitTorrent::Session::instance();
|
||||
|
||||
// Downloads preferences
|
||||
m_ui->checkAdditionDialog->setChecked(AddNewTorrentDialog::isEnabled());
|
||||
@@ -974,7 +974,7 @@ void OptionsDialog::loadOptions()
|
||||
m_ui->spinMaxUploadsPerTorrent->setEnabled(false);
|
||||
}
|
||||
|
||||
auto proxyConfigManager = Net::ProxyConfigurationManager::instance();
|
||||
const auto *proxyConfigManager = Net::ProxyConfigurationManager::instance();
|
||||
Net::ProxyConfiguration proxyConf = proxyConfigManager->proxyConfiguration();
|
||||
using Net::ProxyType;
|
||||
bool useProxyAuth = false;
|
||||
|
||||
@@ -118,7 +118,7 @@ PiecesBar::PiecesBar(QWidget *parent)
|
||||
setMouseTracking(true);
|
||||
}
|
||||
|
||||
void PiecesBar::setTorrent(BitTorrent::TorrentHandle *torrent)
|
||||
void PiecesBar::setTorrent(const BitTorrent::TorrentHandle *torrent)
|
||||
{
|
||||
m_torrent = torrent;
|
||||
if (!m_torrent)
|
||||
|
||||
@@ -50,7 +50,7 @@ class PiecesBar : public QWidget
|
||||
public:
|
||||
explicit PiecesBar(QWidget *parent = nullptr);
|
||||
|
||||
void setTorrent(BitTorrent::TorrentHandle *torrent);
|
||||
void setTorrent(const BitTorrent::TorrentHandle *torrent);
|
||||
void setColors(const QColor &background, const QColor &border, const QColor &complete);
|
||||
|
||||
virtual void clear();
|
||||
|
||||
@@ -213,7 +213,7 @@ void AutomatedRssDownloader::updateFeedList()
|
||||
bool anyEnabled = false;
|
||||
|
||||
for (const QListWidgetItem *ruleItem : asConst(selection)) {
|
||||
auto rule = RSS::AutoDownloader::instance()->ruleByName(ruleItem->text());
|
||||
const auto rule = RSS::AutoDownloader::instance()->ruleByName(ruleItem->text());
|
||||
if (rule.feedURLs().contains(feedURL))
|
||||
anyEnabled = true;
|
||||
else
|
||||
|
||||
@@ -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 = {});
|
||||
|
||||
//! \brief Sets parameters for filtering by size
|
||||
//! \param minSize minimal size in bytes
|
||||
|
||||
@@ -134,7 +134,7 @@ SearchWidget::SearchWidget(MainWindow *mainWindow)
|
||||
connect(m_tabStatusChangedMapper, static_cast<void (QSignalMapper::*)(QWidget *)>(&QSignalMapper::mapped)
|
||||
, this, &SearchWidget::tabStatusChanged);
|
||||
|
||||
auto *searchManager = SearchPluginManager::instance();
|
||||
const auto *searchManager = SearchPluginManager::instance();
|
||||
const auto onPluginChanged = [this]()
|
||||
{
|
||||
fillPluginComboBox();
|
||||
|
||||
@@ -92,7 +92,7 @@ TagFilterModel::TagFilterModel(QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
{
|
||||
using Session = BitTorrent::Session;
|
||||
auto session = Session::instance();
|
||||
const auto *session = Session::instance();
|
||||
|
||||
connect(session, &Session::tagAdded, this, &TagFilterModel::tagAdded);
|
||||
connect(session, &Session::tagRemoved, this, &TagFilterModel::tagRemoved);
|
||||
@@ -265,18 +265,18 @@ void TagFilterModel::populate()
|
||||
{
|
||||
using Torrent = BitTorrent::TorrentHandle;
|
||||
|
||||
auto session = BitTorrent::Session::instance();
|
||||
auto torrents = session->torrents();
|
||||
const auto *session = BitTorrent::Session::instance();
|
||||
const auto torrents = session->torrents();
|
||||
|
||||
// All torrents
|
||||
addToModel(getSpecialAllTag(), torrents.count());
|
||||
|
||||
const int untaggedCount = std::count_if(torrents.begin(), torrents.end(),
|
||||
const int untaggedCount = std::count_if(torrents.cbegin(), torrents.cend(),
|
||||
[](Torrent *torrent) { return torrent->tags().isEmpty(); });
|
||||
addToModel(getSpecialUntaggedTag(), untaggedCount);
|
||||
|
||||
for (const QString &tag : asConst(session->tags())) {
|
||||
const int count = std::count_if(torrents.begin(), torrents.end(),
|
||||
const int count = std::count_if(torrents.cbegin(), torrents.cend(),
|
||||
[tag](Torrent *torrent) { return torrent->hasTag(tag); });
|
||||
addToModel(tag, count);
|
||||
}
|
||||
|
||||
@@ -54,8 +54,8 @@ public:
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = {}) const override;
|
||||
int rowCount(const QModelIndex &parent = {}) const override;
|
||||
|
||||
QModelIndex index(const QString &tag) const;
|
||||
QString tag(const QModelIndex &index) const;
|
||||
|
||||
@@ -90,7 +90,7 @@ TagFilterWidget::TagFilterWidget(QWidget *parent)
|
||||
QString TagFilterWidget::currentTag() const
|
||||
{
|
||||
QModelIndex current;
|
||||
auto selectedRows = selectionModel()->selectedRows();
|
||||
const auto selectedRows = selectionModel()->selectedRows();
|
||||
if (!selectedRows.isEmpty())
|
||||
current = selectedRows.first();
|
||||
|
||||
@@ -113,7 +113,7 @@ void TagFilterWidget::showMenu(QPoint)
|
||||
, tr("Add tag..."));
|
||||
connect(addAct, &QAction::triggered, this, &TagFilterWidget::addTag);
|
||||
|
||||
auto selectedRows = selectionModel()->selectedRows();
|
||||
const auto selectedRows = selectionModel()->selectedRows();
|
||||
if (!selectedRows.empty() && !TagFilterModel::isSpecialItem(selectedRows.first())) {
|
||||
QAction *removeAct = menu.addAction(
|
||||
GuiIconProvider::instance()->getIcon("list-remove")
|
||||
@@ -212,7 +212,7 @@ void TagFilterWidget::addTag()
|
||||
|
||||
void TagFilterWidget::removeTag()
|
||||
{
|
||||
auto selectedRows = selectionModel()->selectedRows();
|
||||
const auto selectedRows = selectionModel()->selectedRows();
|
||||
if (!selectedRows.empty() && !TagFilterModel::isSpecialItem(selectedRows.first())) {
|
||||
BitTorrent::Session::instance()->removeTag(
|
||||
static_cast<TagFilterProxyModel *>(model())->tag(selectedRows.first()));
|
||||
|
||||
@@ -41,7 +41,7 @@ class TorrentCategoryDialog : public QDialog
|
||||
Q_DISABLE_COPY(TorrentCategoryDialog)
|
||||
|
||||
public:
|
||||
static QString createCategory(QWidget *parent, const QString &parentCategoryName = QString());
|
||||
static QString createCategory(QWidget *parent, const QString &parentCategoryName = {});
|
||||
static void editCategory(QWidget *parent, const QString &categoryName);
|
||||
|
||||
explicit TorrentCategoryDialog(QWidget *parent = nullptr);
|
||||
|
||||
@@ -53,16 +53,16 @@ public:
|
||||
void updateFilesAvailability(const QVector<qreal> &fa);
|
||||
QVector<int> getFilePriorities() const;
|
||||
bool allFiltered() const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = {}) const override;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||
TorrentContentModelItem::ItemType itemType(const QModelIndex &index) const;
|
||||
int getFileIndex(const QModelIndex &index);
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = {}) const override;
|
||||
QModelIndex parent(const QModelIndex &index) const override;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int rowCount(const QModelIndex &parent = {}) const override;
|
||||
void clear();
|
||||
void setupModelData(const BitTorrent::TorrentInfo &info);
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ class TorrentCreatorDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TorrentCreatorDialog(QWidget *parent = nullptr, const QString &defaultPath = QString());
|
||||
TorrentCreatorDialog(QWidget *parent = nullptr, const QString &defaultPath = {});
|
||||
~TorrentCreatorDialog() override;
|
||||
void updateInputPath(const QString &path);
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ QVariant TransferListModel::headerData(int section, Qt::Orientation orientation,
|
||||
case TR_RATIO:
|
||||
case TR_PRIORITY:
|
||||
case TR_LAST_ACTIVITY:
|
||||
return {Qt::AlignRight | Qt::AlignVCenter};
|
||||
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||
default:
|
||||
return QAbstractListModel::headerData(section, orientation, role);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
|
||||
explicit TransferListModel(QObject *parent = nullptr);
|
||||
|
||||
int rowCount(const QModelIndex &index = QModelIndex()) const override;
|
||||
int rowCount(const QModelIndex &index = {}) const override;
|
||||
int columnCount(const QModelIndex &parent=QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
private:
|
||||
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
|
||||
bool lowerPositionThan(const QModelIndex &left, const QModelIndex &right) const;
|
||||
bool dateLessThan(const int dateColumn, const QModelIndex &left, const QModelIndex &right, bool sortInvalidInBottom) const;
|
||||
bool dateLessThan(int dateColumn, const QModelIndex &left, const QModelIndex &right, bool sortInvalidInBottom) const;
|
||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
||||
bool matchFilter(int sourceRow, const QModelIndex &sourceParent) const;
|
||||
|
||||
|
||||
@@ -49,9 +49,9 @@ namespace Utils
|
||||
return (size * screenScalingFactor(widget));
|
||||
}
|
||||
|
||||
QPixmap scaledPixmap(const QIcon &icon, const QWidget *widget, const int height);
|
||||
QPixmap scaledPixmap(const QString &path, const QWidget *widget, const int height = 0);
|
||||
QPixmap scaledPixmapSvg(const QString &path, const QWidget *widget, const int baseHeight);
|
||||
QPixmap scaledPixmap(const QIcon &icon, const QWidget *widget, int height);
|
||||
QPixmap scaledPixmap(const QString &path, const QWidget *widget, int height = 0);
|
||||
QPixmap scaledPixmapSvg(const QString &path, const QWidget *widget, int baseHeight);
|
||||
QSize smallIconSize(const QWidget *widget = nullptr);
|
||||
QSize mediumIconSize(const QWidget *widget = nullptr);
|
||||
QSize largeIconSize(const QWidget *widget = nullptr);
|
||||
|
||||
Reference in New Issue
Block a user