Skip to content

Commit

Permalink
Small UI fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
adityapk00 committed Oct 17, 2018
1 parent cf49b2b commit 2f85d08
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ tar -xvf zcash-qt-wallet-v0.1.6.tar.gz
```

## 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
You need a C++14 compatible compiler like g++ or clang++
Expand Down
16 changes: 13 additions & 3 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,20 @@ MainWindow::MainWindow(QWidget *parent) :
auto msg = ui->statusBar->currentMessage();
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", [=]() {
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", [=]() {
Expand Down Expand Up @@ -203,7 +213,7 @@ void MainWindow::setupTransactionsTab() {
auto txModel = dynamic_cast<TxTableModel *>(ui->transactionsTable->model());
QString txid = txModel->getTxId(index.row());

menu.addAction("Copy txid to clipboard", [=] () {
menu.addAction("Copy txid", [=] () {
QGuiApplication::clipboard()->setText(txid);
});
menu.addAction("View on block explorer", [=] () {
Expand Down
2 changes: 1 addition & 1 deletion src/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
Expand Down
14 changes: 8 additions & 6 deletions src/rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ void RPC::refreshBalances() {
allBalances = new QMap<QString, double>();

// 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;
for (auto& it : reply.get<json::array_t>()) {
QString qsAddr = QString::fromStdString(it["address"]);
Expand All @@ -358,11 +358,13 @@ void RPC::refreshBalances() {

(*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.
auto updateUI = [=] () {
auto updateUI = [=] (bool anyUnconfirmed) {
ui->unconfirmedWarning->setVisible(anyUnconfirmed);

// Update balances model data, which will update the table too
balancesTableModel->setNewData(allBalances, utxos);

Expand All @@ -382,12 +384,12 @@ void RPC::refreshBalances() {

// Call the Transparent and Z unspent APIs serially and then, once they're done, update the UI
getTransparentUnspent([=] (json reply) {
processUnspent(reply);
auto anyTUnconfirmed = processUnspent(reply);

getZUnspent([=] (json reply) {
processUnspent(reply);
auto anyZUnconfirmed = processUnspent(reply);

updateUI();
updateUI(anyTUnconfirmed || anyZUnconfirmed);
});
});
}
Expand Down
14 changes: 10 additions & 4 deletions src/scripts/mkrelease.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ echo "[OK]"


echo -n "Configuring..."
rm -f "bin/linux-zcash-qt-wallet-v$APP_VERSION.tar.gz"
make distclean > /dev/null
$QT_STATIC/bin/qmake zcash-qt-wallet.pro -spec linux-clang CONFIG+=release > /dev/null
echo "[OK]"
Expand Down Expand Up @@ -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
cd bin && tar cvf linux-zcash-qt-wallet-v$APP_VERSION.tar.gz zcash-qt-wallet-v$APP_VERSION/ > /dev/null
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 "Package contents:"
tar tf "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:"
tar tf "bin/linux-zcash-qt-wallet-v$APP_VERSION.tar.gz"
else
echo "[ERROR]"
exit 1
fi
2 changes: 1 addition & 1 deletion src/sendtab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ void MainWindow::sendButton() {
json rec = json::object();
rec["address"] = toAddr.addr.toStdString();
rec["amount"] = toAddr.amount;
if (toAddr.addr.startsWith("z"))
if (toAddr.addr.startsWith("z") && !toAddr.encodedMemo.trimmed().isEmpty())
rec["memo"] = toAddr.encodedMemo.toStdString();

allRecepients.push_back(rec);
Expand Down
2 changes: 1 addition & 1 deletion src/ui_mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ class Ui_MainWindow

retranslateUi(MainWindow);

tabWidget->setCurrentIndex(1);
tabWidget->setCurrentIndex(0);


QMetaObject::connectSlotsByName(MainWindow);
Expand Down

0 comments on commit 2f85d08

Please sign in to comment.