http: make HTTP server support configurable

This allows to configure the local files streaming option
per-connection. It defaults to enabled.
This commit is contained in:
Jonas Wielicki
2017-10-15 13:57:30 +02:00
parent 832d81dd10
commit e4a18332a0
6 changed files with 35 additions and 1 deletions

View File

@@ -116,6 +116,9 @@ ServerSettings::ServerSettings(QWidget *p)
REMOVE(streamUrl)
REMOVE(streamUrlNoteLabel)
#endif
#ifndef ENABLE_HTTP_SERVER
REMOVE(allowLocalStreaming);
#endif
#ifdef Q_OS_MAC
expandingSpacer->changeSize(0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
@@ -178,6 +181,7 @@ void ServerSettings::save()
#ifdef ENABLE_HTTP_STREAM_PLAYBACK
|| c.details.streamUrl!=e.streamUrl
#endif
|| c.details.allowLocalStreaming!=e.allowLocalStreaming
) {
toAdd.append(c);
}
@@ -279,6 +283,8 @@ void ServerSettings::add()
details.port=6600;
details.hostname=QLatin1String("localhost");
details.dir=QLatin1String("/var/lib/mpd/music/");
// disable local streaming by default
details.allowLocalStreaming=false;
combo->addItem(details.name);
#ifdef ENABLE_SIMPLE_MPD_SUPPORT
} else {
@@ -375,6 +381,9 @@ void ServerSettings::setDetails(const MPDConnectionDetails &details)
#ifdef ENABLE_HTTP_STREAM_PLAYBACK
streamUrl->setText(details.streamUrl);
#endif
#ifdef ENABLE_HTTP_SERVER
allowLocalStreaming->setChecked(details.allowLocalStreaming);
#endif
stackedWidget->setCurrentIndex(0);
#ifdef ENABLE_SIMPLE_MPD_SUPPORT
}
@@ -399,6 +408,9 @@ MPDConnectionDetails ServerSettings::getDetails() const
#ifdef ENABLE_HTTP_STREAM_PLAYBACK
details.streamUrl=streamUrl->text().trimmed();
#endif
#ifdef ENABLE_HTTP_SERVER
details.allowLocalStreaming=allowLocalStreaming->checkState() == Qt::Checked;
#endif
}
#ifdef ENABLE_SIMPLE_MPD_SUPPORT
else {