Merge pull request #4290

56b07d2 [Qt] allow setting listen via GUI (Philip Kaufmann)
This commit is contained in:
Wladimir J. van der Laan 2014-06-11 12:16:27 +02:00
commit 0cadf620f6
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
6 changed files with 29 additions and 1 deletions

View File

@ -766,7 +766,7 @@ bool AppInit2(boost::thread_group& threadGroup)
} }
// see Step 2: parameter interactions for more information about these // see Step 2: parameter interactions for more information about these
fListen = GetBoolArg("-listen", true); fListen = GetBoolArg("-listen", DEFAULT_LISTEN);
fDiscover = GetBoolArg("-discover", true); fDiscover = GetBoolArg("-discover", true);
fNameLookup = GetBoolArg("-dns", true); fNameLookup = GetBoolArg("-dns", true);

View File

@ -38,6 +38,8 @@ namespace boost {
/** The maximum number of entries in an 'inv' protocol message */ /** The maximum number of entries in an 'inv' protocol message */
static const unsigned int MAX_INV_SZ = 50000; static const unsigned int MAX_INV_SZ = 50000;
/** -listen default */
static const bool DEFAULT_LISTEN = true;
/** -upnp default */ /** -upnp default */
#ifdef USE_UPNP #ifdef USE_UPNP
static const bool DEFAULT_UPNP = USE_UPNP; static const bool DEFAULT_UPNP = USE_UPNP;

View File

@ -242,6 +242,16 @@
</property> </property>
</widget> </widget>
</item> </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> <item>
<widget class="QCheckBox" name="connectSocks"> <widget class="QCheckBox" name="connectSocks">
<property name="toolTip"> <property name="toolTip">

View File

@ -151,6 +151,7 @@ void OptionsDialog::setModel(OptionsModel *model)
/* Wallet */ /* Wallet */
connect(ui->spendZeroConfChange, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning())); connect(ui->spendZeroConfChange, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning()));
/* Network */ /* Network */
connect(ui->allowIncoming, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning()));
connect(ui->connectSocks, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning())); connect(ui->connectSocks, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning()));
/* Display */ /* Display */
connect(ui->lang, SIGNAL(valueChanged()), this, SLOT(showRestartWarning())); connect(ui->lang, SIGNAL(valueChanged()), this, SLOT(showRestartWarning()));
@ -171,6 +172,7 @@ void OptionsDialog::setMapper()
/* Network */ /* Network */
mapper->addMapping(ui->mapPortUpnp, OptionsModel::MapPortUPnP); mapper->addMapping(ui->mapPortUpnp, OptionsModel::MapPortUPnP);
mapper->addMapping(ui->allowIncoming, OptionsModel::Listen);
mapper->addMapping(ui->connectSocks, OptionsModel::ProxyUse); mapper->addMapping(ui->connectSocks, OptionsModel::ProxyUse);
mapper->addMapping(ui->proxyIp, OptionsModel::ProxyIP); mapper->addMapping(ui->proxyIp, OptionsModel::ProxyIP);

View File

@ -110,6 +110,11 @@ void OptionsModel::Init()
if (!SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool())) if (!SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool()))
addOverriddenOption("-upnp"); addOverriddenOption("-upnp");
if (!settings.contains("fListen"))
settings.setValue("fListen", DEFAULT_LISTEN);
if (!SoftSetBoolArg("-listen", settings.value("fListen").toBool()))
addOverriddenOption("-listen");
if (!settings.contains("fUseProxy")) if (!settings.contains("fUseProxy"))
settings.setValue("fUseProxy", false); settings.setValue("fUseProxy", false);
if (!settings.contains("addrProxy")) if (!settings.contains("addrProxy"))
@ -214,6 +219,8 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
return settings.value("nDatabaseCache"); return settings.value("nDatabaseCache");
case ThreadsScriptVerif: case ThreadsScriptVerif:
return settings.value("nThreadsScriptVerif"); return settings.value("nThreadsScriptVerif");
case Listen:
return settings.value("fListen");
default: default:
return QVariant(); return QVariant();
} }
@ -339,6 +346,12 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
setRestartRequired(true); setRestartRequired(true);
} }
break; break;
case Listen:
if (settings.value("fListen") != value) {
settings.setValue("fListen", value);
setRestartRequired(true);
}
break;
default: default:
break; break;
} }

View File

@ -42,6 +42,7 @@ public:
ThreadsScriptVerif, // int ThreadsScriptVerif, // int
DatabaseCache, // int DatabaseCache, // int
SpendZeroConfChange, // bool SpendZeroConfChange, // bool
Listen, // bool
OptionIDRowCount, OptionIDRowCount,
}; };