From c850989772e3694a8822072e8c4ee2732db6b73c Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Tue, 26 Aug 2014 10:20:00 -0700 Subject: [PATCH] draft of basic config screen --- bitcoin-qt.pro | 3 + src/qt/darksendconfig.cpp | 83 ++++++++++++++++++++ src/qt/darksendconfig.h | 38 +++++++++ src/qt/forms/darksendconfig.ui | 136 +++++++++++++++++++++++++++++++++ src/qt/overviewpage.cpp | 9 +++ 5 files changed, 269 insertions(+) create mode 100644 src/qt/darksendconfig.cpp create mode 100644 src/qt/darksendconfig.h create mode 100644 src/qt/forms/darksendconfig.ui diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro index 95577ccf5a..9656e221e3 100644 --- a/bitcoin-qt.pro +++ b/bitcoin-qt.pro @@ -207,6 +207,7 @@ HEADERS += src/qt/bitcoingui.h \ src/qt/bitcoinunits.h \ src/qt/qvaluecombobox.h \ src/qt/askpassphrasedialog.h \ + src/qt/darksendconfig.h \ src/protocol.h \ src/qt/notificator.h \ src/qt/paymentserver.h \ @@ -298,6 +299,7 @@ SOURCES += src/qt/bitcoin.cpp \ src/qt/bitcoinunits.cpp \ src/qt/qvaluecombobox.cpp \ src/qt/askpassphrasedialog.cpp \ + src/qt/darksendconfig.cpp \ src/protocol.cpp \ src/qt/notificator.cpp \ src/qt/paymentserver.cpp \ @@ -331,6 +333,7 @@ FORMS += src/qt/forms/sendcoinsdialog.ui \ src/qt/forms/overviewpage.ui \ src/qt/forms/sendcoinsentry.ui \ src/qt/forms/askpassphrasedialog.ui \ + src/qt/forms/darksendconfig.ui \ src/qt/forms/rpcconsole.ui \ src/qt/forms/optionsdialog.ui diff --git a/src/qt/darksendconfig.cpp b/src/qt/darksendconfig.cpp new file mode 100644 index 0000000000..a5df39db7d --- /dev/null +++ b/src/qt/darksendconfig.cpp @@ -0,0 +1,83 @@ +#include "darksendconfig.h" +#include "ui_darksendconfig.h" + +#include "guiconstants.h" +#include "walletmodel.h" + +#include +#include +#include +#include + +DarksendConfig::DarksendConfig(QWidget *parent) : + QDialog(parent), + ui(new Ui::DarksendConfig), + model(0) +{ + ui->setupUi(this); + + connect(ui->buttonNone, SIGNAL(clicked()), this, SLOT(clickNone())); + connect(ui->buttonBasic, SIGNAL(clicked()), this, SLOT(clickBasic())); + connect(ui->buttonHigh, SIGNAL(clicked()), this, SLOT(clickHigh())); + connect(ui->buttonMax, SIGNAL(clicked()), this, SLOT(clickMaximum())); +} + +DarksendConfig::~DarksendConfig() +{ + delete ui; +} + +void DarksendConfig::setModel(WalletModel *model) +{ + this->model = model; +} + +void DarksendConfig::clickNone() +{ + configure(false, 1000, 2); + + QMessageBox::information(this, tr("Darksend Configuration"), + tr("Darksend was successfully disabled. You can change this at any time by opening Darkcoin's configuration screen.")); + + close(); +} + +void DarksendConfig::clickBasic() +{ + configure(true, 1000, 2); + + QMessageBox::information(this, tr("Darksend Configuration"), + tr("Darksend was successfully set to basic (1000 DRK and 2 rounds). You can change this at any time by opening Darkcoin's configuration screen.")); + + close(); +} + +void DarksendConfig::clickHigh() +{ + configure(true, 1000, 4); + + QMessageBox::information(this, tr("Darksend Configuration"), + tr("Darksend was successfully set to high (1000 DRK and 4 rounds). You can change this at any time by opening Darkcoin's configuration screen.")); + + close(); +} + +void DarksendConfig::clickMax() +{ + configure(true, 1000, 8); + + QMessageBox::information(this, tr("Darksend Configuration"), + tr("Darksend was successfully set to maximum (1000 DRK and 8 rounds). You can change this at any time by opening Darkcoin's configuration screen.")); + + close(); +} + +void DarksendConfig::configure(bool enabled, int coins, int rounds) { + + QSettings settings; + + settings.setValue("fDisableDarksend", enabled); + settings.setValue("nDarksendRounds", rounds); + settings.setValue("nAnonymizeDarkcoinAmount", coins); + +} \ No newline at end of file diff --git a/src/qt/darksendconfig.h b/src/qt/darksendconfig.h new file mode 100644 index 0000000000..69720b4fb6 --- /dev/null +++ b/src/qt/darksendconfig.h @@ -0,0 +1,38 @@ +#ifndef DARKSENDCONFIG_H +#define DARKSENDCONFIG_H + +#include + +namespace Ui { + class DarksendConfig; +} +class WalletModel; + +/** Multifunctional dialog to ask for passphrases. Used for encryption, unlocking, and changing the passphrase. + */ +class DarksendConfig : public QDialog +{ + Q_OBJECT + +public: + + DarksendConfig(QWidget *parent = 0); + ~DarksendConfig(); + + void setModel(WalletModel *model); + + +private: + Ui::DarksendConfig *ui; + WalletModel *model; + void configure(bool enabled, int coins, int rounds); + +private slots: + + void clickNone(); + void clickBasic(); + void clickHigh(); + void clickMax(); +}; + +#endif // DARKSENDCONFIG_H diff --git a/src/qt/forms/darksendconfig.ui b/src/qt/forms/darksendconfig.ui new file mode 100644 index 0000000000..7aae269d25 --- /dev/null +++ b/src/qt/forms/darksendconfig.ui @@ -0,0 +1,136 @@ + + + DarksendConfig + + + + 0 + 0 + 627 + 354 + + + + Dialog + + + + + 20 + 300 + 151 + 27 + + + + Disable Darksend+ + + + + + + 20 + 70 + 151 + 27 + + + + Basic Anonymity + + + + + + 20 + 110 + 151 + 27 + + + + High Anonymity + + + + + + 20 + 150 + 151 + 27 + + + + Maximum Anonymity + + + + + + 30 + 20 + 571 + 31 + + + + Please select an anonymity level. + + + + + + 190 + 70 + 421 + 21 + + + + Use 2 separate masternodes to anonymize up to 1000DRK + + + + + + 190 + 110 + 411 + 21 + + + + Use 4 separate masternodes to anonymize up to 1000DRK + + + + + + 190 + 150 + 421 + 21 + + + + Use 8 separate masternodes + + + + + + 190 + 300 + 251 + 21 + + + + Use pseudonymous transactions + + + + + + diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 581d4e9e37..cd409d6d0d 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -5,6 +5,7 @@ #include "clientmodel.h" #include "walletmodel.h" #include "bitcoinunits.h" +#include "darksendconfig.h" #include "optionsmodel.h" #include "transactiontablemodel.h" #include "transactionfilterproxy.h" @@ -267,6 +268,14 @@ void OverviewPage::darkSendStatus() } } + /* show darksend configuration if client has defaults set */ + + DarksendConfig dlg(this); + dlg.setModel(walletModel); + dlg.exec(); + + /* *******************************************************/ + ui->darksendEnabled->setText("Enabled"); std::ostringstream convert;