mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-01-06 15:04:34 +08:00
new fix for selecting random port when system starts up
This commit is contained in:
parent
2de8b9112d
commit
9913484f68
@ -262,16 +262,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkRandomPort">
|
|
||||||
<property name="text">
|
|
||||||
<string>Use random port to communicate</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_7">
|
<widget class="QGroupBox" name="groupBox_7">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
@ -1108,6 +1098,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkRandomPort">
|
||||||
|
<property name="text">
|
||||||
|
<string>Use random port to communicate</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -133,13 +133,12 @@ options_imp::options_imp(QWidget *parent):
|
|||||||
// Connect signals / slots
|
// Connect signals / slots
|
||||||
connect(comboProxyType, SIGNAL(currentIndexChanged(int)),this, SLOT(enableProxy(int)));
|
connect(comboProxyType, SIGNAL(currentIndexChanged(int)),this, SLOT(enableProxy(int)));
|
||||||
connect(checkAnonymousMode, SIGNAL(toggled(bool)), this, SLOT(toggleAnonymousMode(bool)));
|
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
|
// Apply button is activated when a value is changed
|
||||||
// General tab
|
// General tab
|
||||||
connect(comboI18n, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
|
connect(comboI18n, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
|
||||||
connect(checkAltRowColors, SIGNAL(toggled(bool)), 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(checkShowSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||||
connect(checkCloseToSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
connect(checkCloseToSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||||
connect(checkMinimizeToSysTray, 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()));
|
connect(autoRun_txt, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
||||||
// Connection tab
|
// Connection tab
|
||||||
connect(spinPort, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
|
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(checkUPnP, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||||
connect(checkUploadLimit, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
connect(checkUploadLimit, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||||
connect(checkDownloadLimit, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
connect(checkDownloadLimit, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||||
@ -369,8 +369,6 @@ void options_imp::saveOptions() {
|
|||||||
// General preferences
|
// General preferences
|
||||||
pref.setLocale(locale);
|
pref.setLocale(locale);
|
||||||
pref.setAlternatingRowColors(checkAltRowColors->isChecked());
|
pref.setAlternatingRowColors(checkAltRowColors->isChecked());
|
||||||
// set random port
|
|
||||||
pref.setRandomPort(checkRandomPort->isChecked());
|
|
||||||
pref.setSystrayIntegration(systrayIntegration());
|
pref.setSystrayIntegration(systrayIntegration());
|
||||||
pref.setTrayIconStyle(TrayIcon::Style(comboTrayIcon->currentIndex()));
|
pref.setTrayIconStyle(TrayIcon::Style(comboTrayIcon->currentIndex()));
|
||||||
pref.setCloseToTray(closeToTray());
|
pref.setCloseToTray(closeToTray());
|
||||||
@ -428,6 +426,7 @@ void options_imp::saveOptions() {
|
|||||||
// End Downloads preferences
|
// End Downloads preferences
|
||||||
// Connection preferences
|
// Connection preferences
|
||||||
pref.setSessionPort(getPort());
|
pref.setSessionPort(getPort());
|
||||||
|
pref.setRandomPort(checkRandomPort->isChecked());
|
||||||
pref.setUPnPEnabled(isUPnPEnabled());
|
pref.setUPnPEnabled(isUPnPEnabled());
|
||||||
const QPair<int, int> down_up_limit = getGlobalBandwidthLimits();
|
const QPair<int, int> down_up_limit = getGlobalBandwidthLimits();
|
||||||
pref.setGlobalDownloadLimit(down_up_limit.first);
|
pref.setGlobalDownloadLimit(down_up_limit.first);
|
||||||
@ -544,8 +543,6 @@ void options_imp::loadOptions() {
|
|||||||
const Preferences pref;
|
const Preferences pref;
|
||||||
setLocale(pref.getLocale());
|
setLocale(pref.getLocale());
|
||||||
checkAltRowColors->setChecked(pref.useAlternatingRowColors());
|
checkAltRowColors->setChecked(pref.useAlternatingRowColors());
|
||||||
// get random port
|
|
||||||
checkRandomPort->setChecked(pref.useRandomPort());
|
|
||||||
checkShowSystray->setChecked(pref.systrayIntegration());
|
checkShowSystray->setChecked(pref.systrayIntegration());
|
||||||
checkShowSplash->setChecked(!pref.isSlashScreenDisabled());
|
checkShowSplash->setChecked(!pref.isSlashScreenDisabled());
|
||||||
if (checkShowSystray->isChecked()) {
|
if (checkShowSystray->isChecked()) {
|
||||||
@ -632,6 +629,7 @@ void options_imp::loadOptions() {
|
|||||||
// Connection preferences
|
// Connection preferences
|
||||||
spinPort->setValue(pref.getSessionPort());
|
spinPort->setValue(pref.getSessionPort());
|
||||||
checkUPnP->setChecked(pref.isUPnPEnabled());
|
checkUPnP->setChecked(pref.isUPnPEnabled());
|
||||||
|
checkRandomPort->setChecked(pref.useRandomPort());
|
||||||
intValue = pref.getGlobalDownloadLimit();
|
intValue = pref.getGlobalDownloadLimit();
|
||||||
if (intValue > 0) {
|
if (intValue > 0) {
|
||||||
// Enabled
|
// Enabled
|
||||||
|
@ -1532,7 +1532,7 @@ void QBtSession::loadSessionState() {
|
|||||||
// bdecode
|
// bdecode
|
||||||
lazy_entry e;
|
lazy_entry e;
|
||||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||||
error_code ec;
|
libtorrent::error_code ec;
|
||||||
lazy_bdecode(&in[0], &in[0] + in.size(), e, ec);
|
lazy_bdecode(&in[0], &in[0] + in.size(), e, ec);
|
||||||
if (!ec) {
|
if (!ec) {
|
||||||
#else
|
#else
|
||||||
@ -1916,7 +1916,7 @@ void QBtSession::setListeningPort(int port) {
|
|||||||
Preferences pref;
|
Preferences pref;
|
||||||
std::pair<int,int> ports(port, port);
|
std::pair<int,int> ports(port, port);
|
||||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||||
error_code ec;
|
libtorrent::error_code ec;
|
||||||
#endif
|
#endif
|
||||||
const QString iface_name = pref.getNetworkInterface();
|
const QString iface_name = pref.getNetworkInterface();
|
||||||
if (iface_name.isEmpty()) {
|
if (iface_name.isEmpty()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user