1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2025-02-09 00:08:43 +01:00

Add option to scrobbler setting for showing login error

Fixes #430
This commit is contained in:
Jonas Kvinge 2020-05-12 22:25:00 +02:00
parent a950ec3bd5
commit fcea3a0877
5 changed files with 16 additions and 2 deletions

View File

@ -46,7 +46,9 @@ AudioScrobbler::AudioScrobbler(Application *app, QObject *parent) :
offline_(false), offline_(false),
scrobble_button_(false), scrobble_button_(false),
love_button_(false), love_button_(false),
submit_delay_(0) submit_delay_(0),
prefer_albumartist_(false),
show_auth_error_(false)
{ {
scrobbler_services_->AddService(new LastFMScrobbler(app_, scrobbler_services_)); scrobbler_services_->AddService(new LastFMScrobbler(app_, scrobbler_services_));
@ -73,6 +75,7 @@ void AudioScrobbler::ReloadSettings() {
love_button_ = s.value("love_button", false).toBool(); love_button_ = s.value("love_button", false).toBool();
submit_delay_ = s.value("submit", 0).toInt(); submit_delay_ = s.value("submit", 0).toInt();
prefer_albumartist_ = s.value("albumartist", false).toBool(); prefer_albumartist_ = s.value("albumartist", false).toBool();
show_auth_error_ = s.value("show_auth_error", true).toBool();
s.endGroup(); s.endGroup();
emit ScrobblingEnabledChanged(enabled_); emit ScrobblingEnabledChanged(enabled_);

View File

@ -46,6 +46,7 @@ class AudioScrobbler : public QObject {
bool LoveButton() const { return love_button_; } bool LoveButton() const { return love_button_; }
int SubmitDelay() const { return submit_delay_; } int SubmitDelay() const { return submit_delay_; }
bool PreferAlbumArtist() const { return prefer_albumartist_; } bool PreferAlbumArtist() const { return prefer_albumartist_; }
bool ShowAuthError() const { return show_auth_error_; }
void UpdateNowPlaying(const Song &song); void UpdateNowPlaying(const Song &song);
void ClearPlaying(); void ClearPlaying();
@ -85,6 +86,7 @@ class AudioScrobbler : public QObject {
bool love_button_; bool love_button_;
int submit_delay_; int submit_delay_;
bool prefer_albumartist_; bool prefer_albumartist_;
bool show_auth_error_;
}; };

View File

@ -525,7 +525,7 @@ void ScrobblingAPI20::Scrobble(const Song &song) {
if (app_->scrobbler()->IsOffline()) return; if (app_->scrobbler()->IsOffline()) return;
if (!IsAuthenticated()) { if (!IsAuthenticated()) {
emit ErrorMessage(tr("Scrobbler %1 is not authenticated!").arg(name_)); if (app_->scrobbler()->ShowAuthError()) { emit ErrorMessage(tr("Scrobbler %1 is not authenticated!").arg(name_)); }
return; return;
} }

View File

@ -94,6 +94,7 @@ void ScrobblerSettingsPage::Load() {
ui_->checkbox_offline->setChecked(scrobbler_->IsOffline()); ui_->checkbox_offline->setChecked(scrobbler_->IsOffline());
ui_->spinbox_submit->setValue(scrobbler_->SubmitDelay()); ui_->spinbox_submit->setValue(scrobbler_->SubmitDelay());
ui_->checkbox_albumartist->setChecked(scrobbler_->PreferAlbumArtist()); ui_->checkbox_albumartist->setChecked(scrobbler_->PreferAlbumArtist());
ui_->checkbox_show_auth_error->setChecked(scrobbler_->ShowAuthError());
ui_->checkbox_lastfm_enable->setChecked(lastfmscrobbler_->IsEnabled()); ui_->checkbox_lastfm_enable->setChecked(lastfmscrobbler_->IsEnabled());
ui_->checkbox_lastfm_https->setChecked(lastfmscrobbler_->IsUseHTTPS()); ui_->checkbox_lastfm_https->setChecked(lastfmscrobbler_->IsUseHTTPS());
@ -119,6 +120,7 @@ void ScrobblerSettingsPage::Save() {
s.setValue("offline", ui_->checkbox_offline->isChecked()); s.setValue("offline", ui_->checkbox_offline->isChecked());
s.setValue("submit", ui_->spinbox_submit->value()); s.setValue("submit", ui_->spinbox_submit->value());
s.setValue("albumartist", ui_->checkbox_albumartist->isChecked()); s.setValue("albumartist", ui_->checkbox_albumartist->isChecked());
s.setValue("show_auth_error", ui_->checkbox_show_auth_error->isChecked());
s.endGroup(); s.endGroup();
s.beginGroup(LastFMScrobbler::kSettingsGroup); s.beginGroup(LastFMScrobbler::kSettingsGroup);

View File

@ -109,6 +109,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="checkbox_show_auth_error">
<property name="text">
<string>Show error dialog if scrobbler is enabled without being authenticated</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="groupbox_lastfm"> <widget class="QGroupBox" name="groupbox_lastfm">
<property name="title"> <property name="title">