Refactoring
This commit is contained in:
@@ -36,15 +36,18 @@
|
||||
#include <QSslError>
|
||||
#include <QDateTime>
|
||||
|
||||
#include "core/scoped_ptr.h"
|
||||
#include "core/shared_ptr.h"
|
||||
#include "includes/scoped_ptr.h"
|
||||
#include "includes/shared_ptr.h"
|
||||
#include "core/song.h"
|
||||
#include "streaming/streamingservice.h"
|
||||
#include "settings/subsonicsettingspage.h"
|
||||
#include "constants/subsonicsettings.h"
|
||||
|
||||
class QNetworkReply;
|
||||
|
||||
class Application;
|
||||
class TaskManager;
|
||||
class Database;
|
||||
class UrlHandlers;
|
||||
class AlbumCoverLoader;
|
||||
class SubsonicUrlHandler;
|
||||
class SubsonicRequest;
|
||||
class SubsonicScrobbleRequest;
|
||||
@@ -56,7 +59,12 @@ class SubsonicService : public StreamingService {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SubsonicService(Application *app, QObject *parent = nullptr);
|
||||
explicit SubsonicService(const SharedPtr<TaskManager> task_manager,
|
||||
const SharedPtr<Database> database,
|
||||
const SharedPtr<UrlHandlers> url_handlers,
|
||||
const SharedPtr<AlbumCoverLoader> albumcover_loader,
|
||||
QObject *parent = nullptr);
|
||||
|
||||
~SubsonicService() override;
|
||||
|
||||
static const Song::Source kSource;
|
||||
@@ -66,15 +74,13 @@ class SubsonicService : public StreamingService {
|
||||
void ReloadSettings() override;
|
||||
void Exit() override;
|
||||
|
||||
Application *app() const { return app_; }
|
||||
|
||||
QUrl server_url() const { return server_url_; }
|
||||
QString username() const { return username_; }
|
||||
QString password() const { return password_; }
|
||||
bool http2() const { return http2_; }
|
||||
bool verify_certificate() const { return verify_certificate_; }
|
||||
bool download_album_covers() const { return download_album_covers_; }
|
||||
SubsonicSettingsPage::AuthMethod auth_method() const { return auth_method_; }
|
||||
SubsonicSettings::AuthMethod auth_method() const { return auth_method_; }
|
||||
|
||||
SharedPtr<CollectionBackend> collection_backend() const { return collection_backend_; }
|
||||
CollectionModel *collection_model() const { return collection_model_; }
|
||||
@@ -88,22 +94,20 @@ class SubsonicService : public StreamingService {
|
||||
void Scrobble(const QString &song_id, const bool submission, const QDateTime &time);
|
||||
|
||||
public Q_SLOTS:
|
||||
void ShowConfig() override;
|
||||
void SendPing();
|
||||
void SendPingWithCredentials(QUrl url, const QString &username, const QString &password, const SubsonicSettingsPage::AuthMethod auth_method, const bool redirect = false);
|
||||
void SendPingWithCredentials(QUrl url, const QString &username, const QString &password, const SubsonicSettings::AuthMethod auth_method, const bool redirect = false);
|
||||
void GetSongs() override;
|
||||
void DeleteSongs();
|
||||
void ResetSongsRequest() override;
|
||||
|
||||
private Q_SLOTS:
|
||||
void HandlePingSSLErrors(const QList<QSslError> &ssl_errors);
|
||||
void HandlePingReply(QNetworkReply *reply, const QUrl &url, const QString &username, const QString &password, const SubsonicSettingsPage::AuthMethod auth_method);
|
||||
void HandlePingReply(QNetworkReply *reply, const QUrl &url, const QString &username, const QString &password, const SubsonicSettings::AuthMethod auth_method);
|
||||
void SongsResultsReceived(const SongMap &songs, const QString &error);
|
||||
|
||||
private:
|
||||
void PingError(const QString &error = QString(), const QVariant &debug = QVariant());
|
||||
|
||||
Application *app_;
|
||||
ScopedPtr<QNetworkAccessManager> network_;
|
||||
SubsonicUrlHandler *url_handler_;
|
||||
|
||||
@@ -119,7 +123,7 @@ class SubsonicService : public StreamingService {
|
||||
bool http2_;
|
||||
bool verify_certificate_;
|
||||
bool download_album_covers_;
|
||||
SubsonicSettingsPage::AuthMethod auth_method_;
|
||||
SubsonicSettings::AuthMethod auth_method_;
|
||||
|
||||
QStringList errors_;
|
||||
int ping_redirects_;
|
||||
|
||||
Reference in New Issue
Block a user