Add option to change url stream scheme for Tidal
This commit is contained in:
parent
65b04cac6e
commit
aa83a2b40b
|
@ -282,3 +282,10 @@ void SettingsDialog::CurrentItemChanged(QTreeWidgetItem *item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::ComboBoxLoadFromSettings(QSettings &s, QComboBox *combobox, QString setting, QString default_value) {
|
||||||
|
QString value = s.value(setting, default_value).toString();
|
||||||
|
int i = combobox->findData(value);
|
||||||
|
if (i == -1) i = combobox->findData(default_value);
|
||||||
|
combobox->setCurrentIndex(i);
|
||||||
|
}
|
||||||
|
|
|
@ -36,6 +36,8 @@
|
||||||
#include <QAbstractButton>
|
#include <QAbstractButton>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
#include <QTreeWidgetItem>
|
#include <QTreeWidgetItem>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
#include "widgets/osd.h"
|
#include "widgets/osd.h"
|
||||||
|
@ -108,6 +110,8 @@ public:
|
||||||
|
|
||||||
void set_output_changed(bool output_changed) { output_changed_ = output_changed; }
|
void set_output_changed(bool output_changed) { output_changed_ = output_changed; }
|
||||||
|
|
||||||
|
void ComboBoxLoadFromSettings(QSettings &s, QComboBox *combobox, QString setting, QString default_value);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void NotificationPreview(OSD::Behaviour, QString, QString);
|
void NotificationPreview(OSD::Behaviour, QString, QString);
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,9 @@ TidalSettingsPage::TidalSettingsPage(SettingsDialog *parent)
|
||||||
ui_->combobox_quality->addItem("High", "HIGH");
|
ui_->combobox_quality->addItem("High", "HIGH");
|
||||||
ui_->combobox_quality->addItem("Lossless", "LOSSLESS");
|
ui_->combobox_quality->addItem("Lossless", "LOSSLESS");
|
||||||
|
|
||||||
|
ui_->combobox_streamurl->addItem("HTTP", "http");
|
||||||
|
ui_->combobox_streamurl->addItem("HTTPS", "https");
|
||||||
|
|
||||||
ui_->combobox_coversize->addItem("160x160", "160x160");
|
ui_->combobox_coversize->addItem("160x160", "160x160");
|
||||||
ui_->combobox_coversize->addItem("320x320", "320x320");
|
ui_->combobox_coversize->addItem("320x320", "320x320");
|
||||||
ui_->combobox_coversize->addItem("640x640", "640x640");
|
ui_->combobox_coversize->addItem("640x640", "640x640");
|
||||||
|
@ -71,21 +74,15 @@ void TidalSettingsPage::Load() {
|
||||||
QSettings s;
|
QSettings s;
|
||||||
|
|
||||||
s.beginGroup(kSettingsGroup);
|
s.beginGroup(kSettingsGroup);
|
||||||
|
|
||||||
ui_->username->setText(s.value("username").toString());
|
ui_->username->setText(s.value("username").toString());
|
||||||
ui_->password->setText(s.value("password").toString());
|
ui_->password->setText(s.value("password").toString());
|
||||||
|
dialog()->ComboBoxLoadFromSettings(s, ui_->combobox_quality, "quality", "HIGH");
|
||||||
QString quality = s.value("quality", "HIGH").toString();
|
|
||||||
ui_->combobox_quality->setCurrentIndex(ui_->combobox_quality->findData(quality));
|
|
||||||
|
|
||||||
ui_->spinbox_searchdelay->setValue(s.value("searchdelay", 1500).toInt());
|
ui_->spinbox_searchdelay->setValue(s.value("searchdelay", 1500).toInt());
|
||||||
ui_->spinbox_albumssearchlimit->setValue(s.value("albumssearchlimit", 40).toInt());
|
ui_->spinbox_albumssearchlimit->setValue(s.value("albumssearchlimit", 100).toInt());
|
||||||
ui_->spinbox_songssearchlimit->setValue(s.value("songssearchlimit", 10).toInt());
|
ui_->spinbox_songssearchlimit->setValue(s.value("songssearchlimit", 100).toInt());
|
||||||
ui_->checkbox_fetchalbums->setChecked(s.value("fetchalbums", false).toBool());
|
ui_->checkbox_fetchalbums->setChecked(s.value("fetchalbums", false).toBool());
|
||||||
|
dialog()->ComboBoxLoadFromSettings(s, ui_->combobox_coversize, "coversize", "320x320");
|
||||||
QString coversize = s.value("coversize", "320x320").toString();
|
dialog()->ComboBoxLoadFromSettings(s, ui_->combobox_streamurl, "streamurl", "http");
|
||||||
ui_->combobox_coversize->setCurrentIndex(ui_->combobox_coversize->findData(coversize));
|
|
||||||
|
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
if (service_->authenticated()) ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedIn);
|
if (service_->authenticated()) ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedIn);
|
||||||
|
@ -104,6 +101,7 @@ void TidalSettingsPage::Save() {
|
||||||
s.setValue("songssearchlimit", ui_->spinbox_songssearchlimit->value());
|
s.setValue("songssearchlimit", ui_->spinbox_songssearchlimit->value());
|
||||||
s.setValue("fetchalbums", ui_->checkbox_fetchalbums->isChecked());
|
s.setValue("fetchalbums", ui_->checkbox_fetchalbums->isChecked());
|
||||||
s.setValue("coversize", ui_->combobox_coversize->itemData(ui_->combobox_coversize->currentIndex()));
|
s.setValue("coversize", ui_->combobox_coversize->itemData(ui_->combobox_coversize->currentIndex()));
|
||||||
|
s.setValue("streamurl", ui_->combobox_streamurl->itemData(ui_->combobox_streamurl->currentIndex()));
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
service_->ReloadSettings();
|
service_->ReloadSettings();
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>715</width>
|
<width>715</width>
|
||||||
<height>483</height>
|
<height>547</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -281,6 +281,39 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_streamurl">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_streamurl">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>150</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Stream URL scheme</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="combobox_streamurl"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -106,10 +106,11 @@ void TidalService::ReloadSettings() {
|
||||||
password_ = s.value("password").toString();
|
password_ = s.value("password").toString();
|
||||||
quality_ = s.value("quality").toString();
|
quality_ = s.value("quality").toString();
|
||||||
searchdelay_ = s.value("searchdelay", 1500).toInt();
|
searchdelay_ = s.value("searchdelay", 1500).toInt();
|
||||||
albumssearchlimit_ = s.value("albumssearchlimit", 40).toInt();
|
albumssearchlimit_ = s.value("albumssearchlimit", 100).toInt();
|
||||||
songssearchlimit_ = s.value("songssearchlimit", 10).toInt();
|
songssearchlimit_ = s.value("songssearchlimit", 100).toInt();
|
||||||
fetchalbums_ = s.value("fetchalbums", false).toBool();
|
fetchalbums_ = s.value("fetchalbums", false).toBool();
|
||||||
coversize_ = s.value("coversize", "320x320").toString();
|
coversize_ = s.value("coversize", "320x320").toString();
|
||||||
|
streamurl_ = s.value("streamurl", "http").toString();
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -825,6 +826,8 @@ void TidalService::GetStreamURLFinished(QNetworkReply *reply, const int song_id,
|
||||||
filetype = Song::FileType_Stream;
|
filetype = Song::FileType_Stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (new_url.scheme() != streamurl_) new_url.setScheme(streamurl_);
|
||||||
|
|
||||||
emit StreamURLFinished(new_url, filetype);
|
emit StreamURLFinished(new_url, filetype);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,6 +117,7 @@ class TidalService : public InternetService {
|
||||||
int songssearchlimit_;
|
int songssearchlimit_;
|
||||||
bool fetchalbums_;
|
bool fetchalbums_;
|
||||||
QString coversize_;
|
QString coversize_;
|
||||||
|
QString streamurl_;
|
||||||
QString session_id_;
|
QString session_id_;
|
||||||
quint64 user_id_;
|
quint64 user_id_;
|
||||||
QString country_code_;
|
QString country_code_;
|
||||||
|
|
Loading…
Reference in New Issue