Dash Core  0.12.2.1
P2P Digital Currency
darksendconfig.cpp
Go to the documentation of this file.
1 #include "darksendconfig.h"
2 #include "ui_darksendconfig.h"
3 
4 #include "bitcoinunits.h"
5 #include "guiconstants.h"
6 #include "optionsmodel.h"
7 #include "privatesend-client.h"
8 #include "walletmodel.h"
9 
10 #include <QMessageBox>
11 #include <QPushButton>
12 #include <QKeyEvent>
13 #include <QSettings>
14 
16  QDialog(parent),
17  ui(new Ui::DarksendConfig),
18  model(0)
19 {
20  ui->setupUi(this);
21 
22  connect(ui->buttonBasic, SIGNAL(clicked()), this, SLOT(clickBasic()));
23  connect(ui->buttonHigh, SIGNAL(clicked()), this, SLOT(clickHigh()));
24  connect(ui->buttonMax, SIGNAL(clicked()), this, SLOT(clickMax()));
25 }
26 
28 {
29  delete ui;
30 }
31 
33 {
34  this->model = model;
35 }
36 
38 {
39  configure(true, 1000, 2);
40 
41  QString strAmount(BitcoinUnits::formatWithUnit(
42  model->getOptionsModel()->getDisplayUnit(), 1000 * COIN));
43  QMessageBox::information(this, tr("PrivateSend Configuration"),
44  tr(
45  "PrivateSend was successfully set to basic (%1 and 2 rounds). You can change this at any time by opening Dash's configuration screen."
46  ).arg(strAmount)
47  );
48 
49  close();
50 }
51 
53 {
54  configure(true, 1000, 8);
55 
56  QString strAmount(BitcoinUnits::formatWithUnit(
57  model->getOptionsModel()->getDisplayUnit(), 1000 * COIN));
58  QMessageBox::information(this, tr("PrivateSend Configuration"),
59  tr(
60  "PrivateSend was successfully set to high (%1 and 8 rounds). You can change this at any time by opening Dash's configuration screen."
61  ).arg(strAmount)
62  );
63 
64  close();
65 }
66 
68 {
69  configure(true, 1000, 16);
70 
71  QString strAmount(BitcoinUnits::formatWithUnit(
72  model->getOptionsModel()->getDisplayUnit(), 1000 * COIN));
73  QMessageBox::information(this, tr("PrivateSend Configuration"),
74  tr(
75  "PrivateSend was successfully set to maximum (%1 and 16 rounds). You can change this at any time by opening Dash's configuration screen."
76  ).arg(strAmount)
77  );
78 
79  close();
80 }
81 
82 void DarksendConfig::configure(bool enabled, int coins, int rounds) {
83 
84  QSettings settings;
85 
86  settings.setValue("nPrivateSendRounds", rounds);
87  settings.setValue("nPrivateSendAmount", coins);
88 
91 }
QPushButton * buttonHigh
WalletModel * model
static const CAmount COIN
Definition: amount.h:16
DarksendConfig(QWidget *parent=0)
static QString formatWithUnit(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
Format as string (with unit)
dictionary settings
void configure(bool enabled, int coins, int rounds)
QPushButton * buttonBasic
OptionsModel * getOptionsModel()
CPrivateSendClient privateSendClient
void setModel(WalletModel *model)
int getDisplayUnit()
Definition: optionsmodel.h:73
Ui::DarksendConfig * ui
QPushButton * buttonMax
void setupUi(QDialog *DarksendConfig)