Remove "from" fields
This commit is contained in:
@@ -43,6 +43,10 @@ public:
|
||||
return this->amount < other.amount;
|
||||
}
|
||||
|
||||
bool operator< (const qint64& other) const {
|
||||
return this->amount < other;
|
||||
}
|
||||
|
||||
bool operator> (const CAmount& other) const {
|
||||
return this->amount > other.amount;
|
||||
}
|
||||
|
||||
@@ -127,9 +127,6 @@ void Controller::noConnection() {
|
||||
ui->balSheilded->setToolTip("");
|
||||
ui->balTransparent->setToolTip("");
|
||||
ui->balTotal->setToolTip("");
|
||||
|
||||
// Clear send tab from address
|
||||
ui->inputsCombo->clear();
|
||||
}
|
||||
|
||||
/// This will refresh all the balance data from zcashd
|
||||
@@ -243,9 +240,6 @@ void Controller::updateUI(bool anyUnconfirmed) {
|
||||
|
||||
// Update balances model data, which will update the table too
|
||||
balancesTableModel->setNewData(model->getAllZAddresses(), model->getAllTAddresses(), model->getAllBalances(), model->getUTXOs());
|
||||
|
||||
// Update from address
|
||||
main->updateFromCombo();
|
||||
};
|
||||
|
||||
// Function to process reply of the listunspent and z_listunspent API calls, used below.
|
||||
@@ -280,19 +274,33 @@ void Controller::refreshBalances() {
|
||||
|
||||
// 1. Get the Balances
|
||||
zrpc->fetchBalance([=] (json reply) {
|
||||
CAmount balT = CAmount::fromqint64(reply["tbalance"].get<json::number_unsigned_t>());
|
||||
CAmount balZ = CAmount::fromqint64(reply["zbalance"].get<json::number_unsigned_t>());
|
||||
CAmount balTotal = balT + balZ;
|
||||
CAmount balT = CAmount::fromqint64(reply["tbalance"].get<json::number_unsigned_t>());
|
||||
CAmount balZ = CAmount::fromqint64(reply["zbalance"].get<json::number_unsigned_t>());
|
||||
CAmount balVerified = CAmount::fromqint64(reply["verified_zbalance"].get<json::number_unsigned_t>());
|
||||
|
||||
CAmount balTotal = balT + balZ;
|
||||
CAmount balAvailable = balT + balVerified;
|
||||
|
||||
// This is for the websockets
|
||||
AppDataModel::getInstance()->setBalances(balT, balZ);
|
||||
|
||||
// This is for the datamodel
|
||||
model->setAvailableBalance(balAvailable);
|
||||
|
||||
// Balances table
|
||||
ui->balSheilded ->setText(balZ.toDecimalZECString());
|
||||
ui->balVerified ->setText(balVerified.toDecimalZECString());
|
||||
ui->balTransparent->setText(balT.toDecimalZECString());
|
||||
ui->balTotal ->setText(balTotal.toDecimalZECString());
|
||||
|
||||
ui->balSheilded ->setToolTip(balZ.toDecimalZECUSDString());
|
||||
ui->balTransparent->setToolTip(balT.toDecimalZECUSDString());
|
||||
ui->balTotal ->setToolTip(balTotal.toDecimalZECUSDString());
|
||||
ui->balSheilded ->setToolTip(balZ.toDecimalUSDString());
|
||||
ui->balVerified ->setToolTip(balVerified.toDecimalUSDString());
|
||||
ui->balTransparent->setToolTip(balT.toDecimalUSDString());
|
||||
ui->balTotal ->setToolTip(balTotal.toDecimalUSDString());
|
||||
|
||||
// Send tab
|
||||
ui->txtAvailableZEC->setText(balAvailable.toDecimalZECString());
|
||||
ui->txtAvailableUSD->setText(balAvailable.toDecimalUSDString());
|
||||
});
|
||||
|
||||
// 2. Get the UTXOs
|
||||
|
||||
@@ -33,7 +33,9 @@ public:
|
||||
const QList<UnspentOutput> getUTXOs() { QReadLocker locker(lock); return *utxos; }
|
||||
const QMap<QString, CAmount> getAllBalances() { QReadLocker locker(lock); return *balances; }
|
||||
const QMap<QString, bool> getUsedAddresses() { QReadLocker locker(lock); return *usedAddresses; }
|
||||
|
||||
|
||||
CAmount getAvailableBalance() { return availableBalance; }
|
||||
void setAvailableBalance(CAmount a) { this->availableBalance = a; }
|
||||
|
||||
DataModel();
|
||||
~DataModel();
|
||||
@@ -46,6 +48,8 @@ private:
|
||||
QList<QString>* zaddresses = nullptr;
|
||||
QList<QString>* taddresses = nullptr;
|
||||
|
||||
CAmount availableBalance;
|
||||
|
||||
QReadWriteLock* lock;
|
||||
|
||||
};
|
||||
|
||||
@@ -430,10 +430,6 @@ void MainWindow::payZcashURI(QString uri, QString myAddr) {
|
||||
// Now, set the fields on the send tab
|
||||
clearSendForm();
|
||||
|
||||
if (!myAddr.isEmpty()) {
|
||||
ui->inputsCombo->setCurrentText(myAddr);
|
||||
}
|
||||
|
||||
ui->Address1->setText(paymentInfo.addr);
|
||||
ui->Address1->setCursorPosition(0);
|
||||
ui->Amount1->setText(paymentInfo.amt);
|
||||
@@ -631,40 +627,6 @@ void MainWindow::setupBalancesTab() {
|
||||
ui->lblSyncWarning->setVisible(false);
|
||||
ui->lblSyncWarningReceive->setVisible(false);
|
||||
|
||||
// Double click on balances table
|
||||
auto fnDoSendFrom = [=](const QString& addr, const QString& to = QString(), bool sendMax = false) {
|
||||
// Find the inputs combo
|
||||
for (int i = 0; i < ui->inputsCombo->count(); i++) {
|
||||
auto inputComboAddress = ui->inputsCombo->itemText(i);
|
||||
if (inputComboAddress.startsWith(addr)) {
|
||||
ui->inputsCombo->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If there's a to address, add that as well
|
||||
if (!to.isEmpty()) {
|
||||
// Remember to clear any existing address fields, because we are creating a new transaction.
|
||||
this->clearSendForm();
|
||||
ui->Address1->setText(to);
|
||||
}
|
||||
|
||||
// See if max button has to be checked
|
||||
if (sendMax) {
|
||||
ui->Max1->setChecked(true);
|
||||
}
|
||||
|
||||
// And switch to the send tab.
|
||||
ui->tabWidget->setCurrentIndex(1);
|
||||
};
|
||||
|
||||
// Double click opens up memo if one exists
|
||||
QObject::connect(ui->balancesTable, &QTableView::doubleClicked, [=](auto index) {
|
||||
index = index.sibling(index.row(), 0);
|
||||
auto addr = AddressBook::addressFromAddressLabel(ui->balancesTable->model()->data(index).toString());
|
||||
|
||||
fnDoSendFrom(addr);
|
||||
});
|
||||
|
||||
// Setup context menu on balances tab
|
||||
ui->balancesTable->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
@@ -688,18 +650,8 @@ void MainWindow::setupBalancesTab() {
|
||||
this->exportKeys(addr);
|
||||
});
|
||||
|
||||
menu.addAction("Send from " % addr.left(40) % (addr.size() > 40 ? "..." : ""), [=]() {
|
||||
fnDoSendFrom(addr);
|
||||
});
|
||||
|
||||
if (Settings::isTAddress(addr)) {
|
||||
auto defaultSapling = rpc->getDefaultSaplingAddress();
|
||||
if (!defaultSapling.isEmpty()) {
|
||||
menu.addAction(tr("Shield balance to Sapling"), [=] () {
|
||||
fnDoSendFrom(addr, defaultSapling, true);
|
||||
});
|
||||
}
|
||||
|
||||
menu.addAction(tr("View on block explorer"), [=] () {
|
||||
Settings::openAddressInExplorer(addr);
|
||||
});
|
||||
@@ -1118,9 +1070,6 @@ void MainWindow::updateLabels() {
|
||||
addZAddrsToComboList(ui->rdioZSAddr->isChecked())(true);
|
||||
}
|
||||
|
||||
// Update the Send Tab
|
||||
updateFromCombo();
|
||||
|
||||
// Update the autocomplete
|
||||
updateLabelsAutoComplete();
|
||||
}
|
||||
|
||||
@@ -47,7 +47,6 @@ public:
|
||||
QRegExpValidator* getAmountValidator() { return amtValidator; }
|
||||
|
||||
QString doSendTxValidations(Tx tx);
|
||||
void setDefaultPayFrom();
|
||||
|
||||
void replaceWormholeClient(WormholeClient* newClient);
|
||||
bool isWebsocketListening();
|
||||
@@ -59,7 +58,6 @@ public:
|
||||
|
||||
void updateLabels();
|
||||
void updateTAddrCombo(bool checked);
|
||||
void updateFromCombo();
|
||||
|
||||
// Disable recurring on mainnet
|
||||
void disableRecurring();
|
||||
@@ -100,7 +98,6 @@ private:
|
||||
|
||||
void cancelButton();
|
||||
void sendButton();
|
||||
void inputComboTextChanged(int index);
|
||||
void addAddressSection();
|
||||
void maxAmountChecked(int checked);
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
@@ -75,6 +75,37 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_17">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Verified</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="balVerified">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
@@ -270,60 +301,59 @@
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="AddressCombo" name="inputsCombo"/>
|
||||
</item>
|
||||
</layout>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_15">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Address Balance</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="sendAddressBalance">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="sendAddressBalanceUSD">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Total verified funds available:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="txtAvailableZEC">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="txtAvailableUSD">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@@ -362,8 +392,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1162</width>
|
||||
<height>344</height>
|
||||
<width>1226</width>
|
||||
<height>504</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="sendToLayout">
|
||||
@@ -1055,7 +1085,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1274</width>
|
||||
<height>39</height>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
@@ -1201,7 +1231,6 @@
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>tabWidget</tabstop>
|
||||
<tabstop>inputsCombo</tabstop>
|
||||
<tabstop>Address1</tabstop>
|
||||
<tabstop>Amount1</tabstop>
|
||||
<tabstop>Max1</tabstop>
|
||||
@@ -1220,7 +1249,6 @@
|
||||
<tabstop>transactionsTable</tabstop>
|
||||
<tabstop>balancesTable</tabstop>
|
||||
<tabstop>minerFeeAmt</tabstop>
|
||||
<tabstop>sendAddressBalance</tabstop>
|
||||
<tabstop>sendToScrollArea</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
|
||||
@@ -22,10 +22,6 @@ void MainWindow::setupSendTab() {
|
||||
// Cancel Button
|
||||
QObject::connect(ui->cancelSendButton, &QPushButton::clicked, this, &MainWindow::cancelButton);
|
||||
|
||||
// Input Combobox current text changed
|
||||
QObject::connect(ui->inputsCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &MainWindow::inputComboTextChanged);
|
||||
|
||||
// Hook up add address button click
|
||||
QObject::connect(ui->addAddressButton, &QPushButton::clicked, this, &MainWindow::addAddressSection);
|
||||
|
||||
@@ -168,18 +164,6 @@ void MainWindow::updateLabelsAutoComplete() {
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::setDefaultPayFrom() {
|
||||
|
||||
};
|
||||
|
||||
void MainWindow::updateFromCombo() {
|
||||
// delete
|
||||
}
|
||||
|
||||
void MainWindow::inputComboTextChanged(int) {
|
||||
// delete
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::addAddressSection() {
|
||||
int itemNumber = ui->sendToWidgets->children().size() - 1;
|
||||
@@ -336,12 +320,9 @@ void MainWindow::memoButtonClicked(int number, bool includeReplyTo) {
|
||||
memoDialog.memoTxt->setAcceptButton(memoDialog.buttonBox->button(QDialogButtonBox::Ok));
|
||||
|
||||
auto fnAddReplyTo = [=, &dialog]() {
|
||||
QString replyTo = ui->inputsCombo->currentText();
|
||||
if (!Settings::isZAddress(replyTo)) {
|
||||
replyTo = rpc->getDefaultSaplingAddress();
|
||||
if (replyTo.isEmpty())
|
||||
return;
|
||||
}
|
||||
auto replyTo = rpc->getDefaultSaplingAddress();
|
||||
if (replyTo.isEmpty())
|
||||
return;
|
||||
|
||||
memoDialog.memoTxt->includeReplyTo(replyTo);
|
||||
|
||||
@@ -424,10 +405,8 @@ void MainWindow::maxAmountChecked(int checked) {
|
||||
|
||||
sumAllAmounts = sumAllAmounts + Settings::getMinerFee();
|
||||
|
||||
auto addr = ui->inputsCombo->currentText();
|
||||
|
||||
auto maxamount = rpc->getModel()->getAllBalances().value(addr) - sumAllAmounts;
|
||||
maxamount = (maxamount.toqint64() < 0) ? CAmount::fromqint64(0) : maxamount;
|
||||
auto maxamount = rpc->getModel()->getAvailableBalance() - sumAllAmounts;
|
||||
maxamount = (maxamount < 0) ? CAmount::fromqint64(0): maxamount;
|
||||
|
||||
ui->Amount1->setText(maxamount.toDecimalString());
|
||||
} else if (checked == Qt::Unchecked) {
|
||||
@@ -440,9 +419,6 @@ void MainWindow::maxAmountChecked(int checked) {
|
||||
Tx MainWindow::createTxFromSendPage() {
|
||||
Tx tx;
|
||||
|
||||
// Gather the from / to addresses
|
||||
tx.fromAddr = ui->inputsCombo->currentText();
|
||||
|
||||
// For each addr/amt in the sendTo tab
|
||||
int totalItems = ui->sendToWidgets->children().size() - 2; // The last one is a spacer, so ignore that
|
||||
CAmount totalAmt;
|
||||
|
||||
Reference in New Issue
Block a user