Use C++11 enum class
This commit is contained in:
@@ -82,17 +82,17 @@ void AudioScrobbler::ReloadSettings() {
|
||||
sources_.clear();
|
||||
|
||||
if (sources.isEmpty()) {
|
||||
sources_ << Song::Source_Unknown
|
||||
<< Song::Source_LocalFile
|
||||
<< Song::Source_Collection
|
||||
<< Song::Source_CDDA
|
||||
<< Song::Source_Device
|
||||
<< Song::Source_Stream
|
||||
<< Song::Source_Tidal
|
||||
<< Song::Source_Subsonic
|
||||
<< Song::Source_Qobuz
|
||||
<< Song::Source_SomaFM
|
||||
<< Song::Source_RadioParadise;
|
||||
sources_ << Song::Source::Unknown
|
||||
<< Song::Source::LocalFile
|
||||
<< Song::Source::Collection
|
||||
<< Song::Source::CDDA
|
||||
<< Song::Source::Device
|
||||
<< Song::Source::Stream
|
||||
<< Song::Source::Tidal
|
||||
<< Song::Source::Subsonic
|
||||
<< Song::Source::Qobuz
|
||||
<< Song::Source::SomaFM
|
||||
<< Song::Source::RadioParadise;
|
||||
}
|
||||
else {
|
||||
for (const QString &source : sources) {
|
||||
@@ -141,7 +141,7 @@ void AudioScrobbler::ToggleOffline() {
|
||||
}
|
||||
|
||||
void AudioScrobbler::ShowConfig() {
|
||||
app_->OpenSettingsDialogAtPage(SettingsDialog::Page_Scrobbler);
|
||||
app_->OpenSettingsDialogAtPage(SettingsDialog::Page::Scrobbler);
|
||||
}
|
||||
|
||||
void AudioScrobbler::UpdateNowPlaying(const Song &song) {
|
||||
|
||||
@@ -420,14 +420,15 @@ QByteArray ScrobblingAPI20::GetReplyData(QNetworkReply *reply) {
|
||||
error = QString("Received HTTP code %1").arg(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt());
|
||||
}
|
||||
}
|
||||
const ScrobbleErrorCode lastfm_error_code = static_cast<ScrobbleErrorCode>(error_code);
|
||||
if (reply->error() == QNetworkReply::ContentAccessDenied ||
|
||||
reply->error() == QNetworkReply::ContentOperationNotPermittedError ||
|
||||
reply->error() == QNetworkReply::AuthenticationRequiredError ||
|
||||
error_code == ScrobbleErrorCode::InvalidSessionKey ||
|
||||
error_code == ScrobbleErrorCode::UnauthorizedToken ||
|
||||
error_code == ScrobbleErrorCode::LoginRequired ||
|
||||
error_code == ScrobbleErrorCode::AuthenticationFailed ||
|
||||
error_code == ScrobbleErrorCode::APIKeySuspended
|
||||
lastfm_error_code == ScrobbleErrorCode::InvalidSessionKey ||
|
||||
lastfm_error_code == ScrobbleErrorCode::UnauthorizedToken ||
|
||||
lastfm_error_code == ScrobbleErrorCode::LoginRequired ||
|
||||
lastfm_error_code == ScrobbleErrorCode::AuthenticationFailed ||
|
||||
lastfm_error_code == ScrobbleErrorCode::APIKeySuspended
|
||||
){
|
||||
// Session is probably expired
|
||||
Logout();
|
||||
|
||||
@@ -88,7 +88,7 @@ class ScrobblingAPI20 : public ScrobblerService {
|
||||
|
||||
private:
|
||||
|
||||
enum ScrobbleErrorCode {
|
||||
enum class ScrobbleErrorCode {
|
||||
NoError = 1,
|
||||
InvalidService = 2,
|
||||
InvalidMethod = 3,
|
||||
|
||||
@@ -62,7 +62,7 @@ void SubsonicScrobbler::ReloadSettings() {
|
||||
|
||||
void SubsonicScrobbler::UpdateNowPlaying(const Song &song) {
|
||||
|
||||
if (song.source() != Song::Source::Source_Subsonic) return;
|
||||
if (song.source() != Song::Source::Subsonic) return;
|
||||
|
||||
song_playing_ = song;
|
||||
time_ = QDateTime::currentDateTime();
|
||||
@@ -82,7 +82,7 @@ void SubsonicScrobbler::ClearPlaying() {
|
||||
|
||||
void SubsonicScrobbler::Scrobble(const Song &song) {
|
||||
|
||||
if (song.source() != Song::Source::Source_Subsonic || song.id() != song_playing_.id() || song.url() != song_playing_.url() || !song.is_metadata_good()) return;
|
||||
if (song.source() != Song::Source::Subsonic || song.id() != song_playing_.id() || song.url() != song_playing_.url() || !song.is_metadata_good()) return;
|
||||
|
||||
if (app_->scrobbler()->IsOffline()) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user