2014-12-09 02:17:57 +01:00
|
|
|
#include "darksendconfig.h"
|
|
|
|
#include "ui_darksendconfig.h"
|
|
|
|
|
2015-01-15 12:38:03 +01:00
|
|
|
#include "bitcoinunits.h"
|
2014-12-09 02:17:57 +01:00
|
|
|
#include "guiconstants.h"
|
2015-01-15 12:38:03 +01:00
|
|
|
#include "optionsmodel.h"
|
2017-05-05 13:26:27 +02:00
|
|
|
#include "privatesend-client.h"
|
2014-12-09 02:17:57 +01:00
|
|
|
#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);
|
|
|
|
|
2015-01-15 12:38:03 +01:00
|
|
|
QString strAmount(BitcoinUnits::formatWithUnit(
|
|
|
|
model->getOptionsModel()->getDisplayUnit(), 1000 * COIN));
|
2016-05-09 21:08:13 +02:00
|
|
|
QMessageBox::information(this, tr("PrivateSend Configuration"),
|
2015-01-15 12:38:03 +01:00
|
|
|
tr(
|
2016-05-09 21:08:13 +02:00
|
|
|
"PrivateSend was successfully set to basic (%1 and 2 rounds). You can change this at any time by opening Dash's configuration screen."
|
2015-01-15 12:38:03 +01:00
|
|
|
).arg(strAmount)
|
|
|
|
);
|
2014-12-09 02:17:57 +01:00
|
|
|
|
|
|
|
close();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DarksendConfig::clickHigh()
|
|
|
|
{
|
2015-01-15 12:38:03 +01:00
|
|
|
configure(true, 1000, 8);
|
2014-12-09 02:17:57 +01:00
|
|
|
|
2015-01-15 12:38:03 +01:00
|
|
|
QString strAmount(BitcoinUnits::formatWithUnit(
|
|
|
|
model->getOptionsModel()->getDisplayUnit(), 1000 * COIN));
|
2016-05-09 21:08:13 +02:00
|
|
|
QMessageBox::information(this, tr("PrivateSend Configuration"),
|
2015-01-15 12:38:03 +01:00
|
|
|
tr(
|
2016-05-09 21:08:13 +02:00
|
|
|
"PrivateSend was successfully set to high (%1 and 8 rounds). You can change this at any time by opening Dash's configuration screen."
|
2015-01-15 12:38:03 +01:00
|
|
|
).arg(strAmount)
|
|
|
|
);
|
2014-12-09 02:17:57 +01:00
|
|
|
|
|
|
|
close();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DarksendConfig::clickMax()
|
|
|
|
{
|
2015-01-15 12:38:03 +01:00
|
|
|
configure(true, 1000, 16);
|
2014-12-09 02:17:57 +01:00
|
|
|
|
2015-01-15 12:38:03 +01:00
|
|
|
QString strAmount(BitcoinUnits::formatWithUnit(
|
|
|
|
model->getOptionsModel()->getDisplayUnit(), 1000 * COIN));
|
2016-05-09 21:08:13 +02:00
|
|
|
QMessageBox::information(this, tr("PrivateSend Configuration"),
|
2015-01-15 12:38:03 +01:00
|
|
|
tr(
|
2016-05-09 21:08:13 +02:00
|
|
|
"PrivateSend was successfully set to maximum (%1 and 16 rounds). You can change this at any time by opening Dash's configuration screen."
|
2015-01-15 12:38:03 +01:00
|
|
|
).arg(strAmount)
|
|
|
|
);
|
2014-12-09 02:17:57 +01:00
|
|
|
|
|
|
|
close();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DarksendConfig::configure(bool enabled, int coins, int rounds) {
|
|
|
|
|
|
|
|
QSettings settings;
|
|
|
|
|
2016-05-25 07:25:16 +02:00
|
|
|
settings.setValue("nPrivateSendRounds", rounds);
|
2016-07-29 07:28:57 +02:00
|
|
|
settings.setValue("nPrivateSendAmount", coins);
|
2014-12-09 02:17:57 +01:00
|
|
|
|
2017-05-05 13:26:27 +02:00
|
|
|
privateSendClient.nPrivateSendRounds = rounds;
|
|
|
|
privateSendClient.nPrivateSendAmount = coins;
|
2015-01-15 12:38:03 +01:00
|
|
|
}
|