Make tidal token configurable
This commit is contained in:
@@ -45,25 +45,26 @@ TidalSettingsPage::TidalSettingsPage(SettingsDialog *parent)
|
||||
connect(ui_->button_login, SIGNAL(clicked()), SLOT(LoginClicked()));
|
||||
connect(ui_->login_state, SIGNAL(LogoutClicked()), SLOT(LogoutClicked()));
|
||||
|
||||
connect(this, SIGNAL(Login(QString, QString)), service_, SLOT(SendLogin(QString, QString)));
|
||||
connect(this, SIGNAL(Login(QString, QString, QString)), service_, SLOT(SendLogin(QString, QString, QString)));
|
||||
|
||||
connect(service_, SIGNAL(LoginFailure(QString)), SLOT(LoginFailure(QString)));
|
||||
connect(service_, SIGNAL(LoginSuccess()), SLOT(LoginSuccess()));
|
||||
|
||||
dialog()->installEventFilter(this);
|
||||
|
||||
ui_->combobox_quality->addItem("Low", "LOW");
|
||||
ui_->combobox_quality->addItem("High", "HIGH");
|
||||
ui_->combobox_quality->addItem("Lossless", "LOSSLESS");
|
||||
ui_->quality->addItem("Low", "LOW");
|
||||
ui_->quality->addItem("High", "HIGH");
|
||||
ui_->quality->addItem("Lossless", "LOSSLESS");
|
||||
|
||||
ui_->combobox_streamurl->addItem("HTTP", "http");
|
||||
ui_->combobox_streamurl->addItem("HTTPS", "https");
|
||||
ui_->streamurl->addItem("Default", "default");
|
||||
ui_->streamurl->addItem("HTTP", "http");
|
||||
ui_->streamurl->addItem("HTTPS", "https");
|
||||
|
||||
ui_->combobox_coversize->addItem("160x160", "160x160");
|
||||
ui_->combobox_coversize->addItem("320x320", "320x320");
|
||||
ui_->combobox_coversize->addItem("640x640", "640x640");
|
||||
ui_->combobox_coversize->addItem("750x750", "750x750");
|
||||
ui_->combobox_coversize->addItem("1280x1280", "1280x1280");
|
||||
ui_->coversize->addItem("160x160", "160x160");
|
||||
ui_->coversize->addItem("320x320", "320x320");
|
||||
ui_->coversize->addItem("640x640", "640x640");
|
||||
ui_->coversize->addItem("750x750", "750x750");
|
||||
ui_->coversize->addItem("1280x1280", "1280x1280");
|
||||
|
||||
}
|
||||
|
||||
@@ -79,14 +80,15 @@ void TidalSettingsPage::Load() {
|
||||
QByteArray password = s.value("password").toByteArray();
|
||||
if (password.isEmpty()) ui_->password->clear();
|
||||
else ui_->password->setText(QString::fromUtf8(QByteArray::fromBase64(password)));
|
||||
dialog()->ComboBoxLoadFromSettings(s, ui_->combobox_quality, "quality", "HIGH");
|
||||
ui_->spinbox_searchdelay->setValue(s.value("searchdelay", 1500).toInt());
|
||||
ui_->spinbox_artistssearchlimit->setValue(s.value("artistssearchlimit", 5).toInt());
|
||||
ui_->spinbox_albumssearchlimit->setValue(s.value("albumssearchlimit", 100).toInt());
|
||||
ui_->spinbox_songssearchlimit->setValue(s.value("songssearchlimit", 100).toInt());
|
||||
ui_->token->setText(s.value("token").toString());
|
||||
dialog()->ComboBoxLoadFromSettings(s, ui_->quality, "quality", "HIGH");
|
||||
ui_->searchdelay->setValue(s.value("searchdelay", 1500).toInt());
|
||||
ui_->artistssearchlimit->setValue(s.value("artistssearchlimit", 5).toInt());
|
||||
ui_->albumssearchlimit->setValue(s.value("albumssearchlimit", 100).toInt());
|
||||
ui_->songssearchlimit->setValue(s.value("songssearchlimit", 100).toInt());
|
||||
ui_->checkbox_fetchalbums->setChecked(s.value("fetchalbums", false).toBool());
|
||||
dialog()->ComboBoxLoadFromSettings(s, ui_->combobox_coversize, "coversize", "320x320");
|
||||
dialog()->ComboBoxLoadFromSettings(s, ui_->combobox_streamurl, "streamurl", "http");
|
||||
dialog()->ComboBoxLoadFromSettings(s, ui_->coversize, "coversize", "320x320");
|
||||
dialog()->ComboBoxLoadFromSettings(s, ui_->streamurl, "streamurl", "http");
|
||||
s.endGroup();
|
||||
|
||||
if (service_->authenticated()) ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedIn);
|
||||
@@ -100,14 +102,15 @@ void TidalSettingsPage::Save() {
|
||||
s.setValue("enabled", ui_->checkbox_enable->isChecked());
|
||||
s.setValue("username", ui_->username->text());
|
||||
s.setValue("password", QString::fromUtf8(ui_->password->text().toUtf8().toBase64()));
|
||||
s.setValue("quality", ui_->combobox_quality->itemData(ui_->combobox_quality->currentIndex()));
|
||||
s.setValue("searchdelay", ui_->spinbox_searchdelay->value());
|
||||
s.setValue("artistssearchlimit", ui_->spinbox_artistssearchlimit->value());
|
||||
s.setValue("albumssearchlimit", ui_->spinbox_albumssearchlimit->value());
|
||||
s.setValue("songssearchlimit", ui_->spinbox_songssearchlimit->value());
|
||||
s.setValue("token", ui_->token->text());
|
||||
s.setValue("quality", ui_->quality->itemData(ui_->quality->currentIndex()));
|
||||
s.setValue("searchdelay", ui_->searchdelay->value());
|
||||
s.setValue("artistssearchlimit", ui_->artistssearchlimit->value());
|
||||
s.setValue("albumssearchlimit", ui_->albumssearchlimit->value());
|
||||
s.setValue("songssearchlimit", ui_->songssearchlimit->value());
|
||||
s.setValue("fetchalbums", ui_->checkbox_fetchalbums->isChecked());
|
||||
s.setValue("coversize", ui_->combobox_coversize->itemData(ui_->combobox_coversize->currentIndex()));
|
||||
s.setValue("streamurl", ui_->combobox_streamurl->itemData(ui_->combobox_streamurl->currentIndex()));
|
||||
s.setValue("coversize", ui_->coversize->itemData(ui_->coversize->currentIndex()));
|
||||
s.setValue("streamurl", ui_->streamurl->itemData(ui_->streamurl->currentIndex()));
|
||||
s.endGroup();
|
||||
|
||||
service_->ReloadSettings();
|
||||
@@ -115,7 +118,7 @@ void TidalSettingsPage::Save() {
|
||||
}
|
||||
|
||||
void TidalSettingsPage::LoginClicked() {
|
||||
emit Login(ui_->username->text(), ui_->password->text());
|
||||
emit Login(ui_->username->text(), ui_->password->text(), ui_->token->text());
|
||||
ui_->button_login->setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,8 +43,8 @@ class TidalSettingsPage : public SettingsPage {
|
||||
|
||||
bool eventFilter(QObject *object, QEvent *event);
|
||||
|
||||
signals:
|
||||
void Login(const QString &username, const QString &password);
|
||||
signals:
|
||||
void Login(const QString &username, const QString &password, const QString &token);
|
||||
|
||||
private slots:
|
||||
void LoginClicked();
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>715</width>
|
||||
<height>594</height>
|
||||
<height>650</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -95,7 +95,47 @@
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="layout_preferences">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="quality">
|
||||
<layout class="QHBoxLayout" name="layout_token">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_token">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Token</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="token">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer_token">
|
||||
<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>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_quality">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_quality">
|
||||
<property name="minimumSize">
|
||||
@@ -110,7 +150,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="combobox_quality"/>
|
||||
<widget class="QComboBox" name="quality"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer_quality">
|
||||
@@ -128,7 +168,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="searchdelay">
|
||||
<layout class="QHBoxLayout" name="layout_searchdelay">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_searchdelay">
|
||||
<property name="minimumSize">
|
||||
@@ -143,7 +183,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinbox_searchdelay">
|
||||
<widget class="QSpinBox" name="searchdelay">
|
||||
<property name="suffix">
|
||||
<string>ms</string>
|
||||
</property>
|
||||
@@ -177,7 +217,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="artistssearchlimit">
|
||||
<layout class="QHBoxLayout" name="layout_artistssearchlimit">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_artistssearchlimit">
|
||||
<property name="minimumSize">
|
||||
@@ -192,7 +232,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinbox_artistssearchlimit">
|
||||
<widget class="QSpinBox" name="artistssearchlimit">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
@@ -220,7 +260,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="albumssearchlimit">
|
||||
<layout class="QHBoxLayout" name="layout_albumssearchlimit">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_albumssearchlimit">
|
||||
<property name="minimumSize">
|
||||
@@ -235,7 +275,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinbox_albumssearchlimit">
|
||||
<widget class="QSpinBox" name="albumssearchlimit">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
@@ -263,7 +303,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="songssearchlimit">
|
||||
<layout class="QHBoxLayout" name="layout_songssearchlimit">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_songssearchlimit">
|
||||
<property name="minimumSize">
|
||||
@@ -278,7 +318,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinbox_songssearchlimit">
|
||||
<widget class="QSpinBox" name="songssearchlimit">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
@@ -313,7 +353,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="coversize">
|
||||
<layout class="QHBoxLayout" name="layout_coversize">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_coversize">
|
||||
<property name="minimumSize">
|
||||
@@ -328,7 +368,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="combobox_coversize"/>
|
||||
<widget class="QComboBox" name="coversize"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer_coversize">
|
||||
@@ -346,7 +386,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="streamurl">
|
||||
<layout class="QHBoxLayout" name="layout_streamurl">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_streamurl">
|
||||
<property name="minimumSize">
|
||||
@@ -361,10 +401,10 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="combobox_streamurl"/>
|
||||
<widget class="QComboBox" name="streamurl"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<spacer name="spacer_streamurl">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
|
||||
Reference in New Issue
Block a user