Skip to content

Commit

Permalink
1.0.0.1 (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
MotoAcidic authored Aug 7, 2019
1 parent 7f6498e commit 7d4ec2b
Show file tree
Hide file tree
Showing 10 changed files with 366 additions and 36 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,7 @@ config.status
\.vs/Xavander-coin/v15/\.suo

\.vs/Xavander-coin/v15/ipch/AutoPCH/f3069f7e1af0cae9/CLIENTVERSION\.ipch

\.vs/Xavander-coin/v15/ipch/AutoPCH/fe03518b59430e57/RPCBLOCKCHAIN\.ipch

\.vs/Xavander-coin/v15/ipch/AutoPCH/c3af879c1645467/CLIENTVERSION\.ipch
2 changes: 1 addition & 1 deletion src/activemasternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ vector<COutput> CActiveMasternode::SelectCoinsMasternode()

// Filter
BOOST_FOREACH (const COutput& out, vCoins) {
if (out.tx->vout[out.i].nValue == Params().MasternodeCollateralAmt()*COIN) { //Was 5000 * COIN
if (out.tx->vout[out.i].nValue == Params().MasternodeCollateralAmt() * COIN) { //Was 5000 * COIN
//if (out.tx->vout[out.i].nValue == 10000 * COIN){
filteredCoins.push_back(out);
}
Expand Down
4 changes: 2 additions & 2 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ class CMainParams : public CChainParams
fHeadersFirstSyncingActive = false;

nPoolMaxTransactions = 3;
nEnforceNewSporkKey = 1561931967; //!> Sporks signed after 06/30/2019 @ 9:59pm (UTC)
nRejectOldSporkKey = 1562716800; //!> Fully reject old spork key after 07/10/2019 @ 12:00am (UTC)
nEnforceNewSporkKey = 1564971936; //!> Sporks signed after 08/05/2019 @ 2:25am (UTC)
nRejectOldSporkKey = 1566691200; //!> Fully reject old spork key after 08/25/2019 @ 12:00am (UTC)
strSporkKey = "0279d5e624dff289b3ef1f05d53a328a301f81db61d7da5e463fdd64c3dcda5c62";
strSporkKeyOld = "02085fb93df4c4bf6ac7b88452963d66b7a52b65ed801fdc58909d651fb2035e51";
strObfuscationPoolDummyAddress = "XCNAsFGy8k7amqRG26ikKyfVDwK8585Z6b";
Expand Down
217 changes: 215 additions & 2 deletions src/qt/coincontroldialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,27 @@ CoinControlDialog::CoinControlDialog(QWidget* parent, bool fMultisigEnabled) : Q
// Toggle lock state
connect(ui->pushButtonToggleLock, SIGNAL(clicked()), this, SLOT(buttonToggleLockClicked()));

//selection of first 50 inputs on button pressed
connect(ui->select_50, SIGNAL(clicked()), this, SLOT(select_50()));

//selection of first 100 inputs on button pressed
connect(ui->select_100, SIGNAL(clicked()), this, SLOT(select_100()));

//selection of first 250 inputs on button pressed
connect(ui->select_250, SIGNAL(clicked()), this, SLOT(select_250()));

//Make "advanced" features visible if check (advance check box)
connect(ui->advanced, SIGNAL(clicked(bool)), this, SLOT(toggled(bool)));

//selection of all inputs greater than what the user inputs into "num_box"
connect(ui->GreaterThan, SIGNAL(clicked()), this, SLOT(greater()));

//selection of all inputs less than what the user inputs into "num_box"
connect(ui->LessThan, SIGNAL(clicked()), this, SLOT(Less()));

//selection of all inputs equal to what the user inputs into "num_box"
connect(ui->EqualTo, SIGNAL(clicked()), this, SLOT(Equal()));

// change coin control first column label due Qt4 bug.
// see https://github.com/bitcoin/bitcoin/issues/5716
ui->treeWidget->headerItem()->setText(COLUMN_CHECKBOX, QString());
Expand All @@ -143,6 +164,14 @@ CoinControlDialog::CoinControlDialog(QWidget* parent, bool fMultisigEnabled) : Q
ui->treeWidget->setColumnHidden(COLUMN_AMOUNT_INT64, true); // store amount int64 in this column, but dont show it
ui->treeWidget->setColumnHidden(COLUMN_PRIORITY_INT64, true); // store priority int64 in this column, but dont show it
ui->treeWidget->setColumnHidden(COLUMN_DATE_INT64, true); // store date int64 in this column, but dont show it
ui->num_box->setRange(1, 9999); // set the range
ui->select_50->setVisible(false); // set the advanced features to hidden
ui->select_100->setVisible(false);
ui->select_250->setVisible(false);
ui->GreaterThan->setVisible(false);
ui->LessThan->setVisible(false);
ui->EqualTo->setVisible(false);
ui->num_box->setVisible(false);

// default view is sorted by amount desc
sortView(COLUMN_AMOUNT_INT64, Qt::DescendingOrder);
Expand Down Expand Up @@ -196,7 +225,7 @@ void CoinControlDialog::buttonBoxClicked(QAbstractButton* button)
// (un)select all
void CoinControlDialog::buttonSelectAllClicked()
{
Qt::CheckState state = Qt::Checked;
Qt::CheckState state = Qt::Checked;
for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) {
if (ui->treeWidget->topLevelItem(i)->checkState(COLUMN_CHECKBOX) != Qt::Unchecked) {
state = Qt::Unchecked;
Expand All @@ -214,6 +243,164 @@ void CoinControlDialog::buttonSelectAllClicked()
updateDialogLabels();
}

void CoinControlDialog::HideInputAutoSelection() //set the advanced features to hidden
{
ui->select_50->setVisible(false);
ui->select_100->setVisible(false);
ui->select_250->setVisible(false);
ui->GreaterThan->setVisible(false);
ui->LessThan->setVisible(false);
ui->EqualTo->setVisible(false);
ui->num_box->setVisible(false);
}

void CoinControlDialog::ShowInputAutoSelection() // set the advanced features to shown
{
ui->select_50->setVisible(true);
ui->select_100->setVisible(true);
ui->select_250->setVisible(true);
ui->GreaterThan->setVisible(true);
ui->LessThan->setVisible(true);
ui->EqualTo->setVisible(true);
ui->num_box->setVisible(true);
}


void CoinControlDialog::greater()// select all inputs grater than "amount"
{
int val = ui->num_box->value();
Qt::CheckState state = Qt::Checked;
ui->treeWidget->setEnabled(true);
for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) {
QTreeWidgetItem* item = ui->treeWidget->topLevelItem(i);
double value = item->text(COLUMN_AMOUNT).toDouble();
if (value > val) {
if (ui->treeWidget->topLevelItem(i)->checkState(COLUMN_CHECKBOX) != state)
ui->treeWidget->topLevelItem(i)->setCheckState(COLUMN_CHECKBOX, state);
ui->treeWidget->setEnabled(true);
if (state == Qt::Unchecked)
coinControl->UnSelectAll();
ui->treeWidget->setEnabled(true);
CoinControlDialog::updateLabels(model, this);
updateDialogLabels();
}
}
}

void CoinControlDialog::Less()//select all inputs Less than "amount"
{
int val = ui->num_box->value();
Qt::CheckState state = Qt::Checked;
ui->treeWidget->setEnabled(true);
for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) {
QTreeWidgetItem* item = ui->treeWidget->topLevelItem(i);
double value = item->text(COLUMN_AMOUNT).toDouble();
if (value < val) {
if (ui->treeWidget->topLevelItem(i)->checkState(COLUMN_CHECKBOX) != state)
ui->treeWidget->topLevelItem(i)->setCheckState(COLUMN_CHECKBOX, state);
ui->treeWidget->setEnabled(true);
if (state == Qt::Unchecked)
coinControl->UnSelectAll();
ui->treeWidget->setEnabled(true);
CoinControlDialog::updateLabels(model, this);
updateDialogLabels();
}
}
}


void CoinControlDialog::Equal() // select all inputs equal to "amount"
{
double round;
double val = ui->num_box->value();
Qt::CheckState state = Qt::Checked;
ui->treeWidget->setEnabled(true);
for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) {
QTreeWidgetItem* item = ui->treeWidget->topLevelItem(i);
double value = item->text(COLUMN_AMOUNT).toDouble();
int log = 0;
adjusted:
if (val > value){round = val - value; log++;}//since we can't compare "value" and "val" directly we minus the 2 and get the difference
if (val < value){round = value - val; log++;}
if (log == 0) { val = val +0.001; log++; goto adjusted; } // in the event that the input and "val" are equal add a small amount and go through the sorting process again
if (round < 0.01) { // if are input and "val" are within 0.01 of each other
if (ui->treeWidget->topLevelItem(i)->checkState(COLUMN_CHECKBOX) != state)
ui->treeWidget->topLevelItem(i)->setCheckState(COLUMN_CHECKBOX, state);
ui->treeWidget->setEnabled(true);
if (state == Qt::Unchecked)
coinControl->UnSelectAll();
CoinControlDialog::updateLabels(model, this);
updateDialogLabels();
}
}
}

void CoinControlDialog::select_50() //select the first 50 inputs
{
if (ui->treeWidget->topLevelItemCount() > 49){ //check we have more then 50 inputs
Qt::CheckState state = Qt::Checked;
ui->treeWidget->setEnabled(false);
for (int i = 0; i < 50; i++)
if (ui->treeWidget->topLevelItem(i)->checkState(COLUMN_CHECKBOX) != state)
ui->treeWidget->topLevelItem(i)->setCheckState(COLUMN_CHECKBOX, state);
ui->treeWidget->setEnabled(true);
if (state == Qt::Unchecked)
coinControl->UnSelectAll(); // just to be sure
CoinControlDialog::updateLabels(model, this);
updateDialogLabels();
}else{ //if we have less then 50 inputs give the user dialogue to inform them of this issue
QMessageBox msgBox;
msgBox.setObjectName("lockMessageBox");
msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
msgBox.setText(tr("Please have at least 50 inputs to use this function."));
msgBox.exec();
}
}

void CoinControlDialog::select_100() //select the first 100 inputs
{
if (ui->treeWidget->topLevelItemCount() > 99){ //check we have more then 100 inputs
Qt::CheckState state = Qt::Checked;
ui->treeWidget->setEnabled(false);
for (int i = 0; i < 100; i++)
if (ui->treeWidget->topLevelItem(i)->checkState(COLUMN_CHECKBOX) != state)
ui->treeWidget->topLevelItem(i)->setCheckState(COLUMN_CHECKBOX, state);
ui->treeWidget->setEnabled(true);
if (state == Qt::Unchecked)
coinControl->UnSelectAll(); // just to be sure
CoinControlDialog::updateLabels(model, this);
updateDialogLabels();
}else{ //if we have less then 100 inputs give the user dialogue to inform them of this issue
QMessageBox msgBox;
msgBox.setObjectName("lockMessageBox");
msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
msgBox.setText(tr("Please have at least 100 inputs to use this function."));
msgBox.exec();
}
}

void CoinControlDialog::select_250() //select the first 250 inputs
{
if (ui->treeWidget->topLevelItemCount() > 249){ //check we have more then 250 inputs
Qt::CheckState state = Qt::Checked;
ui->treeWidget->setEnabled(false);
for (int i = 0; i < 250; i++)
if (ui->treeWidget->topLevelItem(i)->checkState(COLUMN_CHECKBOX) != state)
ui->treeWidget->topLevelItem(i)->setCheckState(COLUMN_CHECKBOX, state);
ui->treeWidget->setEnabled(true);
if (state == Qt::Unchecked)
coinControl->UnSelectAll(); // just to be sure
CoinControlDialog::updateLabels(model, this);
updateDialogLabels();
}else{ //if we have less then 250 inputs give the user dialogue to inform them of this issue
QMessageBox msgBox;
msgBox.setObjectName("lockMessageBox");
msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
msgBox.setText(tr("Please have at least 250 inputs to use this function."));
msgBox.exec();
}
}

// Toggle lock state
void CoinControlDialog::buttonToggleLockClicked()
{
Expand Down Expand Up @@ -414,17 +601,43 @@ void CoinControlDialog::headerSectionClicked(int logicalIndex)
// toggle tree mode
void CoinControlDialog::radioTreeMode(bool checked)
{
HideInputAutoSelection();
if (checked && model)
updateView();
}

// toggle list mode
void CoinControlDialog::radioListMode(bool checked)
{
if (ui->advanced->checkState()){
ShowInputAutoSelection();
}else{
HideInputAutoSelection();
}
if (checked && model)
updateView();
}

//toggle advaced features
void CoinControlDialog::toggled(bool checked)
{
if (ui->radioListMode->isChecked()){
if (ui->advanced->checkState()){
ShowInputAutoSelection();
}else{
HideInputAutoSelection();
}
if (checked && model)
updateView();
}else{ // if not in lsit mode
QMessageBox msgBox;
msgBox.setObjectName("lockMessageBox");
msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
msgBox.setText(tr("Please switch to \"List mode\" to use this function."));
msgBox.exec();
}
}

// checkbox clicked by user
void CoinControlDialog::viewItemChanged(QTreeWidgetItem* item, int column)
{
Expand Down Expand Up @@ -903,4 +1116,4 @@ void CoinControlDialog::updateView()
// sort view
sortView(sortColumn, sortOrder);
ui->treeWidget->setEnabled(true);
}
}
13 changes: 10 additions & 3 deletions src/qt/coincontroldialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <QPoint>
#include <QString>
#include <QTreeWidgetItem>

class WalletModel;

class MultisigDialog;
Expand Down Expand Up @@ -52,7 +51,6 @@ class CoinControlDialog : public QDialog
int sortColumn;
Qt::SortOrder sortOrder;
bool fMultisigEnabled;

QMenu* contextMenu;
QTreeWidgetItem* contextMenuItem;
QAction* copyTransactionHashAction;
Expand Down Expand Up @@ -119,12 +117,21 @@ private slots:
void clipboardChange();
void radioTreeMode(bool);
void radioListMode(bool);
void toggled(bool);
void viewItemChanged(QTreeWidgetItem*, int);
void headerSectionClicked(int);
void buttonBoxClicked(QAbstractButton*);
void buttonSelectAllClicked();
void HideInputAutoSelection();
void ShowInputAutoSelection();
void greater();
void Less();
void Equal();
void select_50();
void select_100();
void select_250();
void buttonToggleLockClicked();
void updateLabelLocked();
};

#endif // BITCOIN_QT_COINCONTROLDIALOG_H
#endif // BITCOIN_QT_COINCONTROLDIALOG_H
Loading

0 comments on commit 7d4ec2b

Please sign in to comment.