Tidal: Remove deprecated username/password login
This commit is contained in:
@@ -53,10 +53,8 @@ TidalSettingsPage::TidalSettingsPage(SettingsDialog *dialog, SharedPtr<TidalServ
|
||||
|
||||
QObject::connect(ui_->button_login, &QPushButton::clicked, this, &TidalSettingsPage::LoginClicked);
|
||||
QObject::connect(ui_->login_state, &LoginStateWidget::LogoutClicked, this, &TidalSettingsPage::LogoutClicked);
|
||||
QObject::connect(ui_->oauth, &QCheckBox::toggled, this, &TidalSettingsPage::OAuthClicked);
|
||||
|
||||
QObject::connect(this, &TidalSettingsPage::Authorize, &*service_, &TidalService::StartAuthorization);
|
||||
QObject::connect(this, &TidalSettingsPage::Login, &*service_, &TidalService::SendLoginWithCredentials);
|
||||
|
||||
QObject::connect(&*service_, &StreamingService::LoginFailure, this, &TidalSettingsPage::LoginFailure);
|
||||
QObject::connect(&*service_, &StreamingService::LoginSuccess, this, &TidalSettingsPage::LoginSuccess);
|
||||
@@ -88,16 +86,7 @@ void TidalSettingsPage::Load() {
|
||||
Settings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
ui_->enable->setChecked(s.value(kEnabled, false).toBool());
|
||||
ui_->oauth->setChecked(s.value(kOAuth, true).toBool());
|
||||
|
||||
ui_->client_id->setText(s.value(kClientId).toString());
|
||||
ui_->api_token->setText(s.value(kApiToken).toString());
|
||||
|
||||
ui_->username->setText(s.value(kUsername).toString());
|
||||
QByteArray password = s.value(kPassword).toByteArray();
|
||||
if (password.isEmpty()) ui_->password->clear();
|
||||
else ui_->password->setText(QString::fromUtf8(QByteArray::fromBase64(password)));
|
||||
|
||||
ComboBoxLoadFromSettings(s, ui_->quality, QLatin1String(kQuality), u"LOSSLESS"_s);
|
||||
ui_->searchdelay->setValue(s.value(kSearchDelay, 1500).toInt());
|
||||
ui_->artistssearchlimit->setValue(s.value("kArtistsSearchLimit", 4).toInt());
|
||||
@@ -108,11 +97,11 @@ void TidalSettingsPage::Load() {
|
||||
ComboBoxLoadFromSettings(s, ui_->coversize, QLatin1String(kCoverSize), u"640x640"_s);
|
||||
ui_->streamurl->setCurrentIndex(ui_->streamurl->findData(s.value(kStreamUrl, static_cast<int>(StreamUrlMethod::StreamUrl)).toInt()));
|
||||
ui_->checkbox_album_explicit->setChecked(s.value(kAlbumExplicit, false).toBool());
|
||||
|
||||
s.endGroup();
|
||||
|
||||
OAuthClicked(ui_->oauth->isChecked());
|
||||
if (service_->authenticated()) ui_->login_state->SetLoggedIn(LoginStateWidget::State::LoggedIn);
|
||||
if (service_->authenticated()) {
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::State::LoggedIn);
|
||||
}
|
||||
|
||||
Init(ui_->layout_tidalsettingspage->parentWidget());
|
||||
|
||||
@@ -125,13 +114,19 @@ void TidalSettingsPage::Save() {
|
||||
Settings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
s.setValue(kEnabled, ui_->enable->isChecked());
|
||||
s.setValue(kOAuth, ui_->oauth->isChecked());
|
||||
if (s.contains(kOAuth)) {
|
||||
s.remove(kOAuth);
|
||||
}
|
||||
if (s.contains(kApiToken)) {
|
||||
s.remove(kApiToken);
|
||||
}
|
||||
if (s.contains(kUsername)) {
|
||||
s.remove(kUsername);
|
||||
}
|
||||
if (s.contains(kPassword)) {
|
||||
s.remove(kPassword);
|
||||
}
|
||||
s.setValue(kClientId, ui_->client_id->text());
|
||||
s.setValue(kApiToken, ui_->api_token->text());
|
||||
|
||||
s.setValue(kUsername, ui_->username->text());
|
||||
s.setValue(kPassword, QString::fromUtf8(ui_->password->text().toUtf8().toBase64()));
|
||||
|
||||
s.setValue(kQuality, ui_->quality->currentData().toString());
|
||||
s.setValue(kSearchDelay, ui_->searchdelay->value());
|
||||
s.setValue(kArtistsSearchLimit, ui_->artistssearchlimit->value());
|
||||
@@ -148,28 +143,11 @@ void TidalSettingsPage::Save() {
|
||||
|
||||
void TidalSettingsPage::LoginClicked() {
|
||||
|
||||
if (ui_->oauth->isChecked()) {
|
||||
if (ui_->client_id->text().isEmpty()) {
|
||||
QMessageBox::critical(this, tr("Configuration incomplete"), tr("Missing Tidal client ID."));
|
||||
return;
|
||||
}
|
||||
Q_EMIT Authorize(ui_->client_id->text());
|
||||
}
|
||||
else {
|
||||
if (ui_->api_token->text().isEmpty()) {
|
||||
QMessageBox::critical(this, tr("Configuration incomplete"), tr("Missing API token."));
|
||||
return;
|
||||
}
|
||||
if (ui_->username->text().isEmpty()) {
|
||||
QMessageBox::critical(this, tr("Configuration incomplete"), tr("Missing username."));
|
||||
return;
|
||||
}
|
||||
if (ui_->password->text().isEmpty()) {
|
||||
QMessageBox::critical(this, tr("Configuration incomplete"), tr("Missing password."));
|
||||
return;
|
||||
}
|
||||
Q_EMIT Login(ui_->api_token->text(), ui_->username->text(), ui_->password->text());
|
||||
if (ui_->client_id->text().isEmpty()) {
|
||||
QMessageBox::critical(this, tr("Configuration incomplete"), tr("Missing Tidal client ID."));
|
||||
return;
|
||||
}
|
||||
Q_EMIT Authorize(ui_->client_id->text());
|
||||
ui_->button_login->setEnabled(false);
|
||||
|
||||
}
|
||||
@@ -184,15 +162,6 @@ bool TidalSettingsPage::eventFilter(QObject *object, QEvent *event) {
|
||||
|
||||
}
|
||||
|
||||
void TidalSettingsPage::OAuthClicked(const bool enabled) {
|
||||
|
||||
ui_->client_id->setEnabled(enabled);
|
||||
ui_->api_token->setEnabled(!enabled);
|
||||
ui_->username->setEnabled(!enabled);
|
||||
ui_->password->setEnabled(!enabled);
|
||||
|
||||
}
|
||||
|
||||
void TidalSettingsPage::LogoutClicked() {
|
||||
|
||||
service_->Logout();
|
||||
|
||||
@@ -47,10 +47,8 @@ class TidalSettingsPage : public SettingsPage {
|
||||
|
||||
Q_SIGNALS:
|
||||
void Authorize(const QString &client_id);
|
||||
void Login(const QString &api_token, const QString &username, const QString &password);
|
||||
|
||||
private Q_SLOTS:
|
||||
void OAuthClicked(const bool enabled);
|
||||
void LoginClicked();
|
||||
void LogoutClicked();
|
||||
void LoginSuccess();
|
||||
|
||||
@@ -47,13 +47,6 @@
|
||||
</property>
|
||||
<layout class="QFormLayout" name="layout_credential_group">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="oauth">
|
||||
<property name="text">
|
||||
<string>Use OAuth</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_client_id">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -66,74 +59,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="client_id">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_api_token">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>API Token</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="api_token">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_username">
|
||||
<property name="text">
|
||||
<string>Username</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="username">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_password">
|
||||
<property name="text">
|
||||
<string>Password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="password">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::EchoMode::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -308,7 +240,7 @@
|
||||
<item>
|
||||
<spacer name="spacer_middle">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -323,7 +255,7 @@
|
||||
<item>
|
||||
<spacer name="spacer_bottom">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -366,11 +298,7 @@
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>enable</tabstop>
|
||||
<tabstop>oauth</tabstop>
|
||||
<tabstop>client_id</tabstop>
|
||||
<tabstop>api_token</tabstop>
|
||||
<tabstop>username</tabstop>
|
||||
<tabstop>password</tabstop>
|
||||
<tabstop>button_login</tabstop>
|
||||
<tabstop>quality</tabstop>
|
||||
<tabstop>searchdelay</tabstop>
|
||||
@@ -384,6 +312,8 @@
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../../data/icons.qrc"/>
|
||||
<include location="../../data/icons.qrc"/>
|
||||
<include location="../../data/icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user