draft of basic config screen

This commit is contained in:
Evan Duffield 2014-08-26 10:20:00 -07:00
parent 7ae089a398
commit c850989772
5 changed files with 269 additions and 0 deletions

View File

@ -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

83
src/qt/darksendconfig.cpp Normal file
View File

@ -0,0 +1,83 @@
#include "darksendconfig.h"
#include "ui_darksendconfig.h"
#include "guiconstants.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->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);
}

38
src/qt/darksendconfig.h Normal file
View File

@ -0,0 +1,38 @@
#ifndef DARKSENDCONFIG_H
#define DARKSENDCONFIG_H
#include <QDialog>
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

View File

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DarksendConfig</class>
<widget class="QDialog" name="DarksendConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>627</width>
<height>354</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QPushButton" name="buttonNone">
<property name="geometry">
<rect>
<x>20</x>
<y>300</y>
<width>151</width>
<height>27</height>
</rect>
</property>
<property name="text">
<string>Disable Darksend+</string>
</property>
</widget>
<widget class="QPushButton" name="buttonBasic">
<property name="geometry">
<rect>
<x>20</x>
<y>70</y>
<width>151</width>
<height>27</height>
</rect>
</property>
<property name="text">
<string>Basic Anonymity</string>
</property>
</widget>
<widget class="QPushButton" name="buttonHigh">
<property name="geometry">
<rect>
<x>20</x>
<y>110</y>
<width>151</width>
<height>27</height>
</rect>
</property>
<property name="text">
<string>High Anonymity</string>
</property>
</widget>
<widget class="QPushButton" name="buttonMax">
<property name="geometry">
<rect>
<x>20</x>
<y>150</y>
<width>151</width>
<height>27</height>
</rect>
</property>
<property name="text">
<string>Maximum Anonymity</string>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>30</x>
<y>20</y>
<width>571</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Please select an anonymity level. </string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>190</x>
<y>70</y>
<width>421</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Use 2 separate masternodes to anonymize up to 1000DRK</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>190</x>
<y>110</y>
<width>411</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Use 4 separate masternodes to anonymize up to 1000DRK</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>190</x>
<y>150</y>
<width>421</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Use 8 separate masternodes</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>190</x>
<y>300</y>
<width>251</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Use pseudonymous transactions</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -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;