Fix narrowing conversions
This commit is contained in:
@@ -59,7 +59,7 @@ AuddLyricsProvider::~AuddLyricsProvider() {
|
||||
|
||||
}
|
||||
|
||||
bool AuddLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) {
|
||||
bool AuddLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const int id) {
|
||||
|
||||
Q_UNUSED(album);
|
||||
|
||||
@@ -89,9 +89,9 @@ bool AuddLyricsProvider::StartSearch(const QString &artist, const QString &album
|
||||
|
||||
}
|
||||
|
||||
void AuddLyricsProvider::CancelSearch(const quint64 id) { Q_UNUSED(id); }
|
||||
void AuddLyricsProvider::CancelSearch(const int id) { Q_UNUSED(id); }
|
||||
|
||||
void AuddLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title) {
|
||||
void AuddLyricsProvider::HandleSearchReply(QNetworkReply *reply, const int id, const QString &artist, const QString &title) {
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
|
||||
@@ -42,15 +42,15 @@ class AuddLyricsProvider : public JsonLyricsProvider {
|
||||
explicit AuddLyricsProvider(NetworkAccessManager *network, QObject *parent = nullptr);
|
||||
~AuddLyricsProvider() override;
|
||||
|
||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, quint64 id) override;
|
||||
void CancelSearch(const quint64 id) override;
|
||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, int id) override;
|
||||
void CancelSearch(const int id) override;
|
||||
|
||||
private:
|
||||
void Error(const QString &error, const QVariant &debug = QVariant()) override;
|
||||
QJsonArray ExtractResult(QNetworkReply *reply, const QString &artist, const QString &title);
|
||||
|
||||
private slots:
|
||||
void HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title);
|
||||
void HandleSearchReply(QNetworkReply *reply, const int id, const QString &artist, const QString &title);
|
||||
|
||||
private:
|
||||
static const char *kUrlSearch;
|
||||
|
||||
@@ -53,7 +53,7 @@ ChartLyricsProvider::~ChartLyricsProvider() {
|
||||
|
||||
}
|
||||
|
||||
bool ChartLyricsProvider::StartSearch(const QString &artist, const QString&, const QString &title, const quint64 id) {
|
||||
bool ChartLyricsProvider::StartSearch(const QString &artist, const QString&, const QString &title, const int id) {
|
||||
|
||||
const ParamList params = ParamList() << Param("artist", artist)
|
||||
<< Param("song", title);
|
||||
@@ -81,9 +81,9 @@ bool ChartLyricsProvider::StartSearch(const QString &artist, const QString&, con
|
||||
|
||||
}
|
||||
|
||||
void ChartLyricsProvider::CancelSearch(const quint64) {}
|
||||
void ChartLyricsProvider::CancelSearch(const int) {}
|
||||
|
||||
void ChartLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title) {
|
||||
void ChartLyricsProvider::HandleSearchReply(QNetworkReply *reply, const int id, const QString &artist, const QString &title) {
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
|
||||
@@ -40,14 +40,14 @@ class ChartLyricsProvider : public LyricsProvider {
|
||||
explicit ChartLyricsProvider(NetworkAccessManager *network, QObject *parent = nullptr);
|
||||
~ChartLyricsProvider() override;
|
||||
|
||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) override;
|
||||
void CancelSearch(quint64 id) override;
|
||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, const int id) override;
|
||||
void CancelSearch(int id) override;
|
||||
|
||||
private:
|
||||
void Error(const QString &error, const QVariant &debug = QVariant()) override;
|
||||
|
||||
private slots:
|
||||
void HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title);
|
||||
void HandleSearchReply(QNetworkReply *reply, const int id, const QString &artist, const QString &title);
|
||||
|
||||
private:
|
||||
static const char *kUrlSearch;
|
||||
|
||||
@@ -300,7 +300,7 @@ void GeniusLyricsProvider::AccessTokenRequestFinished(QNetworkReply *reply) {
|
||||
|
||||
}
|
||||
|
||||
bool GeniusLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) {
|
||||
bool GeniusLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const int id) {
|
||||
|
||||
Q_UNUSED(album);
|
||||
|
||||
@@ -339,9 +339,9 @@ bool GeniusLyricsProvider::StartSearch(const QString &artist, const QString &alb
|
||||
|
||||
}
|
||||
|
||||
void GeniusLyricsProvider::CancelSearch(const quint64 id) { Q_UNUSED(id); }
|
||||
void GeniusLyricsProvider::CancelSearch(const int id) { Q_UNUSED(id); }
|
||||
|
||||
void GeniusLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 id) {
|
||||
void GeniusLyricsProvider::HandleSearchReply(QNetworkReply *reply, const int id) {
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
@@ -499,11 +499,11 @@ void GeniusLyricsProvider::HandleLyricReply(QNetworkReply *reply, const int sear
|
||||
|
||||
QString tag_begin = "<div class=\"lyrics\">";
|
||||
QString tag_end = "</div>";
|
||||
int begin_idx = content.indexOf(tag_begin);
|
||||
qint64 begin_idx = content.indexOf(tag_begin);
|
||||
QString lyrics;
|
||||
if (begin_idx > 0) {
|
||||
begin_idx += tag_begin.length();
|
||||
int end_idx = content.indexOf(tag_end, begin_idx);
|
||||
qint64 end_idx = content.indexOf(tag_end, begin_idx);
|
||||
lyrics = content.mid(begin_idx, end_idx - begin_idx);
|
||||
lyrics = lyrics.remove(QRegularExpression("<[^>]*>"));
|
||||
lyrics = lyrics.trimmed();
|
||||
|
||||
@@ -53,8 +53,8 @@ class GeniusLyricsProvider : public JsonLyricsProvider {
|
||||
void Authenticate() override;
|
||||
void Deauthenticate() override { access_token_.clear(); }
|
||||
|
||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, quint64 id) override;
|
||||
void CancelSearch(const quint64 id) override;
|
||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, int id) override;
|
||||
void CancelSearch(const int id) override;
|
||||
|
||||
public:
|
||||
struct GeniusLyricsLyricContext {
|
||||
@@ -82,7 +82,7 @@ class GeniusLyricsProvider : public JsonLyricsProvider {
|
||||
void HandleLoginSSLErrors(const QList<QSslError> &ssl_errors);
|
||||
void RedirectArrived();
|
||||
void AccessTokenRequestFinished(QNetworkReply *reply);
|
||||
void HandleSearchReply(QNetworkReply *reply, const quint64 id);
|
||||
void HandleSearchReply(QNetworkReply *reply, const int id);
|
||||
void HandleLyricReply(QNetworkReply *reply, const int search_id, const QUrl &url);
|
||||
|
||||
private:
|
||||
|
||||
@@ -54,7 +54,7 @@ LoloLyricsProvider::~LoloLyricsProvider() {
|
||||
|
||||
}
|
||||
|
||||
bool LoloLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) {
|
||||
bool LoloLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const int id) {
|
||||
|
||||
Q_UNUSED(album);
|
||||
|
||||
@@ -84,9 +84,9 @@ bool LoloLyricsProvider::StartSearch(const QString &artist, const QString &album
|
||||
|
||||
}
|
||||
|
||||
void LoloLyricsProvider::CancelSearch(const quint64 id) { Q_UNUSED(id); }
|
||||
void LoloLyricsProvider::CancelSearch(const int id) { Q_UNUSED(id); }
|
||||
|
||||
void LoloLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title) {
|
||||
void LoloLyricsProvider::HandleSearchReply(QNetworkReply *reply, const int id, const QString &artist, const QString &title) {
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
|
||||
@@ -40,14 +40,14 @@ class LoloLyricsProvider : public LyricsProvider {
|
||||
explicit LoloLyricsProvider(NetworkAccessManager *network, QObject *parent = nullptr);
|
||||
~LoloLyricsProvider() override;
|
||||
|
||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) override;
|
||||
void CancelSearch(const quint64 id) override;
|
||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, const int id) override;
|
||||
void CancelSearch(const int id) override;
|
||||
|
||||
private:
|
||||
void Error(const QString &error, const QVariant &debug = QVariant()) override;
|
||||
|
||||
private slots:
|
||||
void HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title);
|
||||
void HandleSearchReply(QNetworkReply *reply, const int id, const QString &artist, const QString &title);
|
||||
|
||||
private:
|
||||
static const char *kUrlSearch;
|
||||
|
||||
@@ -45,7 +45,7 @@ LyricsFetcher::LyricsFetcher(LyricsProviders *lyrics_providers, QObject *parent)
|
||||
|
||||
}
|
||||
|
||||
quint64 LyricsFetcher::Search(const QString &artist, const QString &album, const QString &title) {
|
||||
int LyricsFetcher::Search(const QString &artist, const QString &album, const QString &title) {
|
||||
|
||||
LyricsSearchRequest request;
|
||||
request.artist = artist;
|
||||
@@ -105,7 +105,7 @@ void LyricsFetcher::StartRequests() {
|
||||
|
||||
}
|
||||
|
||||
void LyricsFetcher::SingleSearchFinished(const quint64 request_id, const LyricsSearchResults &results) {
|
||||
void LyricsFetcher::SingleSearchFinished(const int request_id, const LyricsSearchResults &results) {
|
||||
|
||||
if (!active_requests_.contains(request_id)) return;
|
||||
|
||||
@@ -115,7 +115,7 @@ void LyricsFetcher::SingleSearchFinished(const quint64 request_id, const LyricsS
|
||||
|
||||
}
|
||||
|
||||
void LyricsFetcher::SingleLyricsFetched(const quint64 request_id, const QString &provider, const QString &lyrics) {
|
||||
void LyricsFetcher::SingleLyricsFetched(const int request_id, const QString &provider, const QString &lyrics) {
|
||||
|
||||
if (!active_requests_.contains(request_id)) return;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class LyricsFetcherSearch;
|
||||
|
||||
struct LyricsSearchRequest {
|
||||
explicit LyricsSearchRequest() : id(-1) {}
|
||||
quint64 id;
|
||||
int id;
|
||||
QString artist;
|
||||
QString album;
|
||||
QString title;
|
||||
@@ -65,29 +65,29 @@ class LyricsFetcher : public QObject {
|
||||
explicit LyricsFetcher(LyricsProviders *lyrics_providers, QObject *parent = nullptr);
|
||||
~LyricsFetcher() override {}
|
||||
|
||||
quint64 Search(const QString &artist, const QString &album, const QString &title);
|
||||
int Search(const QString &artist, const QString &album, const QString &title);
|
||||
void Clear();
|
||||
|
||||
private:
|
||||
void AddRequest(const LyricsSearchRequest &req);
|
||||
|
||||
signals:
|
||||
void LyricsFetched(quint64 request_id, QString provider, QString lyrics);
|
||||
void SearchFinished(quint64 request_id, LyricsSearchResults results);
|
||||
void LyricsFetched(int request_id, QString provider, QString lyrics);
|
||||
void SearchFinished(int request_id, LyricsSearchResults results);
|
||||
|
||||
private slots:
|
||||
void SingleSearchFinished(const quint64 request_id, const LyricsSearchResults &results);
|
||||
void SingleLyricsFetched(const quint64 request_id, const QString &provider, const QString &lyrics);
|
||||
void SingleSearchFinished(const int request_id, const LyricsSearchResults &results);
|
||||
void SingleLyricsFetched(const int request_id, const QString &provider, const QString &lyrics);
|
||||
void StartRequests();
|
||||
|
||||
private:
|
||||
static const int kMaxConcurrentRequests;
|
||||
|
||||
LyricsProviders *lyrics_providers_;
|
||||
quint64 next_id_;
|
||||
int next_id_;
|
||||
|
||||
QQueue<LyricsSearchRequest> queued_requests_;
|
||||
QHash<quint64, LyricsFetcherSearch*> active_requests_;
|
||||
QHash<int, LyricsFetcherSearch*> active_requests_;
|
||||
|
||||
QTimer *request_starter_;
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ void LyricsFetcherSearch::Start(LyricsProviders *lyrics_providers) {
|
||||
|
||||
}
|
||||
|
||||
void LyricsFetcherSearch::ProviderSearchFinished(const quint64 id, const LyricsSearchResults &results) {
|
||||
void LyricsFetcherSearch::ProviderSearchFinished(const int id, const LyricsSearchResults &results) {
|
||||
|
||||
if (!pending_requests_.contains(id)) return;
|
||||
LyricsProvider *provider = pending_requests_.take(id);
|
||||
|
||||
@@ -42,11 +42,11 @@ class LyricsFetcherSearch : public QObject {
|
||||
void Cancel();
|
||||
|
||||
signals:
|
||||
void SearchFinished(quint64, LyricsSearchResults results);
|
||||
void LyricsFetched(quint64, QString provider, QString lyrics);
|
||||
void SearchFinished(int, LyricsSearchResults results);
|
||||
void LyricsFetched(int, QString provider, QString lyrics);
|
||||
|
||||
private slots:
|
||||
void ProviderSearchFinished(const quint64 id, const LyricsSearchResults &results);
|
||||
void ProviderSearchFinished(const int id, const LyricsSearchResults &results);
|
||||
void TerminateSearch();
|
||||
|
||||
private:
|
||||
|
||||
@@ -49,8 +49,8 @@ class LyricsProvider : public QObject {
|
||||
void set_enabled(const bool enabled) { enabled_ = enabled; }
|
||||
void set_order(const int order) { order_ = order; }
|
||||
|
||||
virtual bool StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) = 0;
|
||||
virtual void CancelSearch(const quint64 id) { Q_UNUSED(id); }
|
||||
virtual bool StartSearch(const QString &artist, const QString &album, const QString &title, const int id) = 0;
|
||||
virtual void CancelSearch(const int id) { Q_UNUSED(id); }
|
||||
virtual bool AuthenticationRequired() const { return authentication_required_; }
|
||||
virtual void Authenticate() {}
|
||||
virtual bool IsAuthenticated() const { return !authentication_required_; }
|
||||
|
||||
@@ -52,7 +52,7 @@ MusixmatchLyricsProvider::~MusixmatchLyricsProvider() {
|
||||
|
||||
}
|
||||
|
||||
bool MusixmatchLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) {
|
||||
bool MusixmatchLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const int id) {
|
||||
|
||||
QString artist_stripped = artist;
|
||||
QString title_stripped = title;
|
||||
@@ -93,9 +93,9 @@ bool MusixmatchLyricsProvider::StartSearch(const QString &artist, const QString
|
||||
|
||||
}
|
||||
|
||||
void MusixmatchLyricsProvider::CancelSearch(const quint64 id) { Q_UNUSED(id); }
|
||||
void MusixmatchLyricsProvider::CancelSearch(const int id) { Q_UNUSED(id); }
|
||||
|
||||
void MusixmatchLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &album, const QString &title) {
|
||||
void MusixmatchLyricsProvider::HandleSearchReply(QNetworkReply *reply, const int id, const QString &artist, const QString &album, const QString &title) {
|
||||
|
||||
Q_UNUSED(album);
|
||||
|
||||
@@ -127,11 +127,11 @@ void MusixmatchLyricsProvider::HandleSearchReply(QNetworkReply *reply, const qui
|
||||
QString content = data;
|
||||
QString data_begin = "var __mxmState = ";
|
||||
QString data_end = ";</script>";
|
||||
int begin_idx = content.indexOf(data_begin);
|
||||
qint64 begin_idx = content.indexOf(data_begin);
|
||||
QString content_json;
|
||||
if (begin_idx > 0) {
|
||||
begin_idx += data_begin.length();
|
||||
int end_idx = content.indexOf(data_end, begin_idx);
|
||||
qint64 end_idx = content.indexOf(data_end, begin_idx);
|
||||
if (end_idx > begin_idx) {
|
||||
content_json = content.mid(begin_idx, end_idx - begin_idx);
|
||||
}
|
||||
|
||||
@@ -41,14 +41,14 @@ class MusixmatchLyricsProvider : public JsonLyricsProvider {
|
||||
explicit MusixmatchLyricsProvider(NetworkAccessManager *network, QObject *parent = nullptr);
|
||||
~MusixmatchLyricsProvider() override;
|
||||
|
||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) override;
|
||||
void CancelSearch(const quint64 id) override;
|
||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, const int id) override;
|
||||
void CancelSearch(const int id) override;
|
||||
|
||||
private:
|
||||
void Error(const QString &error, const QVariant &debug = QVariant()) override;
|
||||
|
||||
private slots:
|
||||
void HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &album, const QString &title);
|
||||
void HandleSearchReply(QNetworkReply *reply, const int id, const QString &artist, const QString &album, const QString &title);
|
||||
|
||||
private:
|
||||
QList<QNetworkReply*> replies_;
|
||||
|
||||
@@ -51,7 +51,7 @@ OVHLyricsProvider::~OVHLyricsProvider() {
|
||||
|
||||
}
|
||||
|
||||
bool OVHLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) {
|
||||
bool OVHLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const int id) {
|
||||
|
||||
Q_UNUSED(album);
|
||||
|
||||
@@ -72,9 +72,9 @@ bool OVHLyricsProvider::StartSearch(const QString &artist, const QString &album,
|
||||
|
||||
}
|
||||
|
||||
void OVHLyricsProvider::CancelSearch(const quint64 id) { Q_UNUSED(id); }
|
||||
void OVHLyricsProvider::CancelSearch(const int id) { Q_UNUSED(id); }
|
||||
|
||||
void OVHLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title) {
|
||||
void OVHLyricsProvider::HandleSearchReply(QNetworkReply *reply, const int id, const QString &artist, const QString &title) {
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
|
||||
@@ -40,14 +40,14 @@ class OVHLyricsProvider : public JsonLyricsProvider {
|
||||
explicit OVHLyricsProvider(NetworkAccessManager *network, QObject *parent = nullptr);
|
||||
~OVHLyricsProvider() override;
|
||||
|
||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) override;
|
||||
void CancelSearch(const quint64 id) override;
|
||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, const int id) override;
|
||||
void CancelSearch(const int id) override;
|
||||
|
||||
private:
|
||||
void Error(const QString &error, const QVariant &debug = QVariant()) override;
|
||||
|
||||
private slots:
|
||||
void HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title);
|
||||
void HandleSearchReply(QNetworkReply *reply, const int id, const QString &artist, const QString &title);
|
||||
|
||||
private:
|
||||
static const char *kUrlSearch;
|
||||
|
||||
Reference in New Issue
Block a user