Fix flicker issues on the balances and transactions tables
This commit is contained in:
parent
e99c75b54a
commit
1c282000c8
|
@ -1,5 +1,10 @@
|
|||
<RCC>
|
||||
<qresource prefix="/fonts">
|
||||
<file>Ubuntu-R.ttf</file>
|
||||
<file>res/Ubuntu-R.ttf</file>
|
||||
</qresource>
|
||||
<qresource prefix="/icons">
|
||||
<file>res/connected.png</file>
|
||||
<file>res/loading.gif</file>
|
||||
</qresource>
|
||||
|
||||
</RCC>
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 9.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 802 B |
38
src/about.ui
38
src/about.ui
|
@ -14,6 +14,22 @@
|
|||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>zcash-qt-wallet</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="versionLabel">
|
||||
<property name="text">
|
||||
<string>Version</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textEdit">
|
||||
<property name="readOnly">
|
||||
|
@ -23,17 +39,17 @@
|
|||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Copyright (c) 2018 Aditya Kulkarni. (MIT License)</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Special thanks to:</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">JSON for Modern C++ : <a href="https://nlohmann.github.io/json/"><span style=" text-decoration: underline; color:#007af4;">https://nlohmann.github.io/json/</span></a></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">QR Code generator library Nayuki : <a href="https://www.nayuki.io/page/qr-code-generator-library"><span style=" text-decoration: underline; color:#007af4;">https://www.nayuki.io/page/qr-code-ge…</span></a></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Made with QT : <a href="https://www.qt.io/"><span style=" text-decoration: underline; color:#007af4;">https://www.qt.io/</span></a></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">LICENSE:</p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &quot;Software&quot;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p>
|
||||
<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</li>
|
||||
<li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The Software is provided &quot;as is&quot;, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the Software or the use or other dealings in the Software.</li></ul></body></html></string>
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.1pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Copyright (c) 2018 Aditya Kulkarni. (MIT License)</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Special thanks to:</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">JSON for Modern C++ : </span><a href="https://nlohmann.github.io/json/"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#007af4;">https://nlohmann.github.io/json/</span></a></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">QR Code generator library Nayuki : </span><a href="https://www.nayuki.io/page/qr-code-generator-library"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#007af4;">https://www.nayuki.io/page/qr-code-ge…</span></a></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Made with QT : </span><a href="https://www.qt.io/"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#007af4;">https://www.qt.io/</span></a></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">LICENSE:</span></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &quot;Software&quot;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</span></p>
|
||||
<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'Ubuntu'; font-size:11pt;" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</li>
|
||||
<li style=" font-family:'Ubuntu'; font-size:11pt;" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The Software is provided &quot;as is&quot;, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the Software or the use or other dealings in the Software.</li></ul></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -1,21 +1,29 @@
|
|||
#include "balancestablemodel.h"
|
||||
|
||||
BalancesTableModel::BalancesTableModel(
|
||||
QObject *parent,
|
||||
const QMap<QString, double>* balances,
|
||||
const QList<UnspentOutput>* outputs)
|
||||
BalancesTableModel::BalancesTableModel(QObject *parent)
|
||||
: QAbstractTableModel(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void BalancesTableModel::setNewData(const QMap<QString, double>* balances,
|
||||
const QList<UnspentOutput>* outputs)
|
||||
{
|
||||
// Copy over the utxos for our use
|
||||
delete utxos;
|
||||
utxos = new QList<UnspentOutput>();
|
||||
// This is a QList deep copy.
|
||||
*utxos = *outputs;
|
||||
|
||||
// Process the address balances into a list
|
||||
delete modeldata;
|
||||
modeldata = new QList<std::tuple<QString, QString>>();
|
||||
std::for_each(balances->constKeyValueBegin(), balances->constKeyValueEnd(), [=] (auto it) {
|
||||
modeldata->push_back(std::make_tuple(it.first, QString::number(it.second, 'f')));
|
||||
});
|
||||
|
||||
// And then update the data
|
||||
dataChanged(index(0, 0), index(modeldata->size()-1, columnCount(index(0,0))-1));
|
||||
layoutChanged();
|
||||
}
|
||||
|
||||
BalancesTableModel::~BalancesTableModel() {
|
||||
|
@ -25,6 +33,7 @@ BalancesTableModel::~BalancesTableModel() {
|
|||
|
||||
int BalancesTableModel::rowCount(const QModelIndex&) const
|
||||
{
|
||||
if (modeldata == nullptr) return 0;
|
||||
return modeldata->size();
|
||||
}
|
||||
|
||||
|
@ -36,6 +45,14 @@ int BalancesTableModel::columnCount(const QModelIndex&) const
|
|||
|
||||
QVariant BalancesTableModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
auto fnSplitAddressForWrap = [=] (const QString& a) -> QString {
|
||||
if (!a.startsWith("z")) return a;
|
||||
|
||||
auto half = a.length() / 2;
|
||||
auto splitted = a.left(half) + "\n" + a.right(a.length() - half);
|
||||
return splitted;
|
||||
};
|
||||
|
||||
if (role == Qt::TextAlignmentRole && index.column() == 1) return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||
|
||||
if (role == Qt::ForegroundRole) {
|
||||
|
@ -57,7 +74,7 @@ QVariant BalancesTableModel::data(const QModelIndex &index, int role) const
|
|||
|
||||
if (role == Qt::DisplayRole || role == Qt::ToolTipRole) {
|
||||
switch (index.column()) {
|
||||
case 0: return std::get<0>(modeldata->at(index.row()));
|
||||
case 0: return fnSplitAddressForWrap(std::get<0>(modeldata->at(index.row())));
|
||||
case 1: return QVariant(std::get<1>(modeldata->at(index.row())) % " ZEC");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,17 +8,19 @@
|
|||
class BalancesTableModel : public QAbstractTableModel
|
||||
{
|
||||
public:
|
||||
BalancesTableModel(QObject* parent, const QMap<QString, double>* balances, const QList<UnspentOutput>* outputs);
|
||||
BalancesTableModel(QObject* parent);
|
||||
~BalancesTableModel();
|
||||
|
||||
void setNewData(const QMap<QString, double>* balances, const QList<UnspentOutput>* outputs);
|
||||
|
||||
int rowCount(const QModelIndex &parent) const;
|
||||
int columnCount(const QModelIndex &parent) const;
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
|
||||
private:
|
||||
QList<std::tuple<QString, QString>>* modeldata;
|
||||
QList<UnspentOutput>* utxos;
|
||||
QList<std::tuple<QString, QString>>* modeldata = nullptr;
|
||||
QList<UnspentOutput>* utxos = nullptr;
|
||||
};
|
||||
|
||||
#endif // BALANCESTABLEMODEL_H
|
|
@ -12,7 +12,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
QApplication a(argc, argv);
|
||||
#ifdef Q_OS_LINUX
|
||||
QFontDatabase::addApplicationFont(":/fonts/Ubuntu-R.ttf");
|
||||
QFontDatabase::addApplicationFont(":/fonts/res/Ubuntu-R.ttf");
|
||||
qApp->setFont(QFont("Ubuntu", 11, QFont::Normal, false));
|
||||
#endif
|
||||
|
||||
|
|
|
@ -21,8 +21,19 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
settings = new Settings();
|
||||
|
||||
// Status Bar
|
||||
loadingLabel = new QLabel();
|
||||
loadingMovie = new QMovie(":/icons/res/loading.gif");
|
||||
loadingMovie->setScaledSize(QSize(32, 16));
|
||||
loadingMovie->start();
|
||||
loadingLabel->setAttribute(Qt::WA_NoSystemBackground);
|
||||
loadingLabel->setMovie(loadingMovie);
|
||||
|
||||
ui->statusBar->addPermanentWidget(loadingLabel);
|
||||
loadingLabel->setVisible(false);
|
||||
|
||||
statusLabel = new QLabel();
|
||||
ui->statusBar->addPermanentWidget(statusLabel);
|
||||
|
||||
statusIcon = new QLabel();
|
||||
ui->statusBar->addPermanentWidget(statusIcon);
|
||||
|
||||
|
@ -65,7 +76,11 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
QObject::connect(ui->actionAbout, &QAction::triggered, [=] () {
|
||||
QDialog aboutDialog(this);
|
||||
Ui_about about;
|
||||
about.setupUi(&aboutDialog);
|
||||
about.setupUi(&aboutDialog);
|
||||
|
||||
QString version = QString("Version ") % QString(APP_VERSION) % " (" % QString(__DATE__) % ")";
|
||||
about.versionLabel->setText(version);
|
||||
|
||||
aboutDialog.exec();
|
||||
});
|
||||
|
||||
|
@ -272,4 +287,6 @@ MainWindow::~MainWindow()
|
|||
delete ui;
|
||||
delete rpc;
|
||||
delete settings;
|
||||
|
||||
delete loadingMovie;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@ public:
|
|||
|
||||
QLabel* statusLabel;
|
||||
QLabel* statusIcon;
|
||||
QLabel* loadingLabel;
|
||||
|
||||
private:
|
||||
void setupSendTab();
|
||||
void setupTransactionsTab();
|
||||
|
@ -42,6 +44,8 @@ private:
|
|||
|
||||
RPC* rpc;
|
||||
Settings* settings;
|
||||
|
||||
QMovie* loadingMovie;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <QCheckBox>
|
||||
#include <QScrollBar>
|
||||
#include <QPainter>
|
||||
#include <QMovie>
|
||||
#include <QTimer>
|
||||
#include <QSettings>
|
||||
#include <QFile>
|
||||
|
|
96
src/rpc.cpp
96
src/rpc.cpp
|
@ -9,6 +9,19 @@ RPC::RPC(QNetworkAccessManager* client, MainWindow* main) {
|
|||
this->main = main;
|
||||
this->ui = main->ui;
|
||||
|
||||
// Setup balances table model
|
||||
balancesTableModel = new BalancesTableModel(main->ui->balancesTable);
|
||||
main->ui->balancesTable->setModel(balancesTableModel);
|
||||
main->ui->balancesTable->setColumnWidth(0, 300);
|
||||
|
||||
// Setup transactions table model
|
||||
transactionsTableModel = new TxTableModel(ui->transactionsTable);
|
||||
main->ui->transactionsTable->setModel(transactionsTableModel);
|
||||
main->ui->transactionsTable->horizontalHeader()->setSectionResizeMode(3, QHeaderView::Stretch);
|
||||
main->ui->transactionsTable->setColumnWidth(1, 350);
|
||||
main->ui->transactionsTable->setColumnWidth(2, 200);
|
||||
main->ui->transactionsTable->horizontalHeader()->setSectionResizeMode(3, QHeaderView::Stretch);
|
||||
|
||||
reloadConnectionInfo();
|
||||
|
||||
// Set up a timer to refresh the UI every few seconds
|
||||
|
@ -16,15 +29,15 @@ RPC::RPC(QNetworkAccessManager* client, MainWindow* main) {
|
|||
QObject::connect(timer, &QTimer::timeout, [=]() {
|
||||
refresh();
|
||||
});
|
||||
timer->start(1 * 60 * 1000); // Query every minute
|
||||
timer->start(10 * 1000);
|
||||
|
||||
// Set up the timer to watch for tx status
|
||||
txTimer = new QTimer(main);
|
||||
QObject::connect(txTimer, &QTimer::timeout, [=]() {
|
||||
refreshTxStatus();
|
||||
});
|
||||
// Start at every minute. When an operation is pending, this will change to every second
|
||||
txTimer->start(1 * 60 * 1000);
|
||||
// Start at every 10s. When an operation is pending, this will change to every second
|
||||
txTimer->start(10 * 1000);
|
||||
}
|
||||
|
||||
RPC::~RPC() {
|
||||
|
@ -276,7 +289,8 @@ void RPC::getInfoThenRefresh() {
|
|||
.append(QString::number(reply["blocks"].get<json::number_unsigned_t>()))
|
||||
.append(")");
|
||||
main->statusLabel->setText(statusText);
|
||||
main->statusIcon->clear(); // TODO: Add checked icon
|
||||
QIcon i(":/icons/res/connected.png");
|
||||
main->statusIcon->setPixmap(i.pixmap(16, 16));
|
||||
|
||||
// Refresh everything.
|
||||
refreshBalances();
|
||||
|
@ -338,16 +352,8 @@ void RPC::refreshBalances() {
|
|||
|
||||
// Function to create the data model and update the views, used below.
|
||||
auto updateUI = [=] () {
|
||||
// Create the balances table model.
|
||||
|
||||
// Delete the old Model, because the setModel() doesn't take ownership of the Model object
|
||||
delete balancesTableModel;
|
||||
|
||||
balancesTableModel = new BalancesTableModel(ui->balancesTable, allBalances, utxos);
|
||||
ui->balancesTable->setModel(balancesTableModel);
|
||||
|
||||
// Configure Balances Table
|
||||
ui->balancesTable->setColumnWidth(0, 300);
|
||||
// Update balances model data, which will update the table too
|
||||
balancesTableModel->setNewData(allBalances, utxos);
|
||||
|
||||
// Add all the addresses into the inputs combo box
|
||||
auto lastFromAddr = ui->inputsCombo->currentText().split("(")[0].trimmed();
|
||||
|
@ -355,7 +361,7 @@ void RPC::refreshBalances() {
|
|||
ui->inputsCombo->clear();
|
||||
auto i = allBalances->constBegin();
|
||||
while (i != allBalances->constEnd()) {
|
||||
QString item = i.key() % "(" % QString::number(i.value(), 'f', 8) % " ZEC)";
|
||||
QString item = i.key() % "(" % QString::number(i.value(), 'f') % " ZEC)";
|
||||
ui->inputsCombo->addItem(item);
|
||||
if (item.startsWith(lastFromAddr)) ui->inputsCombo->setCurrentText(item);
|
||||
|
||||
|
@ -376,9 +382,6 @@ void RPC::refreshBalances() {
|
|||
}
|
||||
|
||||
void RPC::refreshTransactions() {
|
||||
// First, delete the previous headers
|
||||
delete transactionsTableModel;
|
||||
|
||||
auto txdata = new QList<TransactionItem>();
|
||||
|
||||
getTransactions([=] (json reply) {
|
||||
|
@ -395,12 +398,8 @@ void RPC::refreshTransactions() {
|
|||
txdata->push_front(tx);
|
||||
}
|
||||
|
||||
transactionsTableModel = new TxTableModel(ui->transactionsTable, txdata);
|
||||
ui->transactionsTable->setModel(transactionsTableModel);
|
||||
|
||||
ui->transactionsTable->setColumnWidth(1, 300);
|
||||
ui->transactionsTable->setColumnWidth(2, 200);
|
||||
ui->transactionsTable->horizontalHeader()->setSectionResizeMode(3, QHeaderView::Stretch);
|
||||
// Update model data, which updates the table view
|
||||
transactionsTableModel->setNewData(txdata);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -418,6 +417,14 @@ void RPC::refreshTxStatus(const QString& newOpid) {
|
|||
};
|
||||
|
||||
doRPC(payload, [=] (const json& reply) {
|
||||
// If there is some op that we are watching, then show the loading bar, otherwise hide it
|
||||
if (watchingOps.isEmpty()) {
|
||||
main->loadingLabel->setVisible(false);
|
||||
} else {
|
||||
main->loadingLabel->setVisible(true);
|
||||
main->loadingLabel->setToolTip(QString::number(watchingOps.size()) + " tx computing");
|
||||
}
|
||||
|
||||
// There's an array for each item in the status
|
||||
for (auto& it : reply.get<json::array_t>()) {
|
||||
// If we were watching this Tx and it's status became "success", then we'll show a status bar alert
|
||||
|
@ -425,20 +432,18 @@ void RPC::refreshTxStatus(const QString& newOpid) {
|
|||
if (watchingOps.contains(id)) {
|
||||
// And if it ended up successful
|
||||
QString status = QString::fromStdString(it["status"]);
|
||||
qDebug() << QString::fromStdString("Watching opid, current status= ") % status;
|
||||
if (status == "success") {
|
||||
qDebug() << QString::fromStdString("Success, showing status message");
|
||||
main->ui->statusBar->showMessage(" Tx " % id % " computed successfully and submitted");
|
||||
main->loadingLabel->setVisible(false);
|
||||
|
||||
watchingOps.remove(id);
|
||||
txTimer->start(1 * 60 * 1000);
|
||||
txTimer->start(10 * 1000);
|
||||
|
||||
// Refresh balances to show unconfirmed balances
|
||||
refresh();
|
||||
} else if (status == "failed") {
|
||||
// If it failed, then we'll actually show a warning.
|
||||
auto errorMsg = QString::fromStdString(it["error"]["message"]);
|
||||
qDebug() << QString::fromStdString("Failed with message") % errorMsg;
|
||||
QMessageBox msg(
|
||||
QMessageBox::Critical,
|
||||
"Transaction Error",
|
||||
|
@ -447,47 +452,18 @@ void RPC::refreshTxStatus(const QString& newOpid) {
|
|||
main
|
||||
);
|
||||
|
||||
txTimer->start(1 * 60 * 1000);
|
||||
watchingOps.remove(id);
|
||||
txTimer->start(10 * 1000);
|
||||
|
||||
main->ui->statusBar->showMessage(" Tx " % id % " failed", 15 * 1000);
|
||||
main->loadingLabel->setVisible(false);
|
||||
|
||||
msg.exec();
|
||||
} else if (status == "executing") {
|
||||
// If the operation is executing, then watch every second.
|
||||
qDebug() << QString::fromStdString("executing, doing again in 1 sec");
|
||||
txTimer->start(1 * 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
[
|
||||
{
|
||||
"id": "opid-ad54b34c-1d89-48af-9cb5-4825905fc62e",
|
||||
"status": "executing",
|
||||
"creation_time": 1539490482,
|
||||
"method": "z_sendmany",
|
||||
"params": {
|
||||
"fromaddress": "t1aWhRh9JNKWzpzjn2gmULDJzfKLC724EPS",
|
||||
"amounts": [
|
||||
{
|
||||
"address": "zcVHg9euUSQF8ef7ZXztrv4LcdC1mytEUYLuoj4W5iSygLFYjm1yQCggAYnnydUaHLy2GBaxF4PX5vjaJjnj2Lq3ecQtGF4",
|
||||
"amount": 0.0001
|
||||
}
|
||||
],
|
||||
"minconf": 1,
|
||||
"fee": 0.0001
|
||||
}
|
||||
},{
|
||||
"id": "opid-7807e672-7f8c-428a-8587-3354d0ae1b88",
|
||||
"status": "failed",
|
||||
"creation_time": 1539490847,
|
||||
"error": {
|
||||
"code": -6,
|
||||
"message": "Insufficient protected funds, have 0.0006001, need 111.0001"
|
||||
},
|
||||
]
|
||||
*/
|
|
@ -1,9 +1,8 @@
|
|||
#include "txtablemodel.h"
|
||||
|
||||
TxTableModel::TxTableModel(QObject *parent, QList<TransactionItem>* data)
|
||||
TxTableModel::TxTableModel(QObject *parent)
|
||||
: QAbstractTableModel(parent)
|
||||
{
|
||||
modeldata = data;
|
||||
headers << "Category" << "Address" << "Date/Time" << "Amount";
|
||||
}
|
||||
|
||||
|
@ -11,8 +10,17 @@ TxTableModel::~TxTableModel() {
|
|||
delete modeldata;
|
||||
}
|
||||
|
||||
void TxTableModel::setNewData(QList<TransactionItem>* data) {
|
||||
delete modeldata;
|
||||
modeldata = data;
|
||||
|
||||
dataChanged(index(0, 0), index(modeldata->size()-1, columnCount(index(0,0))-1));
|
||||
layoutChanged();
|
||||
}
|
||||
|
||||
int TxTableModel::rowCount(const QModelIndex&) const
|
||||
{
|
||||
if (modeldata == nullptr) return 0;
|
||||
return modeldata->size();
|
||||
}
|
||||
|
||||
|
@ -45,7 +53,7 @@ TxTableModel::~TxTableModel() {
|
|||
case 0: return modeldata->at(index.row()).type;
|
||||
case 1: return modeldata->at(index.row()).address;
|
||||
case 2: return modeldata->at(index.row()).datetime;
|
||||
case 3: return QVariant(QString::number(modeldata->at(index.row()).amount, 'f', 8) % " ZEC");
|
||||
case 3: return QVariant(QString::number(modeldata->at(index.row()).amount, 'f') % " ZEC");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,9 +7,11 @@
|
|||
class TxTableModel: public QAbstractTableModel
|
||||
{
|
||||
public:
|
||||
TxTableModel(QObject* parent, QList<TransactionItem>* addresses);
|
||||
TxTableModel(QObject* parent);
|
||||
~TxTableModel();
|
||||
|
||||
void setNewData(QList<TransactionItem>* addresses);
|
||||
|
||||
QString getTxId(int row);
|
||||
|
||||
int rowCount(const QModelIndex &parent) const;
|
||||
|
@ -18,7 +20,7 @@ public:
|
|||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
|
||||
private:
|
||||
QList<TransactionItem>* modeldata;
|
||||
QList<TransactionItem>* modeldata = nullptr;
|
||||
QList<QString> headers;
|
||||
};
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
#include <QtWidgets/QApplication>
|
||||
#include <QtWidgets/QDialog>
|
||||
#include <QtWidgets/QDialogButtonBox>
|
||||
#include <QtWidgets/QGroupBox>
|
||||
#include <QtWidgets/QLabel>
|
||||
#include <QtWidgets/QTextEdit>
|
||||
#include <QtWidgets/QVBoxLayout>
|
||||
|
||||
|
@ -22,6 +24,9 @@ class Ui_about
|
|||
{
|
||||
public:
|
||||
QVBoxLayout *verticalLayout;
|
||||
QGroupBox *groupBox;
|
||||
QVBoxLayout *verticalLayout_2;
|
||||
QLabel *versionLabel;
|
||||
QTextEdit *textEdit;
|
||||
QDialogButtonBox *buttonBox;
|
||||
|
||||
|
@ -32,6 +37,18 @@ public:
|
|||
about->resize(497, 448);
|
||||
verticalLayout = new QVBoxLayout(about);
|
||||
verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
|
||||
groupBox = new QGroupBox(about);
|
||||
groupBox->setObjectName(QStringLiteral("groupBox"));
|
||||
verticalLayout_2 = new QVBoxLayout(groupBox);
|
||||
verticalLayout_2->setObjectName(QStringLiteral("verticalLayout_2"));
|
||||
versionLabel = new QLabel(groupBox);
|
||||
versionLabel->setObjectName(QStringLiteral("versionLabel"));
|
||||
|
||||
verticalLayout_2->addWidget(versionLabel);
|
||||
|
||||
|
||||
verticalLayout->addWidget(groupBox);
|
||||
|
||||
textEdit = new QTextEdit(about);
|
||||
textEdit->setObjectName(QStringLiteral("textEdit"));
|
||||
textEdit->setReadOnly(true);
|
||||
|
@ -56,23 +73,26 @@ public:
|
|||
void retranslateUi(QDialog *about)
|
||||
{
|
||||
about->setWindowTitle(QApplication::translate("about", "Dialog", nullptr));
|
||||
groupBox->setTitle(QApplication::translate("about", "zcash-qt-wallet", nullptr));
|
||||
versionLabel->setText(QApplication::translate("about", "Version", nullptr));
|
||||
textEdit->setHtml(QApplication::translate("about", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
||||
"p, li { white-space: pre-wrap; }\n"
|
||||
"</style></head><body style=\" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;\">\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Copyright (c) 2018 Aditya Kulkarni. (MIT License)</p>\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Special thanks to:</p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">JSON for Modern C++ : <a href=\"https://nlohmann.github.io/json/\"><span style=\""
|
||||
" text-decoration: underline; color:#007af4;\">https://nlohmann.github.io/json/</span></a></p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">QR Code generator library Nayuki : <a href=\"https://www.nayuki.io/page/qr-code-generator-library\"><span style=\" text-decoration: underline; color:#007af4;\">https://www.nayuki.io/page/qr-code-ge\342\200\246</span></a></p>\n"
|
||||
"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Made with QT : <a href=\"https://www.qt.io/\"><span style=\" text-decoration: underline; color:#007af4;\">https://www.qt.io/</span></a></p>\n"
|
||||
"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">LICENSE:</p>\n"
|
||||
"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Permission is hereby granted, free of charge, "
|
||||
"to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p>\n"
|
||||
"<ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;\"><li style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</li>\n"
|
||||
"<li style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">The Software is provided "as is", without warranty of any kind, express or implied, including but not limited to the w"
|
||||
"arranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the Software or the use or other dealings in the Software.</li></ul></body></html>", nullptr));
|
||||
"</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.1pt; font-weight:400; font-style:normal;\">\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:'Ubuntu'; font-size:11pt;\">Copyright (c) 2018 Aditya Kulkarni. (MIT License)</span></p>\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;\"><br /></p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:'Ubuntu'; font-size:11pt;\">Special thanks to:</span></p>\n"
|
||||
"<p style=\" margin-top:0px; marg"
|
||||
"in-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:'Ubuntu'; font-size:11pt;\">JSON for Modern C++ : </span><a href=\"https://nlohmann.github.io/json/\"><span style=\" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#007af4;\">https://nlohmann.github.io/json/</span></a></p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:'Ubuntu'; font-size:11pt;\">QR Code generator library Nayuki : </span><a href=\"https://www.nayuki.io/page/qr-code-generator-library\"><span style=\" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#007af4;\">https://www.nayuki.io/page/qr-code-ge\342\200\246</span></a></p>\n"
|
||||
"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:'Ubuntu'; font-size:11pt;\">Made with QT : </span><a hr"
|
||||
"ef=\"https://www.qt.io/\"><span style=\" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#007af4;\">https://www.qt.io/</span></a></p>\n"
|
||||
"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:'Ubuntu'; font-size:11pt;\">LICENSE:</span></p>\n"
|
||||
"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:'Ubuntu'; font-size:11pt;\">Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</span></p>\n"
|
||||
"<ul style=\"margin-top: 0"
|
||||
"px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;\"><li style=\" font-family:'Ubuntu'; font-size:11pt;\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</li>\n"
|
||||
"<li style=\" font-family:'Ubuntu'; font-size:11pt;\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">The Software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the Software or the use or other dealings in the"
|
||||
" Software.</li></ul></body></html>", nullptr));
|
||||
} // retranslateUi
|
||||
|
||||
};
|
||||
|
|
|
@ -13,13 +13,19 @@ PRECOMPILED_HEADER = src/precompiled.h
|
|||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = zcash-qt-wallet
|
||||
APP_VERSION=\\\"0.1.5\\\"
|
||||
|
||||
|
||||
TEMPLATE = app
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
DEFINES += \
|
||||
QT_DEPRECATED_WARNINGS \
|
||||
APP_VERSION=$$APP_VERSION
|
||||
|
||||
|
||||
INCLUDEPATH += src/3rdparty/
|
||||
|
||||
|
|
Loading…
Reference in New Issue