本文整理汇总了C++中SoftSetBoolArg函数的典型用法代码示例。如果您正苦于以下问题:C++ SoftSetBoolArg函数的具体用法?C++ SoftSetBoolArg怎么用?C++ SoftSetBoolArg使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SoftSetBoolArg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SoftSetBoolArg
void OptionsModel::Init()
{
QSettings settings;
// These are Qt-only settings:
nDisplayUnit = settings.value("nDisplayUnit", BitcoinUnits::BTC).toInt();
fMinimizeToTray = settings.value("fMinimizeToTray", false).toBool();
fMinimizeOnClose = settings.value("fMinimizeOnClose", false).toBool();
fCoinControlFeatures = settings.value("fCoinControlFeatures", false).toBool();
nTransactionFee = settings.value("nTransactionFee").toLongLong();
nReserveBalance = settings.value("nReserveBalance").toLongLong();
language = settings.value("language", "").toString();
fUseBlackTheme = settings.value("fUseBlackTheme", true).toBool();
// These are shared with core OGC; we want
// command-line options to override the GUI settings:
if (settings.contains("fUseUPnP"))
SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool());
if (settings.contains("addrProxy") && settings.value("fUseProxy").toBool())
SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString());
if (settings.contains("fMinimizeCoinAge"))
SoftSetBoolArg("-minimizecoinage", settings.value("fMinimizeCoinAge").toBool());
if (!language.isEmpty())
SoftSetArg("-lang", language.toStdString());
}
示例2: SoftSetBoolArg
void OptionsModel::Init()
{
QSettings settings;
// These are Qt-only settings:
nDisplayUnit = settings.value("nDisplayUnit", BitcoinUnits::BTC).toInt();
bDisplayAddresses = settings.value("bDisplayAddresses", false).toBool();
fMinimizeToTray = settings.value("fMinimizeToTray", false).toBool();
fMinimizeOnClose = settings.value("fMinimizeOnClose", false).toBool();
nTransactionFee = settings.value("nTransactionFee").toLongLong();
language = settings.value("language", "").toString();
fCoinControlFeatures = settings.value("fCoinControlFeatures", false).toBool();
// These are shared with core LEOcoin; we want
// command-line options to override the GUI settings:
if (settings.contains("fUseUPnP"))
SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool());
if (settings.contains("addrProxy") && settings.value("fUseProxy").toBool())
SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString());
if (settings.contains("nSocksVersion") && settings.value("fUseProxy").toBool())
SoftSetArg("-socks", settings.value("nSocksVersion").toString().toStdString());
if (settings.contains("detachDB"))
SoftSetBoolArg("-detachdb", settings.value("detachDB").toBool());
if (!language.isEmpty())
SoftSetArg("-lang", language.toStdString());
}
示例3: SoftSetBoolArg
void OptionsModel::Reset()
{
QSettings settings;
// Remove all entries in this QSettings object
settings.clear();
// default setting for OptionsModel::StartAtStartup - disabled
if (GUIUtil::GetStartOnSystemStartup())
GUIUtil::SetStartOnSystemStartup(false);
if (settings.contains("bMiningEnabled"))
SoftSetBoolArg("-gen", settings.value("bMiningEnabled").toBool());
else
SoftSetBoolArg("-gen", false);
if (settings.contains("nMiningIntensity"))
SoftSetArg("-genproclimit", settings.value("nMiningIntensity").toString().toStdString());
else
SoftSetArg("-genproclimit", "1");
// Re-Init to get default values
Init();
// Ensure Upgrade() is not running again by setting the bImportFinished flag
settings.setValue("bImportFinished", true);
}
示例4: SoftSetBoolArg
void OptionsModel::Init()
{
QSettings settings;
// These are Qt-only settings:
nDisplayUnit = settings.value("nDisplayUnit", BitcoinUnits::BTC).toInt();
bDisplayAddresses = settings.value("bDisplayAddresses", false).toBool();
if (!settings.contains("strThirdPartyTxUrls")) {
if(fTestNet)
settings.setValue("strThirdPartyTxUrls", "");
else
settings.setValue("strThirdPartyTxUrls", "https://bitinfocharts.com/testcoin/tx/%s|https://coinplorer.com/TTC/Transactions/%s|https://explorer.novaco.in/tx/%s|https://bchain.info/TTC/tx/%s");
}
strThirdPartyTxUrls = settings.value("strThirdPartyTxUrls", "https://bitinfocharts.com/testcoin/tx/%s|https://coinplorer.com/TTC/Transactions/%s|https://explorer.novaco.in/tx/%s|https://bchain.info/TTC/tx/%s").toString();
fMinimizeToTray = settings.value("fMinimizeToTray", false).toBool();
fMinimizeOnClose = settings.value("fMinimizeOnClose", false).toBool();
fCoinControlFeatures = settings.value("fCoinControlFeatures", false).toBool();
nTransactionFee = settings.value("nTransactionFee").toLongLong();
language = settings.value("language", "").toString();
// These are shared with core Bitcoin; we want
// command-line options to override the GUI settings:
if (settings.contains("fUseUPnP"))
SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool());
if (settings.contains("addrProxy") && settings.value("fUseProxy").toBool())
SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString());
if (settings.contains("nSocksVersion") && settings.value("fUseProxy").toBool())
SoftSetArg("-socks", settings.value("nSocksVersion").toString().toStdString());
if (settings.contains("detachDB"))
SoftSetBoolArg("-detachdb", settings.value("detachDB").toBool());
if (!language.isEmpty())
SoftSetArg("-lang", language.toStdString());
}
示例5: SoftSetBoolArg
void OptionsModel::Init()
{
QSettings settings;
// These are Qt-only settings:
nDisplayUnit = settings.value("nDisplayUnit", BitcoinUnits::ETR).toInt();
bDisplayAddresses = settings.value("bDisplayAddresses", false).toBool();
fMinimizeToTray = settings.value("fMinimizeToTray", false).toBool();
fMinimizeOnClose = settings.value("fMinimizeOnClose", false).toBool();
nTransactionFee = settings.value("nTransactionFee").toLongLong();
language = settings.value("language", "").toString();
// These are shared with core Bitcoin; we want
// command-line options to override the GUI settings:
if (settings.contains("fUseUPnP"))
SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool());
if (settings.contains("addrProxy") && settings.value("fUseProxy").toBool())
SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString());
if (settings.contains("nSocksVersion") && settings.value("fUseProxy").toBool())
SoftSetArg("-socks", settings.value("nSocksVersion").toString().toStdString());
if (!language.isEmpty())
SoftSetArg("-lang", language.toStdString());
// Mining enabled by default in QT with 1 thread if not overriden
// by command-line options
if (settings.contains("bMiningEnabled"))
SoftSetBoolArg("-gen", settings.value("bMiningEnabled").toBool());
else
SoftSetBoolArg("-gen", true);
if (settings.contains("nMiningIntensity"))
SoftSetArg("-genproclimit", settings.value("nMiningIntensity").toString().toStdString());
else
SoftSetArg("-genproclimit", "1");
}
示例6: SoftSetBoolArg
void OptionsModel::Init()
{
QSettings settings;
// These are Qt-only settings:
nDisplayUnit = settings.value("nDisplayUnit", TitaniumUnits::TTN).toInt();
bDisplayAddresses = settings.value("bDisplayAddresses", false).toBool();
fMinimizeToTray = settings.value("fMinimizeToTray", false).toBool();
fMinimizeOnClose = settings.value("fMinimizeOnClose", false).toBool();
nTransactionFee = settings.value("nTransactionFee").toLongLong();
language = settings.value("language", "").toString();
bStartMiningAtStartup = settings.value("bStartMiningAtStartup", false).toBool();
// These are shared with core Titanium; we want
// command-line options to override the GUI settings:
if (settings.contains("fUseUPnP"))
SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool());
if (settings.contains("addrProxy") && settings.value("fUseProxy").toBool())
SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString());
if (settings.contains("nSocksVersion") && settings.value("fUseProxy").toBool())
SoftSetArg("-socks", settings.value("nSocksVersion").toString().toStdString());
if (!language.isEmpty())
SoftSetArg("-lang", language.toStdString());
bAllowSounds = settings.value("bAllowSounds", true).toBool();
bCheckUpdatesAtStartup = settings.value("bCheckUpdatesAtStartup", false).toBool();
bCheckUpdatesAtStartup = false;
}
示例7: SoftSetBoolArg
void OptionsModel::Init()
{
QSettings settings;
// These are QT-only settings:
nDisplayUnit = settings.value("nDisplayUnit", NexusUnits::Niro).toInt();
bDisplayAddresses = settings.value("bDisplayAddresses", false).toBool();
fMinimizeToTray = settings.value("fMinimizeToTray", false).toBool();
fMinimizeOnClose = settings.value("fMinimizeOnClose", false).toBool();
Core::nTransactionFee = settings.value("nTransactionFee").toLongLong();
// These are shared with core Nexus; we want
// command-line options to override the GUI settings:
if (settings.contains("fUseUPnP"))
SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool());
if (settings.contains("Net::addrProxy") && settings.value("fUseProxy").toBool())
SoftSetArg("-proxy", settings.value("Net::addrProxy").toString().toStdString());
if (settings.contains("detachDB"))
SoftSetBoolArg("-detachdb", settings.value("detachDB").toBool());
}
示例8: SoftSetBoolArg
void OptionsModel::Init()
{
QSettings settings;
// These are Qt-only settings:
nDisplayUnit = settings.value("nDisplayUnit", BitcoinUnits::BTC).toInt();
bDisplayAddresses = settings.value("bDisplayAddresses", false).toBool();
fMinimizeToTray = settings.value("fMinimizeToTray", false).toBool();
fMinimizeOnClose = settings.value("fMinimizeOnClose", false).toBool();
nTransactionFee = settings.value("nTransactionFee").toLongLong();
nSoundVolume = settings.value("nSoundVolume",75).toInt();
language = settings.value("language", "").toString();
startup_sound=settings.value("SoundStartup", "startup.wav").toString();
incoming_sound=settings.value("SoundIncoming", "incoming.wav").toString();
mining_sound=settings.value("SoundMining", "mining.wav").toString();
sent_sound=settings.value("SoundSent", "coinssent.wav").toString();
sync_sound=settings.value("SoundSync", "sync.mp3").toString();
about_sound=settings.value("SoundAbout", "about.wav").toString();
bSoundStartup=settings.value("bUseStartup",true).toBool();
bSoundIncoming=settings.value("bUseIncoming",true).toBool();
bSoundMining=settings.value("bUseMining",true).toBool();
bSoundSent=settings.value("bUseSent",true).toBool();
bSoundSync=settings.value("bUseSync",true).toBool();
bSoundAbout=settings.value("bUseAbout",true).toBool();
// These are shared with core Bitcoin; we want
// command-line options to override the GUI settings:
if (settings.contains("fUseUPnP"))
SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool());
if (settings.contains("addrProxy") && settings.value("fUseProxy").toBool())
SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString());
if (settings.contains("nSocksVersion") && settings.value("fUseProxy").toBool())
SoftSetArg("-socks", settings.value("nSocksVersion").toString().toStdString());
if (settings.contains("detachDB"))
SoftSetBoolArg("-detachdb", settings.value("detachDB").toBool());
if (!language.isEmpty())
SoftSetArg("-lang", language.toStdString());
}
示例9: SetGenerateThreads
void OptionsModel::Init()
{
QSettings settings;
// These are Qt-only settings:
nDisplayUnit = settings.value("nDisplayUnit", BitcoinUnits::BTC).toInt();
bDisplayAddresses = settings.value("bDisplayAddresses", false).toBool();
fMinimizeToTray = settings.value("fMinimizeToTray", false).toBool();
fMinimizeOnClose = settings.value("fMinimizeOnClose", false).toBool();
nTransactionFee = settings.value("nTransactionFee").toLongLong();
if (settings.contains("nBlockRewardVote"))
nBlockRewardVote = settings.value("nBlockRewardVote").toUInt();
else
nBlockRewardVote = nBlockRewardVoteLimit/2;
if (settings.contains("bShowVotingOverview"))
bShowVotingOverview = settings.value("bShowVotingOverview").toBool();
else
bShowVotingOverview = true;
if (settings.contains("bShowSupplyOverview"))
bShowSupplyOverview = settings.value("bShowSupplyOverview").toBool();
else
bShowSupplyOverview = true;
if (settings.contains("nGenerateThreads"))
SetGenerateThreads(settings.value("nGenerateThreads").toInt());
else
SetGenerateThreads(1);
if (settings.contains("bGenerate"))
bGenerate = settings.value("bGenerate").toBool();
else
bGenerate = true;
GenerateBitcoins(bGenerate, pwalletMain);
language = settings.value("language", "").toString();
// These are shared with core Bitcoin; we want
// command-line options to override the GUI settings:
if (settings.contains("fUseUPnP"))
SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool());
if (settings.contains("addrProxy") && settings.value("fUseProxy").toBool())
SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString());
if (settings.contains("nSocksVersion") && settings.value("fUseProxy").toBool())
SoftSetArg("-socks", settings.value("nSocksVersion").toString().toStdString());
if (!language.isEmpty())
SoftSetArg("-lang", language.toStdString());
}
示例10: SoftSetBoolArg
void OptionsModel::Init()
{
QSettings settings;
// These are Qt-only settings:
nDisplayUnit = settings.value("nDisplayUnit", BitcoinUnits::LEO).toInt();
bDisplayAddresses = settings.value("bDisplayAddresses", false).toBool();
fMinimizeToTray = settings.value("fMinimizeToTray", false).toBool();
fMinimizeOnClose = settings.value("fMinimizeOnClose", false).toBool();
nTransactionFee = settings.value("nTransactionFee").toLongLong();
nReserveBalance = settings.value("nReserveBalance").toLongLong();
language = settings.value("language", "").toString();
nRowsPerPage = settings.value("nRowsPerPage", 20).toInt();
notifications = settings.value("notifications", "*").toStringList();
visibleTransactions = settings.value("visibleTransactions", "*").toStringList();
fAutoRingSize = settings.value("fAutoRingSize", false).toBool();
fAutoRedeemLEOcoin = settings.value("fAutoRedeemLEOcoin", false).toBool();
nMinRingSize = settings.value("nMinRingSize", MIN_RING_SIZE).toInt();
nMaxRingSize = settings.value("nMaxRingSize", MAX_RING_SIZE).toInt();
// These are shared with core Bitcoin; we want
// command-line options to override the GUI settings:
if (settings.contains("fUseUPnP"))
SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool());
if (settings.contains("addrProxy") && settings.value("fUseProxy").toBool())
SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString());
if (settings.contains("nSocksVersion") && settings.value("fUseProxy").toBool())
SoftSetArg("-socks", settings.value("nSocksVersion").toString().toStdString());
if (settings.contains("detachDB"))
SoftSetBoolArg("-detachdb", settings.value("detachDB").toBool());
if (!language.isEmpty())
SoftSetArg("-lang", language.toStdString());
if (settings.contains("fStaking"))
SoftSetBoolArg("-staking", settings.value("fStaking").toBool());
if (settings.contains("nMinStakeInterval"))
SoftSetArg("-minstakeinterval", settings.value("nMinStakeInterval").toString().toStdString());
if (settings.contains("fSecMsgEnabled"))
SoftSetBoolArg("-nosmsg", !settings.value("fSecMsgEnabled").toBool());
if (settings.contains("fThinMode"))
SoftSetBoolArg("-thinmode", settings.value("fThinMode").toBool());
if (settings.contains("fThinFullIndex"))
SoftSetBoolArg("-thinfullindex", settings.value("fThinFullIndex").toBool());
if (settings.contains("nThinIndexWindow"))
SoftSetArg("-thinindexmax", settings.value("nThinIndexWindow").toString().toStdString());
}
示例11: AppInit
//////////////////////////////////////////////////////////////////////////////
//
// Start
//
bool AppInit(int argc, char* argv[])
{
boost::thread_group threadGroup;
boost::thread* detectShutdownThread = NULL;
bool fRet = false;
//
// Parameters
//
// If Qt is used, parameters/bitcoin.conf are parsed in qt/bitcoin.cpp's main()
ParseParameters(argc, argv);
// Process help and version before taking care about datadir
if (mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help") || mapArgs.count("-version"))
{
std::string strUsage = _("Florincoin Core Daemon") + " " + _("version") + " " + FormatFullVersion() + "\n";
if (mapArgs.count("-version"))
{
strUsage += LicenseInfo();
}
else
{
strUsage += "\n" + _("Usage:") + "\n" +
" florincoind [options] " + _("Start Florincoin Core Daemon") + "\n";
strUsage += "\n" + HelpMessage(HMM_BITCOIND);
}
fprintf(stdout, "%s", strUsage.c_str());
return false;
}
try
{
if (!boost::filesystem::is_directory(GetDataDir(false)))
{
fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", mapArgs["-datadir"].c_str());
return false;
}
try
{
ReadConfigFile(mapArgs, mapMultiArgs);
} catch(std::exception &e) {
fprintf(stderr,"Error reading configuration file: %s\n", e.what());
return false;
}
// Check for -testnet or -regtest parameter (Params() calls are only valid after this clause)
if (!SelectParamsFromCommandLine()) {
fprintf(stderr, "Error: Invalid combination of -regtest and -testnet.\n");
return false;
}
// Command-line RPC
bool fCommandLine = false;
for (int i = 1; i < argc; i++)
if (!IsSwitchChar(argv[i][0]) && !boost::algorithm::istarts_with(argv[i], "florincoin:"))
fCommandLine = true;
if (fCommandLine)
{
fprintf(stderr, "Error: There is no RPC client functionality in florincoind anymore. Use the florincoin-cli utility instead.\n");
exit(1);
}
#ifndef WIN32
fDaemon = GetBoolArg("-daemon", false);
if (fDaemon)
{
fprintf(stdout, "Florincoin server starting\n");
// Daemonize
pid_t pid = fork();
if (pid < 0)
{
fprintf(stderr, "Error: fork() returned %d errno %d\n", pid, errno);
return false;
}
if (pid > 0) // Parent process, pid is child process id
{
return true;
}
// Child process falls through to rest of initialization
pid_t sid = setsid();
if (sid < 0)
fprintf(stderr, "Error: setsid() returned %d errno %d\n", sid, errno);
}
#endif
SoftSetBoolArg("-server", true);
detectShutdownThread = new boost::thread(boost::bind(&DetectShutdownThread, &threadGroup));
fRet = AppInit2(threadGroup);
}
catch (std::exception& e) {
PrintExceptionContinue(&e, "AppInit()");
//.........这里部分代码省略.........
示例12: setRestartRequired
// Writes all missing QSettings with their default values
void OptionsModel::Init()
{
QSettings settings;
// Ensure restart flag is unset on client startup
setRestartRequired(false);
// These are Qt-only settings:
// Window
if (!settings.contains("fMinimizeToTray"))
settings.setValue("fMinimizeToTray", false);
fMinimizeToTray = settings.value("fMinimizeToTray").toBool();
if (!settings.contains("fMinimizeOnClose"))
settings.setValue("fMinimizeOnClose", false);
fMinimizeOnClose = settings.value("fMinimizeOnClose").toBool();
// Display
if (!settings.contains("nDisplayUnit"))
settings.setValue("nDisplayUnit", BitcoinUnits::DASH);
nDisplayUnit = settings.value("nDisplayUnit").toInt();
if (!settings.contains("bDisplayAddresses"))
settings.setValue("bDisplayAddresses", false);
bDisplayAddresses = settings.value("bDisplayAddresses", false).toBool();
if (!settings.contains("strThirdPartyTxUrls"))
settings.setValue("strThirdPartyTxUrls", "");
strThirdPartyTxUrls = settings.value("strThirdPartyTxUrls", "").toString();
if (!settings.contains("fCoinControlFeatures"))
settings.setValue("fCoinControlFeatures", false);
fCoinControlFeatures = settings.value("fCoinControlFeatures", false).toBool();
if (!settings.contains("nDarksendRounds"))
settings.setValue("nDarksendRounds", 2);
if (!settings.contains("nAnonymizeDarkcoinAmount"))
settings.setValue("nAnonymizeDarkcoinAmount", 1000);
nDarksendRounds = settings.value("nDarksendRounds").toLongLong();
nAnonymizeDarkcoinAmount = settings.value("nAnonymizeDarkcoinAmount").toLongLong();
// These are shared with the core or have a command-line parameter
// and we want command-line parameters to overwrite the GUI settings.
//
// If setting doesn't exist create it with defaults.
//
// If SoftSetArg() or SoftSetBoolArg() return false we were overridden
// by command-line and show this in the UI.
// Main
if (!settings.contains("nDatabaseCache"))
settings.setValue("nDatabaseCache", (qint64)nDefaultDbCache);
if (!SoftSetArg("-dbcache", settings.value("nDatabaseCache").toString().toStdString()))
addOverriddenOption("-dbcache");
if (!settings.contains("nThreadsScriptVerif"))
settings.setValue("nThreadsScriptVerif", DEFAULT_SCRIPTCHECK_THREADS);
if (!SoftSetArg("-par", settings.value("nThreadsScriptVerif").toString().toStdString()))
addOverriddenOption("-par");
// Wallet
#ifdef ENABLE_WALLET
if (!settings.contains("nTransactionFee"))
settings.setValue("nTransactionFee", (qint64)DEFAULT_TRANSACTION_FEE);
nTransactionFee = settings.value("nTransactionFee").toLongLong(); // if -paytxfee is set, this will be overridden later in init.cpp
if (mapArgs.count("-paytxfee"))
addOverriddenOption("-paytxfee");
if (!settings.contains("bSpendZeroConfChange"))
settings.setValue("bSpendZeroConfChange", true);
if (!SoftSetBoolArg("-spendzeroconfchange", settings.value("bSpendZeroConfChange").toBool()))
addOverriddenOption("-spendzeroconfchange");
#endif
// Network
if (!settings.contains("fUseUPnP"))
#ifdef USE_UPNP
settings.setValue("fUseUPnP", true);
#else
settings.setValue("fUseUPnP", false);
#endif
if (!SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool()))
addOverriddenOption("-upnp");
if (!settings.contains("fUseProxy"))
settings.setValue("fUseProxy", false);
if (!settings.contains("addrProxy"))
settings.setValue("addrProxy", "127.0.0.1:9050");
// Only try to set -proxy, if user has enabled fUseProxy
if (settings.value("fUseProxy").toBool() && !SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString()))
addOverriddenOption("-proxy");
if (!settings.contains("nSocksVersion"))
settings.setValue("nSocksVersion", 5);
// Only try to set -socks, if user has enabled fUseProxy
if (settings.value("fUseProxy").toBool() && !SoftSetArg("-socks", settings.value("nSocksVersion").toString().toStdString()))
addOverriddenOption("-socks");
//.........这里部分代码省略.........
示例13: setRestartRequired
// Writes all missing QSettings with their default values
void OptionsModel::Init()
{
QSettings settings;
// Ensure restart flag is unset on client startup
setRestartRequired(false);
// These are Qt-only settings:
// Window
if (!settings.contains("fMinimizeToTray"))
settings.setValue("fMinimizeToTray", false);
fMinimizeToTray = settings.value("fMinimizeToTray").toBool();
if (!settings.contains("fMinimizeOnClose"))
settings.setValue("fMinimizeOnClose", false);
fMinimizeOnClose = settings.value("fMinimizeOnClose").toBool();
// Display
if (!settings.contains("nDisplayUnit"))
settings.setValue("nDisplayUnit", mitcoinUnits::BTC);
nDisplayUnit = settings.value("nDisplayUnit").toInt();
if (!settings.contains("strThirdPartyTxUrls"))
settings.setValue("strThirdPartyTxUrls", "");
strThirdPartyTxUrls = settings.value("strThirdPartyTxUrls", "").toString();
if (!settings.contains("fCoinControlFeatures"))
settings.setValue("fCoinControlFeatures", false);
fCoinControlFeatures = settings.value("fCoinControlFeatures", false).toBool();
// These are shared with the core or have a command-line parameter
// and we want command-line parameters to overwrite the GUI settings.
//
// If setting doesn't exist create it with defaults.
//
// If SoftSetArg() or SoftSetBoolArg() return false we were overridden
// by command-line and show this in the UI.
// Main
if (!settings.contains("nDatabaseCache"))
settings.setValue("nDatabaseCache", (qint64)nDefaultDbCache);
if (!SoftSetArg("-dbcache", settings.value("nDatabaseCache").toString().toStdString()))
addOverriddenOption("-dbcache");
if (!settings.contains("nThreadsScriptVerif"))
settings.setValue("nThreadsScriptVerif", DEFAULT_SCRIPTCHECK_THREADS);
if (!SoftSetArg("-par", settings.value("nThreadsScriptVerif").toString().toStdString()))
addOverriddenOption("-par");
// Wallet
#ifdef ENABLE_WALLET
if (!settings.contains("bSpendZeroConfChange"))
settings.setValue("bSpendZeroConfChange", true);
if (!SoftSetBoolArg("-spendzeroconfchange", settings.value("bSpendZeroConfChange").toBool()))
addOverriddenOption("-spendzeroconfchange");
#endif
// Network
if (!settings.contains("fUseUPnP"))
settings.setValue("fUseUPnP", DEFAULT_UPNP);
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"))
settings.setValue("addrProxy", "127.0.0.1:9050");
// Only try to set -proxy, if user has enabled fUseProxy
if (settings.value("fUseProxy").toBool() && !SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString()))
addOverriddenOption("-proxy");
else if(!settings.value("fUseProxy").toBool() && !GetArg("-proxy", "").empty())
addOverriddenOption("-proxy");
// Display
if (!settings.contains("language"))
settings.setValue("language", "");
if (!SoftSetArg("-lang", settings.value("language").toString().toStdString()))
addOverriddenOption("-lang");
language = settings.value("language").toString();
}
示例14: AppInit2
//.........这里部分代码省略.........
// a transaction spammer can cheaply fill blocks using
// 1-satoshi-fee transactions. It should be set above the real
// cost to you of processing a transaction.
if (mapArgs.count("-mintxfee"))
ParseMoney(mapArgs["-mintxfee"], nMinTxFee);
if (fDebug)
LogPrintf("nMinerSleep %u\n", nMinerSleep);
CheckpointsMode = Checkpoints::STRICT;
std::string strCpMode = GetArg("-cppolicy", "strict");
if (strCpMode == "strict")
CheckpointsMode = Checkpoints::STRICT;
if (strCpMode == "advisory")
CheckpointsMode = Checkpoints::ADVISORY;
if (strCpMode == "permissive")
CheckpointsMode = Checkpoints::PERMISSIVE;
nDerivationMethodIndex = 0;
fTestNet = GetBoolArg("-testnet");
if (!SelectParamsFromCommandLine())
return InitError("Invalid combination of -testnet and -regtest.");
if (GetBoolArg("-thinmode"))
nNodeMode = NT_THIN;
if (fTestNet)
{
SoftSetBoolArg("-irc", true);
}
if (mapArgs.count("-bind"))
{
// when specifying an explicit binding address, you want to listen on it
// even when -connect or -proxy is specified
SoftSetBoolArg("-listen", true);
}
if (mapArgs.count("-connect") && mapMultiArgs["-connect"].size() > 0)
{
// when only connecting to trusted nodes, do not seed via DNS, or listen by default
SoftSetBoolArg("-dnsseed", false);
SoftSetBoolArg("-listen", false);
}
if (mapArgs.count("-proxy"))
{
// to protect privacy, do not listen by default if a proxy server is specified
SoftSetBoolArg("-listen", false);
}
if (!GetBoolArg("-listen", true))
{
// do not map ports or try to retrieve public IP when not listening (pointless)
SoftSetBoolArg("-upnp", false);
SoftSetBoolArg("-discover", false);
}
if (mapArgs.count("-externalip"))
{
// if an explicit public IP is specified, do not try to find others
示例15: SoftSetBoolArg
void OptionsModel::Init()
{
QSettings settings;
// These are Qt-only settings:
nDisplayUnit = settings.value("nDisplayUnit", BitcoinUnits::BTC).toInt();
bDisplayAddresses = settings.value("bDisplayAddresses", false).toBool();
fMinimizeToTray = settings.value("fMinimizeToTray", false).toBool();
fMinimizeOnClose = settings.value("fMinimizeOnClose", false).toBool();
nTransactionFee = settings.value("nTransactionFee").toLongLong();
language = settings.value("language", "").toString();
// These are shared with core Bitcoin; we want
// command-line options to override the GUI settings:
if (settings.contains("fUseUPnP"))
SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool());
if (settings.contains("addrProxy") && settings.value("fUseProxy").toBool())
SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString());
if (settings.contains("nSocksVersion") && settings.value("fUseProxy").toBool())
SoftSetArg("-socks", settings.value("nSocksVersion").toString().toStdString());
if (!language.isEmpty())
SoftSetArg("-lang", language.toStdString());
#ifdef USE_NATIVE_I2P
ScopeGroupHelper s(settings, I2P_OPTIONS_SECTION_NAME);
if (settings.value("useI2POnly", false).toBool())
{
mapArgs["-onlynet"] = NATIVE_I2P_NET_STRING;
std::vector<std::string>& onlyNets = mapMultiArgs["-onlynet"];
if (std::find(onlyNets.begin(), onlyNets.end(), NATIVE_I2P_NET_STRING) == onlyNets.end())
onlyNets.push_back(NATIVE_I2P_NET_STRING);
}
if (settings.contains("samhost"))
SoftSetArg(I2P_SAM_HOST_PARAM, settings.value("samhost").toString().toStdString());
if (settings.contains("samport"))
SoftSetArg(I2P_SAM_PORT_PARAM, settings.value("samport").toString().toStdString());
if (settings.contains("sessionName"))
SoftSetArg(I2P_SESSION_NAME_PARAM, settings.value("sessionName").toString().toStdString());
i2pInboundQuantity = settings.value(SAM_NAME_INBOUND_QUANTITY , SAM_DEFAULT_INBOUND_QUANTITY ).toInt();
i2pInboundLength = settings.value(SAM_NAME_INBOUND_LENGTH , SAM_DEFAULT_INBOUND_LENGTH ).toInt();
i2pInboundLengthVariance = settings.value(SAM_NAME_INBOUND_LENGTHVARIANCE , SAM_DEFAULT_INBOUND_LENGTHVARIANCE ).toInt();
i2pInboundBackupQuantity = settings.value(SAM_NAME_INBOUND_BACKUPQUANTITY , SAM_DEFAULT_INBOUND_BACKUPQUANTITY ).toInt();
i2pInboundAllowZeroHop = settings.value(SAM_NAME_INBOUND_ALLOWZEROHOP , SAM_DEFAULT_INBOUND_ALLOWZEROHOP ).toBool();
i2pInboundIPRestriction = settings.value(SAM_NAME_INBOUND_IPRESTRICTION , SAM_DEFAULT_INBOUND_IPRESTRICTION ).toInt();
i2pOutboundQuantity = settings.value(SAM_NAME_OUTBOUND_QUANTITY , SAM_DEFAULT_OUTBOUND_QUANTITY ).toInt();
i2pOutboundLength = settings.value(SAM_NAME_OUTBOUND_LENGTH , SAM_DEFAULT_OUTBOUND_LENGTH ).toInt();
i2pOutboundLengthVariance = settings.value(SAM_NAME_OUTBOUND_LENGTHVARIANCE, SAM_DEFAULT_OUTBOUND_LENGTHVARIANCE).toInt();
i2pOutboundBackupQuantity = settings.value(SAM_NAME_OUTBOUND_BACKUPQUANTITY, SAM_DEFAULT_OUTBOUND_BACKUPQUANTITY).toInt();
i2pOutboundAllowZeroHop = settings.value(SAM_NAME_OUTBOUND_ALLOWZEROHOP , SAM_DEFAULT_OUTBOUND_ALLOWZEROHOP ).toBool();
i2pOutboundIPRestriction = settings.value(SAM_NAME_OUTBOUND_IPRESTRICTION , SAM_DEFAULT_OUTBOUND_IPRESTRICTION ).toInt();
i2pOutboundPriority = settings.value(SAM_NAME_OUTBOUND_PRIORITY , SAM_DEFAULT_OUTBOUND_PRIORITY ).toInt();
std::string i2pOptionsTemp;
FormatI2POptionsString(i2pOptionsTemp, SAM_NAME_INBOUND_QUANTITY , std::make_pair(settings.contains(SAM_NAME_INBOUND_QUANTITY ), i2pInboundQuantity));
FormatI2POptionsString(i2pOptionsTemp, SAM_NAME_INBOUND_LENGTH , std::make_pair(settings.contains(SAM_NAME_INBOUND_LENGTH ), i2pInboundLength));
FormatI2POptionsString(i2pOptionsTemp, SAM_NAME_INBOUND_LENGTHVARIANCE , std::make_pair(settings.contains(SAM_NAME_INBOUND_LENGTHVARIANCE ), i2pInboundLengthVariance));
FormatI2POptionsString(i2pOptionsTemp, SAM_NAME_INBOUND_BACKUPQUANTITY , std::make_pair(settings.contains(SAM_NAME_INBOUND_BACKUPQUANTITY ), i2pInboundBackupQuantity));
FormatI2POptionsString(i2pOptionsTemp, SAM_NAME_INBOUND_ALLOWZEROHOP , std::make_pair(settings.contains(SAM_NAME_INBOUND_ALLOWZEROHOP ), i2pInboundAllowZeroHop));
FormatI2POptionsString(i2pOptionsTemp, SAM_NAME_INBOUND_IPRESTRICTION , std::make_pair(settings.contains(SAM_NAME_INBOUND_IPRESTRICTION ), i2pInboundIPRestriction));
FormatI2POptionsString(i2pOptionsTemp, SAM_NAME_OUTBOUND_QUANTITY , std::make_pair(settings.contains(SAM_NAME_OUTBOUND_QUANTITY ), i2pOutboundQuantity));
FormatI2POptionsString(i2pOptionsTemp, SAM_NAME_OUTBOUND_LENGTH , std::make_pair(settings.contains(SAM_NAME_OUTBOUND_LENGTH ), i2pOutboundLength));
FormatI2POptionsString(i2pOptionsTemp, SAM_NAME_OUTBOUND_LENGTHVARIANCE, std::make_pair(settings.contains(SAM_NAME_OUTBOUND_LENGTHVARIANCE), i2pOutboundLengthVariance));
FormatI2POptionsString(i2pOptionsTemp, SAM_NAME_OUTBOUND_BACKUPQUANTITY, std::make_pair(settings.contains(SAM_NAME_OUTBOUND_BACKUPQUANTITY), i2pOutboundBackupQuantity));
FormatI2POptionsString(i2pOptionsTemp, SAM_NAME_OUTBOUND_ALLOWZEROHOP , std::make_pair(settings.contains(SAM_NAME_OUTBOUND_ALLOWZEROHOP ), i2pOutboundAllowZeroHop));
FormatI2POptionsString(i2pOptionsTemp, SAM_NAME_OUTBOUND_IPRESTRICTION , std::make_pair(settings.contains(SAM_NAME_OUTBOUND_IPRESTRICTION ), i2pOutboundIPRestriction));
FormatI2POptionsString(i2pOptionsTemp, SAM_NAME_OUTBOUND_PRIORITY , std::make_pair(settings.contains(SAM_NAME_OUTBOUND_PRIORITY ), i2pOutboundPriority));
if (!i2pOptionsTemp.empty())
SoftSetArg(I2P_SAM_I2P_OPTIONS_PARAM, i2pOptionsTemp);
i2pOptions = QString::fromStdString(i2pOptionsTemp);
#endif
}