Skip to content

Commit

Permalink
Add an option to disable popups for PS mixing txes (#2272)
Browse files Browse the repository at this point in the history
* Add an option to disable popups for PS mixing txes

* capital S
  • Loading branch information
UdjinM6 authored Sep 11, 2018
1 parent 38ccfef commit 55d7bb9
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/qt/forms/optionsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,16 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showPrivateSendPopups">
<property name="toolTip">
<string>Show system popups for PrivateSend mixing transactions&lt;br/&gt;just like for all other transaction types.</string>
</property>
<property name="text">
<string>Show popups for Privatesend transactions</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="lowKeysWarning">
<property name="toolTip">
Expand Down
1 change: 1 addition & 0 deletions src/qt/optionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ void OptionsDialog::setMapper()
mapper->addMapping(ui->coinControlFeatures, OptionsModel::CoinControlFeatures);
mapper->addMapping(ui->showMasternodesTab, OptionsModel::ShowMasternodesTab);
mapper->addMapping(ui->showAdvancedPSUI, OptionsModel::ShowAdvancedPSUI);
mapper->addMapping(ui->showPrivateSendPopups, OptionsModel::ShowPrivateSendPopups);
mapper->addMapping(ui->lowKeysWarning, OptionsModel::LowKeysWarning);
mapper->addMapping(ui->privateSendMultiSession, OptionsModel::PrivateSendMultiSession);
mapper->addMapping(ui->spendZeroConfChange, OptionsModel::SpendZeroConfChange);
Expand Down
8 changes: 8 additions & 0 deletions src/qt/optionsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ void OptionsModel::Init(bool resetSettings)
settings.setValue("fShowAdvancedPSUI", false);
fShowAdvancedPSUI = settings.value("fShowAdvancedPSUI", false).toBool();

if (!settings.contains("fShowPrivateSendPopups"))
settings.setValue("fShowPrivateSendPopups", true);

if (!settings.contains("fLowKeysWarning"))
settings.setValue("fLowKeysWarning", true);
#endif // ENABLE_WALLET
Expand Down Expand Up @@ -272,6 +275,8 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
return settings.value("fShowMasternodesTab");
case ShowAdvancedPSUI:
return fShowAdvancedPSUI;
case ShowPrivateSendPopups:
return settings.value("fShowPrivateSendPopups");
case LowKeysWarning:
return settings.value("fLowKeysWarning");
case PrivateSendRounds:
Expand Down Expand Up @@ -422,6 +427,9 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
settings.setValue("fShowAdvancedPSUI", fShowAdvancedPSUI);
Q_EMIT advancedPSUIChanged(fShowAdvancedPSUI);
break;
case ShowPrivateSendPopups:
settings.setValue("fShowPrivateSendPopups", value);
break;
case LowKeysWarning:
settings.setValue("fLowKeysWarning", value);
break;
Expand Down
1 change: 1 addition & 0 deletions src/qt/optionsmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class OptionsModel : public QAbstractListModel
SpendZeroConfChange, // bool
ShowMasternodesTab, // bool
ShowAdvancedPSUI, // bool
ShowPrivateSendPopups, // bool
LowKeysWarning, // bool
PrivateSendRounds, // int
PrivateSendAmount, // int
Expand Down
12 changes: 11 additions & 1 deletion src/qt/walletview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "receivecoinsdialog.h"
#include "sendcoinsdialog.h"
#include "signverifymessagedialog.h"
#include "transactionrecord.h"
#include "transactiontablemodel.h"
#include "transactionview.h"
#include "walletmodel.h"
Expand Down Expand Up @@ -194,10 +195,19 @@ void WalletView::processNewTransaction(const QModelIndex& parent, int start, int
if (!ttm || ttm->processingQueuedTransactions())
return;

QModelIndex index = ttm->index(start, 0, parent);
QSettings settings;
if (!settings.value("fShowPrivateSendPopups").toBool()) {
QVariant nType = ttm->data(index, TransactionTableModel::TypeRole);
if (nType == TransactionRecord::PrivateSendDenominate ||
nType == TransactionRecord::PrivateSendCollateralPayment ||
nType == TransactionRecord::PrivateSendMakeCollaterals ||
nType == TransactionRecord::PrivateSendCreateDenominations) return;
}

QString date = ttm->index(start, TransactionTableModel::Date, parent).data().toString();
qint64 amount = ttm->index(start, TransactionTableModel::Amount, parent).data(Qt::EditRole).toULongLong();
QString type = ttm->index(start, TransactionTableModel::Type, parent).data().toString();
QModelIndex index = ttm->index(start, 0, parent);
QString address = ttm->data(index, TransactionTableModel::AddressRole).toString();
QString label = ttm->data(index, TransactionTableModel::LabelRole).toString();

Expand Down

0 comments on commit 55d7bb9

Please sign in to comment.