diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2020-02-23 02:12:19 +0200 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2021-01-07 18:07:09 +0200 |
commit | a39f7336a3b493d46a4486c4c94fdca1b3151370 (patch) | |
tree | 4adf1ae61b5b02f5081b5dbcee09b64503b0947f /src/qt | |
parent | 28acffd9d53ec437e908abb8c84497a4f41b91ed (diff) | |
download | bitcoin-a39f7336a3b493d46a4486c4c94fdca1b3151370.tar.xz |
net: Add -natpmp command line option
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/optionsdialog.cpp | 2 | ||||
-rw-r--r-- | src/qt/optionsmodel.cpp | 18 | ||||
-rw-r--r-- | src/qt/optionsmodel.h | 1 |
3 files changed, 19 insertions, 2 deletions
diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index d3677f0773..4057712a41 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -53,7 +53,7 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) : #endif connect(this, &QDialog::accepted, [this](){ QSettings settings; - model->node().mapPort(settings.value("fUseUPnP").toBool()); + model->node().mapPort(settings.value("fUseUPnP").toBool(), settings.value("fUseNatpmp").toBool()); }); ui->proxyIp->setEnabled(false); diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 81ebe3b810..1e0391a35c 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -124,6 +124,13 @@ void OptionsModel::Init(bool resetSettings) if (!gArgs.SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool())) addOverriddenOption("-upnp"); + if (!settings.contains("fUseNatpmp")) { + settings.setValue("fUseNatpmp", DEFAULT_NATPMP); + } + if (!gArgs.SoftSetBoolArg("-natpmp", settings.value("fUseNatpmp").toBool())) { + addOverriddenOption("-natpmp"); + } + if (!settings.contains("fListen")) settings.setValue("fListen", DEFAULT_LISTEN); if (!gArgs.SoftSetBoolArg("-listen", settings.value("fListen").toBool())) @@ -283,7 +290,13 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const return settings.value("fUseUPnP"); #else return false; -#endif +#endif // USE_UPNP + case MapPortNatpmp: +#ifdef USE_NATPMP + return settings.value("fUseNatpmp"); +#else + return false; +#endif // USE_NATPMP case MinimizeOnClose: return fMinimizeOnClose; @@ -356,6 +369,9 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in case MapPortUPnP: // core option - can be changed on-the-fly settings.setValue("fUseUPnP", value.toBool()); break; + case MapPortNatpmp: // core option - can be changed on-the-fly + settings.setValue("fUseNatpmp", value.toBool()); + break; case MinimizeOnClose: fMinimizeOnClose = value.toBool(); settings.setValue("fMinimizeOnClose", fMinimizeOnClose); diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h index f1929a5e06..f7171951a1 100644 --- a/src/qt/optionsmodel.h +++ b/src/qt/optionsmodel.h @@ -48,6 +48,7 @@ public: ShowTrayIcon, // bool MinimizeToTray, // bool MapPortUPnP, // bool + MapPortNatpmp, // bool MinimizeOnClose, // bool ProxyUse, // bool ProxyIP, // QString |