From 56b07d2dcdec336173b866210c535439b03416a1 Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Thu, 29 May 2014 13:02:22 +0200 Subject: [Qt] allow setting listen via GUI - add DEFAULT_LISTEN in net.h and use in the code (shared setting between core and GUI) Important: This makes it obvious, that we need to re-think the settings/options handling, as GUI settings are processed before any parameter-interaction (which is mostly important for network stuff) in AppInit2()! --- src/qt/optionsmodel.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/qt/optionsmodel.cpp') 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; } -- cgit v1.2.3