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 <QScrollArea>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QComboBox>
|
||||
#include <QSettings>
|
||||
|
||||
#include "core/logging.h"
|
||||
#include "widgets/osd.h"
|
||||
|
@ -108,6 +110,8 @@ public:
|
|||
|
||||
void set_output_changed(bool output_changed) { output_changed_ = output_changed; }
|
||||
|
||||
void ComboBoxLoadFromSettings(QSettings &s, QComboBox *combobox, QString setting, QString default_value);
|
||||
|
||||
signals:
|
||||
void NotificationPreview(OSD::Behaviour, QString, QString);
|
||||
|
||||
|
|
|
@ -56,6 +56,9 @@ TidalSettingsPage::TidalSettingsPage(SettingsDialog *parent)
|
|||
ui_->combobox_quality->addItem("High", "HIGH");
|
||||
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("320x320", "320x320");
|
||||
ui_->combobox_coversize->addItem("640x640", "640x640");
|
||||
|
@ -71,21 +74,15 @@ void TidalSettingsPage::Load() {
|
|||
QSettings s;
|
||||
|
||||
s.beginGroup(kSettingsGroup);
|
||||
|
||||
ui_->username->setText(s.value("username").toString());
|
||||
ui_->password->setText(s.value("password").toString());
|
||||
|
||||
QString quality = s.value("quality", "HIGH").toString();
|
||||
ui_->combobox_quality->setCurrentIndex(ui_->combobox_quality->findData(quality));
|
||||
|
||||
dialog()->ComboBoxLoadFromSettings(s, ui_->combobox_quality, "quality", "HIGH");
|
||||
ui_->spinbox_searchdelay->setValue(s.value("searchdelay", 1500).toInt());
|
||||
ui_->spinbox_albumssearchlimit->setValue(s.value("albumssearchlimit", 40).toInt());
|
||||
ui_->spinbox_songssearchlimit->setValue(s.value("songssearchlimit", 10).toInt());
|
||||
ui_->spinbox_albumssearchlimit->setValue(s.value("albumssearchlimit", 100).toInt());
|
||||
ui_->spinbox_songssearchlimit->setValue(s.value("songssearchlimit", 100).toInt());
|
||||
ui_->checkbox_fetchalbums->setChecked(s.value("fetchalbums", false).toBool());
|
||||
|
||||
QString coversize = s.value("coversize", "320x320").toString();
|
||||
ui_->combobox_coversize->setCurrentIndex(ui_->combobox_coversize->findData(coversize));
|
||||
|
||||
dialog()->ComboBoxLoadFromSettings(s, ui_->combobox_coversize, "coversize", "320x320");
|
||||
dialog()->ComboBoxLoadFromSettings(s, ui_->combobox_streamurl, "streamurl", "http");
|
||||
s.endGroup();
|
||||
|
||||
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("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.endGroup();
|
||||
|
||||
service_->ReloadSettings();
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>715</width>
|
||||
<height>483</height>
|
||||
<height>547</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -281,6 +281,39 @@
|
|||
</item>
|
||||
</layout>
|
||||
</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>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -106,10 +106,11 @@ void TidalService::ReloadSettings() {
|
|||
password_ = s.value("password").toString();
|
||||
quality_ = s.value("quality").toString();
|
||||
searchdelay_ = s.value("searchdelay", 1500).toInt();
|
||||
albumssearchlimit_ = s.value("albumssearchlimit", 40).toInt();
|
||||
songssearchlimit_ = s.value("songssearchlimit", 10).toInt();
|
||||
albumssearchlimit_ = s.value("albumssearchlimit", 100).toInt();
|
||||
songssearchlimit_ = s.value("songssearchlimit", 100).toInt();
|
||||
fetchalbums_ = s.value("fetchalbums", false).toBool();
|
||||
coversize_ = s.value("coversize", "320x320").toString();
|
||||
streamurl_ = s.value("streamurl", "http").toString();
|
||||
s.endGroup();
|
||||
|
||||
}
|
||||
|
@ -825,6 +826,8 @@ void TidalService::GetStreamURLFinished(QNetworkReply *reply, const int song_id,
|
|||
filetype = Song::FileType_Stream;
|
||||
}
|
||||
|
||||
if (new_url.scheme() != streamurl_) new_url.setScheme(streamurl_);
|
||||
|
||||
emit StreamURLFinished(new_url, filetype);
|
||||
|
||||
}
|
||||
|
|
|
@ -117,6 +117,7 @@ class TidalService : public InternetService {
|
|||
int songssearchlimit_;
|
||||
bool fetchalbums_;
|
||||
QString coversize_;
|
||||
QString streamurl_;
|
||||
QString session_id_;
|
||||
quint64 user_id_;
|
||||
QString country_code_;
|
||||
|
|
Loading…
Reference in New Issue