Lyrics: Refactor
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Strawberry Music Player
|
||||
* Copyright 2020-2021, Jonas Kvinge <jonas@jkvinge.net>
|
||||
* Copyright 2020-2025, Jonas Kvinge <jonas@jkvinge.net>
|
||||
*
|
||||
* Strawberry is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -116,7 +116,7 @@ void LyricsSettingsPage::CurrentItemChanged(QListWidgetItem *item_current, QList
|
||||
|
||||
if (item_previous) {
|
||||
LyricsProvider *provider = lyrics_providers_->ProviderByName(item_previous->text());
|
||||
if (provider && provider->AuthenticationRequired()) DisconnectAuthentication(provider);
|
||||
if (provider && provider->authentication_required()) DisconnectAuthentication(provider);
|
||||
}
|
||||
|
||||
if (item_current) {
|
||||
@@ -125,8 +125,8 @@ void LyricsSettingsPage::CurrentItemChanged(QListWidgetItem *item_current, QList
|
||||
ui_->providers_down->setEnabled(row != ui_->providers->count() - 1);
|
||||
LyricsProvider *provider = lyrics_providers_->ProviderByName(item_current->text());
|
||||
if (provider) {
|
||||
if (provider->AuthenticationRequired()) {
|
||||
ui_->login_state->SetLoggedIn(provider->IsAuthenticated() ? LoginStateWidget::State::LoggedIn : LoginStateWidget::State::LoggedOut);
|
||||
if (provider->authentication_required()) {
|
||||
ui_->login_state->SetLoggedIn(provider->authenticated() ? LoginStateWidget::State::LoggedIn : LoginStateWidget::State::LoggedOut);
|
||||
ui_->button_authenticate->setEnabled(true);
|
||||
ui_->button_authenticate->show();
|
||||
ui_->login_state->show();
|
||||
@@ -227,7 +227,7 @@ void LyricsSettingsPage::LogoutClicked() {
|
||||
if (!ui_->providers->currentItem()) return;
|
||||
LyricsProvider *provider = lyrics_providers_->ProviderByName(ui_->providers->currentItem()->text());
|
||||
if (!provider) return;
|
||||
provider->Deauthenticate();
|
||||
provider->ClearSession();
|
||||
|
||||
ui_->button_authenticate->setEnabled(true);
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::State::LoggedOut);
|
||||
@@ -247,7 +247,7 @@ void LyricsSettingsPage::AuthenticationSuccess() {
|
||||
|
||||
}
|
||||
|
||||
void LyricsSettingsPage::AuthenticationFailure(const QStringList &errors) {
|
||||
void LyricsSettingsPage::AuthenticationFailure(const QString &error) {
|
||||
|
||||
LyricsProvider *provider = qobject_cast<LyricsProvider*>(sender());
|
||||
if (!provider) return;
|
||||
@@ -255,7 +255,7 @@ void LyricsSettingsPage::AuthenticationFailure(const QStringList &errors) {
|
||||
|
||||
if (!isVisible() || !ui_->providers->currentItem() || ui_->providers->currentItem()->text() != provider->name()) return;
|
||||
|
||||
QMessageBox::warning(this, tr("Authentication failed"), errors.join(u'\n'));
|
||||
QMessageBox::warning(this, tr("Authentication failed"), error);
|
||||
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::State::LoggedOut);
|
||||
ui_->button_authenticate->setEnabled(true);
|
||||
|
||||
Reference in New Issue
Block a user