diff --git a/src/preferences/options.ui b/src/preferences/options.ui index 09f4f0721..85f23c749 100755 --- a/src/preferences/options.ui +++ b/src/preferences/options.ui @@ -262,16 +262,6 @@ - - - - Use random port to communicate - - - false - - - @@ -1108,6 +1098,16 @@ + + + + Use random port to communicate + + + false + + + diff --git a/src/preferences/options_imp.cpp b/src/preferences/options_imp.cpp index 653853222..663cafa11 100755 --- a/src/preferences/options_imp.cpp +++ b/src/preferences/options_imp.cpp @@ -133,13 +133,12 @@ options_imp::options_imp(QWidget *parent): // Connect signals / slots connect(comboProxyType, SIGNAL(currentIndexChanged(int)),this, SLOT(enableProxy(int))); connect(checkAnonymousMode, SIGNAL(toggled(bool)), this, SLOT(toggleAnonymousMode(bool))); + connect(checkRandomPort, SIGNAL(toggled(bool)), spinPort, SLOT(setDisabled(bool))); // Apply button is activated when a value is changed // General tab connect(comboI18n, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton())); connect(checkAltRowColors, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); - // add checkbox for random port - connect(checkRandomPort, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkShowSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkCloseToSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkMinimizeToSysTray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); @@ -186,6 +185,7 @@ options_imp::options_imp(QWidget *parent): connect(autoRun_txt, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton())); // Connection tab connect(spinPort, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton())); + connect(checkRandomPort, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkUPnP, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkUploadLimit, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkDownloadLimit, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); @@ -369,8 +369,6 @@ void options_imp::saveOptions() { // General preferences pref.setLocale(locale); pref.setAlternatingRowColors(checkAltRowColors->isChecked()); - // set random port - pref.setRandomPort(checkRandomPort->isChecked()); pref.setSystrayIntegration(systrayIntegration()); pref.setTrayIconStyle(TrayIcon::Style(comboTrayIcon->currentIndex())); pref.setCloseToTray(closeToTray()); @@ -428,6 +426,7 @@ void options_imp::saveOptions() { // End Downloads preferences // Connection preferences pref.setSessionPort(getPort()); + pref.setRandomPort(checkRandomPort->isChecked()); pref.setUPnPEnabled(isUPnPEnabled()); const QPair down_up_limit = getGlobalBandwidthLimits(); pref.setGlobalDownloadLimit(down_up_limit.first); @@ -544,8 +543,6 @@ void options_imp::loadOptions() { const Preferences pref; setLocale(pref.getLocale()); checkAltRowColors->setChecked(pref.useAlternatingRowColors()); - // get random port - checkRandomPort->setChecked(pref.useRandomPort()); checkShowSystray->setChecked(pref.systrayIntegration()); checkShowSplash->setChecked(!pref.isSlashScreenDisabled()); if (checkShowSystray->isChecked()) { @@ -632,6 +629,7 @@ void options_imp::loadOptions() { // Connection preferences spinPort->setValue(pref.getSessionPort()); checkUPnP->setChecked(pref.isUPnPEnabled()); + checkRandomPort->setChecked(pref.useRandomPort()); intValue = pref.getGlobalDownloadLimit(); if (intValue > 0) { // Enabled diff --git a/src/qtlibtorrent/qbtsession.cpp b/src/qtlibtorrent/qbtsession.cpp index 36f771988..cd8a68a30 100755 --- a/src/qtlibtorrent/qbtsession.cpp +++ b/src/qtlibtorrent/qbtsession.cpp @@ -1532,7 +1532,7 @@ void QBtSession::loadSessionState() { // bdecode lazy_entry e; #if LIBTORRENT_VERSION_NUM >= 001600 - error_code ec; + libtorrent::error_code ec; lazy_bdecode(&in[0], &in[0] + in.size(), e, ec); if (!ec) { #else @@ -1916,7 +1916,7 @@ void QBtSession::setListeningPort(int port) { Preferences pref; std::pair ports(port, port); #if LIBTORRENT_VERSION_NUM >= 001600 - error_code ec; + libtorrent::error_code ec; #endif const QString iface_name = pref.getNetworkInterface(); if (iface_name.isEmpty()) {