-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement GUI version of consolidateunspent
- Loading branch information
1 parent
c33982a
commit 6e0deab
Showing
9 changed files
with
440 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#include "consolidateunspentdialog.h" | ||
#include "ui_consolidateunspentdialog.h" | ||
|
||
#include "util.h" | ||
|
||
using namespace std; | ||
|
||
ConsolidateUnspentDialog::ConsolidateUnspentDialog(QWidget *parent) : | ||
QDialog(parent), | ||
ui(new Ui::ConsolidateUnspentDialog) | ||
{ | ||
ui->setupUi(this); | ||
|
||
ui->addressTableWidget->setSelectionMode(QAbstractItemView::SingleSelection); | ||
|
||
// ok button | ||
connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonBoxClicked(QAbstractButton*))); | ||
|
||
// destination address selection | ||
connect(ui->addressTableWidget, SIGNAL(itemSelectionChanged()), this, SLOT(addressSelectionChanged())); | ||
} | ||
|
||
ConsolidateUnspentDialog::~ConsolidateUnspentDialog() | ||
{ | ||
delete ui; | ||
} | ||
|
||
// --------------------------------------------------------- address - label | ||
void ConsolidateUnspentDialog::SetAddressList(const std::map<QString, QString>& addressList) | ||
{ | ||
ui->addressTableWidget->setSortingEnabled(false); | ||
|
||
int row = 0; | ||
for (const auto& iter : addressList) | ||
{ | ||
ui->addressTableWidget->insertRow(row); | ||
|
||
QTableWidgetItem* label = new QTableWidgetItem(iter.second); | ||
QTableWidgetItem* address = new QTableWidgetItem(iter.first); | ||
|
||
if (label != nullptr) ui->addressTableWidget->setItem(row, 0, label); | ||
if (address != nullptr) ui->addressTableWidget->setItem(row, 1, address); | ||
|
||
++row; | ||
} | ||
|
||
ui->addressTableWidget->setCurrentItem(ui->addressTableWidget->item(0, 1)); | ||
} | ||
|
||
void ConsolidateUnspentDialog::SetOutputWarningVisible(bool status) | ||
{ | ||
ui->outputLimitWarningIconLabel->setVisible(status); | ||
ui->outputLimitWarningLabel->setVisible(status); | ||
} | ||
|
||
// ok button | ||
void ConsolidateUnspentDialog::buttonBoxClicked(QAbstractButton* button) | ||
{ | ||
// closes the dialog | ||
if (ui->buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) done(QDialog::Accepted); | ||
|
||
emit selectedConsolidationAddressSignal(m_selectedDestinationAddress); | ||
} | ||
|
||
void ConsolidateUnspentDialog::addressSelectionChanged() | ||
{ | ||
int currentRow = ui->addressTableWidget->currentRow(); | ||
|
||
QTableWidgetItem* selectedLabel = ui->addressTableWidget->item(currentRow, 0); | ||
QTableWidgetItem* selectedAddress = ui->addressTableWidget->item(currentRow, 1); | ||
|
||
m_selectedDestinationAddress = std::make_pair(selectedLabel->text(), selectedAddress->text()); | ||
|
||
LogPrint(BCLog::LogFlags::MISC, "INFO: %s: Label %, Address %s selected.", __func__, | ||
m_selectedDestinationAddress.first.toStdString(), | ||
m_selectedDestinationAddress.second.toStdString()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#ifndef CONSOLIDATEUNSPENTDIALOG_H | ||
#define CONSOLIDATEUNSPENTDIALOG_H | ||
|
||
#include <QDialogButtonBox> | ||
#include <QDialog> | ||
#include <QList> | ||
#include <QSet> | ||
#include <QString> | ||
|
||
namespace Ui { | ||
class ConsolidateUnspentDialog; | ||
} | ||
|
||
class ConsolidateUnspentDialog : public QDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit ConsolidateUnspentDialog(QWidget *parent = 0); | ||
~ConsolidateUnspentDialog(); | ||
|
||
void SetAddressList(const std::map<QString, QString>& addressList); | ||
void SetOutputWarningVisible(bool status); | ||
|
||
signals: | ||
void selectedConsolidationAddressSignal(std::pair<QString, QString> address); | ||
|
||
private: | ||
Ui::ConsolidateUnspentDialog *ui; | ||
|
||
std::pair<QString, QString> m_selectedDestinationAddress; | ||
|
||
private slots: | ||
void buttonBoxClicked(QAbstractButton *button); | ||
void addressSelectionChanged(); | ||
}; | ||
|
||
#endif // CONSOLIDATEUNSPENTDIALOG_H |
Oops, something went wrong.