@ -30,6 +30,11 @@ OptionsModel::OptionsModel(QObject *parent) :
Init ( ) ;
Init ( ) ;
}
}
void OptionsModel : : addOverriddenOption ( const std : : string & option )
{
strOverriddenByCommandLine + = QString : : fromStdString ( option ) + " = " + QString : : fromStdString ( mapArgs [ option ] ) + " " ;
}
// Writes all missing QSettings with their default values
// Writes all missing QSettings with their default values
void OptionsModel : : Init ( )
void OptionsModel : : Init ( )
{
{
@ -76,23 +81,23 @@ void OptionsModel::Init()
settings . setValue ( " nTransactionFee " , 0 ) ;
settings . setValue ( " nTransactionFee " , 0 ) ;
nTransactionFee = settings . value ( " nTransactionFee " ) . toLongLong ( ) ; // if -paytxfee is set, this will be overridden later in init.cpp
nTransactionFee = settings . value ( " nTransactionFee " ) . toLongLong ( ) ; // if -paytxfee is set, this will be overridden later in init.cpp
if ( mapArgs . count ( " -paytxfee " ) )
if ( mapArgs . count ( " -paytxfee " ) )
strOverriddenByCommandLine + = " -paytxfee " ;
addOverriddenOption ( " -paytxfee " ) ;
if ( ! settings . contains ( " bSpendZeroConfChange " ) )
if ( ! settings . contains ( " bSpendZeroConfChange " ) )
settings . setValue ( " bSpendZeroConfChange " , true ) ;
settings . setValue ( " bSpendZeroConfChange " , true ) ;
if ( ! SoftSetBoolArg ( " -spendzeroconfchange " , settings . value ( " bSpendZeroConfChange " ) . toBool ( ) ) )
if ( ! SoftSetBoolArg ( " -spendzeroconfchange " , settings . value ( " bSpendZeroConfChange " ) . toBool ( ) ) )
strOverriddenByCommandLine + = " -spendzeroconfchange " ;
addOverriddenOption ( " -spendzeroconfchange " ) ;
# endif
# endif
if ( ! settings . contains ( " nDatabaseCache " ) )
if ( ! settings . contains ( " nDatabaseCache " ) )
settings . setValue ( " nDatabaseCache " , ( qint64 ) nDefaultDbCache ) ;
settings . setValue ( " nDatabaseCache " , ( qint64 ) nDefaultDbCache ) ;
if ( ! SoftSetArg ( " -dbcache " , settings . value ( " nDatabaseCache " ) . toString ( ) . toStdString ( ) ) )
if ( ! SoftSetArg ( " -dbcache " , settings . value ( " nDatabaseCache " ) . toString ( ) . toStdString ( ) ) )
strOverriddenByCommandLine + = " -dbcache " ;
addOverriddenOption ( " -dbcache " ) ;
if ( ! settings . contains ( " nThreadsScriptVerif " ) )
if ( ! settings . contains ( " nThreadsScriptVerif " ) )
settings . setValue ( " nThreadsScriptVerif " , 0 ) ;
settings . setValue ( " nThreadsScriptVerif " , 0 ) ;
if ( ! SoftSetArg ( " -par " , settings . value ( " nThreadsScriptVerif " ) . toString ( ) . toStdString ( ) ) )
if ( ! SoftSetArg ( " -par " , settings . value ( " nThreadsScriptVerif " ) . toString ( ) . toStdString ( ) ) )
strOverriddenByCommandLine + = " -par " ;
addOverriddenOption ( " -par " ) ;
// Network
// Network
if ( ! settings . contains ( " fUseUPnP " ) )
if ( ! settings . contains ( " fUseUPnP " ) )
@ -100,9 +105,9 @@ void OptionsModel::Init()
settings . setValue ( " fUseUPnP " , true ) ;
settings . setValue ( " fUseUPnP " , true ) ;
# else
# else
settings . setValue ( " fUseUPnP " , false ) ;
settings . setValue ( " fUseUPnP " , false ) ;
# endif
# endif
if ( ! SoftSetBoolArg ( " -upnp " , settings . value ( " fUseUPnP " ) . toBool ( ) ) )
if ( ! SoftSetBoolArg ( " -upnp " , settings . value ( " fUseUPnP " ) . toBool ( ) ) )
strOverriddenByCommandLine + = " -upnp " ;
addOverriddenOption ( " -upnp " ) ;
if ( ! settings . contains ( " fUseProxy " ) )
if ( ! settings . contains ( " fUseProxy " ) )
settings . setValue ( " fUseProxy " , false ) ;
settings . setValue ( " fUseProxy " , false ) ;
@ -110,18 +115,18 @@ void OptionsModel::Init()
settings . setValue ( " addrProxy " , " 127.0.0.1:9050 " ) ;
settings . setValue ( " addrProxy " , " 127.0.0.1:9050 " ) ;
// Only try to set -proxy, if user has enabled fUseProxy
// Only try to set -proxy, if user has enabled fUseProxy
if ( settings . value ( " fUseProxy " ) . toBool ( ) & & ! SoftSetArg ( " -proxy " , settings . value ( " addrProxy " ) . toString ( ) . toStdString ( ) ) )
if ( settings . value ( " fUseProxy " ) . toBool ( ) & & ! SoftSetArg ( " -proxy " , settings . value ( " addrProxy " ) . toString ( ) . toStdString ( ) ) )
strOverriddenByCommandLine + = " -proxy " ;
addOverriddenOption ( " -proxy " ) ;
if ( ! settings . contains ( " nSocksVersion " ) )
if ( ! settings . contains ( " nSocksVersion " ) )
settings . setValue ( " nSocksVersion " , 5 ) ;
settings . setValue ( " nSocksVersion " , 5 ) ;
// Only try to set -socks, if user has enabled fUseProxy
// Only try to set -socks, if user has enabled fUseProxy
if ( settings . value ( " fUseProxy " ) . toBool ( ) & & ! SoftSetArg ( " -socks " , settings . value ( " nSocksVersion " ) . toString ( ) . toStdString ( ) ) )
if ( settings . value ( " fUseProxy " ) . toBool ( ) & & ! SoftSetArg ( " -socks " , settings . value ( " nSocksVersion " ) . toString ( ) . toStdString ( ) ) )
strOverriddenByCommandLine + = " -socks " ;
addOverriddenOption ( " -socks " ) ;
// Display
// Display
if ( ! settings . contains ( " language " ) )
if ( ! settings . contains ( " language " ) )
settings . setValue ( " language " , " " ) ;
settings . setValue ( " language " , " " ) ;
if ( ! SoftSetArg ( " -lang " , settings . value ( " language " ) . toString ( ) . toStdString ( ) ) )
if ( ! SoftSetArg ( " -lang " , settings . value ( " language " ) . toString ( ) . toStdString ( ) ) )
strOverriddenByCommandLine + = " -lang " ;
addOverriddenOption ( " -lang " ) ;
language = settings . value ( " language " ) . toString ( ) ;
language = settings . value ( " language " ) . toString ( ) ;
}
}