update sendTab
This commit is contained in:
6
lib/Cargo.lock
generated
6
lib/Cargo.lock
generated
@@ -1051,7 +1051,7 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"silentdragonlitelib 0.1.0 (git+https://github.com/DenioD/silentdragonlite-cli?rev=127b8533cd3b20f454853f9da372215a72d469e7)",
|
"silentdragonlitelib 0.1.0 (git+https://github.com/DenioD/silentdragonlite-cli?rev=0b09f20990195a2a44bce871cd0bb293eaf38b33)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1467,7 +1467,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "silentdragonlitelib"
|
name = "silentdragonlitelib"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/DenioD/silentdragonlite-cli?rev=127b8533cd3b20f454853f9da372215a72d469e7#127b8533cd3b20f454853f9da372215a72d469e7"
|
source = "git+https://github.com/DenioD/silentdragonlite-cli?rev=0b09f20990195a2a44bce871cd0bb293eaf38b33#0b09f20990195a2a44bce871cd0bb293eaf38b33"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"bellman 0.1.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
"bellman 0.1.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
||||||
@@ -2481,7 +2481,7 @@ dependencies = [
|
|||||||
"checksum serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)" = "2f72eb2a68a7dc3f9a691bfda9305a1c017a6215e5a4545c258500d2099a37c2"
|
"checksum serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)" = "2f72eb2a68a7dc3f9a691bfda9305a1c017a6215e5a4545c258500d2099a37c2"
|
||||||
"checksum serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)" = "691b17f19fc1ec9d94ec0b5864859290dff279dbd7b03f017afda54eb36c3c35"
|
"checksum serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)" = "691b17f19fc1ec9d94ec0b5864859290dff279dbd7b03f017afda54eb36c3c35"
|
||||||
"checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d"
|
"checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d"
|
||||||
"checksum silentdragonlitelib 0.1.0 (git+https://github.com/DenioD/silentdragonlite-cli?rev=127b8533cd3b20f454853f9da372215a72d469e7)" = "<none>"
|
"checksum silentdragonlitelib 0.1.0 (git+https://github.com/DenioD/silentdragonlite-cli?rev=0b09f20990195a2a44bce871cd0bb293eaf38b33)" = "<none>"
|
||||||
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
||||||
"checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7"
|
"checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7"
|
||||||
"checksum sodiumoxide 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585232e78a4fc18133eef9946d3080befdf68b906c51b621531c37e91787fa2b"
|
"checksum sodiumoxide 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585232e78a4fc18133eef9946d3080befdf68b906c51b621531c37e91787fa2b"
|
||||||
|
|||||||
@@ -11,4 +11,4 @@ crate-type = ["staticlib"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
libc = "0.2.58"
|
libc = "0.2.58"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
silentdragonlitelib = { git = "https://github.com/DenioD/silentdragonlite-cli", rev = "127b8533cd3b20f454853f9da372215a72d469e7" }
|
silentdragonlitelib = { git = "https://github.com/DenioD/silentdragonlite-cli", rev = "0b09f20990195a2a44bce871cd0bb293eaf38b33" }
|
||||||
|
|||||||
@@ -144,8 +144,6 @@ void Controller::getInfoThenRefresh(bool force) {
|
|||||||
static bool prevCallSucceeded = false;
|
static bool prevCallSucceeded = false;
|
||||||
|
|
||||||
zrpc->fetchInfo([=] (const json& reply) {
|
zrpc->fetchInfo([=] (const json& reply) {
|
||||||
qDebug() << "Info updated";
|
|
||||||
|
|
||||||
prevCallSucceeded = true;
|
prevCallSucceeded = true;
|
||||||
|
|
||||||
// Testnet?
|
// Testnet?
|
||||||
@@ -159,11 +157,13 @@ void Controller::getInfoThenRefresh(bool force) {
|
|||||||
if (!Settings::getInstance()->isTestnet())
|
if (!Settings::getInstance()->isTestnet())
|
||||||
main->disableRecurring();
|
main->disableRecurring();
|
||||||
|
|
||||||
static int lastBlock = 0;
|
|
||||||
int curBlock = reply["latest_block_height"].get<json::number_integer_t>();
|
int curBlock = reply["latest_block_height"].get<json::number_integer_t>();
|
||||||
|
bool doUpdate = force || (model->getLatestBlock() != curBlock);
|
||||||
model->setLatestBlock(curBlock);
|
model->setLatestBlock(curBlock);
|
||||||
ui->blockHeight->setText(QString::number(curBlock));
|
ui->blockHeight->setText(QString::number(curBlock));
|
||||||
|
|
||||||
|
qDebug() << "Refreshing. Full update: " << doUpdate;
|
||||||
|
|
||||||
// Connected, so display checkmark.
|
// Connected, so display checkmark.
|
||||||
auto tooltip = Settings::getInstance()->getSettings().server + "\n" + QString::fromStdString(reply.dump());
|
auto tooltip = Settings::getInstance()->getSettings().server + "\n" + QString::fromStdString(reply.dump());
|
||||||
QIcon i(":/icons/res/connected.gif");
|
QIcon i(":/icons/res/connected.gif");
|
||||||
@@ -185,10 +185,8 @@ void Controller::getInfoThenRefresh(bool force) {
|
|||||||
// See if recurring payments needs anything
|
// See if recurring payments needs anything
|
||||||
Recurring::getInstance()->processPending(main);
|
Recurring::getInstance()->processPending(main);
|
||||||
|
|
||||||
if ( force || (curBlock != lastBlock) ) {
|
if ( doUpdate ) {
|
||||||
// Something changed, so refresh everything.
|
// Something changed, so refresh everything.
|
||||||
lastBlock = curBlock;
|
|
||||||
|
|
||||||
refreshBalances();
|
refreshBalances();
|
||||||
refreshAddresses(); // This calls refreshZSentTransactions() and refreshReceivedZTrans()
|
refreshAddresses(); // This calls refreshZSentTransactions() and refreshReceivedZTrans()
|
||||||
refreshTransactions();
|
refreshTransactions();
|
||||||
@@ -347,6 +345,16 @@ void Controller::refreshTransactions() {
|
|||||||
CAmount total_amount;
|
CAmount total_amount;
|
||||||
QList<TransactionItemDetail> items;
|
QList<TransactionItemDetail> items;
|
||||||
|
|
||||||
|
long confirmations;
|
||||||
|
if (it.find("unconfirmed") != it.end() && it["unconfirmed"].get<json::boolean_t>()) {
|
||||||
|
confirmations = 0;
|
||||||
|
} else {
|
||||||
|
confirmations = model->getLatestBlock() - it["block_height"].get<json::number_integer_t>() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto txid = QString::fromStdString(it["txid"]);
|
||||||
|
auto datetime = it["datetime"].get<json::number_integer_t>();
|
||||||
|
|
||||||
// First, check if there's outgoing metadata
|
// First, check if there's outgoing metadata
|
||||||
if (!it["outgoing_metadata"].is_null()) {
|
if (!it["outgoing_metadata"].is_null()) {
|
||||||
|
|
||||||
@@ -375,12 +383,7 @@ void Controller::refreshTransactions() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
txdata.push_back(TransactionItem{
|
txdata.push_back(TransactionItem{
|
||||||
"Sent",
|
"Sent", datetime, address, txid,confirmations, items
|
||||||
it["datetime"].get<json::number_integer_t>(),
|
|
||||||
address,
|
|
||||||
QString::fromStdString(it["txid"]),
|
|
||||||
model->getLatestBlock() - it["block_height"].get<json::number_integer_t>(),
|
|
||||||
items
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Incoming Transaction
|
// Incoming Transaction
|
||||||
@@ -400,12 +403,7 @@ void Controller::refreshTransactions() {
|
|||||||
|
|
||||||
|
|
||||||
TransactionItem tx{
|
TransactionItem tx{
|
||||||
"Receive",
|
"Receive", datetime, address, txid,confirmations, items
|
||||||
it["datetime"].get<json::number_integer_t>(),
|
|
||||||
address,
|
|
||||||
QString::fromStdString(it["txid"]),
|
|
||||||
model->getLatestBlock() - it["block_height"].get<json::number_integer_t>() + 1,
|
|
||||||
items
|
|
||||||
};
|
};
|
||||||
|
|
||||||
txdata.push_back(tx);
|
txdata.push_back(tx);
|
||||||
|
|||||||
@@ -179,13 +179,19 @@ void MainWindow::restoreSavedStates() {
|
|||||||
QSettings s;
|
QSettings s;
|
||||||
restoreGeometry(s.value("geometry").toByteArray());
|
restoreGeometry(s.value("geometry").toByteArray());
|
||||||
|
|
||||||
ui->balancesTable->horizontalHeader()->restoreState(s.value("baltablegeometry").toByteArray());
|
auto balance_geom = s.value("baltablegeom");
|
||||||
ui->transactionsTable->horizontalHeader()->restoreState(s.value("tratablegeometry").toByteArray());
|
if (balance_geom == QVariant()) {
|
||||||
|
ui->balancesTable->setColumnWidth(0, 500);
|
||||||
|
} else {
|
||||||
|
ui->balancesTable->horizontalHeader()->restoreState(balance_geom.toByteArray());
|
||||||
|
}
|
||||||
|
|
||||||
// Explicitly set the tx table resize headers, since some previous values may have made them
|
auto tx_geom = s.value("tratablegeom");
|
||||||
// non-expandable.
|
if (tx_geom == QVariant()) {
|
||||||
ui->transactionsTable->horizontalHeader()->setSectionResizeMode(3, QHeaderView::Interactive);
|
ui->transactionsTable->setColumnWidth(1, 500);
|
||||||
ui->transactionsTable->horizontalHeader()->setSectionResizeMode(4, QHeaderView::Interactive);
|
} else {
|
||||||
|
ui->transactionsTable->horizontalHeader()->restoreState(tx_geom.toByteArray());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::doClose() {
|
void MainWindow::doClose() {
|
||||||
@@ -196,8 +202,8 @@ void MainWindow::closeEvent(QCloseEvent* event) {
|
|||||||
QSettings s;
|
QSettings s;
|
||||||
|
|
||||||
s.setValue("geometry", saveGeometry());
|
s.setValue("geometry", saveGeometry());
|
||||||
s.setValue("baltablegeometry", ui->balancesTable->horizontalHeader()->saveState());
|
s.setValue("baltablegeom", ui->balancesTable->horizontalHeader()->saveState());
|
||||||
s.setValue("tratablegeometry", ui->transactionsTable->horizontalHeader()->saveState());
|
s.setValue("tratablegeom", ui->transactionsTable->horizontalHeader()->saveState());
|
||||||
|
|
||||||
s.sync();
|
s.sync();
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>1</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@@ -392,8 +392,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1226</width>
|
<width>1162</width>
|
||||||
<height>504</height>
|
<height>344</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="sendToLayout">
|
<layout class="QVBoxLayout" name="sendToLayout">
|
||||||
@@ -932,6 +932,9 @@
|
|||||||
<property name="selectionBehavior">
|
<property name="selectionBehavior">
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<attribute name="horizontalHeaderStretchLastSection">
|
||||||
|
<bool>true</bool>
|
||||||
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@@ -1085,7 +1088,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1274</width>
|
<width>1274</width>
|
||||||
<height>22</height>
|
<height>39</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuFile">
|
<widget class="QMenu" name="menuFile">
|
||||||
|
|||||||
@@ -489,8 +489,6 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
|
|||||||
confirm.setupUi(&d);
|
confirm.setupUi(&d);
|
||||||
Settings::saveRestore(&d);
|
Settings::saveRestore(&d);
|
||||||
|
|
||||||
const QFont fixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
|
||||||
|
|
||||||
// Remove all existing address/amt qlabels on the confirm dialog.
|
// Remove all existing address/amt qlabels on the confirm dialog.
|
||||||
int totalConfirmAddrItems = confirm.sendToAddrs->children().size();
|
int totalConfirmAddrItems = confirm.sendToAddrs->children().size();
|
||||||
for (int i = 0; i < totalConfirmAddrItems / 3; i++) {
|
for (int i = 0; i < totalConfirmAddrItems / 3; i++) {
|
||||||
@@ -526,7 +524,6 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
|
|||||||
Addr->setObjectName(QString("Addr") % QString::number(i + 1));
|
Addr->setObjectName(QString("Addr") % QString::number(i + 1));
|
||||||
Addr->setWordWrap(true);
|
Addr->setWordWrap(true);
|
||||||
Addr->setText(fnSplitAddressForWrap(toAddr.addr));
|
Addr->setText(fnSplitAddressForWrap(toAddr.addr));
|
||||||
Addr->setFont(fixedFont);
|
|
||||||
confirm.gridLayout->addWidget(Addr, row, 0, 1, 1);
|
confirm.gridLayout->addWidget(Addr, row, 0, 1, 1);
|
||||||
|
|
||||||
// Amount (hush)
|
// Amount (hush)
|
||||||
@@ -646,11 +643,36 @@ void MainWindow::sendButton() {
|
|||||||
// Then delete the additional fields from the sendTo tab
|
// Then delete the additional fields from the sendTo tab
|
||||||
clearSendForm();
|
clearSendForm();
|
||||||
|
|
||||||
|
// Create a new Dialog to show that we are computing/sending the Tx
|
||||||
|
auto d = new QDialog(this);
|
||||||
|
auto connD = new Ui_ConnectionDialog();
|
||||||
|
connD->setupUi(d);
|
||||||
|
QPixmap logo(":/img/res/logobig.gif");
|
||||||
|
connD->topIcon->setBasePixmap(logo.scaled(256, 256, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||||
|
|
||||||
|
connD->status->setText(tr("Please wait..."));
|
||||||
|
connD->statusDetail->setText(tr("Computing your transaction"));
|
||||||
|
|
||||||
|
d->show();
|
||||||
|
|
||||||
// And send the Tx
|
// And send the Tx
|
||||||
rpc->executeTransaction(tx,
|
rpc->executeTransaction(tx,
|
||||||
[=] (QString txid) {
|
[=] (QString txid) {
|
||||||
ui->statusBar->showMessage(Settings::txidStatusMessage + " " + txid);
|
ui->statusBar->showMessage(Settings::txidStatusMessage + " " + txid);
|
||||||
|
|
||||||
|
connD->status->setText(tr("Done!"));
|
||||||
|
connD->statusDetail->setText(txid);
|
||||||
|
|
||||||
|
QTimer::singleShot(1000, [=]() {
|
||||||
|
d->accept();
|
||||||
|
d->close();
|
||||||
|
delete connD;
|
||||||
|
delete d;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Force a UI update so we get the unconfirmed Tx
|
||||||
|
rpc->refresh(true);
|
||||||
|
|
||||||
// If this was a recurring payment, update the payment with the info
|
// If this was a recurring payment, update the payment with the info
|
||||||
if (!recurringPaymentHash.isEmpty()) {
|
if (!recurringPaymentHash.isEmpty()) {
|
||||||
// Since this is the send button payment, this is the first payment
|
// Since this is the send button payment, this is the first payment
|
||||||
@@ -662,6 +684,11 @@ void MainWindow::sendButton() {
|
|||||||
[=] (QString opid, QString errStr) {
|
[=] (QString opid, QString errStr) {
|
||||||
ui->statusBar->showMessage(QObject::tr(" Tx ") % opid % QObject::tr(" failed"), 15 * 1000);
|
ui->statusBar->showMessage(QObject::tr(" Tx ") % opid % QObject::tr(" failed"), 15 * 1000);
|
||||||
|
|
||||||
|
d->accept();
|
||||||
|
d->close();
|
||||||
|
delete connD;
|
||||||
|
delete d;
|
||||||
|
|
||||||
if (!opid.isEmpty())
|
if (!opid.isEmpty())
|
||||||
errStr = QObject::tr("The transaction with id ") % opid % QObject::tr(" failed. The error was") + ":\n\n" + errStr;
|
errStr = QObject::tr("The transaction with id ") % opid % QObject::tr(" failed. The error was") + ":\n\n" + errStr;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user