mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 12:34:19 +00:00
Add pointer qualifications to auto
-typed variables
This commit is contained in:
parent
8c9b6e2f2d
commit
e408973ee6
@ -1651,7 +1651,7 @@ lt::settings_pack SessionImpl::loadLTSettings() const
|
||||
settingsPack.set_int(lt::settings_pack::proxy_type, lt::settings_pack::none);
|
||||
if (Preferences::instance()->useProxyForBT())
|
||||
{
|
||||
const auto proxyManager = Net::ProxyConfigurationManager::instance();
|
||||
const auto *proxyManager = Net::ProxyConfigurationManager::instance();
|
||||
const Net::ProxyConfiguration proxyConfig = proxyManager->proxyConfiguration();
|
||||
|
||||
switch (proxyConfig.type)
|
||||
@ -5229,7 +5229,7 @@ void SessionImpl::handleAddTorrentAlerts(const std::vector<lt::alert *> &alerts)
|
||||
if (a->type() != lt::add_torrent_alert::alert_type)
|
||||
continue;
|
||||
|
||||
auto alert = static_cast<const lt::add_torrent_alert *>(a);
|
||||
const auto *alert = static_cast<const lt::add_torrent_alert *>(a);
|
||||
if (alert->error)
|
||||
{
|
||||
const QString msg = QString::fromStdString(alert->message());
|
||||
|
@ -208,7 +208,7 @@ void Net::DownloadHandlerImpl::handleRedirection(const QUrl &newUrl)
|
||||
return;
|
||||
}
|
||||
|
||||
auto redirected = static_cast<DownloadHandlerImpl *>(
|
||||
auto *redirected = static_cast<DownloadHandlerImpl *>(
|
||||
m_manager->download(DownloadRequest(m_downloadRequest).url(newUrlString), useProxy()));
|
||||
redirected->m_redirectionCount = m_redirectionCount + 1;
|
||||
connect(redirected, &DownloadHandlerImpl::finished, this, [this](const DownloadResult &result)
|
||||
|
@ -163,7 +163,7 @@ Net::DownloadHandler *Net::DownloadManager::download(const DownloadRequest &down
|
||||
const ServiceID id = ServiceID::fromURL(downloadRequest.url());
|
||||
const bool isSequentialService = m_sequentialServices.contains(id);
|
||||
|
||||
auto downloadHandler = new DownloadHandlerImpl(this, downloadRequest, useProxy);
|
||||
auto *downloadHandler = new DownloadHandlerImpl(this, downloadRequest, useProxy);
|
||||
connect(downloadHandler, &DownloadHandler::finished, downloadHandler, &QObject::deleteLater);
|
||||
connect(downloadHandler, &QObject::destroyed, this, [this, id, downloadHandler]()
|
||||
{
|
||||
@ -274,7 +274,7 @@ void Net::DownloadManager::handleDownloadFinished(DownloadHandlerImpl *finishedH
|
||||
return;
|
||||
}
|
||||
|
||||
auto handler = waitingJobsIter.value().dequeue();
|
||||
auto *handler = waitingJobsIter.value().dequeue();
|
||||
qDebug("Downloading %s...", qUtf8Printable(handler->url()));
|
||||
processRequest(handler);
|
||||
handler->disconnect(this);
|
||||
|
@ -345,7 +345,7 @@ bool Feed::addArticle(const QVariantHash &articleData)
|
||||
|
||||
void Feed::removeOldestArticle()
|
||||
{
|
||||
auto oldestArticle = m_articlesByDate.last();
|
||||
auto *oldestArticle = m_articlesByDate.last();
|
||||
emit articleAboutToBeRemoved(oldestArticle);
|
||||
|
||||
m_articles.remove(oldestArticle->guid());
|
||||
|
@ -49,7 +49,7 @@ Folder::~Folder()
|
||||
{
|
||||
emit aboutToBeDestroyed(this);
|
||||
|
||||
for (auto item : asConst(items()))
|
||||
for (auto *item : asConst(items()))
|
||||
delete item;
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ void Folder::addItem(Item *item)
|
||||
connect(item, &Item::articleAboutToBeRemoved, this, &Item::articleAboutToBeRemoved);
|
||||
connect(item, &Item::unreadCountChanged, this, &Folder::handleItemUnreadCountChanged);
|
||||
|
||||
for (auto article : asConst(item->articles()))
|
||||
for (auto *article : asConst(item->articles()))
|
||||
emit newArticle(article);
|
||||
|
||||
if (item->unreadCount() > 0)
|
||||
@ -138,7 +138,7 @@ void Folder::removeItem(Item *item)
|
||||
{
|
||||
Q_ASSERT(m_items.contains(item));
|
||||
|
||||
for (auto article : asConst(item->articles()))
|
||||
for (auto *article : asConst(item->articles()))
|
||||
emit articleAboutToBeRemoved(article);
|
||||
|
||||
item->disconnect(this);
|
||||
|
@ -100,7 +100,7 @@ Session::Session()
|
||||
// Remove legacy/corrupted settings
|
||||
// (at least on Windows, QSettings is case-insensitive and it can get
|
||||
// confused when asked about settings that differ only in their case)
|
||||
auto settingsStorage = SettingsStorage::instance();
|
||||
auto *settingsStorage = SettingsStorage::instance();
|
||||
settingsStorage->removeValue(u"Rss/streamList"_qs);
|
||||
settingsStorage->removeValue(u"Rss/streamAlias"_qs);
|
||||
settingsStorage->removeValue(u"Rss/open_folders"_qs);
|
||||
@ -140,7 +140,7 @@ nonstd::expected<void, QString> Session::addFolder(const QString &path)
|
||||
if (!result)
|
||||
return result.get_unexpected();
|
||||
|
||||
const auto destFolder = result.value();
|
||||
auto *destFolder = result.value();
|
||||
addItem(new Folder(path), destFolder);
|
||||
store();
|
||||
return {};
|
||||
@ -155,7 +155,7 @@ nonstd::expected<void, QString> Session::addFeed(const QString &url, const QStri
|
||||
if (!result)
|
||||
return result.get_unexpected();
|
||||
|
||||
const auto destFolder = result.value();
|
||||
auto *destFolder = result.value();
|
||||
auto *feed = new Feed(generateUID(), url, path, this);
|
||||
addItem(feed, destFolder);
|
||||
store();
|
||||
@ -198,7 +198,7 @@ nonstd::expected<void, QString> Session::moveItem(const QString &itemPath, const
|
||||
if (itemPath.isEmpty())
|
||||
return nonstd::make_unexpected(tr("Cannot move root folder."));
|
||||
|
||||
auto item = m_itemsByPath.value(itemPath);
|
||||
auto *item = m_itemsByPath.value(itemPath);
|
||||
if (!item)
|
||||
return nonstd::make_unexpected(tr("Item doesn't exist: %1.").arg(itemPath));
|
||||
|
||||
@ -214,11 +214,11 @@ nonstd::expected<void, QString> Session::moveItem(Item *item, const QString &des
|
||||
if (!result)
|
||||
return result.get_unexpected();
|
||||
|
||||
const auto destFolder = result.value();
|
||||
auto *destFolder = result.value();
|
||||
if (static_cast<Item *>(destFolder) == item)
|
||||
return nonstd::make_unexpected(tr("Couldn't move folder into itself."));
|
||||
|
||||
auto srcFolder = static_cast<Folder *>(m_itemsByPath.value(Item::parentPath(item->path())));
|
||||
auto *srcFolder = static_cast<Folder *>(m_itemsByPath.value(Item::parentPath(item->path())));
|
||||
if (srcFolder != destFolder)
|
||||
{
|
||||
srcFolder->removeItem(item);
|
||||
@ -242,7 +242,7 @@ nonstd::expected<void, QString> Session::removeItem(const QString &itemPath)
|
||||
emit itemAboutToBeRemoved(item);
|
||||
item->cleanup();
|
||||
|
||||
auto folder = static_cast<Folder *>(m_itemsByPath.value(Item::parentPath(item->path())));
|
||||
auto *folder = static_cast<Folder *>(m_itemsByPath.value(Item::parentPath(item->path())));
|
||||
folder->removeItem(item);
|
||||
delete item;
|
||||
store();
|
||||
@ -410,7 +410,7 @@ nonstd::expected<Folder *, QString> Session::prepareItemDest(const QString &path
|
||||
return nonstd::make_unexpected(tr("RSS item with given path already exists: %1.").arg(path));
|
||||
|
||||
const QString destFolderPath = Item::parentPath(path);
|
||||
const auto destFolder = qobject_cast<Folder *>(m_itemsByPath.value(destFolderPath));
|
||||
auto *destFolder = qobject_cast<Folder *>(m_itemsByPath.value(destFolderPath));
|
||||
if (!destFolder)
|
||||
return nonstd::make_unexpected(tr("Parent folder doesn't exist: %1.").arg(destFolderPath));
|
||||
|
||||
@ -419,21 +419,21 @@ nonstd::expected<Folder *, QString> Session::prepareItemDest(const QString &path
|
||||
|
||||
Folder *Session::addSubfolder(const QString &name, Folder *parentFolder)
|
||||
{
|
||||
auto folder = new Folder(Item::joinPath(parentFolder->path(), name));
|
||||
auto *folder = new Folder(Item::joinPath(parentFolder->path(), name));
|
||||
addItem(folder, parentFolder);
|
||||
return folder;
|
||||
}
|
||||
|
||||
Feed *Session::addFeedToFolder(const QUuid &uid, const QString &url, const QString &name, Folder *parentFolder)
|
||||
{
|
||||
auto feed = new Feed(uid, url, Item::joinPath(parentFolder->path(), name), this);
|
||||
auto *feed = new Feed(uid, url, Item::joinPath(parentFolder->path(), name), this);
|
||||
addItem(feed, parentFolder);
|
||||
return feed;
|
||||
}
|
||||
|
||||
void Session::addItem(Item *item, Folder *destFolder)
|
||||
{
|
||||
if (auto feed = qobject_cast<Feed *>(item))
|
||||
if (auto *feed = qobject_cast<Feed *>(item))
|
||||
{
|
||||
connect(feed, &Feed::titleChanged, this, &Session::handleFeedTitleChanged);
|
||||
connect(feed, &Feed::iconLoaded, this, &Session::feedIconLoaded);
|
||||
@ -530,7 +530,7 @@ QThread *Session::workingThread() const
|
||||
void Session::handleItemAboutToBeDestroyed(Item *item)
|
||||
{
|
||||
m_itemsByPath.remove(item->path());
|
||||
auto feed = qobject_cast<Feed *>(item);
|
||||
auto *feed = qobject_cast<Feed *>(item);
|
||||
if (feed)
|
||||
{
|
||||
m_feedsByUID.remove(feed->uid());
|
||||
|
@ -831,7 +831,7 @@ void AdvancedSettings::loadAdvancedSettings()
|
||||
template <typename T>
|
||||
void AdvancedSettings::addRow(const int row, const QString &text, T *widget)
|
||||
{
|
||||
auto label = new QLabel(text);
|
||||
auto *label = new QLabel(text);
|
||||
label->setOpenExternalLinks(true);
|
||||
|
||||
setCellWidget(row, PROPERTY, label);
|
||||
|
@ -942,7 +942,7 @@ void MainWindow::askRecursiveTorrentDownloadConfirmation(const BitTorrent::Torre
|
||||
|
||||
void MainWindow::on_actionSetGlobalSpeedLimits_triggered()
|
||||
{
|
||||
auto dialog = new SpeedLimitDialog {this};
|
||||
auto *dialog = new SpeedLimitDialog {this};
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dialog->open();
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ void OptionsDialog::loadBehaviorTabOptions()
|
||||
});
|
||||
connect(m_ui->buttonCustomizeUITheme, &QPushButton::clicked, this, [this]
|
||||
{
|
||||
auto dialog = new UIThemeDialog(this);
|
||||
auto *dialog = new UIThemeDialog(this);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dialog->open();
|
||||
});
|
||||
@ -698,7 +698,7 @@ void OptionsDialog::saveDownloadsTabOptions() const
|
||||
session->setTorrentExportDirectory(getTorrentExportDir());
|
||||
session->setFinishedTorrentExportDirectory(getFinishedTorrentExportDir());
|
||||
|
||||
auto watchedFoldersModel = static_cast<WatchedFoldersModel *>(m_ui->scanFoldersView->model());
|
||||
auto *watchedFoldersModel = static_cast<WatchedFoldersModel *>(m_ui->scanFoldersView->model());
|
||||
watchedFoldersModel->apply();
|
||||
|
||||
session->setExcludedFileNamesEnabled(m_ui->groupExcludedFileNames->isChecked());
|
||||
@ -882,7 +882,7 @@ void OptionsDialog::saveConnectionTabOptions() const
|
||||
session->setI2PPort(m_ui->spinI2PPort->value());
|
||||
session->setI2PMixedMode(m_ui->checkI2PMixed->isChecked());
|
||||
|
||||
auto proxyConfigManager = Net::ProxyConfigurationManager::instance();
|
||||
auto *proxyConfigManager = Net::ProxyConfigurationManager::instance();
|
||||
Net::ProxyConfiguration proxyConf;
|
||||
proxyConf.type = getProxyType();
|
||||
proxyConf.ip = getProxyIp();
|
||||
@ -1668,13 +1668,13 @@ void OptionsDialog::on_addWatchedFolderButton_clicked()
|
||||
if (dir.isEmpty())
|
||||
return;
|
||||
|
||||
auto dialog = new WatchedFolderOptionsDialog({}, this);
|
||||
auto *dialog = new WatchedFolderOptionsDialog({}, this);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
connect(dialog, &QDialog::accepted, this, [this, dialog, dir, pref]()
|
||||
{
|
||||
try
|
||||
{
|
||||
auto watchedFoldersModel = static_cast<WatchedFoldersModel *>(m_ui->scanFoldersView->model());
|
||||
auto *watchedFoldersModel = static_cast<WatchedFoldersModel *>(m_ui->scanFoldersView->model());
|
||||
watchedFoldersModel->addFolder(dir, dialog->watchedFolderOptions());
|
||||
|
||||
pref->setScanDirsLastPath(dir);
|
||||
@ -1722,8 +1722,8 @@ void OptionsDialog::editWatchedFolderOptions(const QModelIndex &index)
|
||||
if (!index.isValid())
|
||||
return;
|
||||
|
||||
auto watchedFoldersModel = static_cast<WatchedFoldersModel *>(m_ui->scanFoldersView->model());
|
||||
auto dialog = new WatchedFolderOptionsDialog(watchedFoldersModel->folderOptions(index.row()), this);
|
||||
auto *watchedFoldersModel = static_cast<WatchedFoldersModel *>(m_ui->scanFoldersView->model());
|
||||
auto *dialog = new WatchedFolderOptionsDialog(watchedFoldersModel->folderOptions(index.row()), this);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
connect(dialog, &QDialog::accepted, this, [this, dialog, index, watchedFoldersModel]()
|
||||
{
|
||||
@ -1880,7 +1880,7 @@ bool OptionsDialog::schedTimesOk()
|
||||
|
||||
void OptionsDialog::on_banListButton_clicked()
|
||||
{
|
||||
auto dialog = new BanListOptionsDialog(this);
|
||||
auto *dialog = new BanListOptionsDialog(this);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
connect(dialog, &QDialog::accepted, this, &OptionsDialog::enableApplyButton);
|
||||
dialog->open();
|
||||
@ -1888,7 +1888,7 @@ void OptionsDialog::on_banListButton_clicked()
|
||||
|
||||
void OptionsDialog::on_IPSubnetWhitelistButton_clicked()
|
||||
{
|
||||
auto dialog = new IPSubnetWhitelistOptionsDialog(this);
|
||||
auto *dialog = new IPSubnetWhitelistOptionsDialog(this);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
connect(dialog, &QDialog::accepted, this, &OptionsDialog::enableApplyButton);
|
||||
dialog->open();
|
||||
|
@ -145,7 +145,7 @@ void PreviewSelectDialog::previewButtonClicked()
|
||||
|
||||
void PreviewSelectDialog::displayColumnHeaderMenu()
|
||||
{
|
||||
auto menu = new QMenu(this);
|
||||
auto *menu = new QMenu(this);
|
||||
menu->setAttribute(Qt::WA_DeleteOnClose);
|
||||
menu->setToolTipsVisible(true);
|
||||
|
||||
|
@ -437,7 +437,7 @@ void TrackerListWidget::openAddTrackersDialog()
|
||||
if (!torrent)
|
||||
return;
|
||||
|
||||
const auto dialog = new TrackersAdditionDialog(this, torrent);
|
||||
auto *dialog = new TrackersAdditionDialog(this, torrent);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dialog->open();
|
||||
}
|
||||
|
@ -71,11 +71,11 @@ void ArticleListWidget::setRSSItem(RSS::Item *rssItem, bool unreadOnly)
|
||||
connect(m_rssItem, &RSS::Item::articleRead, this, &ArticleListWidget::handleArticleRead);
|
||||
connect(m_rssItem, &RSS::Item::articleAboutToBeRemoved, this, &ArticleListWidget::handleArticleAboutToBeRemoved);
|
||||
|
||||
for (const auto article : asConst(rssItem->articles()))
|
||||
for (auto *article : asConst(rssItem->articles()))
|
||||
{
|
||||
if (!(m_unreadOnly && article->isRead()))
|
||||
{
|
||||
auto item = createItem(article);
|
||||
auto *item = createItem(article);
|
||||
addItem(item);
|
||||
m_rssArticleToListItemMapping.insert(article, item);
|
||||
}
|
||||
@ -89,7 +89,7 @@ void ArticleListWidget::handleArticleAdded(RSS::Article *rssArticle)
|
||||
{
|
||||
if (!(m_unreadOnly && rssArticle->isRead()))
|
||||
{
|
||||
auto item = createItem(rssArticle);
|
||||
auto *item = createItem(rssArticle);
|
||||
insertItem(0, item);
|
||||
m_rssArticleToListItemMapping.insert(rssArticle, item);
|
||||
}
|
||||
@ -99,7 +99,7 @@ void ArticleListWidget::handleArticleAdded(RSS::Article *rssArticle)
|
||||
|
||||
void ArticleListWidget::handleArticleRead(RSS::Article *rssArticle)
|
||||
{
|
||||
auto item = mapRSSArticle(rssArticle);
|
||||
auto *item = mapRSSArticle(rssArticle);
|
||||
if (!item) return;
|
||||
|
||||
const QBrush foregroundBrush {UIThemeManager::instance()->getColor(u"RSS.ReadArticle"_qs)};
|
||||
|
@ -192,7 +192,7 @@ void AutomatedRssDownloader::loadFeedList()
|
||||
{
|
||||
const QSignalBlocker feedListSignalBlocker(m_ui->listFeeds);
|
||||
|
||||
for (const auto feed : asConst(RSS::Session::instance()->feeds()))
|
||||
for (const auto *feed : asConst(RSS::Session::instance()->feeds()))
|
||||
{
|
||||
QListWidgetItem *item = new QListWidgetItem(feed->name(), m_ui->listFeeds);
|
||||
item->setData(Qt::UserRole, feed->url());
|
||||
@ -636,11 +636,11 @@ void AutomatedRssDownloader::updateMatchingArticles()
|
||||
: RSS::AutoDownloader::instance()->ruleByName(ruleItem->text()));
|
||||
for (const QString &feedURL : asConst(rule.feedURLs()))
|
||||
{
|
||||
auto feed = RSS::Session::instance()->feedByURL(feedURL);
|
||||
auto *feed = RSS::Session::instance()->feedByURL(feedURL);
|
||||
if (!feed) continue; // feed doesn't exist
|
||||
|
||||
QStringList matchingArticles;
|
||||
for (const auto article : asConst(feed->articles()))
|
||||
for (const auto *article : asConst(feed->articles()))
|
||||
if (rule.matches(article->data()))
|
||||
matchingArticles << article->title();
|
||||
if (!matchingArticles.isEmpty())
|
||||
@ -853,7 +853,7 @@ void AutomatedRssDownloader::handleRuleAdded(const QString &ruleName)
|
||||
|
||||
void AutomatedRssDownloader::handleRuleRenamed(const QString &ruleName, const QString &oldRuleName)
|
||||
{
|
||||
auto item = m_itemsByRuleName.take(oldRuleName);
|
||||
auto *item = m_itemsByRuleName.take(oldRuleName);
|
||||
m_itemsByRuleName.insert(ruleName, item);
|
||||
if (m_currentRule.name() == oldRuleName)
|
||||
m_currentRule.setName(ruleName);
|
||||
@ -862,7 +862,7 @@ void AutomatedRssDownloader::handleRuleRenamed(const QString &ruleName, const QS
|
||||
|
||||
void AutomatedRssDownloader::handleRuleChanged(const QString &ruleName)
|
||||
{
|
||||
auto item = m_itemsByRuleName.value(ruleName);
|
||||
auto *item = m_itemsByRuleName.value(ruleName);
|
||||
if (item && (item != m_currentRuleItem))
|
||||
item->setCheckState(RSS::AutoDownloader::instance()->ruleByName(ruleName).isEnabled() ? Qt::Checked : Qt::Unchecked);
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ FeedListWidget::FeedListWidget(QWidget *parent)
|
||||
|
||||
void FeedListWidget::handleItemAdded(RSS::Item *rssItem)
|
||||
{
|
||||
auto parentItem = m_rssToTreeItemMapping.value(
|
||||
auto *parentItem = m_rssToTreeItemMapping.value(
|
||||
RSS::Session::instance()->itemByPath(RSS::Item::parentPath(rssItem->path())));
|
||||
createItem(rssItem, parentItem);
|
||||
}
|
||||
@ -264,7 +264,7 @@ void FeedListWidget::dropEvent(QDropEvent *event)
|
||||
// move as much items as possible
|
||||
for (QTreeWidgetItem *srcItem : asConst(selectedItems()))
|
||||
{
|
||||
auto rssItem = getRSSItem(srcItem);
|
||||
auto *rssItem = getRSSItem(srcItem);
|
||||
RSS::Session::instance()->moveItem(rssItem, RSS::Item::joinPath(destFolder->path(), rssItem->name()));
|
||||
}
|
||||
|
||||
@ -281,7 +281,7 @@ QTreeWidgetItem *FeedListWidget::createItem(RSS::Item *rssItem, QTreeWidgetItem
|
||||
m_rssToTreeItemMapping[rssItem] = item;
|
||||
|
||||
QIcon icon;
|
||||
if (auto feed = qobject_cast<RSS::Feed *>(rssItem))
|
||||
if (auto *feed = qobject_cast<RSS::Feed *>(rssItem))
|
||||
icon = rssFeedIcon(feed);
|
||||
else
|
||||
icon = UIThemeManager::instance()->getIcon(u"directory"_qs);
|
||||
@ -299,11 +299,11 @@ QTreeWidgetItem *FeedListWidget::createItem(RSS::Item *rssItem, QTreeWidgetItem
|
||||
|
||||
void FeedListWidget::fill(QTreeWidgetItem *parent, RSS::Folder *rssParent)
|
||||
{
|
||||
for (const auto rssItem : asConst(rssParent->items()))
|
||||
for (auto *rssItem : asConst(rssParent->items()))
|
||||
{
|
||||
QTreeWidgetItem *item = createItem(rssItem, parent);
|
||||
// Recursive call if this is a folder.
|
||||
if (auto folder = qobject_cast<RSS::Folder *>(rssItem))
|
||||
if (auto *folder = qobject_cast<RSS::Folder *>(rssItem))
|
||||
fill(item, folder);
|
||||
}
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ void RSSWidget::displayItemsListMenu()
|
||||
bool hasLink = false;
|
||||
for (const QListWidgetItem *item : asConst(m_articleListWidget->selectedItems()))
|
||||
{
|
||||
auto article = item->data(Qt::UserRole).value<RSS::Article *>();
|
||||
auto *article = item->data(Qt::UserRole).value<RSS::Article *>();
|
||||
Q_ASSERT(article);
|
||||
|
||||
if (!article->torrentUrl().isEmpty())
|
||||
@ -364,7 +364,7 @@ void RSSWidget::downloadSelectedTorrents()
|
||||
{
|
||||
for (QListWidgetItem *item : asConst(m_articleListWidget->selectedItems()))
|
||||
{
|
||||
auto article = item->data(Qt::UserRole).value<RSS::Article *>();
|
||||
auto *article = item->data(Qt::UserRole).value<RSS::Article *>();
|
||||
Q_ASSERT(article);
|
||||
|
||||
// Mark as read
|
||||
@ -385,7 +385,7 @@ void RSSWidget::openSelectedArticlesUrls()
|
||||
{
|
||||
for (QListWidgetItem *item : asConst(m_articleListWidget->selectedItems()))
|
||||
{
|
||||
auto article = item->data(Qt::UserRole).value<RSS::Article *>();
|
||||
auto *article = item->data(Qt::UserRole).value<RSS::Article *>();
|
||||
Q_ASSERT(article);
|
||||
|
||||
// Mark as read
|
||||
@ -467,7 +467,7 @@ void RSSWidget::copySelectedFeedsURL()
|
||||
QStringList URLs;
|
||||
for (QTreeWidgetItem *item : asConst(m_feedListWidget->selectedItems()))
|
||||
{
|
||||
if (auto feed = qobject_cast<RSS::Feed *>(m_feedListWidget->getRSSItem(item)))
|
||||
if (auto *feed = qobject_cast<RSS::Feed *>(m_feedListWidget->getRSSItem(item)))
|
||||
URLs << feed->url();
|
||||
}
|
||||
qApp->clipboard()->setText(URLs.join(u'\n'));
|
||||
@ -496,14 +496,14 @@ void RSSWidget::handleCurrentArticleItemChanged(QListWidgetItem *currentItem, QL
|
||||
|
||||
if (previousItem)
|
||||
{
|
||||
auto article = m_articleListWidget->getRSSArticle(previousItem);
|
||||
auto *article = m_articleListWidget->getRSSArticle(previousItem);
|
||||
Q_ASSERT(article);
|
||||
article->markAsRead();
|
||||
}
|
||||
|
||||
if (!currentItem) return;
|
||||
|
||||
auto article = m_articleListWidget->getRSSArticle(currentItem);
|
||||
auto *article = m_articleListWidget->getRSSArticle(currentItem);
|
||||
Q_ASSERT(article);
|
||||
|
||||
const QString highlightedBaseColor = m_ui->textBrowser->palette().color(QPalette::Highlight).name();
|
||||
|
@ -459,7 +459,7 @@ int SearchJobWidget::visibleColumnsCount() const
|
||||
|
||||
void SearchJobWidget::displayColumnHeaderMenu()
|
||||
{
|
||||
auto menu = new QMenu(this);
|
||||
auto *menu = new QMenu(this);
|
||||
menu->setAttribute(Qt::WA_DeleteOnClose);
|
||||
menu->setTitle(tr("Column visibility"));
|
||||
menu->setToolTipsVisible(true);
|
||||
|
@ -144,7 +144,7 @@ SearchWidget::SearchWidget(IGUIApplication *app, MainWindow *mainWindow)
|
||||
connect(m_ui->selectPlugin, qOverload<int>(&QComboBox::currentIndexChanged)
|
||||
, this, &SearchWidget::fillCatCombobox);
|
||||
|
||||
const auto focusSearchHotkey = new QShortcut(QKeySequence::Find, this);
|
||||
const auto *focusSearchHotkey = new QShortcut(QKeySequence::Find, this);
|
||||
connect(focusSearchHotkey, &QShortcut::activated, this, &SearchWidget::toggleFocusBetweenLineEdits);
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ bool SearchWidget::eventFilter(QObject *object, QEvent *event)
|
||||
if (event->type() != QEvent::MouseButtonRelease)
|
||||
return false;
|
||||
|
||||
const auto mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
const auto *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
const int tabIndex = m_ui->tabWidget->tabBar()->tabAt(mouseEvent->pos());
|
||||
if ((mouseEvent->button() == Qt::MiddleButton) && (tabIndex >= 0))
|
||||
{
|
||||
|
@ -255,7 +255,7 @@ void StatusBar::updateAltSpeedsBtn(bool alternative)
|
||||
|
||||
void StatusBar::capSpeed()
|
||||
{
|
||||
auto dialog = new SpeedLimitDialog {parentWidget()};
|
||||
auto *dialog = new SpeedLimitDialog {parentWidget()};
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dialog->open();
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ void TorrentCategoryDialog::editCategory(QWidget *parent, const QString &categor
|
||||
|
||||
Q_ASSERT(Session::instance()->categories().contains(categoryName));
|
||||
|
||||
auto dialog = new TorrentCategoryDialog(parent);
|
||||
auto *dialog = new TorrentCategoryDialog(parent);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dialog->setCategoryNameEditable(false);
|
||||
dialog->setCategoryName(categoryName);
|
||||
|
@ -75,7 +75,7 @@ TorrentContentWidget::TorrentContentWidget(QWidget *parent)
|
||||
m_filterModel->setSourceModel(m_model);
|
||||
QTreeView::setModel(m_filterModel);
|
||||
|
||||
auto itemDelegate = new TorrentContentItemDelegate(this);
|
||||
auto *itemDelegate = new TorrentContentItemDelegate(this);
|
||||
setItemDelegate(itemDelegate);
|
||||
|
||||
connect(this, &QAbstractItemView::clicked, this, qOverload<const QModelIndex &>(&QAbstractItemView::edit));
|
||||
@ -436,7 +436,7 @@ void TorrentContentWidget::openParentFolder(const QModelIndex &index) const
|
||||
|
||||
Path TorrentContentWidget::getFullPath(const QModelIndex &index) const
|
||||
{
|
||||
const auto contentHandler = m_model->contentHandler();
|
||||
const auto *contentHandler = m_model->contentHandler();
|
||||
if (const int fileIdx = getFileIndex(index); fileIdx >= 0)
|
||||
{
|
||||
const Path fullPath = contentHandler->actualStorageLocation() / contentHandler->actualFilePath(fileIdx);
|
||||
@ -450,7 +450,7 @@ Path TorrentContentWidget::getFullPath(const QModelIndex &index) const
|
||||
|
||||
void TorrentContentWidget::onItemDoubleClicked(const QModelIndex &index)
|
||||
{
|
||||
const auto contentHandler = m_model->contentHandler();
|
||||
const auto *contentHandler = m_model->contentHandler();
|
||||
Q_ASSERT(contentHandler && contentHandler->hasMetadata());
|
||||
|
||||
if (Q_UNLIKELY(!contentHandler || !contentHandler->hasMetadata()))
|
||||
|
@ -204,7 +204,7 @@ QVariant CategoryFilterModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid()) return {};
|
||||
|
||||
auto item = static_cast<const CategoryModelItem *>(index.internalPointer());
|
||||
const auto *item = static_cast<const CategoryModelItem *>(index.internalPointer());
|
||||
|
||||
if ((index.column() == 0) && (role == Qt::DecorationRole))
|
||||
{
|
||||
@ -248,7 +248,7 @@ QModelIndex CategoryFilterModel::index(int row, int column, const QModelIndex &p
|
||||
if (parent.isValid() && (parent.column() != 0))
|
||||
return {};
|
||||
|
||||
auto parentItem = parent.isValid() ? static_cast<CategoryModelItem *>(parent.internalPointer())
|
||||
auto *parentItem = parent.isValid() ? static_cast<CategoryModelItem *>(parent.internalPointer())
|
||||
: m_rootItem;
|
||||
if (row < parentItem->childCount())
|
||||
return createIndex(row, column, parentItem->childAt(row));
|
||||
@ -261,7 +261,7 @@ QModelIndex CategoryFilterModel::parent(const QModelIndex &index) const
|
||||
if (!index.isValid())
|
||||
return {};
|
||||
|
||||
auto item = static_cast<CategoryModelItem *>(index.internalPointer());
|
||||
auto *item = static_cast<CategoryModelItem *>(index.internalPointer());
|
||||
if (!item) return {};
|
||||
|
||||
return this->index(item->parent());
|
||||
@ -275,7 +275,7 @@ int CategoryFilterModel::rowCount(const QModelIndex &parent) const
|
||||
if (!parent.isValid())
|
||||
return m_rootItem->childCount();
|
||||
|
||||
auto item = static_cast<CategoryModelItem *>(parent.internalPointer());
|
||||
auto *item = static_cast<CategoryModelItem *>(parent.internalPointer());
|
||||
if (!item) return 0;
|
||||
|
||||
return item->childCount();
|
||||
@ -319,7 +319,7 @@ void CategoryFilterModel::categoryAdded(const QString &categoryName)
|
||||
|
||||
void CategoryFilterModel::categoryRemoved(const QString &categoryName)
|
||||
{
|
||||
auto item = findItem(categoryName);
|
||||
auto *item = findItem(categoryName);
|
||||
if (item)
|
||||
{
|
||||
QModelIndex i = index(item);
|
||||
@ -354,7 +354,7 @@ void CategoryFilterModel::torrentCategoryChanged(BitTorrent::Torrent *const torr
|
||||
{
|
||||
QModelIndex i;
|
||||
|
||||
auto item = findItem(oldCategory);
|
||||
auto *item = findItem(oldCategory);
|
||||
Q_ASSERT(item);
|
||||
|
||||
item->decreaseTorrentsCount();
|
||||
|
@ -214,7 +214,7 @@ void CategoryFilterWidget::removeCategory()
|
||||
|
||||
void CategoryFilterWidget::removeUnusedCategories()
|
||||
{
|
||||
auto session = BitTorrent::Session::instance();
|
||||
auto *session = BitTorrent::Session::instance();
|
||||
for (const QString &category : asConst(session->categories()))
|
||||
{
|
||||
if (model()->data(static_cast<CategoryFilterProxyModel *>(model())->index(category), Qt::UserRole) == 0)
|
||||
|
@ -208,7 +208,7 @@ void TagFilterWidget::removeTag()
|
||||
|
||||
void TagFilterWidget::removeUnusedTags()
|
||||
{
|
||||
auto session = BitTorrent::Session::instance();
|
||||
auto *session = BitTorrent::Session::instance();
|
||||
for (const QString &tag : asConst(session->tags()))
|
||||
if (model()->data(static_cast<TagFilterProxyModel *>(model())->index(tag), Qt::UserRole) == 0)
|
||||
session->removeTag(tag);
|
||||
|
@ -335,7 +335,7 @@ void TransferListWidget::setSelectedTorrentsLocation()
|
||||
|
||||
const Path oldLocation = torrents[0]->savePath();
|
||||
|
||||
auto fileDialog = new QFileDialog(this, tr("Choose save path"), oldLocation.data());
|
||||
auto *fileDialog = new QFileDialog(this, tr("Choose save path"), oldLocation.data());
|
||||
fileDialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
fileDialog->setFileMode(QFileDialog::Directory);
|
||||
fileDialog->setOptions(QFileDialog::DontConfirmOverwrite | QFileDialog::ShowDirsOnly | QFileDialog::HideNameFilterDetails);
|
||||
@ -616,7 +616,7 @@ void TransferListWidget::setTorrentOptions()
|
||||
const QVector<BitTorrent::Torrent *> selectedTorrents = getSelectedTorrents();
|
||||
if (selectedTorrents.empty()) return;
|
||||
|
||||
auto dialog = new TorrentOptionsDialog {this, selectedTorrents};
|
||||
auto *dialog = new TorrentOptionsDialog {this, selectedTorrents};
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dialog->open();
|
||||
}
|
||||
@ -654,7 +654,7 @@ int TransferListWidget::visibleColumnsCount() const
|
||||
// hide/show columns menu
|
||||
void TransferListWidget::displayColumnHeaderMenu()
|
||||
{
|
||||
auto menu = new QMenu(this);
|
||||
auto *menu = new QMenu(this);
|
||||
menu->setAttribute(Qt::WA_DeleteOnClose);
|
||||
menu->setTitle(tr("Column visibility"));
|
||||
menu->setToolTipsVisible(true);
|
||||
@ -767,7 +767,7 @@ void TransferListWidget::editTorrentTrackers()
|
||||
}
|
||||
}
|
||||
|
||||
auto trackerDialog = new TrackerEntriesDialog(this);
|
||||
auto *trackerDialog = new TrackerEntriesDialog(this);
|
||||
trackerDialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
trackerDialog->setTrackers(commonTrackers);
|
||||
|
||||
@ -785,7 +785,7 @@ void TransferListWidget::exportTorrent()
|
||||
if (getSelectedTorrents().isEmpty())
|
||||
return;
|
||||
|
||||
auto fileDialog = new QFileDialog(this, tr("Choose folder to save exported .torrent files"));
|
||||
auto *fileDialog = new QFileDialog(this, tr("Choose folder to save exported .torrent files"));
|
||||
fileDialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
fileDialog->setFileMode(QFileDialog::Directory);
|
||||
fileDialog->setOptions(QFileDialog::ShowDirsOnly);
|
||||
|
@ -124,7 +124,7 @@ private:
|
||||
|
||||
void showColorDialog()
|
||||
{
|
||||
auto dialog = new QColorDialog(m_currentColor, this);
|
||||
auto *dialog = new QColorDialog(m_currentColor, this);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
connect(dialog, &QDialog::accepted, this, [this, dialog]
|
||||
{
|
||||
|
@ -616,7 +616,7 @@ void AppController::setPreferencesAction()
|
||||
session->setMaxUploadsPerTorrent(it.value().toInt());
|
||||
|
||||
// Proxy Server
|
||||
auto proxyManager = Net::ProxyConfigurationManager::instance();
|
||||
auto *proxyManager = Net::ProxyConfigurationManager::instance();
|
||||
Net::ProxyConfiguration proxyConf = proxyManager->proxyConfiguration();
|
||||
if (hasKey(u"proxy_type"_qs))
|
||||
proxyConf.type = Utils::String::toEnum(it.value().toString(), Net::ProxyType::HTTP);
|
||||
|
@ -1279,7 +1279,7 @@ void TorrentsController::removeCategoriesAction()
|
||||
|
||||
void TorrentsController::categoriesAction()
|
||||
{
|
||||
const auto session = BitTorrent::Session::instance();
|
||||
const auto *session = BitTorrent::Session::instance();
|
||||
|
||||
QJsonObject categories;
|
||||
const QStringList categoriesList = session->categories();
|
||||
|
Loading…
x
Reference in New Issue
Block a user