Clang-Tidy and Clazy fixes
This commit is contained in:
@@ -208,6 +208,6 @@ void AudioScrobbler::WriteCache() {
|
||||
|
||||
}
|
||||
|
||||
void AudioScrobbler::ErrorReceived(QString error) {
|
||||
void AudioScrobbler::ErrorReceived(const QString &error) {
|
||||
emit ErrorMessage(error);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ class AudioScrobbler : public QObject {
|
||||
void Submit();
|
||||
void Love();
|
||||
void WriteCache();
|
||||
void ErrorReceived(QString);
|
||||
void ErrorReceived(const QString &error);
|
||||
|
||||
signals:
|
||||
void ErrorMessage(QString);
|
||||
@@ -78,7 +78,6 @@ class AudioScrobbler : public QObject {
|
||||
void LoveButtonVisibilityChanged(bool value);
|
||||
|
||||
private:
|
||||
|
||||
Application *app_;
|
||||
ScrobblerServices *scrobbler_services_;
|
||||
|
||||
|
||||
@@ -552,7 +552,8 @@ void ListenBrainzScrobbler::Submit() {
|
||||
QJsonArray array;
|
||||
int i(0);
|
||||
QList<quint64> list;
|
||||
for (ScrobblerCacheItemPtr item : cache_->List()) {
|
||||
QList<ScrobblerCacheItemPtr> items = cache_->List();
|
||||
for (ScrobblerCacheItemPtr item : items) { // clazy:exclude=range-loop
|
||||
if (item->sent_) continue;
|
||||
item->sent_ = true;
|
||||
++i;
|
||||
@@ -587,7 +588,7 @@ void ListenBrainzScrobbler::Submit() {
|
||||
|
||||
}
|
||||
|
||||
void ListenBrainzScrobbler::ScrobbleRequestFinished(QNetworkReply *reply, QList<quint64> list) {
|
||||
void ListenBrainzScrobbler::ScrobbleRequestFinished(QNetworkReply *reply, const QList<quint64> &list) {
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
|
||||
@@ -80,7 +80,7 @@ class ListenBrainzScrobbler : public ScrobblerService {
|
||||
void AuthenticateReplyFinished(QNetworkReply *reply);
|
||||
void RequestNewAccessToken() { RequestAccessToken(); }
|
||||
void UpdateNowPlayingRequestFinished(QNetworkReply *reply);
|
||||
void ScrobbleRequestFinished(QNetworkReply *reply, QList<quint64>);
|
||||
void ScrobbleRequestFinished(QNetworkReply *reply, const QList<quint64> &list);
|
||||
|
||||
private:
|
||||
QNetworkReply *CreateRequest(const QUrl &url, const QJsonDocument &json_doc);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
#include <chrono>
|
||||
|
||||
#include <QObject>
|
||||
#include <QStandardPaths>
|
||||
@@ -43,6 +44,8 @@
|
||||
#include "scrobblercache.h"
|
||||
#include "scrobblercacheitem.h"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
ScrobblerCache::ScrobblerCache(const QString &filename, QObject *parent) :
|
||||
QObject(parent),
|
||||
timer_flush_(new QTimer(this)),
|
||||
@@ -53,7 +56,7 @@ ScrobblerCache::ScrobblerCache(const QString &filename, QObject *parent) :
|
||||
loaded_ = true;
|
||||
|
||||
timer_flush_->setSingleShot(true);
|
||||
timer_flush_->setInterval(600000);
|
||||
timer_flush_->setInterval(10min);
|
||||
QObject::connect(timer_flush_, &QTimer::timeout, this, &ScrobblerCache::WriteCache);
|
||||
|
||||
}
|
||||
@@ -197,7 +200,7 @@ void ScrobblerCache::WriteCache() {
|
||||
|
||||
}
|
||||
|
||||
ScrobblerCacheItemPtr ScrobblerCache::Add(const Song &song, const quint64 ×tamp) {
|
||||
ScrobblerCacheItemPtr ScrobblerCache::Add(const Song &song, const quint64 timestamp) {
|
||||
|
||||
if (scrobbler_cache_.contains(timestamp)) return nullptr;
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class ScrobblerCache : public QObject {
|
||||
|
||||
void ReadCache();
|
||||
|
||||
ScrobblerCacheItemPtr Add(const Song &song, const quint64 ×tamp);
|
||||
ScrobblerCacheItemPtr Add(const Song &song, const quint64 timestamp);
|
||||
ScrobblerCacheItemPtr Get(const quint64 hash);
|
||||
void Remove(const quint64 hash);
|
||||
void Remove(ScrobblerCacheItemPtr item);
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
|
||||
#include "scrobblercacheitem.h"
|
||||
|
||||
ScrobblerCacheItem::ScrobblerCacheItem(const QString &artist, const QString &album, const QString &song, const QString &albumartist, const int track, const qint64 duration, const quint64 ×tamp) :
|
||||
ScrobblerCacheItem::ScrobblerCacheItem(const QString &artist, const QString &album, const QString &song, const QString &albumartist, const int track, const qint64 duration, const quint64 timestamp, QObject *parent) :
|
||||
QObject(parent),
|
||||
artist_(artist),
|
||||
album_(album),
|
||||
song_(song),
|
||||
|
||||
@@ -34,7 +34,7 @@ class ScrobblerCacheItem : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ScrobblerCacheItem(const QString &artist, const QString &album, const QString &song, const QString &albumartist, const int track, const qint64 duration, const quint64 ×tamp);
|
||||
explicit ScrobblerCacheItem(const QString &artist, const QString &album, const QString &song, const QString &albumartist, const int track, const qint64 duration, const quint64 timestamp, QObject *parent = nullptr);
|
||||
|
||||
QString effective_albumartist() const { return albumartist_.isEmpty() || albumartist_.toLower() == Song::kVariousArtists ? artist_ : albumartist_; }
|
||||
|
||||
|
||||
@@ -585,7 +585,8 @@ void ScrobblingAPI20::Submit() {
|
||||
|
||||
int i = 0;
|
||||
QList<quint64> list;
|
||||
for (ScrobblerCacheItemPtr item : cache()->List()) {
|
||||
QList<ScrobblerCacheItemPtr> items = cache()->List();
|
||||
for (ScrobblerCacheItemPtr item : items) { // clazy:exclude=range-loop
|
||||
if (item->sent_) continue;
|
||||
item->sent_ = true;
|
||||
if (!batch_) {
|
||||
@@ -614,7 +615,7 @@ void ScrobblingAPI20::Submit() {
|
||||
|
||||
}
|
||||
|
||||
void ScrobblingAPI20::ScrobbleRequestFinished(QNetworkReply *reply, QList<quint64> list) {
|
||||
void ScrobblingAPI20::ScrobbleRequestFinished(QNetworkReply *reply, const QList<quint64> &list) {
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
@@ -720,7 +721,7 @@ void ScrobblingAPI20::ScrobbleRequestFinished(QNetworkReply *reply, QList<quint6
|
||||
return;
|
||||
}
|
||||
|
||||
for (const QJsonValueRef value : array_scrobble) {
|
||||
for (const QJsonValueRef value : array_scrobble) { // clazy:exclude=range-loop
|
||||
|
||||
if (!value.isObject()) {
|
||||
Error("Json scrobbles scrobble array value is not an object.");
|
||||
@@ -807,7 +808,7 @@ void ScrobblingAPI20::SendSingleScrobble(ScrobblerCacheItemPtr item) {
|
||||
|
||||
}
|
||||
|
||||
void ScrobblingAPI20::SingleScrobbleRequestFinished(QNetworkReply *reply, quint64 timestamp) {
|
||||
void ScrobblingAPI20::SingleScrobbleRequestFinished(QNetworkReply *reply, const quint64 timestamp) {
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
|
||||
@@ -83,8 +83,8 @@ class ScrobblingAPI20 : public ScrobblerService {
|
||||
void RedirectArrived();
|
||||
void AuthenticateReplyFinished(QNetworkReply *reply);
|
||||
void UpdateNowPlayingRequestFinished(QNetworkReply *reply);
|
||||
void ScrobbleRequestFinished(QNetworkReply *reply, QList<quint64>);
|
||||
void SingleScrobbleRequestFinished(QNetworkReply *reply, quint64 timestamp);
|
||||
void ScrobbleRequestFinished(QNetworkReply *reply, const QList<quint64> &list);
|
||||
void SingleScrobbleRequestFinished(QNetworkReply *reply, const quint64 timestamp);
|
||||
void LoveRequestFinished(QNetworkReply *reply);
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user