Refactoring
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
#include <QUrl>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "core/networkaccessmanager.h"
|
||||
#include "utilities/transliterate.h"
|
||||
#include "lyricssearchrequest.h"
|
||||
@@ -38,7 +38,7 @@ constexpr char kEndTag[] = "</div>";
|
||||
constexpr char kLyricsStart[] = "<!-- Usage of azlyrics.com content by any third-party lyrics provider is prohibited by our licensing agreement. Sorry about that. -->";
|
||||
} // namespace
|
||||
|
||||
AzLyricsComLyricsProvider::AzLyricsComLyricsProvider(SharedPtr<NetworkAccessManager> network, QObject *parent)
|
||||
AzLyricsComLyricsProvider::AzLyricsComLyricsProvider(const SharedPtr<NetworkAccessManager> network, QObject *parent)
|
||||
: HtmlLyricsProvider(u"azlyrics.com"_s, true, QLatin1String(kStartTag), QLatin1String(kEndTag), QLatin1String(kLyricsStart), false, network, parent) {}
|
||||
|
||||
QUrl AzLyricsComLyricsProvider::Url(const LyricsSearchRequest &request) {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "core/networkaccessmanager.h"
|
||||
#include "htmllyricsprovider.h"
|
||||
#include "lyricssearchrequest.h"
|
||||
@@ -34,7 +34,7 @@ class AzLyricsComLyricsProvider : public HtmlLyricsProvider {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AzLyricsComLyricsProvider(SharedPtr<NetworkAccessManager> network, QObject *parent = nullptr);
|
||||
explicit AzLyricsComLyricsProvider(const SharedPtr<NetworkAccessManager> network, QObject *parent = nullptr);
|
||||
|
||||
protected:
|
||||
QUrl Url(const LyricsSearchRequest &request) override;
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
#include <QNetworkReply>
|
||||
#include <QXmlStreamReader>
|
||||
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/shared_ptr.h"
|
||||
#include "core/networkaccessmanager.h"
|
||||
#include "utilities/strutils.h"
|
||||
#include "lyricssearchrequest.h"
|
||||
@@ -44,7 +44,7 @@ namespace {
|
||||
constexpr char kUrlSearch[] = "http://api.chartlyrics.com/apiv1.asmx/SearchLyricDirect";
|
||||
}
|
||||
|
||||
ChartLyricsProvider::ChartLyricsProvider(SharedPtr<NetworkAccessManager> network, QObject *parent) : LyricsProvider(u"ChartLyrics"_s, false, false, network, parent) {}
|
||||
ChartLyricsProvider::ChartLyricsProvider(const SharedPtr<NetworkAccessManager> network, QObject *parent) : LyricsProvider(u"ChartLyrics"_s, false, false, network, parent) {}
|
||||
|
||||
ChartLyricsProvider::~ChartLyricsProvider() {
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "lyricsprovider.h"
|
||||
#include "lyricsfetcher.h"
|
||||
|
||||
@@ -38,7 +38,7 @@ class ChartLyricsProvider : public LyricsProvider {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ChartLyricsProvider(SharedPtr<NetworkAccessManager> network, QObject *parent = nullptr);
|
||||
explicit ChartLyricsProvider(const SharedPtr<NetworkAccessManager> network, QObject *parent = nullptr);
|
||||
~ChartLyricsProvider() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <QUrl>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "core/networkaccessmanager.h"
|
||||
#include "utilities/transliterate.h"
|
||||
#include "lyricssearchrequest.h"
|
||||
@@ -38,7 +38,7 @@ constexpr char kEndTag[] = "<\\/div>";
|
||||
constexpr char kLyricsStart[] = "<div id='inlyr'>";
|
||||
} // namespace
|
||||
|
||||
ElyricsNetLyricsProvider::ElyricsNetLyricsProvider(SharedPtr<NetworkAccessManager> network, QObject *parent)
|
||||
ElyricsNetLyricsProvider::ElyricsNetLyricsProvider(const SharedPtr<NetworkAccessManager> network, QObject *parent)
|
||||
: HtmlLyricsProvider(u"elyrics.net"_s, true, QLatin1String(kStartTag), QLatin1String(kEndTag), QLatin1String(kLyricsStart), false, network, parent) {}
|
||||
|
||||
QUrl ElyricsNetLyricsProvider::Url(const LyricsSearchRequest &request) {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "core/networkaccessmanager.h"
|
||||
#include "htmllyricsprovider.h"
|
||||
#include "lyricssearchrequest.h"
|
||||
@@ -34,7 +34,7 @@ class ElyricsNetLyricsProvider : public HtmlLyricsProvider {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ElyricsNetLyricsProvider(SharedPtr<NetworkAccessManager> network, QObject *parent = nullptr);
|
||||
explicit ElyricsNetLyricsProvider(const SharedPtr<NetworkAccessManager> network, QObject *parent = nullptr);
|
||||
|
||||
protected:
|
||||
QUrl Url(const LyricsSearchRequest &request) override;
|
||||
|
||||
@@ -45,8 +45,8 @@
|
||||
#include <QMessageBox>
|
||||
#include <QMutexLocker>
|
||||
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/shared_ptr.h"
|
||||
#include "core/networkaccessmanager.h"
|
||||
#include "core/settings.h"
|
||||
#include "core/localredirectserver.h"
|
||||
@@ -68,7 +68,7 @@ constexpr char kClientIDB64[] = "RUNTNXU4U1VyMU1KUU5hdTZySEZteUxXY2hkanFiY3lfc2J
|
||||
constexpr char kClientSecretB64[] = "VE9pMU9vUjNtTXZ3eFR3YVN0QVRyUjVoUlhVWDI1Ylp5X240eEt1M0ZkYlNwRG5JUnd0LXFFbHdGZkZkRWY2VzJ1S011UnQzM3c2Y3hqY0tVZ3NGN2c=";
|
||||
} // namespace
|
||||
|
||||
GeniusLyricsProvider::GeniusLyricsProvider(SharedPtr<NetworkAccessManager> network, QObject *parent) : JsonLyricsProvider(u"Genius"_s, true, true, network, parent), server_(nullptr) {
|
||||
GeniusLyricsProvider::GeniusLyricsProvider(const SharedPtr<NetworkAccessManager> network, QObject *parent) : JsonLyricsProvider(u"Genius"_s, true, true, network, parent), server_(nullptr) {
|
||||
|
||||
Settings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include <QJsonArray>
|
||||
#include <QMutex>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "jsonlyricsprovider.h"
|
||||
#include "lyricssearchrequest.h"
|
||||
#include "lyricssearchresult.h"
|
||||
@@ -47,7 +47,7 @@ class GeniusLyricsProvider : public JsonLyricsProvider {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GeniusLyricsProvider(SharedPtr<NetworkAccessManager> network, QObject *parent = nullptr);
|
||||
explicit GeniusLyricsProvider(const SharedPtr<NetworkAccessManager> network, QObject *parent = nullptr);
|
||||
~GeniusLyricsProvider() override;
|
||||
|
||||
bool IsAuthenticated() const override { return !access_token().isEmpty(); }
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/shared_ptr.h"
|
||||
#include "core/networkaccessmanager.h"
|
||||
#include "utilities/strutils.h"
|
||||
#include "htmllyricsprovider.h"
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
using namespace Qt::Literals::StringLiterals;
|
||||
|
||||
HtmlLyricsProvider::HtmlLyricsProvider(const QString &name, const bool enabled, const QString &start_tag, const QString &end_tag, const QString &lyrics_start, const bool multiple, SharedPtr<NetworkAccessManager> network, QObject *parent)
|
||||
HtmlLyricsProvider::HtmlLyricsProvider(const QString &name, const bool enabled, const QString &start_tag, const QString &end_tag, const QString &lyrics_start, const bool multiple, const SharedPtr<NetworkAccessManager> network, QObject *parent)
|
||||
: LyricsProvider(name, enabled, false, network, parent), start_tag_(start_tag), end_tag_(end_tag), lyrics_start_(lyrics_start), multiple_(multiple) {}
|
||||
|
||||
HtmlLyricsProvider::~HtmlLyricsProvider() {
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "core/networkaccessmanager.h"
|
||||
#include "lyricsprovider.h"
|
||||
#include "lyricssearchrequest.h"
|
||||
@@ -40,7 +40,7 @@ class HtmlLyricsProvider : public LyricsProvider {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit HtmlLyricsProvider(const QString &name, const bool enabled, const QString &start_tag, const QString &end_tag, const QString &lyrics_start, const bool multiple, SharedPtr<NetworkAccessManager> network, QObject *parent);
|
||||
explicit HtmlLyricsProvider(const QString &name, const bool enabled, const QString &start_tag, const QString &end_tag, const QString &lyrics_start, const bool multiple, const SharedPtr<NetworkAccessManager> network, QObject *parent);
|
||||
~HtmlLyricsProvider();
|
||||
|
||||
virtual bool StartSearchAsync(const int id, const LyricsSearchRequest &request) override;
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "core/networkaccessmanager.h"
|
||||
#include "jsonlyricsprovider.h"
|
||||
|
||||
JsonLyricsProvider::JsonLyricsProvider(const QString &name, const bool enabled, const bool authentication_required, SharedPtr<NetworkAccessManager> network, QObject *parent) : LyricsProvider(name, enabled, authentication_required, network, parent) {}
|
||||
JsonLyricsProvider::JsonLyricsProvider(const QString &name, const bool enabled, const bool authentication_required, const SharedPtr<NetworkAccessManager> network, QObject *parent) : LyricsProvider(name, enabled, authentication_required, network, parent) {}
|
||||
|
||||
QByteArray JsonLyricsProvider::ExtractData(QNetworkReply *reply) {
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <QString>
|
||||
#include <QJsonObject>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "lyricsprovider.h"
|
||||
|
||||
class NetworkAccessManager;
|
||||
@@ -39,7 +39,7 @@ class JsonLyricsProvider : public LyricsProvider {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit JsonLyricsProvider(const QString &name, const bool enabled, const bool authentication_required, SharedPtr<NetworkAccessManager> network, QObject *parent = nullptr);
|
||||
explicit JsonLyricsProvider(const QString &name, const bool enabled, const bool authentication_required, const SharedPtr<NetworkAccessManager> network, QObject *parent = nullptr);
|
||||
|
||||
protected:
|
||||
QByteArray ExtractData(QNetworkReply *reply);
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <QUrl>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "core/networkaccessmanager.h"
|
||||
#include "core/logging.h"
|
||||
#include "utilities/transliterate.h"
|
||||
@@ -39,7 +39,7 @@ constexpr char kEndTag[] = "<\\/div>";
|
||||
constexpr char kLyricsStart[] = "<div id=\"letra-cnt\">";
|
||||
} // namespace
|
||||
|
||||
LetrasLyricsProvider::LetrasLyricsProvider(SharedPtr<NetworkAccessManager> network, QObject *parent)
|
||||
LetrasLyricsProvider::LetrasLyricsProvider(const SharedPtr<NetworkAccessManager> network, QObject *parent)
|
||||
: HtmlLyricsProvider(u"letras.mus.br"_s, true, QLatin1String(kStartTag), QLatin1String(kEndTag), QLatin1String(kLyricsStart), false, network, parent) {}
|
||||
|
||||
QUrl LetrasLyricsProvider::Url(const LyricsSearchRequest &request) {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "core/networkaccessmanager.h"
|
||||
#include "htmllyricsprovider.h"
|
||||
#include "lyricssearchrequest.h"
|
||||
@@ -34,7 +34,7 @@ class LetrasLyricsProvider : public HtmlLyricsProvider {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LetrasLyricsProvider(SharedPtr<NetworkAccessManager> network, QObject *parent = nullptr);
|
||||
explicit LetrasLyricsProvider(const SharedPtr<NetworkAccessManager> network, QObject *parent = nullptr);
|
||||
|
||||
protected:
|
||||
QUrl Url(const LyricsSearchRequest &request) override;
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
#include <QNetworkReply>
|
||||
#include <QXmlStreamReader>
|
||||
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/shared_ptr.h"
|
||||
#include "core/networkaccessmanager.h"
|
||||
#include "utilities/strutils.h"
|
||||
#include "lyricssearchrequest.h"
|
||||
@@ -44,7 +44,7 @@ namespace {
|
||||
constexpr char kUrlSearch[] = "http://api.lololyrics.com/0.5/getLyric";
|
||||
}
|
||||
|
||||
LoloLyricsProvider::LoloLyricsProvider(SharedPtr<NetworkAccessManager> network, QObject *parent) : LyricsProvider(u"LoloLyrics"_s, true, false, network, parent) {}
|
||||
LoloLyricsProvider::LoloLyricsProvider(const SharedPtr<NetworkAccessManager> network, QObject *parent) : LyricsProvider(u"LoloLyrics"_s, true, false, network, parent) {}
|
||||
|
||||
LoloLyricsProvider::~LoloLyricsProvider() {
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "lyricsprovider.h"
|
||||
#include "lyricssearchrequest.h"
|
||||
|
||||
@@ -39,7 +39,7 @@ class LoloLyricsProvider : public LyricsProvider {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LoloLyricsProvider(SharedPtr<NetworkAccessManager> network, QObject *parent = nullptr);
|
||||
explicit LoloLyricsProvider(const SharedPtr<NetworkAccessManager> network, QObject *parent = nullptr);
|
||||
~LoloLyricsProvider() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -45,7 +45,7 @@ constexpr char kLyricsStart[] = "<script id=\"__NEXT_DATA__\" type=\"application
|
||||
constexpr char kLyricsEnd[] = "</script>";
|
||||
} // namespace
|
||||
|
||||
LyricFindLyricsProvider::LyricFindLyricsProvider(SharedPtr<NetworkAccessManager> network, QObject *parent) : JsonLyricsProvider(u"lyricfind.com"_s, true, false, network, parent) {}
|
||||
LyricFindLyricsProvider::LyricFindLyricsProvider(const SharedPtr<NetworkAccessManager> network, QObject *parent) : JsonLyricsProvider(u"lyricfind.com"_s, true, false, network, parent) {}
|
||||
|
||||
LyricFindLyricsProvider::~LyricFindLyricsProvider() {
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class LyricFindLyricsProvider : public JsonLyricsProvider {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LyricFindLyricsProvider(SharedPtr<NetworkAccessManager> network, QObject *parent = nullptr);
|
||||
explicit LyricFindLyricsProvider(const SharedPtr<NetworkAccessManager> network, QObject *parent = nullptr);
|
||||
~LyricFindLyricsProvider() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <QTimer>
|
||||
#include <QString>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "core/song.h"
|
||||
#include "lyricsfetcher.h"
|
||||
#include "lyricsfetchersearch.h"
|
||||
@@ -38,7 +38,7 @@ namespace {
|
||||
constexpr int kMaxConcurrentRequests = 5;
|
||||
}
|
||||
|
||||
LyricsFetcher::LyricsFetcher(SharedPtr<LyricsProviders> lyrics_providers, QObject *parent)
|
||||
LyricsFetcher::LyricsFetcher(const SharedPtr<LyricsProviders> lyrics_providers, QObject *parent)
|
||||
: QObject(parent),
|
||||
lyrics_providers_(lyrics_providers),
|
||||
next_id_(0),
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "lyricssearchrequest.h"
|
||||
#include "lyricssearchresult.h"
|
||||
|
||||
@@ -44,7 +44,7 @@ class LyricsFetcher : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LyricsFetcher(SharedPtr<LyricsProviders> lyrics_providers, QObject *parent = nullptr);
|
||||
explicit LyricsFetcher(const SharedPtr<LyricsProviders> lyrics_providers, QObject *parent = nullptr);
|
||||
~LyricsFetcher() override {}
|
||||
|
||||
struct Request {
|
||||
@@ -69,7 +69,7 @@ class LyricsFetcher : public QObject {
|
||||
void StartRequests();
|
||||
|
||||
private:
|
||||
SharedPtr<LyricsProviders> lyrics_providers_;
|
||||
const SharedPtr<LyricsProviders> lyrics_providers_;
|
||||
quint64 next_id_;
|
||||
|
||||
QQueue<Request> queued_requests_;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <QList>
|
||||
|
||||
#include "core/logging.h"
|
||||
#include "core/shared_ptr.h"
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "lyricsfetchersearch.h"
|
||||
#include "lyricssearchrequest.h"
|
||||
#include "lyricssearchresult.h"
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "lyricssearchrequest.h"
|
||||
#include "lyricssearchresult.h"
|
||||
|
||||
@@ -58,7 +58,7 @@ class LyricsFetcherSearch : public QObject {
|
||||
|
||||
private:
|
||||
quint64 id_;
|
||||
LyricsSearchRequest request_;
|
||||
const LyricsSearchRequest request_;
|
||||
LyricsSearchResults results_;
|
||||
QMap<int, LyricsProvider*> pending_requests_;
|
||||
bool cancel_requested_;
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "core/networkaccessmanager.h"
|
||||
#include "lyricsprovider.h"
|
||||
|
||||
LyricsProvider::LyricsProvider(const QString &name, const bool enabled, const bool authentication_required, SharedPtr<NetworkAccessManager> network, QObject *parent)
|
||||
LyricsProvider::LyricsProvider(const QString &name, const bool enabled, const bool authentication_required, const SharedPtr<NetworkAccessManager> network, QObject *parent)
|
||||
: QObject(parent), network_(network), name_(name), enabled_(enabled), order_(0), authentication_required_(authentication_required) {}
|
||||
|
||||
bool LyricsProvider::StartSearchAsync(const int id, const LyricsSearchRequest &request) {
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <QString>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "core/networkaccessmanager.h"
|
||||
#include "lyricssearchrequest.h"
|
||||
#include "lyricssearchresult.h"
|
||||
@@ -38,7 +38,7 @@ class LyricsProvider : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LyricsProvider(const QString &name, const bool enabled, const bool authentication_required, SharedPtr<NetworkAccessManager> network, QObject *parent);
|
||||
explicit LyricsProvider(const QString &name, const bool enabled, const bool authentication_required, const SharedPtr<NetworkAccessManager> network, QObject *parent);
|
||||
|
||||
QString name() const { return name_; }
|
||||
bool is_enabled() const { return enabled_; }
|
||||
@@ -66,7 +66,7 @@ class LyricsProvider : public QObject {
|
||||
void SearchFinished(const int id, const LyricsSearchResults &results = LyricsSearchResults());
|
||||
|
||||
protected:
|
||||
SharedPtr<NetworkAccessManager> network_;
|
||||
const SharedPtr<NetworkAccessManager> network_;
|
||||
const QString name_;
|
||||
bool enabled_;
|
||||
int order_;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "lyricsprovider.h"
|
||||
#include "lyricsproviders.h"
|
||||
|
||||
#include "settings/lyricssettingspage.h"
|
||||
#include "constants/lyricssettings.h"
|
||||
|
||||
int LyricsProviders::NextOrderId = 0;
|
||||
|
||||
@@ -72,8 +72,8 @@ void LyricsProviders::ReloadSettings() {
|
||||
}
|
||||
|
||||
Settings s;
|
||||
s.beginGroup(LyricsSettingsPage::kSettingsGroup);
|
||||
const QStringList providers_enabled = s.value("providers", QStringList() << all_providers.values()).toStringList();
|
||||
s.beginGroup(LyricsSettings::kSettingsGroup);
|
||||
const QStringList providers_enabled = s.value(LyricsSettings::kProviders, QStringList() << all_providers.values()).toStringList();
|
||||
s.endGroup();
|
||||
|
||||
int i = 0;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <QAtomicInt>
|
||||
#include <QThread>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "includes/shared_ptr.h"
|
||||
|
||||
class NetworkAccessManager;
|
||||
class LyricsProvider;
|
||||
@@ -63,7 +63,7 @@ class LyricsProviders : public QObject {
|
||||
static int NextOrderId;
|
||||
|
||||
QThread *thread_;
|
||||
SharedPtr<NetworkAccessManager> network_;
|
||||
const SharedPtr<NetworkAccessManager> network_;
|
||||
|
||||
QMap<LyricsProvider*, QString> lyrics_providers_;
|
||||
QList<LyricsProvider*> ordered_providers_;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
class LyricsSearchRequest {
|
||||
public:
|
||||
explicit LyricsSearchRequest() {}
|
||||
explicit LyricsSearchRequest() = default;
|
||||
QString albumartist;
|
||||
QString artist;
|
||||
QString album;
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/shared_ptr.h"
|
||||
#include "core/networkaccessmanager.h"
|
||||
#include "utilities/strutils.h"
|
||||
#include "jsonlyricsprovider.h"
|
||||
@@ -48,7 +48,7 @@
|
||||
using namespace Qt::Literals::StringLiterals;
|
||||
using std::make_shared;
|
||||
|
||||
MusixmatchLyricsProvider::MusixmatchLyricsProvider(SharedPtr<NetworkAccessManager> network, QObject *parent) : JsonLyricsProvider(u"Musixmatch"_s, true, false, network, parent), use_api_(true) {}
|
||||
MusixmatchLyricsProvider::MusixmatchLyricsProvider(const SharedPtr<NetworkAccessManager> network, QObject *parent) : JsonLyricsProvider(u"Musixmatch"_s, true, false, network, parent), use_api_(true) {}
|
||||
|
||||
MusixmatchLyricsProvider::~MusixmatchLyricsProvider() {
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "jsonlyricsprovider.h"
|
||||
#include "lyricssearchrequest.h"
|
||||
#include "lyricssearchresult.h"
|
||||
@@ -42,7 +42,7 @@ class MusixmatchLyricsProvider : public JsonLyricsProvider, public MusixmatchPro
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MusixmatchLyricsProvider(SharedPtr<NetworkAccessManager> network, QObject *parent = nullptr);
|
||||
explicit MusixmatchLyricsProvider(const SharedPtr<NetworkAccessManager> network, QObject *parent = nullptr);
|
||||
~MusixmatchLyricsProvider() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
#include <QNetworkReply>
|
||||
#include <QJsonObject>
|
||||
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/shared_ptr.h"
|
||||
#include "core/networkaccessmanager.h"
|
||||
#include "utilities/strutils.h"
|
||||
#include "lyricssearchrequest.h"
|
||||
@@ -43,7 +43,7 @@ namespace {
|
||||
constexpr char kUrlSearch[] = "https://api.lyrics.ovh/v1/";
|
||||
}
|
||||
|
||||
OVHLyricsProvider::OVHLyricsProvider(SharedPtr<NetworkAccessManager> network, QObject *parent) : JsonLyricsProvider(u"Lyrics.ovh"_s, true, false, network, parent) {}
|
||||
OVHLyricsProvider::OVHLyricsProvider(const SharedPtr<NetworkAccessManager> network, QObject *parent) : JsonLyricsProvider(u"Lyrics.ovh"_s, true, false, network, parent) {}
|
||||
|
||||
OVHLyricsProvider::~OVHLyricsProvider() {
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "jsonlyricsprovider.h"
|
||||
#include "lyricssearchrequest.h"
|
||||
|
||||
@@ -39,7 +39,7 @@ class OVHLyricsProvider : public JsonLyricsProvider {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OVHLyricsProvider(SharedPtr<NetworkAccessManager> network, QObject *parent = nullptr);
|
||||
explicit OVHLyricsProvider(const SharedPtr<NetworkAccessManager> network, QObject *parent = nullptr);
|
||||
~OVHLyricsProvider() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <QUrl>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "core/networkaccessmanager.h"
|
||||
#include "lyricssearchrequest.h"
|
||||
#include "songlyricscomlyricsprovider.h"
|
||||
@@ -37,7 +37,7 @@ constexpr char kEndTag[] = "<\\/p>";
|
||||
constexpr char kLyricsStart[] = "<p id=\"songLyricsDiv\"[^>]+>";
|
||||
} // namespace
|
||||
|
||||
SongLyricsComLyricsProvider::SongLyricsComLyricsProvider(SharedPtr<NetworkAccessManager> network, QObject *parent)
|
||||
SongLyricsComLyricsProvider::SongLyricsComLyricsProvider(const SharedPtr<NetworkAccessManager> network, QObject *parent)
|
||||
: HtmlLyricsProvider(u"songlyrics.com"_s, true, QLatin1String(kStartTag), QLatin1String(kEndTag), QLatin1String(kLyricsStart), false, network, parent) {}
|
||||
|
||||
QUrl SongLyricsComLyricsProvider::Url(const LyricsSearchRequest &request) {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "core/networkaccessmanager.h"
|
||||
#include "htmllyricsprovider.h"
|
||||
#include "lyricssearchrequest.h"
|
||||
@@ -34,7 +34,7 @@ class SongLyricsComLyricsProvider : public HtmlLyricsProvider {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SongLyricsComLyricsProvider(SharedPtr<NetworkAccessManager> network, QObject *parent = nullptr);
|
||||
explicit SongLyricsComLyricsProvider(const SharedPtr<NetworkAccessManager> network, QObject *parent = nullptr);
|
||||
|
||||
protected:
|
||||
QUrl Url(const LyricsSearchRequest &request) override;
|
||||
|
||||
Reference in New Issue
Block a user