From e27159142f30524de6fbeadb0d71328c4bc929dd Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Sun, 13 Feb 2011 23:22:05 -0500 Subject: [PATCH] Revamp the config gui slightly. Put network settings on its own tab and jabber settings on its own tab. Add a UI way to set the external port. --- src/libtomahawk/tomahawksettings.cpp | 7 +- src/settingsdialog.cpp | 15 +- src/settingsdialog.ui | 380 ++++++++++++++------------- 3 files changed, 200 insertions(+), 202 deletions(-) diff --git a/src/libtomahawk/tomahawksettings.cpp b/src/libtomahawk/tomahawksettings.cpp index bd0363e6d..2b6b9935f 100644 --- a/src/libtomahawk/tomahawksettings.cpp +++ b/src/libtomahawk/tomahawksettings.cpp @@ -368,14 +368,17 @@ int TomahawkSettings::externalPort() const { QMutexLocker locker( m_safety ); - return value( "network/external-port" ).toInt(); + return value( "network/external-port", 50210 ).toInt(); } void TomahawkSettings::setExternalPort(int externalPort) { QMutexLocker locker( m_safety ); - setValue( "network/external-port", externalPort); + if ( externalPort == 0 ) + setValue( "network/external-port", 50210); + else + setValue( "network/external-port", externalPort); } diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp index 3b66be646..30818b0b2 100644 --- a/src/settingsdialog.cpp +++ b/src/settingsdialog.cpp @@ -51,19 +51,7 @@ SettingsDialog::SettingsDialog( QWidget *parent ) ui->jabberServer->setText( s->jabberServer() ); ui->jabberPort->setValue( s->jabberPort() ); ui->staticHostName->setText( s->externalHostname() ); - ui->proxyButton->setVisible( false ); - - if ( ui->jabberPort->text().toInt() != 5222 || !ui->jabberServer->text().isEmpty() ) - { - ui->checkBoxAdvanced->setChecked( true ); - } - else - { - // hide advanved settings - ui->checkBoxAdvanced->setChecked( false ); - ui->groupBoxJabberAdvanced->setVisible( false ); - ui->groupBoxNetworkAdvanced->setVisible( false ); - } + ui->staticPort->setValue( s->externalPort() ); if ( s->twitterOAuthToken().isEmpty() || s->twitterOAuthTokenSecret().isEmpty() ) { @@ -134,6 +122,7 @@ SettingsDialog::~SettingsDialog() s->setJabberPort( ui->jabberPort->value() ); s->setExternalHostname( ui->staticHostName->text() ); + s->setExternalPort( ui->staticPort->value() ); s->setScannerPath( ui->lineEditMusicPath->text() ); diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui index 616de8780..2b844db9a 100644 --- a/src/settingsdialog.ui +++ b/src/settingsdialog.ui @@ -40,36 +40,30 @@ 16 - - - 16 - - + + - + 0 0 - 100 + 0 0 Jabber ID: - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - jabberUsername - + @@ -79,20 +73,23 @@ - + + + + 0 + 0 + + Password: - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - jabberPassword - + @@ -108,22 +105,6 @@ - - - - - 0 - 0 - - - - Qt::RightToLeft - - - Show Advanced Settings - - - @@ -227,72 +208,6 @@ - - - - - 0 - 0 - - - - Advanced Network Settings - - - - - - - - Static Host Name: - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Proxy Settings... - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - @@ -306,50 +221,189 @@ - - - - Qt::RightToLeft - - - Playdar HTTP API - NO AUTH - - - false - - - - - - - Qt::RightToLeft - - - Use UPnP to establish port forward - - - true - - - - - - - Qt::RightToLeft - - - Connect automatically when Tomahawk starts - - - true - - - + + + Network + + + + + 20 + 10 + 551 + 341 + + + + + 0 + 0 + + + + Advanced Network Settings + + + + + + + + + 0 + 0 + + + + If you're having difficulty connecting to peers, try setting this to your external IP address/host name and a port number (default 50210). Make sure to forward that port to this machine! + + + true + + + + + + + + + + 0 + 0 + + + + Static Host Name: + + + + + + + + + + + 0 + 0 + + + + Static Port: + + + + + + + 65535 + + + 50210 + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Proxy Settings... + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::RightToLeft + + + Playdar HTTP API - NO AUTH + + + false + + + + + + + Qt::RightToLeft + + + Connect automatically when Tomahawk starts + + + true + + + + + + + Qt::RightToLeft + + + Use UPnP to establish port forward + + + true + + + + + + - Music + Local Music @@ -430,7 +484,7 @@ Authenticating with Twitter allows you to discover and play music from your Twitter friends running Tomahawk. -This feature works best when you have set a static host name in the "Jabber" settings tab under Advanced Settings, but may work even if you do not. Please note: this discovery uses Direct Messages and will only work when both Twitter users have followed each other. Tomahawk will attempt to "clean up" after itself to keep your Direct Message inbox tidy, but may miss some. +This feature works best when you have set a static host name in the "Network" settings tab under Advanced Settings, but may work even if you do not. Please note: this discovery uses Direct Messages and will only work when both Twitter users have followed each other. Tomahawk will attempt to "clean up" after itself to keep your Direct Message inbox tidy, but may miss some. When you press the button your web browser will launch and take you to Twitter.com to authenticate. You must copy and paste the PIN number into the dialog box that appears. @@ -738,54 +792,6 @@ If connections to peers seem to have been lost, just press the button again to r - - checkBoxAdvanced - toggled(bool) - proxyButton - setVisible(bool) - - - 310 - 110 - - - 368 - 194 - - - - - checkBoxAdvanced - toggled(bool) - groupBoxJabberAdvanced - setVisible(bool) - - - 310 - 115 - - - 310 - 174 - - - - - checkBoxAdvanced - toggled(bool) - groupBoxNetworkAdvanced - setVisible(bool) - - - 310 - 115 - - - 310 - 262 - - - twitterAuthenticateButton pressed()