settings set instantly

This commit is contained in:
Evan Duffield 2014-08-10 06:20:21 -07:00
parent 196e64a0c5
commit 388bb3bb3f
6 changed files with 33 additions and 8 deletions

View File

@ -97,11 +97,9 @@
</item>
<item>
<widget class="QComboBox" name="darksendRounds">
<item>
<property name="text">
<string>Disable Darksend</string>
<property name="currentIndex">
<number>1</number>
</property>
</item>
<item>
<property name="text">
<string>1</string>
@ -176,6 +174,20 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="disableDarksend">
<property name="text">
<string>Disable Darksend</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_Main">
<property name="orientation">

View File

@ -149,6 +149,7 @@ void OptionsDialog::setMapper()
mapper->addMapping(ui->coinControlFeatures, OptionsModel::CoinControlFeatures);
/* Darksend Rounds */
mapper->addMapping(ui->disableDarksend, OptionsModel::DisableDarksend);
mapper->addMapping(ui->darksendRounds, OptionsModel::DarksendRounds);
mapper->addMapping(ui->anonymizeDarkcoin, OptionsModel::AnonymizeDarkcoinAmount);

View File

@ -51,6 +51,7 @@ void OptionsModel::Init()
fCoinControlFeatures = settings.value("fCoinControlFeatures", false).toBool();
nDarksendRounds = settings.value("nDarksendRounds").toLongLong();
nAnonymizeDarkcoinAmount = settings.value("nAnonymizeDarkcoinAmount").toLongLong();
fDisableDarksend = settings.value("fDisableDarksend", false).toBool();
// These are shared with core Bitcoin; we want
// command-line options to override the GUI settings:
@ -66,6 +67,8 @@ void OptionsModel::Init()
SoftSetArg("-darksendrounds", settings.value("nDarksendRounds").toString().toStdString());
if (settings.contains("nAnonymizeDarkcoinAmount"))
SoftSetArg("-anonymizedarkcoinamount", settings.value("nAnonymizeDarkcoinAmount").toString().toStdString());
if (settings.contains("fDisableDarksend"))
SoftSetArg("-disabledarksend", settings.value("fDisableDarksend").toString().toStdString());
}
@ -204,6 +207,8 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
return QVariant(bDisplayAddresses);
case Language:
return settings.value("language", "");
case DisableDarksend:
return QVariant(fDisableDarksend);
case DarksendRounds:
return QVariant(nDarksendRounds);
case AnonymizeDarkcoinAmount:
@ -292,6 +297,11 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
case Language:
settings.setValue("language", value);
break;
case DisableDarksend:
fDisableDarksend = value.toInt();
settings.setValue("fDisableDarksend", value);
emit disableDarksendChanged(fDisableDarksend);
break;
case DarksendRounds:
nDarksendRounds = value.toInt();
settings.setValue("nDarksendRounds", value);

View File

@ -30,6 +30,7 @@ public:
DisplayAddresses, // bool
Language, // QString
CoinControlFeatures, // bool
DisableDarksend, // bool
DarksendRounds, // int
AnonymizeDarkcoinAmount, //int
OptionIDRowCount,
@ -59,8 +60,6 @@ private:
bool bDisplayAddresses;
bool fMinimizeToTray;
bool fMinimizeOnClose;
int nDarksendRounds;
int nAnonymizeDarkcoinAmount;
QString language;
bool fCoinControlFeatures;
@ -69,6 +68,7 @@ signals:
void transactionFeeChanged(qint64);
void darksendRoundsChanged(int);
void anonymizeDarkcoinAmountChanged(int);
void disableDarksendChanged(bool);
void coinControlFeaturesChanged(bool);
};

View File

@ -90,10 +90,11 @@ void WalletModel::updateStatus()
void WalletModel::pollBalanceChanged()
{
if(nBestHeight != cachedNumBlocks)
if(nBestHeight != cachedNumBlocks || nDarksendRounds != cachedDarksendRounds)
{
// Balance and number of transactions might have changed
cachedNumBlocks = nBestHeight;
cachedDarksendRounds = nDarksendRounds;
checkBalanceChanged();
}
}

View File

@ -145,6 +145,7 @@ private:
qint64 cachedImmatureBalance;
qint64 cachedAnonymizedBalance;
qint64 cachedNumTransactions;
int cachedDarksendRounds;
EncryptionStatus cachedEncryptionStatus;
int cachedNumBlocks;