diff --git a/src/libtomahawk/TomahawkSettings.cpp b/src/libtomahawk/TomahawkSettings.cpp
index 5b9429822..bbc56d4f9 100644
--- a/src/libtomahawk/TomahawkSettings.cpp
+++ b/src/libtomahawk/TomahawkSettings.cpp
@@ -771,6 +771,20 @@ TomahawkSettings::setHttpEnabled( bool enable )
}
+bool
+TomahawkSettings::httpBindAll() const
+{
+ return value ( "network/httpbindall", false ).toBool();
+}
+
+
+void
+TomahawkSettings::setHttpBindAll( bool bindAll )
+{
+ setValue( "network/httpbindall", bindAll );
+}
+
+
bool
TomahawkSettings::crashReporterEnabled() const
{
diff --git a/src/libtomahawk/TomahawkSettings.h b/src/libtomahawk/TomahawkSettings.h
index 6edbcad6e..ce2805a92 100644
--- a/src/libtomahawk/TomahawkSettings.h
+++ b/src/libtomahawk/TomahawkSettings.h
@@ -142,6 +142,9 @@ public:
bool httpEnabled() const; /// true by default
void setHttpEnabled( bool enable );
+ bool httpBindAll() const; /// false by default
+ void setHttpBindAll( bool bindAll );
+
bool crashReporterEnabled() const; /// true by default
void setCrashReporterEnabled( bool enable );
diff --git a/src/tomahawk/TomahawkApp.cpp b/src/tomahawk/TomahawkApp.cpp
index 926ba01f5..7fa07aad7 100644
--- a/src/tomahawk/TomahawkApp.cpp
+++ b/src/tomahawk/TomahawkApp.cpp
@@ -491,9 +491,21 @@ TomahawkApp::initHTTP()
{
if ( TomahawkSettings::instance()->httpEnabled() )
{
- if ( playdarApi.isNull() )
+ if ( !playdarApi.isNull() )
{
- playdarApi = new PlaydarApi( QHostAddress::LocalHost, 60210, this ); // TODO Config
+ delete playdarApi.data();
+ }
+ if ( TomahawkSettings::instance()->httpBindAll() )
+ {
+#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
+ playdarApi = new PlaydarApi( QHostAddress::Any, 60210, this ); // TODO Auth
+#else
+ playdarApi = new PlaydarApi( QHostAddress::AnyIPv6, 60210, this ); // TODO Auth
+#endif
+ }
+ else
+ {
+ playdarApi = new PlaydarApi( QHostAddress::LocalHost, 60210, this ); // TODO Config port
}
playdarApi->start();
}
diff --git a/src/tomahawk/dialogs/SettingsDialog.cpp b/src/tomahawk/dialogs/SettingsDialog.cpp
index cb37e0a46..e304eecc5 100644
--- a/src/tomahawk/dialogs/SettingsDialog.cpp
+++ b/src/tomahawk/dialogs/SettingsDialog.cpp
@@ -94,6 +94,7 @@ SettingsDialog::SettingsDialog(QObject *parent )
m_advancedWidgetUi->checkBoxReporter->setChecked( s->crashReporterEnabled() );
m_advancedWidgetUi->checkBoxHttp->setChecked( s->httpEnabled() );
+ m_advancedWidgetUi->checkBoxListenApi->setChecked( s->httpBindAll() );
m_advancedWidgetUi->checkBoxSongChangeNotifications->setChecked( s->songChangeNotificationEnabled() );
#ifndef Q_OS_LINUX // no backends on OSX or Win so far
m_advancedWidgetUi->checkBoxSongChangeNotifications->setVisible( false );
@@ -272,6 +273,7 @@ SettingsDialog::saveSettings()
s->setCrashReporterEnabled( m_advancedWidgetUi->checkBoxReporter->checkState() == Qt::Checked );
s->setHttpEnabled( m_advancedWidgetUi->checkBoxHttp->checkState() == Qt::Checked );
+ s->setHttpBindAll( m_advancedWidgetUi->checkBoxListenApi->checkState() == Qt::Checked );
s->setSongChangeNotificationEnabled( m_advancedWidgetUi->checkBoxSongChangeNotifications->checkState() == Qt::Checked );
s->setProxyType( m_advancedWidgetUi->enableProxyCheckBox->isChecked() ? QNetworkProxy::Socks5Proxy : QNetworkProxy::NoProxy );
s->setExternalAddressMode( m_advancedWidgetUi->upnpRadioButton->isChecked() ? Tomahawk::Network::ExternalAddress::Upnp : ( m_advancedWidgetUi->lanOnlyRadioButton->isChecked() ? Tomahawk::Network::ExternalAddress::Lan : Tomahawk::Network::ExternalAddress::Static ) );
diff --git a/src/tomahawk/dialogs/Settings_Advanced.ui b/src/tomahawk/dialogs/Settings_Advanced.ui
index 371d53ab7..2ca796b44 100644
--- a/src/tomahawk/dialogs/Settings_Advanced.ui
+++ b/src/tomahawk/dialogs/Settings_Advanced.ui
@@ -175,6 +175,19 @@
+ -
+
+
+ Qt::LeftToRight
+
+
+ Allow other computers to interact with Tomahawk (not recommended yet)
+
+
+ false
+
+
+
-