mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-20 15:59:42 +01:00
Moved static port forward settings to separate dialog.
This commit is contained in:
parent
b05c043374
commit
a2a67ae1cf
@ -80,6 +80,7 @@ SET( tomahawkUI ${tomahawkUI}
|
||||
Settings_Accounts.ui
|
||||
Settings_Advanced.ui
|
||||
Settings_Collection.ui
|
||||
HostDialog.ui
|
||||
ProxyDialog.ui
|
||||
|
||||
AudioControls.ui
|
||||
|
161
src/tomahawk/HostDialog.ui
Normal file
161
src/tomahawk/HostDialog.ui
Normal file
@ -0,0 +1,161 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>HostDialog</class>
|
||||
<widget class="QDialog" name="HostDialog">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::WindowModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>585</width>
|
||||
<height>170</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Host Settings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="staticHostNamePortLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Configure your external IP address or host name here. Make sure to manually forward the selected port to this host on your router.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="staticHostNamePortLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="staticHostNameLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Static Host Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="staticHostName"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="staticPortLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Static Port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="staticPort">
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>50210</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autoDetectIpCheckBox">
|
||||
<property name="text">
|
||||
<string>Automatically detect external IP address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>buttonBox</zorder>
|
||||
<zorder>staticHostNamePortLabel</zorder>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>HostDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>HostDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -3,7 +3,7 @@
|
||||
* Copyright 2010-2013, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
|
||||
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||
* Copyright 2012, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2012-2014, Teo Mrnjavac <teo@kde.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "SettingsDialog.h"
|
||||
#include "ui_HostDialog.h"
|
||||
#include "ui_ProxyDialog.h"
|
||||
#include "ui_Settings_Accounts.h"
|
||||
#include "ui_Settings_Collection.h"
|
||||
@ -77,6 +78,7 @@ SettingsDialog::SettingsDialog(QObject *parent )
|
||||
, m_collectionWidget( new QWidget )
|
||||
, m_advancedWidgetUi( new Ui_Settings_Advanced )
|
||||
, m_advancedWidget( new QWidget )
|
||||
, m_staticHostSettings( 0 )
|
||||
, m_proxySettings( 0 )
|
||||
, m_restartRequired( false )
|
||||
, m_accountModel( 0 )
|
||||
@ -106,11 +108,7 @@ SettingsDialog::SettingsDialog(QObject *parent )
|
||||
else
|
||||
m_advancedWidgetUi->upnpRadioButton->setChecked( true );
|
||||
|
||||
m_advancedWidgetUi->staticHostNamePortLabel->setEnabled( m_advancedWidgetUi->staticIpRadioButton->isChecked() );
|
||||
m_advancedWidgetUi->staticHostName->setEnabled( m_advancedWidgetUi->staticIpRadioButton->isChecked() && !s->autoDetectExternalIp() );
|
||||
m_advancedWidgetUi->staticPort->setEnabled( m_advancedWidgetUi->staticIpRadioButton->isChecked() );
|
||||
m_advancedWidgetUi->staticHostNameLabel->setEnabled( m_advancedWidgetUi->staticIpRadioButton->isChecked() );
|
||||
m_advancedWidgetUi->staticPortLabel->setEnabled( m_advancedWidgetUi->staticIpRadioButton->isChecked() );
|
||||
m_advancedWidgetUi->staticHostSettingsButton->setEnabled( m_advancedWidgetUi->staticIpRadioButton->isChecked() );
|
||||
|
||||
bool useProxy = TomahawkSettings::instance()->proxyType() == QNetworkProxy::Socks5Proxy;
|
||||
m_advancedWidgetUi->enableProxyCheckBox->setChecked( useProxy );
|
||||
@ -124,6 +122,9 @@ SettingsDialog::SettingsDialog(QObject *parent )
|
||||
m_proxySettings.setSizeGripEnabled( true );
|
||||
QSizeGrip* p = m_proxySettings.findChild< QSizeGrip* >();
|
||||
p->setFixedSize( 0, 0 );
|
||||
m_staticHostSettings.setSizeGripEnabled( true );
|
||||
p = m_staticHostSettings.findChild< QSizeGrip* >();
|
||||
p->setFixedSize( 0, 0 );
|
||||
#endif
|
||||
|
||||
m_accountsWidgetUi->installFromFileBtn->setText( tr( "Install from file" ) );
|
||||
@ -169,10 +170,7 @@ SettingsDialog::SettingsDialog(QObject *parent )
|
||||
}
|
||||
|
||||
// ADVANCED
|
||||
m_advancedWidgetUi->staticHostName->setText( s->externalHostname() );
|
||||
m_advancedWidgetUi->staticPort->setValue( s->externalPort() );
|
||||
m_advancedWidgetUi->proxyButton->setVisible( true );
|
||||
m_advancedWidgetUi->autoDetectIpCheckBox->setChecked( s->autoDetectExternalIp() );
|
||||
|
||||
m_collectionWidgetUi->checkBoxWatchForChanges->setChecked( s->watchForChanges() );
|
||||
m_collectionWidgetUi->scannerTimeSpinBox->setValue( s->scannerTime() );
|
||||
@ -249,6 +247,7 @@ SettingsDialog::SettingsDialog(QObject *parent )
|
||||
|
||||
m_dialog->setCurrentIndex( 0 );
|
||||
|
||||
connect( m_advancedWidgetUi->staticHostSettingsButton, SIGNAL( clicked() ), SLOT( showStaticHostSettings() ) );
|
||||
connect( m_advancedWidgetUi->proxyButton, SIGNAL( clicked() ), SLOT( showProxySettings() ) );
|
||||
connect( m_advancedWidgetUi->lanOnlyRadioButton, SIGNAL( toggled( bool ) ), SLOT( requiresRestart() ) );
|
||||
connect( m_advancedWidgetUi->staticIpRadioButton, SIGNAL( toggled( bool ) ), SLOT( requiresRestart() ) );
|
||||
@ -256,7 +255,6 @@ SettingsDialog::SettingsDialog(QObject *parent )
|
||||
connect( m_advancedWidgetUi->lanOnlyRadioButton, SIGNAL( toggled( bool ) ), SLOT( toggleRemoteMode() ) );
|
||||
connect( m_advancedWidgetUi->staticIpRadioButton, SIGNAL( toggled( bool ) ), SLOT( toggleRemoteMode() ) );
|
||||
connect( m_advancedWidgetUi->upnpRadioButton, SIGNAL( toggled( bool ) ), SLOT( toggleRemoteMode() ) );
|
||||
connect( m_advancedWidgetUi->autoDetectIpCheckBox, SIGNAL( toggled( bool ) ), SLOT( toggleAutoDetectIp( bool ) ) );
|
||||
connect( m_advancedWidgetUi->enableProxyCheckBox, SIGNAL( toggled( bool ) ), SLOT( toggleProxyEnabled() ) );
|
||||
connect( m_advancedWidgetUi->enableProxyCheckBox, SIGNAL( toggled( bool ) ), SLOT( requiresRestart() ) );
|
||||
|
||||
@ -277,10 +275,6 @@ SettingsDialog::saveSettings()
|
||||
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 ) );
|
||||
s->setAutoDetectExternalIp( m_advancedWidgetUi->autoDetectIpCheckBox->isChecked() );
|
||||
|
||||
s->setExternalHostname( m_advancedWidgetUi->staticHostName->text() );
|
||||
s->setExternalPort( m_advancedWidgetUi->staticPort->value() );
|
||||
|
||||
QStringList libraryPaths;
|
||||
for ( int i = 0; i < m_collectionWidgetUi->pathListWidget->count(); i++ )
|
||||
@ -375,6 +369,18 @@ SettingsDialog::changeEvent( QEvent *e )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SettingsDialog::showStaticHostSettings()
|
||||
{
|
||||
m_staticHostSettings.exec();
|
||||
if ( m_staticHostSettings.result() == QDialog::Accepted )
|
||||
{
|
||||
requiresRestart();
|
||||
m_staticHostSettings.saveSettings();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SettingsDialog::showProxySettings()
|
||||
{
|
||||
@ -390,11 +396,7 @@ SettingsDialog::showProxySettings()
|
||||
void
|
||||
SettingsDialog::toggleRemoteMode()
|
||||
{
|
||||
m_advancedWidgetUi->staticHostNamePortLabel->setEnabled( m_advancedWidgetUi->staticIpRadioButton->isChecked() );
|
||||
m_advancedWidgetUi->staticHostName->setEnabled( m_advancedWidgetUi->staticIpRadioButton->isChecked() );
|
||||
m_advancedWidgetUi->staticPort->setEnabled( m_advancedWidgetUi->staticIpRadioButton->isChecked() );
|
||||
m_advancedWidgetUi->staticHostNameLabel->setEnabled( m_advancedWidgetUi->staticIpRadioButton->isChecked() );
|
||||
m_advancedWidgetUi->staticPortLabel->setEnabled( m_advancedWidgetUi->staticIpRadioButton->isChecked() );
|
||||
m_advancedWidgetUi->staticHostSettingsButton->setEnabled( m_advancedWidgetUi->staticIpRadioButton->isChecked() );
|
||||
}
|
||||
|
||||
|
||||
@ -405,13 +407,6 @@ SettingsDialog::toggleProxyEnabled()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SettingsDialog::toggleAutoDetectIp( bool checked )
|
||||
{
|
||||
m_advancedWidgetUi->staticHostName->setEnabled( !checked );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SettingsDialog::addLibraryPath()
|
||||
{
|
||||
@ -600,6 +595,43 @@ SettingsDialog::requiresRestart()
|
||||
}
|
||||
|
||||
|
||||
HostDialog::HostDialog( QWidget* parent )
|
||||
: QDialog( parent )
|
||||
, ui( new Ui::HostDialog )
|
||||
{
|
||||
ui->setupUi( this );
|
||||
|
||||
TomahawkSettings* s = TomahawkSettings::instance();
|
||||
|
||||
connect( ui->autoDetectIpCheckBox, SIGNAL( toggled( bool ) ),
|
||||
SLOT( toggleAutoDetectIp( bool ) ) );
|
||||
|
||||
ui->staticHostName->setText( s->externalHostname() );
|
||||
ui->staticPort->setValue( s->externalPort() );
|
||||
ui->autoDetectIpCheckBox->setChecked( s->autoDetectExternalIp() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
HostDialog::saveSettings()
|
||||
{
|
||||
TomahawkSettings* s = TomahawkSettings::instance();
|
||||
|
||||
s->setAutoDetectExternalIp( ui->autoDetectIpCheckBox->isChecked() );
|
||||
s->setExternalHostname( ui->staticHostName->text() );
|
||||
s->setExternalPort( ui->staticPort->value() );
|
||||
|
||||
s->sync();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
HostDialog::toggleAutoDetectIp( bool checked )
|
||||
{
|
||||
ui->staticHostName->setEnabled( !checked );
|
||||
}
|
||||
|
||||
|
||||
ProxyDialog::ProxyDialog( QWidget *parent )
|
||||
: QDialog( parent )
|
||||
, ui( new Ui::ProxyDialog )
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
|
||||
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||
* Copyright 2012, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2012-2014, Teo Mrnjavac <teo@kde.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -39,6 +39,7 @@ class QToolbarTabDialog;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class HostDialog;
|
||||
class ProxyDialog;
|
||||
}
|
||||
|
||||
@ -54,6 +55,24 @@ class AccountModelFilterProxy;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class HostDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit HostDialog( QWidget* parent = 0 );
|
||||
~HostDialog() {}
|
||||
|
||||
void saveSettings();
|
||||
|
||||
private slots:
|
||||
void toggleAutoDetectIp( bool checked );
|
||||
|
||||
private:
|
||||
Ui::HostDialog* ui;
|
||||
};
|
||||
|
||||
class ProxyDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -87,7 +106,7 @@ protected:
|
||||
private slots:
|
||||
void toggleRemoteMode();
|
||||
void toggleProxyEnabled();
|
||||
void toggleAutoDetectIp( bool checked );
|
||||
void showStaticHostSettings();
|
||||
void showProxySettings();
|
||||
void addLibraryPath();
|
||||
void removeLibraryPath();
|
||||
@ -121,6 +140,7 @@ private:
|
||||
|
||||
QToolbarTabDialog* m_dialog;
|
||||
|
||||
HostDialog m_staticHostSettings;
|
||||
ProxyDialog m_proxySettings;
|
||||
bool m_restartRequired;
|
||||
Tomahawk::Accounts::AccountModel* m_accountModel;
|
||||
|
@ -39,37 +39,30 @@
|
||||
<item>
|
||||
<widget class="QRadioButton" name="upnpRadioButton">
|
||||
<property name="text">
|
||||
<string>Use UPnP to establish port forward (recommended)</string>
|
||||
<string>Automatic port forward with UPnP (recommended)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="staticIpRadioButton">
|
||||
<property name="text">
|
||||
<string>Use static external IP address/host name and port</string>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="staticHostNamePortLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Set this to your external IP address or host name. Make sure to forward the port to this host!</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="staticHostNamePortLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="staticHostNameLabel">
|
||||
<widget class="QRadioButton" name="staticIpRadioButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Manual port forward</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="staticHostSettingsButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@ -77,60 +70,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Static Host Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="staticHostName"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="staticPortLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Static Port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="staticPort">
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>50210</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autoDetectIpCheckBox">
|
||||
<property name="text">
|
||||
<string>Automatically detect external IP address</string>
|
||||
<string>Host Settings...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user