diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-06-11 12:16:27 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-06-11 12:16:41 +0200 |
commit | 0cadf620f6ca130b263b7cd7567fd31b9b18c6b6 (patch) | |
tree | 939a4888f8d4cbc15d53fb928ba338c0c7ddfe30 | |
parent | 5905d71fe3bb22d0111da7fb4ca8433ed54c9abf (diff) | |
parent | 56b07d2dcdec336173b866210c535439b03416a1 (diff) |
Merge pull request #4290
56b07d2 [Qt] allow setting listen via GUI (Philip Kaufmann)
-rw-r--r-- | src/init.cpp | 2 | ||||
-rw-r--r-- | src/net.h | 2 | ||||
-rw-r--r-- | src/qt/forms/optionsdialog.ui | 10 | ||||
-rw-r--r-- | src/qt/optionsdialog.cpp | 2 | ||||
-rw-r--r-- | src/qt/optionsmodel.cpp | 13 | ||||
-rw-r--r-- | src/qt/optionsmodel.h | 1 |
6 files changed, 29 insertions, 1 deletions
diff --git a/src/init.cpp b/src/init.cpp index 1d86cf087d..528c3df064 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -766,7 +766,7 @@ bool AppInit2(boost::thread_group& threadGroup) } // see Step 2: parameter interactions for more information about these - fListen = GetBoolArg("-listen", true); + fListen = GetBoolArg("-listen", DEFAULT_LISTEN); fDiscover = GetBoolArg("-discover", true); fNameLookup = GetBoolArg("-dns", true); @@ -38,6 +38,8 @@ namespace boost { /** The maximum number of entries in an 'inv' protocol message */ static const unsigned int MAX_INV_SZ = 50000; +/** -listen default */ +static const bool DEFAULT_LISTEN = true; /** -upnp default */ #ifdef USE_UPNP static const bool DEFAULT_UPNP = USE_UPNP; diff --git a/src/qt/forms/optionsdialog.ui b/src/qt/forms/optionsdialog.ui index 0103842e02..0c5b8895aa 100644 --- a/src/qt/forms/optionsdialog.ui +++ b/src/qt/forms/optionsdialog.ui @@ -243,6 +243,16 @@ </widget> </item> <item> + <widget class="QCheckBox" name="allowIncoming"> + <property name="toolTip"> + <string>Accept connections from outside</string> + </property> + <property name="text"> + <string>Allow incoming connections</string> + </property> + </widget> + </item> + <item> <widget class="QCheckBox" name="connectSocks"> <property name="toolTip"> <string>Connect to the Bitcoin network through a SOCKS proxy.</string> diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index 1cbf5f8810..abfd4123e0 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -151,6 +151,7 @@ void OptionsDialog::setModel(OptionsModel *model) /* Wallet */ connect(ui->spendZeroConfChange, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning())); /* Network */ + connect(ui->allowIncoming, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning())); connect(ui->connectSocks, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning())); /* Display */ connect(ui->lang, SIGNAL(valueChanged()), this, SLOT(showRestartWarning())); @@ -171,6 +172,7 @@ void OptionsDialog::setMapper() /* Network */ mapper->addMapping(ui->mapPortUpnp, OptionsModel::MapPortUPnP); + mapper->addMapping(ui->allowIncoming, OptionsModel::Listen); mapper->addMapping(ui->connectSocks, OptionsModel::ProxyUse); mapper->addMapping(ui->proxyIp, OptionsModel::ProxyIP); diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index f3a5f37bb3..4dafd9d2af 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -110,6 +110,11 @@ void OptionsModel::Init() if (!SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool())) addOverriddenOption("-upnp"); + if (!settings.contains("fListen")) + settings.setValue("fListen", DEFAULT_LISTEN); + if (!SoftSetBoolArg("-listen", settings.value("fListen").toBool())) + addOverriddenOption("-listen"); + if (!settings.contains("fUseProxy")) settings.setValue("fUseProxy", false); if (!settings.contains("addrProxy")) @@ -214,6 +219,8 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const return settings.value("nDatabaseCache"); case ThreadsScriptVerif: return settings.value("nThreadsScriptVerif"); + case Listen: + return settings.value("fListen"); default: return QVariant(); } @@ -339,6 +346,12 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in setRestartRequired(true); } break; + case Listen: + if (settings.value("fListen") != value) { + settings.setValue("fListen", value); + setRestartRequired(true); + } + break; default: break; } diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h index f05e3e92de..2596682d07 100644 --- a/src/qt/optionsmodel.h +++ b/src/qt/optionsmodel.h @@ -42,6 +42,7 @@ public: ThreadsScriptVerif, // int DatabaseCache, // int SpendZeroConfChange, // bool + Listen, // bool OptionIDRowCount, }; |