Change to const references, make search progress and status pass search id
This commit is contained in:
@@ -722,15 +722,8 @@ void SubsonicRequest::FinishCheck() {
|
||||
album_covers_received_ >= album_covers_requested_
|
||||
) {
|
||||
finished_ = true;
|
||||
if (songs_.isEmpty()) {
|
||||
if (no_results_) emit Results(songs_);
|
||||
else if (errors_.isEmpty()) emit ErrorSignal(tr("Unknown error"));
|
||||
else emit ErrorSignal(errors_);
|
||||
}
|
||||
else {
|
||||
emit Results(songs_);
|
||||
}
|
||||
|
||||
if (no_results_) emit Results(SongList(), QString());
|
||||
else emit Results(songs_, errors_);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -58,12 +58,10 @@ class SubsonicRequest : public SubsonicBaseRequest {
|
||||
void Reset();
|
||||
|
||||
signals:
|
||||
void Results(SongList songs);
|
||||
void ErrorSignal(QString message);
|
||||
void ErrorSignal(int id, QString message);
|
||||
void UpdateStatus(QString text);
|
||||
void ProgressSetMaximum(int max);
|
||||
void UpdateProgress(int max);
|
||||
void Results(const SongList &songs, const QString &error);
|
||||
void UpdateStatus(const QString &text);
|
||||
void ProgressSetMaximum(const int max);
|
||||
void UpdateProgress(const int max);
|
||||
|
||||
private slots:
|
||||
|
||||
|
||||
@@ -321,25 +321,18 @@ void SubsonicService::GetSongs() {
|
||||
|
||||
ResetSongsRequest();
|
||||
songs_request_.reset(new SubsonicRequest(this, url_handler_, network_, this));
|
||||
connect(songs_request_.get(), SIGNAL(ErrorSignal(QString)), SLOT(SongsErrorReceived(QString)));
|
||||
connect(songs_request_.get(), SIGNAL(Results(SongList)), SLOT(SongsResultsReceived(SongList)));
|
||||
connect(songs_request_.get(), SIGNAL(UpdateStatus(QString)), SIGNAL(SongsUpdateStatus(QString)));
|
||||
connect(songs_request_.get(), SIGNAL(ProgressSetMaximum(int)), SIGNAL(SongsProgressSetMaximum(int)));
|
||||
connect(songs_request_.get(), SIGNAL(UpdateProgress(int)), SIGNAL(SongsUpdateProgress(int)));
|
||||
connect(songs_request_.get(), SIGNAL(Results(const SongList&, const QString&)), SLOT(SongsResultsReceived(const SongList&, const QString&)));
|
||||
connect(songs_request_.get(), SIGNAL(UpdateStatus(const QString&)), SIGNAL(SongsUpdateStatus(const QString&)));
|
||||
connect(songs_request_.get(), SIGNAL(ProgressSetMaximum(const int)), SIGNAL(SongsProgressSetMaximum(const int)));
|
||||
connect(songs_request_.get(), SIGNAL(UpdateProgress(const int)), SIGNAL(SongsUpdateProgress(const int)));
|
||||
|
||||
songs_request_->GetAlbums();
|
||||
|
||||
}
|
||||
|
||||
void SubsonicService::SongsResultsReceived(SongList songs) {
|
||||
void SubsonicService::SongsResultsReceived(const SongList &songs, const QString &error) {
|
||||
|
||||
emit SongsResults(songs);
|
||||
|
||||
}
|
||||
|
||||
void SubsonicService::SongsErrorReceived(QString error) {
|
||||
|
||||
emit SongsError(error);
|
||||
emit SongsResults(songs, error);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -90,8 +90,7 @@ class SubsonicService : public InternetService {
|
||||
|
||||
private slots:
|
||||
void HandlePingReply(QNetworkReply *reply);
|
||||
void SongsResultsReceived(SongList songs);
|
||||
void SongsErrorReceived(QString error);
|
||||
void SongsResultsReceived(const SongList &songs, const QString &error);
|
||||
|
||||
private:
|
||||
typedef QPair<QString, QString> Param;
|
||||
|
||||
Reference in New Issue
Block a user