Browse Source

Merge pull request #13431 from Chocobo1/namespace

Fix code defects
adaptive-webui-19844
Mike Tzou 4 years ago committed by GitHub
parent
commit
2bfaa8229a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/base/bittorrent/downloadpriority.cpp
  2. 2
      src/base/bittorrent/session.cpp
  3. 54
      src/base/bittorrent/session.h
  4. 2
      src/base/bittorrent/torrenthandle.cpp
  5. 2
      src/base/bittorrent/torrenthandleimpl.cpp
  6. 2
      src/base/bittorrent/torrentinfo.cpp
  7. 5
      src/gui/updownratiodialog.cpp

10
src/base/bittorrent/downloadpriority.cpp

@ -33,11 +33,11 @@ namespace BitTorrent
bool isValidDownloadPriority(const DownloadPriority priority) bool isValidDownloadPriority(const DownloadPriority priority)
{ {
switch (priority) { switch (priority) {
case BitTorrent::DownloadPriority::Ignored: case DownloadPriority::Ignored:
case BitTorrent::DownloadPriority::Normal: case DownloadPriority::Normal:
case BitTorrent::DownloadPriority::High: case DownloadPriority::High:
case BitTorrent::DownloadPriority::Maximum: case DownloadPriority::Maximum:
case BitTorrent::DownloadPriority::Mixed: case DownloadPriority::Mixed:
return true; return true;
default: default:
return false; return false;

2
src/base/bittorrent/session.cpp

@ -4717,7 +4717,7 @@ void Session::handleStorageMovedFailedAlert(const lt::storage_moved_failed_alert
void Session::handleStateUpdateAlert(const lt::state_update_alert *p) void Session::handleStateUpdateAlert(const lt::state_update_alert *p)
{ {
QVector<BitTorrent::TorrentHandle *> updatedTorrents; QVector<TorrentHandle *> updatedTorrents;
updatedTorrents.reserve(p->status.size()); updatedTorrents.reserve(p->status.size());
for (const lt::torrent_status &status : p->status) { for (const lt::torrent_status &status : p->status) {

54
src/base/bittorrent/session.h

@ -492,39 +492,39 @@ namespace BitTorrent
void categoryRemoved(const QString &categoryName); void categoryRemoved(const QString &categoryName);
void downloadFromUrlFailed(const QString &url, const QString &reason); void downloadFromUrlFailed(const QString &url, const QString &reason);
void downloadFromUrlFinished(const QString &url); void downloadFromUrlFinished(const QString &url);
void fullDiskError(BitTorrent::TorrentHandle *const torrent, const QString &msg); void fullDiskError(TorrentHandle *torrent, const QString &msg);
void IPFilterParsed(bool error, int ruleCount); void IPFilterParsed(bool error, int ruleCount);
void loadTorrentFailed(const QString &error); void loadTorrentFailed(const QString &error);
void metadataLoaded(const BitTorrent::TorrentInfo &info); void metadataLoaded(const TorrentInfo &info);
void recursiveTorrentDownloadPossible(BitTorrent::TorrentHandle *const torrent); void recursiveTorrentDownloadPossible(TorrentHandle *torrent);
void speedLimitModeChanged(bool alternative); void speedLimitModeChanged(bool alternative);
void statsUpdated(); void statsUpdated();
void subcategoriesSupportChanged(); void subcategoriesSupportChanged();
void tagAdded(const QString &tag); void tagAdded(const QString &tag);
void tagRemoved(const QString &tag); void tagRemoved(const QString &tag);
void torrentAboutToBeRemoved(BitTorrent::TorrentHandle *const torrent); void torrentAboutToBeRemoved(TorrentHandle *torrent);
void torrentAdded(BitTorrent::TorrentHandle *const torrent); void torrentAdded(TorrentHandle *torrent);
void torrentCategoryChanged(BitTorrent::TorrentHandle *const torrent, const QString &oldCategory); void torrentCategoryChanged(TorrentHandle *torrent, const QString &oldCategory);
void torrentFinished(BitTorrent::TorrentHandle *const torrent); void torrentFinished(TorrentHandle *torrent);
void torrentFinishedChecking(BitTorrent::TorrentHandle *const torrent); void torrentFinishedChecking(TorrentHandle *torrent);
void torrentLoaded(BitTorrent::TorrentHandle *const torrent); void torrentLoaded(TorrentHandle *torrent);
void torrentMetadataLoaded(BitTorrent::TorrentHandle *const torrent); void torrentMetadataLoaded(TorrentHandle *torrent);
void torrentPaused(BitTorrent::TorrentHandle *const torrent); void torrentPaused(TorrentHandle *torrent);
void torrentResumed(BitTorrent::TorrentHandle *const torrent); void torrentResumed(TorrentHandle *torrent);
void torrentSavePathChanged(BitTorrent::TorrentHandle *const torrent); void torrentSavePathChanged(TorrentHandle *torrent);
void torrentSavingModeChanged(BitTorrent::TorrentHandle *const torrent); void torrentSavingModeChanged(TorrentHandle *torrent);
void torrentStorageMoveFailed(BitTorrent::TorrentHandle *const torrent, const QString &targetPath, const QString &error); void torrentStorageMoveFailed(TorrentHandle *torrent, const QString &targetPath, const QString &error);
void torrentStorageMoveFinished(BitTorrent::TorrentHandle *const torrent, const QString &newPath); void torrentStorageMoveFinished(TorrentHandle *torrent, const QString &newPath);
void torrentsUpdated(const QVector<BitTorrent::TorrentHandle *> &torrents); void torrentsUpdated(const QVector<TorrentHandle *> &torrents);
void torrentTagAdded(BitTorrent::TorrentHandle *const torrent, const QString &tag); void torrentTagAdded(TorrentHandle *torrent, const QString &tag);
void torrentTagRemoved(BitTorrent::TorrentHandle *const torrent, const QString &tag); void torrentTagRemoved(TorrentHandle *torrent, const QString &tag);
void trackerError(BitTorrent::TorrentHandle *const torrent, const QString &tracker); void trackerError(TorrentHandle *torrent, const QString &tracker);
void trackerlessStateChanged(BitTorrent::TorrentHandle *const torrent, bool trackerless); void trackerlessStateChanged(TorrentHandle *torrent, bool trackerless);
void trackersAdded(BitTorrent::TorrentHandle *const torrent, const QVector<BitTorrent::TrackerEntry> &trackers); void trackersAdded(TorrentHandle *torrent, const QVector<TrackerEntry> &trackers);
void trackersChanged(BitTorrent::TorrentHandle *const torrent); void trackersChanged(TorrentHandle *torrent);
void trackersRemoved(BitTorrent::TorrentHandle *const torrent, const QVector<BitTorrent::TrackerEntry> &trackers); void trackersRemoved(TorrentHandle *torrent, const QVector<TrackerEntry> &trackers);
void trackerSuccess(BitTorrent::TorrentHandle *const torrent, const QString &tracker); void trackerSuccess(TorrentHandle *torrent, const QString &tracker);
void trackerWarning(BitTorrent::TorrentHandle *const torrent, const QString &tracker); void trackerWarning(TorrentHandle *torrent, const QString &tracker);
private slots: private slots:
void configureDeferred(); void configureDeferred();
@ -744,7 +744,7 @@ namespace BitTorrent
int m_numResumeData = 0; int m_numResumeData = 0;
int m_extraLimit = 0; int m_extraLimit = 0;
QVector<BitTorrent::TrackerEntry> m_additionalTrackerList; QVector<TrackerEntry> m_additionalTrackerList;
QString m_resumeFolderPath; QString m_resumeFolderPath;
QFile *m_resumeFolderLock = nullptr; QFile *m_resumeFolderLock = nullptr;

2
src/base/bittorrent/torrenthandle.cpp

@ -33,7 +33,7 @@
namespace BitTorrent namespace BitTorrent
{ {
uint qHash(const BitTorrent::TorrentState key, const uint seed) uint qHash(const TorrentState key, const uint seed)
{ {
return ::qHash(static_cast<std::underlying_type_t<TorrentState>>(key), seed); return ::qHash(static_cast<std::underlying_type_t<TorrentState>>(key), seed);
} }

2
src/base/bittorrent/torrenthandleimpl.cpp

@ -91,7 +91,7 @@ namespace
out.reserve(priorities.size()); out.reserve(priorities.size());
std::transform(priorities.cbegin(), priorities.cend() std::transform(priorities.cbegin(), priorities.cend()
, std::back_inserter(out), [](BitTorrent::DownloadPriority priority) , std::back_inserter(out), [](const DownloadPriority priority)
{ {
return static_cast<lt::download_priority_t>( return static_cast<lt::download_priority_t>(
static_cast<LTUnderlyingType<lt::download_priority_t>>(priority)); static_cast<LTUnderlyingType<lt::download_priority_t>>(priority));

2
src/base/bittorrent/torrentinfo.cpp

@ -382,7 +382,7 @@ void TorrentInfo::renameFile(const int index, const QString &newPath)
nativeInfo()->rename_file(lt::file_index_t {index}, Utils::Fs::toNativePath(newPath).toStdString()); nativeInfo()->rename_file(lt::file_index_t {index}, Utils::Fs::toNativePath(newPath).toStdString());
} }
int BitTorrent::TorrentInfo::fileIndex(const QString &fileName) const int TorrentInfo::fileIndex(const QString &fileName) const
{ {
// the check whether the object is valid is not needed here // the check whether the object is valid is not needed here
// because if filesCount() returns -1 the loop exits immediately // because if filesCount() returns -1 the loop exits immediately

5
src/gui/updownratiodialog.cpp

@ -69,8 +69,13 @@ UpDownRatioDialog::UpDownRatioDialog(bool useDefault, qreal initialRatioValue,
m_ui->timeSpinBox->setMaximum(maxTimeValue); m_ui->timeSpinBox->setMaximum(maxTimeValue);
m_ui->timeSpinBox->setValue(initialTimeValue); m_ui->timeSpinBox->setValue(initialTimeValue);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
connect(m_ui->buttonGroup, &QButtonGroup::idClicked
, this, &UpDownRatioDialog::handleRatioTypeChanged);
#else
connect(m_ui->buttonGroup, qOverload<int>(&QButtonGroup::buttonClicked) connect(m_ui->buttonGroup, qOverload<int>(&QButtonGroup::buttonClicked)
, this, &UpDownRatioDialog::handleRatioTypeChanged); , this, &UpDownRatioDialog::handleRatioTypeChanged);
#endif
connect(m_ui->checkMaxRatio, &QCheckBox::toggled, this, &UpDownRatioDialog::enableRatioSpin); connect(m_ui->checkMaxRatio, &QCheckBox::toggled, this, &UpDownRatioDialog::enableRatioSpin);
connect(m_ui->checkMaxTime, &QCheckBox::toggled, this, &UpDownRatioDialog::enableTimeSpin); connect(m_ui->checkMaxTime, &QCheckBox::toggled, this, &UpDownRatioDialog::enableTimeSpin);

Loading…
Cancel
Save