neobytes/src/qt/darksendconfig.cpp
UdjinM6 5a8c0c9b9d Merge #928: Refactor All The Things - part1
86d8505 Refactor CActiveMasternode
+ move strMasterNodeAddr to CActiveMasternode

a005c79 Refactor InstantSend
+ new lock cs_instantsend to protect maps on CleanTransactionLocksList()
+ new DEFAULT_INSTANTSEND_DEPTH constant
+ rename MIN_INSTANTX_PROTO_VERSION to MIN_INSTANTSEND_PROTO_VERSION and bump it

d24182c Refactor Privatesend
+ decouple from util.h and version.h
+ more functions for CDarksendBroadcastTx: constructors, signing, serialization
+ move from rand() to insecure_rand() in general but to GetRand() for session id
+ fix defaults
2016-08-05 21:49:45 +02:00

92 lines
2.4 KiB
C++

#include "darksendconfig.h"
#include "ui_darksendconfig.h"
#include "bitcoinunits.h"
#include "darksend.h"
#include "guiconstants.h"
#include "optionsmodel.h"
#include "walletmodel.h"
#include <QMessageBox>
#include <QPushButton>
#include <QKeyEvent>
#include <QSettings>
DarksendConfig::DarksendConfig(QWidget *parent) :
QDialog(parent),
ui(new Ui::DarksendConfig),
model(0)
{
ui->setupUi(this);
connect(ui->buttonBasic, SIGNAL(clicked()), this, SLOT(clickBasic()));
connect(ui->buttonHigh, SIGNAL(clicked()), this, SLOT(clickHigh()));
connect(ui->buttonMax, SIGNAL(clicked()), this, SLOT(clickMax()));
}
DarksendConfig::~DarksendConfig()
{
delete ui;
}
void DarksendConfig::setModel(WalletModel *model)
{
this->model = model;
}
void DarksendConfig::clickBasic()
{
configure(true, 1000, 2);
QString strAmount(BitcoinUnits::formatWithUnit(
model->getOptionsModel()->getDisplayUnit(), 1000 * COIN));
QMessageBox::information(this, tr("PrivateSend Configuration"),
tr(
"PrivateSend was successfully set to basic (%1 and 2 rounds). You can change this at any time by opening Dash's configuration screen."
).arg(strAmount)
);
close();
}
void DarksendConfig::clickHigh()
{
configure(true, 1000, 8);
QString strAmount(BitcoinUnits::formatWithUnit(
model->getOptionsModel()->getDisplayUnit(), 1000 * COIN));
QMessageBox::information(this, tr("PrivateSend Configuration"),
tr(
"PrivateSend was successfully set to high (%1 and 8 rounds). You can change this at any time by opening Dash's configuration screen."
).arg(strAmount)
);
close();
}
void DarksendConfig::clickMax()
{
configure(true, 1000, 16);
QString strAmount(BitcoinUnits::formatWithUnit(
model->getOptionsModel()->getDisplayUnit(), 1000 * COIN));
QMessageBox::information(this, tr("PrivateSend Configuration"),
tr(
"PrivateSend was successfully set to maximum (%1 and 16 rounds). You can change this at any time by opening Dash's configuration screen."
).arg(strAmount)
);
close();
}
void DarksendConfig::configure(bool enabled, int coins, int rounds) {
QSettings settings;
settings.setValue("nPrivateSendRounds", rounds);
settings.setValue("nPrivateSendAmount", coins);
nPrivateSendRounds = rounds;
nPrivateSendAmount = coins;
}