Only start internal HTTP server when required, and stop 1 second after last Cantata stream is removed.

BUG: 369
This commit is contained in:
craig.p.drummond
2014-01-02 19:05:06 +00:00
committed by craig.p.drummond
parent 16b3ed8e25
commit 3a07ab4e6d
9 changed files with 153 additions and 77 deletions

View File

@@ -26,7 +26,6 @@
#include "localize.h"
#include "httpserver.h"
#include <QComboBox>
#include <QTimer>
#include <QNetworkInterface>
static int isIfaceType(const QNetworkInterface &iface, const QString &prefix)
@@ -64,7 +63,6 @@ HttpServerSettings::HttpServerSettings(QWidget *p)
{
setupUi(this);
initInterfaces(httpInterface);
updateStatus();
}
void HttpServerSettings::load()
@@ -87,14 +85,4 @@ void HttpServerSettings::save()
{
Settings::self()->saveHttpInterface(httpInterface->itemData(httpInterface->currentIndex()).toString());
HttpServer::self()->readConfig();
QTimer::singleShot(250, this, SLOT(updateStatus()));
}
void HttpServerSettings::updateStatus()
{
if (HttpServer::self()->isAlive()) {
status->setText(HttpServer::self()->address());
} else {
status->setText(i18n("Inactive"));
}
}