diff options
author | Kevin Smith <git@kismith.co.uk> | 2012-11-13 10:22:26 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2012-11-13 10:50:16 (GMT) |
commit | 5fcc96c17e4f97fb8946880fce1fedc6afd8ed21 (patch) | |
tree | 7cc354ab0c9dcf2606bbb3e29a2345fe0bfe0913 /Swift | |
parent | 59c1b26ba8f85bfb52f7c8e95bf1eca208d3de7b (diff) | |
download | swift-contrib-5fcc96c17e4f97fb8946880fce1fedc6afd8ed21.zip swift-contrib-5fcc96c17e4f97fb8946880fce1fedc6afd8ed21.tar.bz2 |
Don't show -1 as default port in UI.
Change-Id: I6ef93c0ea63fc39daacea832775f0f883d01ee12
Resolves: #1177
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/QtUI/QtConnectionSettingsWindow.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Swift/QtUI/QtConnectionSettingsWindow.cpp b/Swift/QtUI/QtConnectionSettingsWindow.cpp index 5bc2754..040b92a 100644 --- a/Swift/QtUI/QtConnectionSettingsWindow.cpp +++ b/Swift/QtUI/QtConnectionSettingsWindow.cpp @@ -70,7 +70,9 @@ QtConnectionSettingsWindow::QtConnectionSettingsWindow(const ClientOptions& opti if (!options.manualHostname.empty()) { ui.manual_manualHost->setChecked(true); ui.manual_manualHostName->setText(P2QSTRING(options.manualHostname)); - ui.manual_manualHostPort->setText(P2QSTRING(boost::lexical_cast<std::string>(options.manualPort))); + if (options.manualPort >=0) { + ui.manual_manualHostPort->setText(P2QSTRING(boost::lexical_cast<std::string>(options.manualPort))); + } } ui.manual_proxyType->setCurrentIndex(options.proxyType); if (!options.manualProxyHostname.empty()) { @@ -112,7 +114,9 @@ ClientOptions QtConnectionSettingsWindow::getOptions() { options.manualHostname = Q2PSTRING(ui.manual_manualHostName->text()); try { options.manualPort = boost::lexical_cast<int>(Q2PSTRING(ui.manual_manualHostPort->text())); - } catch (const boost::bad_lexical_cast&) {} + } catch (const boost::bad_lexical_cast&) { + options.manualPort = -1; + } } options.proxyType = static_cast<ClientOptions::ProxyType>(ui.manual_proxyType->currentIndex()); if (ui.manual_manualProxy->isChecked()) { |