Remove libre.fm
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Strawberry Music Player
|
||||
* Copyright 2018-2021, Jonas Kvinge <jonas@jkvinge.net>
|
||||
* Copyright 2018-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
|
||||
@@ -38,7 +38,6 @@
|
||||
|
||||
#include "scrobbler/audioscrobbler.h"
|
||||
#include "scrobbler/lastfmscrobbler.h"
|
||||
#include "scrobbler/librefmscrobbler.h"
|
||||
#include "scrobbler/listenbrainzscrobbler.h"
|
||||
#include "constants/scrobblersettings.h"
|
||||
|
||||
@@ -50,10 +49,8 @@ ScrobblerSettingsPage::ScrobblerSettingsPage(SettingsDialog *dialog, const Share
|
||||
ui_(new Ui_ScrobblerSettingsPage),
|
||||
scrobbler_(scrobbler),
|
||||
lastfmscrobbler_(scrobbler_->Service<LastFMScrobbler>()),
|
||||
librefmscrobbler_(scrobbler_->Service<LibreFMScrobbler>()),
|
||||
listenbrainzscrobbler_(scrobbler_->Service<ListenBrainzScrobbler>()),
|
||||
lastfm_waiting_for_auth_(false),
|
||||
librefm_waiting_for_auth_(false),
|
||||
listenbrainz_waiting_for_auth_(false) {
|
||||
|
||||
ui_->setupUi(this);
|
||||
@@ -66,13 +63,6 @@ ScrobblerSettingsPage::ScrobblerSettingsPage(SettingsDialog *dialog, const Share
|
||||
QObject::connect(ui_->widget_lastfm_login_state, &LoginStateWidget::LogoutClicked, this, &ScrobblerSettingsPage::LastFM_Logout);
|
||||
ui_->widget_lastfm_login_state->AddCredentialGroup(ui_->widget_lastfm_login);
|
||||
|
||||
// Libre.fm
|
||||
QObject::connect(&*librefmscrobbler_, &LibreFMScrobbler::AuthenticationComplete, this, &ScrobblerSettingsPage::LibreFM_AuthenticationComplete);
|
||||
QObject::connect(ui_->button_librefm_login, &QPushButton::clicked, this, &ScrobblerSettingsPage::LibreFM_Login);
|
||||
QObject::connect(ui_->widget_librefm_login_state, &LoginStateWidget::LoginClicked, this, &ScrobblerSettingsPage::LibreFM_Login);
|
||||
QObject::connect(ui_->widget_librefm_login_state, &LoginStateWidget::LogoutClicked, this, &ScrobblerSettingsPage::LibreFM_Logout);
|
||||
ui_->widget_librefm_login_state->AddCredentialGroup(ui_->widget_librefm_login);
|
||||
|
||||
// ListenBrainz
|
||||
QObject::connect(&*listenbrainzscrobbler_, &ListenBrainzScrobbler::AuthenticationComplete, this, &ScrobblerSettingsPage::ListenBrainz_AuthenticationComplete);
|
||||
QObject::connect(ui_->button_listenbrainz_login, &QPushButton::clicked, this, &ScrobblerSettingsPage::ListenBrainz_Login);
|
||||
@@ -118,9 +108,6 @@ void ScrobblerSettingsPage::Load() {
|
||||
ui_->checkbox_lastfm_enable->setChecked(lastfmscrobbler_->enabled());
|
||||
LastFM_RefreshControls(lastfmscrobbler_->authenticated());
|
||||
|
||||
ui_->checkbox_librefm_enable->setChecked(librefmscrobbler_->enabled());
|
||||
LibreFM_RefreshControls(librefmscrobbler_->authenticated());
|
||||
|
||||
ui_->checkbox_listenbrainz_enable->setChecked(listenbrainzscrobbler_->enabled());
|
||||
ui_->lineedit_listenbrainz_user_token->setText(listenbrainzscrobbler_->user_token());
|
||||
ListenBrainz_RefreshControls(listenbrainzscrobbler_->authenticated());
|
||||
@@ -167,10 +154,6 @@ void ScrobblerSettingsPage::Save() {
|
||||
s.setValue(kEnabled, ui_->checkbox_lastfm_enable->isChecked());
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup(LibreFMScrobbler::kSettingsGroup);
|
||||
s.setValue(kEnabled, ui_->checkbox_librefm_enable->isChecked());
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup(ListenBrainzScrobbler::kSettingsGroup);
|
||||
s.setValue(kEnabled, ui_->checkbox_listenbrainz_enable->isChecked());
|
||||
s.setValue(kUserToken, ui_->lineedit_listenbrainz_user_token->text());
|
||||
@@ -215,41 +198,6 @@ void ScrobblerSettingsPage::LastFM_RefreshControls(const bool authenticated) {
|
||||
ui_->widget_lastfm_login_state->SetLoggedIn(authenticated ? LoginStateWidget::State::LoggedIn : LoginStateWidget::State::LoggedOut, lastfmscrobbler_->username());
|
||||
}
|
||||
|
||||
void ScrobblerSettingsPage::LibreFM_Login() {
|
||||
|
||||
librefm_waiting_for_auth_ = true;
|
||||
ui_->widget_librefm_login_state->SetLoggedIn(LoginStateWidget::State::LoginInProgress);
|
||||
librefmscrobbler_->Authenticate();
|
||||
|
||||
}
|
||||
|
||||
void ScrobblerSettingsPage::LibreFM_Logout() {
|
||||
|
||||
librefmscrobbler_->ClearSession();
|
||||
LibreFM_RefreshControls(false);
|
||||
|
||||
}
|
||||
|
||||
void ScrobblerSettingsPage::LibreFM_AuthenticationComplete(const bool success, const QString &error) {
|
||||
|
||||
if (!librefm_waiting_for_auth_) return;
|
||||
librefm_waiting_for_auth_ = false;
|
||||
|
||||
if (success) {
|
||||
Save();
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(this, u"Authentication failed"_s, error);
|
||||
}
|
||||
|
||||
LibreFM_RefreshControls(success);
|
||||
|
||||
}
|
||||
|
||||
void ScrobblerSettingsPage::LibreFM_RefreshControls(const bool authenticated) {
|
||||
ui_->widget_librefm_login_state->SetLoggedIn(authenticated ? LoginStateWidget::State::LoggedIn : LoginStateWidget::State::LoggedOut, librefmscrobbler_->username());
|
||||
}
|
||||
|
||||
void ScrobblerSettingsPage::ListenBrainz_Login() {
|
||||
|
||||
listenbrainz_waiting_for_auth_ = true;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Strawberry Music Player
|
||||
* Copyright 2018-2021, Jonas Kvinge <jonas@jkvinge.net>
|
||||
* Copyright 2018-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
|
||||
@@ -33,7 +33,6 @@ class SettingsDialog;
|
||||
class Ui_ScrobblerSettingsPage;
|
||||
class AudioScrobbler;
|
||||
class LastFMScrobbler;
|
||||
class LibreFMScrobbler;
|
||||
class ListenBrainzScrobbler;
|
||||
|
||||
class ScrobblerSettingsPage : public SettingsPage {
|
||||
@@ -50,9 +49,6 @@ class ScrobblerSettingsPage : public SettingsPage {
|
||||
void LastFM_Login();
|
||||
void LastFM_Logout();
|
||||
void LastFM_AuthenticationComplete(const bool success, const QString &error = QString());
|
||||
void LibreFM_Login();
|
||||
void LibreFM_Logout();
|
||||
void LibreFM_AuthenticationComplete(const bool success, const QString &error = QString());
|
||||
void ListenBrainz_Login();
|
||||
void ListenBrainz_Logout();
|
||||
void ListenBrainz_AuthenticationComplete(const bool success, const QString &error = QString());
|
||||
@@ -62,15 +58,12 @@ class ScrobblerSettingsPage : public SettingsPage {
|
||||
|
||||
const SharedPtr<AudioScrobbler> scrobbler_;
|
||||
const SharedPtr<LastFMScrobbler> lastfmscrobbler_;
|
||||
const SharedPtr<LibreFMScrobbler> librefmscrobbler_;
|
||||
const SharedPtr<ListenBrainzScrobbler> listenbrainzscrobbler_;
|
||||
|
||||
bool lastfm_waiting_for_auth_;
|
||||
bool librefm_waiting_for_auth_;
|
||||
bool listenbrainz_waiting_for_auth_;
|
||||
|
||||
void LastFM_RefreshControls(const bool authenticated);
|
||||
void LibreFM_RefreshControls(const bool authenticated);
|
||||
void ListenBrainz_RefreshControls(const bool authenticated);
|
||||
};
|
||||
|
||||
|
||||
@@ -270,55 +270,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupbox_librefm">
|
||||
<property name="title">
|
||||
<string>Libre.fm</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="layout_librefm">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkbox_librefm_enable">
|
||||
<property name="text">
|
||||
<string>Enable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="LoginStateWidget" name="widget_librefm_login_state" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_librefm_login" native="true">
|
||||
<layout class="QVBoxLayout" name="layout_librefm_login">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_librefm_button_login">
|
||||
<item>
|
||||
<widget class="QPushButton" name="button_librefm_login">
|
||||
<property name="text">
|
||||
<string>Login</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer_librefm_login">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupbox_listenbrainz">
|
||||
<property name="title">
|
||||
@@ -444,8 +395,6 @@
|
||||
<tabstop>checkbox_source_radioparadise</tabstop>
|
||||
<tabstop>checkbox_lastfm_enable</tabstop>
|
||||
<tabstop>button_lastfm_login</tabstop>
|
||||
<tabstop>checkbox_librefm_enable</tabstop>
|
||||
<tabstop>button_librefm_login</tabstop>
|
||||
<tabstop>checkbox_listenbrainz_enable</tabstop>
|
||||
<tabstop>lineedit_listenbrainz_user_token</tabstop>
|
||||
<tabstop>button_listenbrainz_login</tabstop>
|
||||
|
||||
Reference in New Issue
Block a user