Browse Source

Merge pull request #8585 from Chocobo1/lint

Fix compiler/clazy warnings
adaptive-webui-19844
Mike Tzou 7 years ago committed by GitHub
parent
commit
e78b5202bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/base/bittorrent/session.cpp
  2. 2
      src/base/rss/rss_autodownloader.cpp
  3. 2
      src/gui/downloadfromurldlg.h
  4. 8
      src/gui/mainwindow.cpp
  5. 3
      src/gui/properties/propertieswidget.cpp
  6. 2
      src/gui/properties/trackerlist.cpp
  7. 3
      src/webui/api/torrentscontroller.cpp

2
src/base/bittorrent/session.cpp

@ -123,8 +123,6 @@ namespace
QString convertIfaceNameToGuid(const QString &name); QString convertIfaceNameToGuid(const QString &name);
#endif #endif
inline SettingsStorage *settings() { return SettingsStorage::instance(); }
QStringMap map_cast(const QVariantMap &map) QStringMap map_cast(const QVariantMap &map)
{ {
QStringMap result; QStringMap result;

2
src/base/rss/rss_autodownloader.cpp

@ -275,7 +275,7 @@ void AutoDownloader::importRulesFromLegacyFormat(const QByteArray &data)
if (in.status() != QDataStream::Ok) if (in.status() != QDataStream::Ok)
throw ParsingError(tr("Invalid data format")); throw ParsingError(tr("Invalid data format"));
for (const QVariant &val : dict) for (const QVariant &val : qAsConst(dict))
insertRule(AutoDownloadRule::fromLegacyDict(val.toHash())); insertRule(AutoDownloadRule::fromLegacyDict(val.toHash()));
} }

2
src/gui/downloadfromurldlg.h

@ -107,7 +107,7 @@ class downloadFromURL : public QDialog, private Ui::downloadFromURL
} }
} }
} }
if (!url_list_cleaned.size()) { if (url_list_cleaned.isEmpty()) {
QMessageBox::warning(this, tr("No URL entered"), tr("Please type at least one URL.")); QMessageBox::warning(this, tr("No URL entered"), tr("Please type at least one URL."));
return; return;
} }

8
src/gui/mainwindow.cpp

@ -679,8 +679,8 @@ void MainWindow::displayRSSTab(bool enable)
if (!m_rssWidget) { if (!m_rssWidget) {
m_rssWidget = new RSSWidget(m_tabs); m_rssWidget = new RSSWidget(m_tabs);
connect(m_rssWidget.data(), &RSSWidget::unreadCountUpdated, this, &MainWindow::handleRSSUnreadCountUpdated); connect(m_rssWidget.data(), &RSSWidget::unreadCountUpdated, this, &MainWindow::handleRSSUnreadCountUpdated);
int indexTab = m_tabs->addTab(m_rssWidget, tr("RSS (%1)").arg(RSS::Session::instance()->rootFolder()->unreadCount()));
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
const int indexTab = m_tabs->addTab(m_rssWidget, tr("RSS (%1)").arg(RSS::Session::instance()->rootFolder()->unreadCount()));
m_tabs->setTabIcon(indexTab, GuiIconProvider::instance()->getIcon("application-rss+xml")); m_tabs->setTabIcon(indexTab, GuiIconProvider::instance()->getIcon("application-rss+xml"));
#endif #endif
} }
@ -1388,7 +1388,9 @@ void MainWindow::loadPreferences(bool configureSession)
{ {
Logger::instance()->addMessage(tr("Options were saved successfully.")); Logger::instance()->addMessage(tr("Options were saved successfully."));
const Preferences *const pref = Preferences::instance(); const Preferences *const pref = Preferences::instance();
#ifndef Q_OS_MAC #ifdef Q_OS_MAC
Q_UNUSED(configureSession);
#else
const bool newSystrayIntegration = pref->systrayIntegration(); const bool newSystrayIntegration = pref->systrayIntegration();
m_ui->actionLock->setVisible(newSystrayIntegration); m_ui->actionLock->setVisible(newSystrayIntegration);
if (newSystrayIntegration != (m_systrayIcon != 0)) { if (newSystrayIntegration != (m_systrayIcon != 0)) {
@ -1877,8 +1879,8 @@ void MainWindow::on_actionExecutionLogs_triggered(bool checked)
if (checked) { if (checked) {
Q_ASSERT(!m_executionLog); Q_ASSERT(!m_executionLog);
m_executionLog = new ExecutionLog(m_tabs, static_cast<Log::MsgType>(executionLogMsgTypes())); m_executionLog = new ExecutionLog(m_tabs, static_cast<Log::MsgType>(executionLogMsgTypes()));
int indexTab = m_tabs->addTab(m_executionLog, tr("Execution Log"));
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
const int indexTab = m_tabs->addTab(m_executionLog, tr("Execution Log"));
m_tabs->setTabIcon(indexTab, GuiIconProvider::instance()->getIcon("view-calendar-journal")); m_tabs->setTabIcon(indexTab, GuiIconProvider::instance()->getIcon("view-calendar-journal"));
#endif #endif
} }

3
src/gui/properties/propertieswidget.cpp

@ -579,6 +579,7 @@ void PropertiesWidget::openFolder(const QModelIndex &index, bool containingFolde
// Flush data // Flush data
m_torrent->flushCache(); m_torrent->flushCache();
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
Q_UNUSED(containingFolder);
MacUtils::openFiles(QSet<QString>{absolutePath}); MacUtils::openFiles(QSet<QString>{absolutePath});
#else #else
if (containingFolder) if (containingFolder)
@ -660,7 +661,7 @@ void PropertiesWidget::displayWebSeedListMenu(const QPoint &)
QAction *actCpy = nullptr; QAction *actCpy = nullptr;
QAction *actEdit = nullptr; QAction *actEdit = nullptr;
if (rows.size()) { if (!rows.isEmpty()) {
actDel = seedMenu.addAction(GuiIconProvider::instance()->getIcon("list-remove"), tr("Remove Web seed")); actDel = seedMenu.addAction(GuiIconProvider::instance()->getIcon("list-remove"), tr("Remove Web seed"));
seedMenu.addSeparator(); seedMenu.addSeparator();
actCpy = seedMenu.addAction(GuiIconProvider::instance()->getIcon("edit-copy"), tr("Copy Web seed URL")); actCpy = seedMenu.addAction(GuiIconProvider::instance()->getIcon("edit-copy"), tr("Copy Web seed URL"));

2
src/gui/properties/trackerlist.cpp

@ -446,8 +446,6 @@ void TrackerList::editSelectedTracker()
BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent(); BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent();
if (!torrent) return; if (!torrent) return;
QString hash = torrent->hash();
QList<QTreeWidgetItem *> selectedTrackerItems = getSelectedTrackerItems(); QList<QTreeWidgetItem *> selectedTrackerItems = getSelectedTrackerItems();
if (selectedTrackerItems.isEmpty()) return; if (selectedTrackerItems.isEmpty()) return;

3
src/webui/api/torrentscontroller.cpp

@ -43,6 +43,7 @@
#include "base/bittorrent/torrenthandle.h" #include "base/bittorrent/torrenthandle.h"
#include "base/bittorrent/torrentinfo.h" #include "base/bittorrent/torrentinfo.h"
#include "base/bittorrent/trackerentry.h" #include "base/bittorrent/trackerentry.h"
#include "base/global.h"
#include "base/logger.h" #include "base/logger.h"
#include "base/net/downloadmanager.h" #include "base/net/downloadmanager.h"
#include "base/torrentfilter.h" #include "base/torrentfilter.h"
@ -493,7 +494,7 @@ void TorrentsController::addAction()
params.downloadLimit = (dlLimit > 0) ? dlLimit : -1; params.downloadLimit = (dlLimit > 0) ? dlLimit : -1;
bool partialSuccess = false; bool partialSuccess = false;
for (QString url : urls.split('\n')) { for (QString url : copyAsConst(urls.split('\n'))) {
url = url.trimmed(); url = url.trimmed();
if (!url.isEmpty()) { if (!url.isEmpty()) {
Net::DownloadManager::instance()->setCookiesFromUrl(cookies, QUrl::fromEncoded(url.toUtf8())); Net::DownloadManager::instance()->setCookiesFromUrl(cookies, QUrl::fromEncoded(url.toUtf8()));

Loading…
Cancel
Save