mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-24 09:49:42 +01:00
Add setting to let playdar/remote api listen on all IPs
This commit is contained in:
parent
237ea85369
commit
3b1728db5f
@ -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
|
||||
{
|
||||
|
@ -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 );
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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 ) );
|
||||
|
@ -175,6 +175,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxListenApi">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Allow other computers to interact with Tomahawk (not recommended yet)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxReporter">
|
||||
<property name="layoutDirection">
|
||||
|
Loading…
x
Reference in New Issue
Block a user