Browse Source

Convert pass-by-value arguments to const refs where applicable

adaptive-webui-19844
thalieht 6 years ago
parent
commit
445adb0ab4
  1. 2
      src/base/bittorrent/peerinfo.cpp
  2. 2
      src/base/bittorrent/peerinfo.h
  3. 68
      src/base/bittorrent/session.cpp
  4. 36
      src/base/bittorrent/session.h
  5. 2
      src/base/bittorrent/torrenthandle.cpp
  6. 2
      src/base/bittorrent/torrenthandle.h
  7. 2
      src/base/search/searchpluginmanager.cpp
  8. 2
      src/base/search/searchpluginmanager.h
  9. 8
      src/gui/mainwindow.cpp
  10. 8
      src/gui/mainwindow.h
  11. 2
      src/gui/properties/trackerlistwidget.cpp
  12. 2
      src/gui/properties/trackerlistwidget.h
  13. 8
      src/gui/search/pluginselectdialog.cpp
  14. 8
      src/gui/search/pluginselectdialog.h
  15. 2
      src/gui/search/searchwidget.cpp
  16. 2
      src/gui/search/searchwidget.h
  17. 6
      src/gui/transferlistwidget.cpp
  18. 6
      src/gui/transferlistwidget.h

2
src/base/bittorrent/peerinfo.cpp

@ -43,7 +43,7 @@ PeerAddress::PeerAddress()
{ {
} }
PeerAddress::PeerAddress(QHostAddress ip, ushort port) PeerAddress::PeerAddress(const QHostAddress &ip, ushort port)
: ip(ip) : ip(ip)
, port(port) , port(port)
{ {

2
src/base/bittorrent/peerinfo.h

@ -45,7 +45,7 @@ namespace BitTorrent
ushort port; ushort port;
PeerAddress(); PeerAddress();
PeerAddress(QHostAddress ip, ushort port); PeerAddress(const QHostAddress &ip, ushort port);
}; };
class PeerInfo class PeerInfo

68
src/base/bittorrent/session.cpp

@ -3762,7 +3762,7 @@ void Session::readAlerts()
handleAlert(a); handleAlert(a);
} }
void Session::handleAlert(libt::alert *a) void Session::handleAlert(const libt::alert *a)
{ {
try { try {
switch (a->type()) { switch (a->type()) {
@ -3784,53 +3784,53 @@ void Session::handleAlert(libt::alert *a)
dispatchTorrentAlert(a); dispatchTorrentAlert(a);
break; break;
case libt::metadata_received_alert::alert_type: case libt::metadata_received_alert::alert_type:
handleMetadataReceivedAlert(static_cast<libt::metadata_received_alert*>(a)); handleMetadataReceivedAlert(static_cast<const libt::metadata_received_alert*>(a));
dispatchTorrentAlert(a); dispatchTorrentAlert(a);
break; break;
case libt::state_update_alert::alert_type: case libt::state_update_alert::alert_type:
handleStateUpdateAlert(static_cast<libt::state_update_alert*>(a)); handleStateUpdateAlert(static_cast<const libt::state_update_alert*>(a));
break; break;
case libt::session_stats_alert::alert_type: case libt::session_stats_alert::alert_type:
handleSessionStatsAlert(static_cast<libt::session_stats_alert*>(a)); handleSessionStatsAlert(static_cast<const libt::session_stats_alert*>(a));
break; break;
case libt::file_error_alert::alert_type: case libt::file_error_alert::alert_type:
handleFileErrorAlert(static_cast<libt::file_error_alert*>(a)); handleFileErrorAlert(static_cast<const libt::file_error_alert*>(a));
break; break;
case libt::add_torrent_alert::alert_type: case libt::add_torrent_alert::alert_type:
handleAddTorrentAlert(static_cast<libt::add_torrent_alert*>(a)); handleAddTorrentAlert(static_cast<const libt::add_torrent_alert*>(a));
break; break;
case libt::torrent_removed_alert::alert_type: case libt::torrent_removed_alert::alert_type:
handleTorrentRemovedAlert(static_cast<libt::torrent_removed_alert*>(a)); handleTorrentRemovedAlert(static_cast<const libt::torrent_removed_alert*>(a));
break; break;
case libt::torrent_deleted_alert::alert_type: case libt::torrent_deleted_alert::alert_type:
handleTorrentDeletedAlert(static_cast<libt::torrent_deleted_alert*>(a)); handleTorrentDeletedAlert(static_cast<const libt::torrent_deleted_alert*>(a));
break; break;
case libt::torrent_delete_failed_alert::alert_type: case libt::torrent_delete_failed_alert::alert_type:
handleTorrentDeleteFailedAlert(static_cast<libt::torrent_delete_failed_alert*>(a)); handleTorrentDeleteFailedAlert(static_cast<const libt::torrent_delete_failed_alert*>(a));
break; break;
case libt::portmap_error_alert::alert_type: case libt::portmap_error_alert::alert_type:
handlePortmapWarningAlert(static_cast<libt::portmap_error_alert*>(a)); handlePortmapWarningAlert(static_cast<const libt::portmap_error_alert*>(a));
break; break;
case libt::portmap_alert::alert_type: case libt::portmap_alert::alert_type:
handlePortmapAlert(static_cast<libt::portmap_alert*>(a)); handlePortmapAlert(static_cast<const libt::portmap_alert*>(a));
break; break;
case libt::peer_blocked_alert::alert_type: case libt::peer_blocked_alert::alert_type:
handlePeerBlockedAlert(static_cast<libt::peer_blocked_alert*>(a)); handlePeerBlockedAlert(static_cast<const libt::peer_blocked_alert*>(a));
break; break;
case libt::peer_ban_alert::alert_type: case libt::peer_ban_alert::alert_type:
handlePeerBanAlert(static_cast<libt::peer_ban_alert*>(a)); handlePeerBanAlert(static_cast<const libt::peer_ban_alert*>(a));
break; break;
case libt::url_seed_alert::alert_type: case libt::url_seed_alert::alert_type:
handleUrlSeedAlert(static_cast<libt::url_seed_alert*>(a)); handleUrlSeedAlert(static_cast<const libt::url_seed_alert*>(a));
break; break;
case libt::listen_succeeded_alert::alert_type: case libt::listen_succeeded_alert::alert_type:
handleListenSucceededAlert(static_cast<libt::listen_succeeded_alert*>(a)); handleListenSucceededAlert(static_cast<const libt::listen_succeeded_alert*>(a));
break; break;
case libt::listen_failed_alert::alert_type: case libt::listen_failed_alert::alert_type:
handleListenFailedAlert(static_cast<libt::listen_failed_alert*>(a)); handleListenFailedAlert(static_cast<const libt::listen_failed_alert*>(a));
break; break;
case libt::external_ip_alert::alert_type: case libt::external_ip_alert::alert_type:
handleExternalIPAlert(static_cast<libt::external_ip_alert*>(a)); handleExternalIPAlert(static_cast<const libt::external_ip_alert*>(a));
break; break;
} }
} }
@ -3839,7 +3839,7 @@ void Session::handleAlert(libt::alert *a)
} }
} }
void Session::dispatchTorrentAlert(libt::alert *a) void Session::dispatchTorrentAlert(const libt::alert *a)
{ {
TorrentHandle *const torrent = m_torrents.value(static_cast<const libt::torrent_alert*>(a)->handle.info_hash()); TorrentHandle *const torrent = m_torrents.value(static_cast<const libt::torrent_alert*>(a)->handle.info_hash());
if (torrent) if (torrent)
@ -3901,7 +3901,7 @@ void Session::createTorrentHandle(const libt::torrent_handle &nativeHandle)
emit torrentNew(torrent); emit torrentNew(torrent);
} }
void Session::handleAddTorrentAlert(libt::add_torrent_alert *p) void Session::handleAddTorrentAlert(const libt::add_torrent_alert *p)
{ {
if (p->error) { if (p->error) {
qDebug("/!\\ Error: Failed to add torrent!"); qDebug("/!\\ Error: Failed to add torrent!");
@ -3914,7 +3914,7 @@ void Session::handleAddTorrentAlert(libt::add_torrent_alert *p)
} }
} }
void Session::handleTorrentRemovedAlert(libt::torrent_removed_alert *p) void Session::handleTorrentRemovedAlert(const libt::torrent_removed_alert *p)
{ {
const InfoHash infoHash {p->info_hash}; const InfoHash infoHash {p->info_hash};
@ -3930,7 +3930,7 @@ void Session::handleTorrentRemovedAlert(libt::torrent_removed_alert *p)
} }
} }
void Session::handleTorrentDeletedAlert(libt::torrent_deleted_alert *p) void Session::handleTorrentDeletedAlert(const libt::torrent_deleted_alert *p)
{ {
const InfoHash infoHash {p->info_hash}; const InfoHash infoHash {p->info_hash};
@ -3942,7 +3942,7 @@ void Session::handleTorrentDeletedAlert(libt::torrent_deleted_alert *p)
LogMsg(tr("'%1' was removed from the transfer list and hard disk.", "'xxx.avi' was removed...").arg(tmpRemovingTorrentData.name)); LogMsg(tr("'%1' was removed from the transfer list and hard disk.", "'xxx.avi' was removed...").arg(tmpRemovingTorrentData.name));
} }
void Session::handleTorrentDeleteFailedAlert(libt::torrent_delete_failed_alert *p) void Session::handleTorrentDeleteFailedAlert(const libt::torrent_delete_failed_alert *p)
{ {
const InfoHash infoHash {p->info_hash}; const InfoHash infoHash {p->info_hash};
@ -3958,7 +3958,7 @@ void Session::handleTorrentDeleteFailedAlert(libt::torrent_delete_failed_alert *
, Log::CRITICAL); , Log::CRITICAL);
} }
void Session::handleMetadataReceivedAlert(libt::metadata_received_alert *p) void Session::handleMetadataReceivedAlert(const libt::metadata_received_alert *p)
{ {
const InfoHash hash {p->handle.info_hash()}; const InfoHash hash {p->handle.info_hash()};
@ -3970,7 +3970,7 @@ void Session::handleMetadataReceivedAlert(libt::metadata_received_alert *p)
} }
} }
void Session::handleFileErrorAlert(libt::file_error_alert *p) void Session::handleFileErrorAlert(const libt::file_error_alert *p)
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
// NOTE: Check this function! // NOTE: Check this function!
@ -3988,18 +3988,18 @@ void Session::handleFileErrorAlert(libt::file_error_alert *p)
} }
} }
void Session::handlePortmapWarningAlert(libt::portmap_error_alert *p) void Session::handlePortmapWarningAlert(const libt::portmap_error_alert *p)
{ {
Logger::instance()->addMessage(tr("UPnP/NAT-PMP: Port mapping failure, message: %1").arg(QString::fromStdString(p->message())), Log::CRITICAL); Logger::instance()->addMessage(tr("UPnP/NAT-PMP: Port mapping failure, message: %1").arg(QString::fromStdString(p->message())), Log::CRITICAL);
} }
void Session::handlePortmapAlert(libt::portmap_alert *p) void Session::handlePortmapAlert(const libt::portmap_alert *p)
{ {
qDebug("UPnP Success, msg: %s", p->message().c_str()); qDebug("UPnP Success, msg: %s", p->message().c_str());
Logger::instance()->addMessage(tr("UPnP/NAT-PMP: Port mapping successful, message: %1").arg(QString::fromStdString(p->message())), Log::INFO); Logger::instance()->addMessage(tr("UPnP/NAT-PMP: Port mapping successful, message: %1").arg(QString::fromStdString(p->message())), Log::INFO);
} }
void Session::handlePeerBlockedAlert(libt::peer_blocked_alert *p) void Session::handlePeerBlockedAlert(const libt::peer_blocked_alert *p)
{ {
boost::system::error_code ec; boost::system::error_code ec;
const std::string ip = p->ip.to_string(ec); const std::string ip = p->ip.to_string(ec);
@ -4029,7 +4029,7 @@ void Session::handlePeerBlockedAlert(libt::peer_blocked_alert *p)
Logger::instance()->addPeer(QString::fromLatin1(ip.c_str()), true, reason); Logger::instance()->addPeer(QString::fromLatin1(ip.c_str()), true, reason);
} }
void Session::handlePeerBanAlert(libt::peer_ban_alert *p) void Session::handlePeerBanAlert(const libt::peer_ban_alert *p)
{ {
boost::system::error_code ec; boost::system::error_code ec;
const std::string ip = p->ip.address().to_string(ec); const std::string ip = p->ip.address().to_string(ec);
@ -4037,14 +4037,14 @@ void Session::handlePeerBanAlert(libt::peer_ban_alert *p)
Logger::instance()->addPeer(QString::fromLatin1(ip.c_str()), false); Logger::instance()->addPeer(QString::fromLatin1(ip.c_str()), false);
} }
void Session::handleUrlSeedAlert(libt::url_seed_alert *p) void Session::handleUrlSeedAlert(const libt::url_seed_alert *p)
{ {
Logger::instance()->addMessage(tr("URL seed lookup failed for URL: '%1', message: %2") Logger::instance()->addMessage(tr("URL seed lookup failed for URL: '%1', message: %2")
.arg(QString::fromStdString(p->server_url())) .arg(QString::fromStdString(p->server_url()))
.arg(QString::fromStdString(p->message())), Log::CRITICAL); .arg(QString::fromStdString(p->message())), Log::CRITICAL);
} }
void Session::handleListenSucceededAlert(libt::listen_succeeded_alert *p) void Session::handleListenSucceededAlert(const libt::listen_succeeded_alert *p)
{ {
boost::system::error_code ec; boost::system::error_code ec;
QString proto = "TCP"; QString proto = "TCP";
@ -4067,7 +4067,7 @@ void Session::handleListenSucceededAlert(libt::listen_succeeded_alert *p)
it->force_reannounce(); it->force_reannounce();
} }
void Session::handleListenFailedAlert(libt::listen_failed_alert *p) void Session::handleListenFailedAlert(const libt::listen_failed_alert *p)
{ {
boost::system::error_code ec; boost::system::error_code ec;
QString proto = "TCP"; QString proto = "TCP";
@ -4090,13 +4090,13 @@ void Session::handleListenFailedAlert(libt::listen_failed_alert *p)
, Log::CRITICAL); , Log::CRITICAL);
} }
void Session::handleExternalIPAlert(libt::external_ip_alert *p) void Session::handleExternalIPAlert(const libt::external_ip_alert *p)
{ {
boost::system::error_code ec; boost::system::error_code ec;
Logger::instance()->addMessage(tr("External IP: %1", "e.g. External IP: 192.168.0.1").arg(p->external_address.to_string(ec).c_str()), Log::INFO); Logger::instance()->addMessage(tr("External IP: %1", "e.g. External IP: 192.168.0.1").arg(p->external_address.to_string(ec).c_str()), Log::INFO);
} }
void Session::handleSessionStatsAlert(libt::session_stats_alert *p) void Session::handleSessionStatsAlert(const libt::session_stats_alert *p)
{ {
const qreal interval = m_statsUpdateTimer.restart() / 1000.; const qreal interval = m_statsUpdateTimer.restart() / 1000.;
@ -4161,7 +4161,7 @@ void Session::handleSessionStatsAlert(libt::session_stats_alert *p)
emit statsUpdated(); emit statsUpdated();
} }
void Session::handleStateUpdateAlert(libt::state_update_alert *p) void Session::handleStateUpdateAlert(const libt::state_update_alert *p)
{ {
for (const libt::torrent_status &status : p->status) { for (const libt::torrent_status &status : p->status) {
TorrentHandle *const torrent = m_torrents.value(status.info_hash); TorrentHandle *const torrent = m_torrents.value(status.info_hash);

36
src/base/bittorrent/session.h

@ -589,24 +589,24 @@ namespace BitTorrent
void exportTorrentFile(TorrentHandle *const torrent, TorrentExportFolder folder = TorrentExportFolder::Regular); void exportTorrentFile(TorrentHandle *const torrent, TorrentExportFolder folder = TorrentExportFolder::Regular);
void saveTorrentResumeData(TorrentHandle *const torrent); void saveTorrentResumeData(TorrentHandle *const torrent);
void handleAlert(libtorrent::alert *a); void handleAlert(const libtorrent::alert *a);
void dispatchTorrentAlert(libtorrent::alert *a); void dispatchTorrentAlert(const libtorrent::alert *a);
void handleAddTorrentAlert(libtorrent::add_torrent_alert *p); void handleAddTorrentAlert(const libtorrent::add_torrent_alert *p);
void handleStateUpdateAlert(libtorrent::state_update_alert *p); void handleStateUpdateAlert(const libtorrent::state_update_alert *p);
void handleMetadataReceivedAlert(libtorrent::metadata_received_alert *p); void handleMetadataReceivedAlert(const libtorrent::metadata_received_alert *p);
void handleFileErrorAlert(libtorrent::file_error_alert *p); void handleFileErrorAlert(const libtorrent::file_error_alert *p);
void handleTorrentRemovedAlert(libtorrent::torrent_removed_alert *p); void handleTorrentRemovedAlert(const libtorrent::torrent_removed_alert *p);
void handleTorrentDeletedAlert(libtorrent::torrent_deleted_alert *p); void handleTorrentDeletedAlert(const libtorrent::torrent_deleted_alert *p);
void handleTorrentDeleteFailedAlert(libtorrent::torrent_delete_failed_alert *p); void handleTorrentDeleteFailedAlert(const libtorrent::torrent_delete_failed_alert *p);
void handlePortmapWarningAlert(libtorrent::portmap_error_alert *p); void handlePortmapWarningAlert(const libtorrent::portmap_error_alert *p);
void handlePortmapAlert(libtorrent::portmap_alert *p); void handlePortmapAlert(const libtorrent::portmap_alert *p);
void handlePeerBlockedAlert(libtorrent::peer_blocked_alert *p); void handlePeerBlockedAlert(const libtorrent::peer_blocked_alert *p);
void handlePeerBanAlert(libtorrent::peer_ban_alert *p); void handlePeerBanAlert(const libtorrent::peer_ban_alert *p);
void handleUrlSeedAlert(libtorrent::url_seed_alert *p); void handleUrlSeedAlert(const libtorrent::url_seed_alert *p);
void handleListenSucceededAlert(libtorrent::listen_succeeded_alert *p); void handleListenSucceededAlert(const libtorrent::listen_succeeded_alert *p);
void handleListenFailedAlert(libtorrent::listen_failed_alert *p); void handleListenFailedAlert(const libtorrent::listen_failed_alert *p);
void handleExternalIPAlert(libtorrent::external_ip_alert *p); void handleExternalIPAlert(const libtorrent::external_ip_alert *p);
void handleSessionStatsAlert(libtorrent::session_stats_alert *p); void handleSessionStatsAlert(const libtorrent::session_stats_alert *p);
void createTorrentHandle(const libtorrent::torrent_handle &nativeHandle); void createTorrentHandle(const libtorrent::torrent_handle &nativeHandle);

2
src/base/bittorrent/torrenthandle.cpp

@ -1717,7 +1717,7 @@ void TorrentHandle::handleAppendExtensionToggled()
manageIncompleteFiles(); manageIncompleteFiles();
} }
void TorrentHandle::handleAlert(libtorrent::alert *a) void TorrentHandle::handleAlert(const libtorrent::alert *a)
{ {
switch (a->type()) { switch (a->type()) {
case libt::stats_alert::alert_type: case libt::stats_alert::alert_type:

2
src/base/bittorrent/torrenthandle.h

@ -358,7 +358,7 @@ namespace BitTorrent
// Session interface // Session interface
libtorrent::torrent_handle nativeHandle() const; libtorrent::torrent_handle nativeHandle() const;
void handleAlert(libtorrent::alert *a); void handleAlert(const libtorrent::alert *a);
void handleStateUpdate(const libtorrent::torrent_status &nativeStatus); void handleStateUpdate(const libtorrent::torrent_status &nativeStatus);
void handleTempPathChanged(); void handleTempPathChanged();
void handleCategorySavePathChanged(); void handleCategorySavePathChanged();

2
src/base/search/searchpluginmanager.cpp

@ -533,7 +533,7 @@ void SearchPluginManager::parseVersionInfo(const QByteArray &info)
} }
} }
bool SearchPluginManager::isUpdateNeeded(QString pluginName, PluginVersion newVersion) const bool SearchPluginManager::isUpdateNeeded(const QString &pluginName, PluginVersion newVersion) const
{ {
PluginInfo *plugin = pluginInfo(pluginName); PluginInfo *plugin = pluginInfo(pluginName);
if (!plugin) return true; if (!plugin) return true;

2
src/base/search/searchpluginmanager.h

@ -102,7 +102,7 @@ private:
void updateNova(); void updateNova();
void parseVersionInfo(const QByteArray &info); void parseVersionInfo(const QByteArray &info);
void installPlugin_impl(const QString &name, const QString &path); void installPlugin_impl(const QString &name, const QString &path);
bool isUpdateNeeded(QString pluginName, PluginVersion newVersion) const; bool isUpdateNeeded(const QString &pluginName, PluginVersion newVersion) const;
void versionInfoDownloaded(const QString &url, const QByteArray &data); void versionInfoDownloaded(const QString &url, const QByteArray &data);
void versionInfoDownloadFailed(const QString &url, const QString &reason); void versionInfoDownloadFailed(const QString &url, const QString &reason);

8
src/gui/mainwindow.cpp

@ -849,7 +849,7 @@ void MainWindow::finishedTorrent(BitTorrent::TorrentHandle *const torrent) const
} }
// Notification when disk is full // Notification when disk is full
void MainWindow::fullDiskError(BitTorrent::TorrentHandle *const torrent, QString msg) const void MainWindow::fullDiskError(BitTorrent::TorrentHandle *const torrent, const QString &msg) const
{ {
showNotificationBaloon(tr("I/O Error", "i.e: Input/Output Error") showNotificationBaloon(tr("I/O Error", "i.e: Input/Output Error")
, tr("An I/O error occurred for torrent '%1'.\n Reason: %2" , tr("An I/O error occurred for torrent '%1'.\n Reason: %2"
@ -963,7 +963,7 @@ void MainWindow::askRecursiveTorrentDownloadConfirmation(BitTorrent::TorrentHand
confirmBox->show(); confirmBox->show();
} }
void MainWindow::handleDownloadFromUrlFailure(QString url, QString reason) const void MainWindow::handleDownloadFromUrlFailure(const QString &url, const QString &reason) const
{ {
// Display a message box // Display a message box
showNotificationBaloon(tr("URL download error") showNotificationBaloon(tr("URL download error")
@ -1061,7 +1061,7 @@ bool MainWindow::unlockUI()
return true; return true;
} }
void MainWindow::notifyOfUpdate(QString) void MainWindow::notifyOfUpdate(const QString &)
{ {
// Show restart message // Show restart message
m_statusBar->showRestartRequired(); m_statusBar->showRestartRequired();
@ -1565,7 +1565,7 @@ void MainWindow::updateGUI()
} }
} }
void MainWindow::showNotificationBaloon(QString title, QString msg) const void MainWindow::showNotificationBaloon(const QString &title, const QString &msg) const
{ {
if (!isNotificationsEnabled()) return; if (!isNotificationsEnabled()) return;
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) && defined(QT_DBUS_LIB) #if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) && defined(QT_DBUS_LIB)

8
src/gui/mainwindow.h

@ -99,20 +99,20 @@ public:
void activate(); void activate();
void cleanup(); void cleanup();
void showNotificationBaloon(QString title, QString msg) const; void showNotificationBaloon(const QString &title, const QString &msg) const;
private slots: private slots:
void showFilterContextMenu(const QPoint &); void showFilterContextMenu(const QPoint &);
void balloonClicked(); void balloonClicked();
void writeSettings(); void writeSettings();
void readSettings(); void readSettings();
void fullDiskError(BitTorrent::TorrentHandle *const torrent, QString msg) const; void fullDiskError(BitTorrent::TorrentHandle *const torrent, const QString &msg) const;
void handleDownloadFromUrlFailure(QString, QString) const; void handleDownloadFromUrlFailure(const QString &, const QString &) const;
void tabChanged(int newTab); void tabChanged(int newTab);
bool defineUILockPassword(); bool defineUILockPassword();
void clearUILockPassword(); void clearUILockPassword();
bool unlockUI(); bool unlockUI();
void notifyOfUpdate(QString); void notifyOfUpdate(const QString &);
void showConnectionSettings(); void showConnectionSettings();
void minimizeWindow(); void minimizeWindow();
// Keyboard shortcuts // Keyboard shortcuts

2
src/gui/properties/trackerlistwidget.cpp

@ -149,7 +149,7 @@ QList<QTreeWidgetItem*> TrackerListWidget::getSelectedTrackerItems() const
return selectedTrackers; return selectedTrackers;
} }
void TrackerListWidget::setRowColor(const int row, QColor color) void TrackerListWidget::setRowColor(const int row, const QColor &color)
{ {
const int nbColumns = columnCount(); const int nbColumns = columnCount();
QTreeWidgetItem *item = topLevelItem(row); QTreeWidgetItem *item = topLevelItem(row);

2
src/gui/properties/trackerlistwidget.h

@ -69,7 +69,7 @@ public:
int visibleColumnsCount() const; int visibleColumnsCount() const;
public slots: public slots:
void setRowColor(int row, QColor color); void setRowColor(int row, const QColor &color);
void moveSelectionUp(); void moveSelectionUp();
void moveSelectionDown(); void moveSelectionDown();

8
src/gui/search/pluginselectdialog.cpp

@ -228,7 +228,7 @@ void PluginSelectDialog::enableSelection(bool enable)
} }
// Set the color of a row in data model // Set the color of a row in data model
void PluginSelectDialog::setRowColor(const int row, QString color) void PluginSelectDialog::setRowColor(const int row, const QString &color)
{ {
QTreeWidgetItem *item = m_ui->pluginsTree->topLevelItem(row); QTreeWidgetItem *item = m_ui->pluginsTree->topLevelItem(row);
for (int i = 0; i < m_ui->pluginsTree->columnCount(); ++i) { for (int i = 0; i < m_ui->pluginsTree->columnCount(); ++i) {
@ -236,7 +236,7 @@ void PluginSelectDialog::setRowColor(const int row, QString color)
} }
} }
QList<QTreeWidgetItem*> PluginSelectDialog::findItemsWithUrl(QString url) QList<QTreeWidgetItem*> PluginSelectDialog::findItemsWithUrl(const QString &url)
{ {
QList<QTreeWidgetItem*> res; QList<QTreeWidgetItem*> res;
@ -249,7 +249,7 @@ QList<QTreeWidgetItem*> PluginSelectDialog::findItemsWithUrl(QString url)
return res; return res;
} }
QTreeWidgetItem *PluginSelectDialog::findItemWithID(QString id) QTreeWidgetItem *PluginSelectDialog::findItemWithID(const QString &id)
{ {
for (int i = 0; i < m_ui->pluginsTree->topLevelItemCount(); ++i) { for (int i = 0; i < m_ui->pluginsTree->topLevelItemCount(); ++i) {
QTreeWidgetItem *item = m_ui->pluginsTree->topLevelItem(i); QTreeWidgetItem *item = m_ui->pluginsTree->topLevelItem(i);
@ -268,7 +268,7 @@ void PluginSelectDialog::loadSupportedSearchPlugins()
addNewPlugin(name); addNewPlugin(name);
} }
void PluginSelectDialog::addNewPlugin(QString pluginName) void PluginSelectDialog::addNewPlugin(const QString &pluginName)
{ {
QTreeWidgetItem *item = new QTreeWidgetItem(m_ui->pluginsTree); QTreeWidgetItem *item = new QTreeWidgetItem(m_ui->pluginsTree);
PluginInfo *plugin = m_pluginManager->pluginInfo(pluginName); PluginInfo *plugin = m_pluginManager->pluginInfo(pluginName);

8
src/gui/search/pluginselectdialog.h

@ -51,8 +51,8 @@ public:
explicit PluginSelectDialog(SearchPluginManager *pluginManager, QWidget *parent = nullptr); explicit PluginSelectDialog(SearchPluginManager *pluginManager, QWidget *parent = nullptr);
~PluginSelectDialog(); ~PluginSelectDialog();
QList<QTreeWidgetItem*> findItemsWithUrl(QString url); QList<QTreeWidgetItem*> findItemsWithUrl(const QString &url);
QTreeWidgetItem *findItemWithID(QString id); QTreeWidgetItem *findItemWithID(const QString &id);
protected: protected:
void dropEvent(QDropEvent *event) override; void dropEvent(QDropEvent *event) override;
@ -64,7 +64,7 @@ private slots:
void on_installButton_clicked(); void on_installButton_clicked();
void on_closeButton_clicked(); void on_closeButton_clicked();
void togglePluginState(QTreeWidgetItem*, int); void togglePluginState(QTreeWidgetItem*, int);
void setRowColor(int row, QString color); void setRowColor(int row, const QString &color);
void displayContextMenu(const QPoint &pos); void displayContextMenu(const QPoint &pos);
void enableSelection(bool enable); void enableSelection(bool enable);
void askForLocalPlugin(); void askForLocalPlugin();
@ -81,7 +81,7 @@ private slots:
private: private:
void loadSupportedSearchPlugins(); void loadSupportedSearchPlugins();
void addNewPlugin(QString pluginName); void addNewPlugin(const QString &pluginName);
void startAsyncOp(); void startAsyncOp();
void finishAsyncOp(); void finishAsyncOp();
void finishPluginUpdate(); void finishPluginUpdate();

2
src/gui/search/searchwidget.cpp

@ -280,7 +280,7 @@ void SearchWidget::on_pluginsButton_clicked()
new PluginSelectDialog(SearchPluginManager::instance(), this); new PluginSelectDialog(SearchPluginManager::instance(), this);
} }
void SearchWidget::searchTextEdited(QString) void SearchWidget::searchTextEdited(const QString &)
{ {
// Enable search button // Enable search button
m_ui->searchButton->setText(tr("Search")); m_ui->searchButton->setText(tr("Search"));

2
src/gui/search/searchwidget.h

@ -74,7 +74,7 @@ private:
void fillCatCombobox(); void fillCatCombobox();
void fillPluginComboBox(); void fillPluginComboBox();
void selectActivePage(); void selectActivePage();
void searchTextEdited(QString); void searchTextEdited(const QString &);
void updateButtons(); void updateButtons();
QString selectedCategory() const; QString selectedCategory() const;

6
src/gui/transferlistwidget.cpp

@ -338,7 +338,7 @@ TransferListModel *TransferListWidget::getSourceModel() const
return m_listModel; return m_listModel;
} }
void TransferListWidget::previewFile(QString filePath) void TransferListWidget::previewFile(const QString &filePath)
{ {
Utils::Misc::openPath(filePath); Utils::Misc::openPath(filePath);
} }
@ -854,7 +854,7 @@ void TransferListWidget::renameSelectedTorrent()
} }
} }
void TransferListWidget::setSelectionCategory(QString category) void TransferListWidget::setSelectionCategory(const QString &category)
{ {
for (const QModelIndex &index : asConst(selectionModel()->selectedRows())) for (const QModelIndex &index : asConst(selectionModel()->selectedRows()))
m_listModel->setData(m_listModel->index(mapToSource(index).row(), TransferListModel::TR_CATEGORY), category, Qt::DisplayRole); m_listModel->setData(m_listModel->index(mapToSource(index).row(), TransferListModel::TR_CATEGORY), category, Qt::DisplayRole);
@ -1173,7 +1173,7 @@ void TransferListWidget::currentChanged(const QModelIndex &current, const QModel
emit currentTorrentChanged(torrent); emit currentTorrentChanged(torrent);
} }
void TransferListWidget::applyCategoryFilter(QString category) void TransferListWidget::applyCategoryFilter(const QString &category)
{ {
if (category.isNull()) if (category.isNull())
m_sortFilterModel->disableCategoryFilter(); m_sortFilterModel->disableCategoryFilter();

6
src/gui/transferlistwidget.h

@ -56,7 +56,7 @@ public:
TransferListModel *getSourceModel() const; TransferListModel *getSourceModel() const;
public slots: public slots:
void setSelectionCategory(QString category); void setSelectionCategory(const QString &category);
void addSelectionTag(const QString &tag); void addSelectionTag(const QString &tag);
void removeSelectionTag(const QString &tag); void removeSelectionTag(const QString &tag);
void clearSelectionTags(); void clearSelectionTags();
@ -90,11 +90,11 @@ public slots:
void displayDLHoSMenu(const QPoint&); void displayDLHoSMenu(const QPoint&);
void applyNameFilter(const QString &name); void applyNameFilter(const QString &name);
void applyStatusFilter(int f); void applyStatusFilter(int f);
void applyCategoryFilter(QString category); void applyCategoryFilter(const QString &category);
void applyTagFilter(const QString &tag); void applyTagFilter(const QString &tag);
void applyTrackerFilterAll(); void applyTrackerFilterAll();
void applyTrackerFilter(const QStringList &hashes); void applyTrackerFilter(const QStringList &hashes);
void previewFile(QString filePath); void previewFile(const QString &filePath);
void renameSelectedTorrent(); void renameSelectedTorrent();
protected: protected:

Loading…
Cancel
Save