Small UI fixes

This commit is contained in:
Aditya Kulkarni
2018-10-17 15:30:01 -07:00
parent cf49b2bffa
commit 2f85d08d05
7 changed files with 35 additions and 17 deletions

View File

@@ -25,7 +25,7 @@ tar -xvf zcash-qt-wallet-v0.1.6.tar.gz
``` ```
## Compiling from source ## Compiling from source
zcash-qt-wallet depends on QT5, which you can get from here: https://www.qt.io/download zcash-qt-wallet depends on Qt5, which you can get from here: https://www.qt.io/download
### Compiling on Linux ### Compiling on Linux
You need a C++14 compatible compiler like g++ or clang++ You need a C++14 compatible compiler like g++ or clang++

View File

@@ -35,10 +35,20 @@ MainWindow::MainWindow(QWidget *parent) :
auto msg = ui->statusBar->currentMessage(); auto msg = ui->statusBar->currentMessage();
QMenu menu(this); QMenu menu(this);
if (!msg.isEmpty() && msg.startsWith(Utils::txidStatusMessage)) { if (!msg.isEmpty() && msg.startsWith(Utils::txidStatusMessage)) {
auto txid = msg.split(":")[1].trimmed();
menu.addAction("Copy txid", [=]() { menu.addAction("Copy txid", [=]() {
QGuiApplication::clipboard()->setText(msg.split(":")[1].trimmed()); QGuiApplication::clipboard()->setText(txid);
}); });
menu.addAction("View tx on block explorer", [=]() {
QString url;
if (Settings::getInstance()->isTestnet()) {
url = "https://explorer.testnet.z.cash/tx/" + txid;
} else {
url = "https://explorer.zcha.in/transactions/" + txid;
}
QDesktopServices::openUrl(QUrl(url));
});
} }
menu.addAction("Refresh", [=]() { menu.addAction("Refresh", [=]() {
@@ -203,7 +213,7 @@ void MainWindow::setupTransactionsTab() {
auto txModel = dynamic_cast<TxTableModel *>(ui->transactionsTable->model()); auto txModel = dynamic_cast<TxTableModel *>(ui->transactionsTable->model());
QString txid = txModel->getTxId(index.row()); QString txid = txModel->getTxId(index.row());
menu.addAction("Copy txid to clipboard", [=] () { menu.addAction("Copy txid", [=] () {
QGuiApplication::clipboard()->setText(txid); QGuiApplication::clipboard()->setText(txid);
}); });
menu.addAction("View on block explorer", [=] () { menu.addAction("View on block explorer", [=] () {

View File

@@ -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>0</number>
</property> </property>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="tab">
<attribute name="title"> <attribute name="title">

View File

@@ -338,7 +338,7 @@ void RPC::refreshBalances() {
allBalances = new QMap<QString, double>(); allBalances = new QMap<QString, double>();
// Function to process reply of the listunspent and z_listunspent API calls, used below. // Function to process reply of the listunspent and z_listunspent API calls, used below.
auto processUnspent = [=] (const json& reply) { auto processUnspent = [=] (const json& reply) -> bool {
bool anyUnconfirmed = false; bool anyUnconfirmed = false;
for (auto& it : reply.get<json::array_t>()) { for (auto& it : reply.get<json::array_t>()) {
QString qsAddr = QString::fromStdString(it["address"]); QString qsAddr = QString::fromStdString(it["address"]);
@@ -358,11 +358,13 @@ void RPC::refreshBalances() {
(*allBalances)[qsAddr] = (*allBalances)[qsAddr] + it["amount"].get<json::number_float_t>(); (*allBalances)[qsAddr] = (*allBalances)[qsAddr] + it["amount"].get<json::number_float_t>();
} }
ui->unconfirmedWarning->setVisible(anyUnconfirmed); return anyUnconfirmed;
}; };
// Function to create the data model and update the views, used below. // Function to create the data model and update the views, used below.
auto updateUI = [=] () { auto updateUI = [=] (bool anyUnconfirmed) {
ui->unconfirmedWarning->setVisible(anyUnconfirmed);
// Update balances model data, which will update the table too // Update balances model data, which will update the table too
balancesTableModel->setNewData(allBalances, utxos); balancesTableModel->setNewData(allBalances, utxos);
@@ -382,12 +384,12 @@ void RPC::refreshBalances() {
// Call the Transparent and Z unspent APIs serially and then, once they're done, update the UI // Call the Transparent and Z unspent APIs serially and then, once they're done, update the UI
getTransparentUnspent([=] (json reply) { getTransparentUnspent([=] (json reply) {
processUnspent(reply); auto anyTUnconfirmed = processUnspent(reply);
getZUnspent([=] (json reply) { getZUnspent([=] (json reply) {
processUnspent(reply); auto anyZUnconfirmed = processUnspent(reply);
updateUI(); updateUI(anyTUnconfirmed || anyZUnconfirmed);
}); });
}); });
} }

View File

@@ -14,6 +14,7 @@ echo "[OK]"
echo -n "Configuring..." echo -n "Configuring..."
rm -f "bin/linux-zcash-qt-wallet-v$APP_VERSION.tar.gz"
make distclean > /dev/null make distclean > /dev/null
$QT_STATIC/bin/qmake zcash-qt-wallet.pro -spec linux-clang CONFIG+=release > /dev/null $QT_STATIC/bin/qmake zcash-qt-wallet.pro -spec linux-clang CONFIG+=release > /dev/null
echo "[OK]" echo "[OK]"
@@ -41,9 +42,14 @@ cp README.md bin/zcash-qt-wallet-v$APP_VERSION > /dev/null
cp LICENSE bin/zcash-qt-wallet-v$APP_VERSION > /dev/null cp LICENSE bin/zcash-qt-wallet-v$APP_VERSION > /dev/null
cd bin && tar cvf linux-zcash-qt-wallet-v$APP_VERSION.tar.gz zcash-qt-wallet-v$APP_VERSION/ > /dev/null cd bin && tar cvf linux-zcash-qt-wallet-v$APP_VERSION.tar.gz zcash-qt-wallet-v$APP_VERSION/ > /dev/null
cd .. cd ..
echo "[OK]"
if [ -f bin/linux-zcash-qt-wallet-v$APP_VERSION.tar.gz ] ; then
echo "[OK]"
echo "Done. Build is bin/linux-zcash-qt-wallet-v$APP_VERSION.tar.gz" echo "Done. Build is bin/linux-zcash-qt-wallet-v$APP_VERSION.tar.gz"
echo "Package contents:" echo "Package contents:"
tar tf "bin/linux-zcash-qt-wallet-v$APP_VERSION.tar.gz" tar tf "bin/linux-zcash-qt-wallet-v$APP_VERSION.tar.gz"
else
echo "[ERROR]"
exit 1
fi

View File

@@ -304,7 +304,7 @@ void MainWindow::sendButton() {
json rec = json::object(); json rec = json::object();
rec["address"] = toAddr.addr.toStdString(); rec["address"] = toAddr.addr.toStdString();
rec["amount"] = toAddr.amount; rec["amount"] = toAddr.amount;
if (toAddr.addr.startsWith("z")) if (toAddr.addr.startsWith("z") && !toAddr.encodedMemo.trimmed().isEmpty())
rec["memo"] = toAddr.encodedMemo.toStdString(); rec["memo"] = toAddr.encodedMemo.toStdString();
allRecepients.push_back(rec); allRecepients.push_back(rec);

View File

@@ -656,7 +656,7 @@ public:
retranslateUi(MainWindow); retranslateUi(MainWindow);
tabWidget->setCurrentIndex(1); tabWidget->setCurrentIndex(0);
QMetaObject::connectSlotsByName(MainWindow); QMetaObject::connectSlotsByName(MainWindow);