Browse Source

Render USD total, work on feedback and show version/port info in hushd tab

pull/45/head
Duke Leto 5 years ago
parent
commit
e3d3b7914e
  1. 4
      res/Info.plist
  2. 108
      src/mainwindow.ui
  3. 9
      src/rpc.cpp
  4. 4
      src/sendtab.cpp
  5. 3
      src/settings.cpp

4
res/Info.plist

@ -29,10 +29,10 @@
<array>
<dict>
<key>CFBundleURLName</key>
<string>zcash URI</string>
<string>hush URI</string>
<key>CFBundleURLSchemes</key>
<array>
<string>zcash</string>
<string>hush</string>
</array>
</dict>
</array>

108
src/mainwindow.ui

@ -148,6 +148,47 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_99">
<item>
<widget class="QLabel" name="label_99">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string></string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="balUSDTotal">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
@ -1083,6 +1124,73 @@
</item>
<item row="12" column="0">
<widget class="QLabel" name="versionlabel">
<property name="text">
<string>Version</string>
</property>
</widget>
</item>
<item row="12" column="2">
<widget class="QLabel" name="version">
<property name="text">
<string>Loading...</string>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QLabel" name="versionspacer">
<property name="text">
<string>|</string>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="p2pportlabel">
<property name="text">
<string>P2P Port</string>
</property>
</widget>
</item>
<item row="13" column="2">
<widget class="QLabel" name="p2pport">
<property name="text">
<string>Loading...</string>
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QLabel" name="p2pportspacer">
<property name="text">
<string>|</string>
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QLabel" name="rpcportlabel">
<property name="text">
<string>RPC Port</string>
</property>
</widget>
</item>
<item row="14" column="2">
<widget class="QLabel" name="rpcport">
<property name="text">
<string>Loading...</string>
</property>
</widget>
</item>
<item row="14" column="1">
<widget class="QLabel" name="rpcportspacer">
<property name="text">
<string>|</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QLabel" name="solrate">
<property name="text">

9
src/rpc.cpp

@ -398,6 +398,7 @@ void RPC::noConnection() {
ui->balSheilded->setText("");
ui->balTransparent->setText("");
ui->balTotal->setText("");
ui->balUSDTotal->setText("");
ui->balSheilded->setToolTip("");
ui->balTransparent->setToolTip("");
@ -556,6 +557,8 @@ void RPC::getInfoThenRefresh(bool force) {
static int lastBlock = 0;
int curBlock = reply["blocks"].get<json::number_integer_t>();
int version = reply["version"].get<json::number_integer_t>();
int p2pport = reply["p2pport"].get<json::number_integer_t>();
int rpcport = reply["rpcport"].get<json::number_integer_t>();
int notarized = reply["notarized"].get<json::number_integer_t>();
int protocolversion = reply["protocolversion"].get<json::number_integer_t>();
int lag = curBlock - notarized;
@ -568,8 +571,11 @@ void RPC::getInfoThenRefresh(bool force) {
ui->notarizedhashvalue->setText( ntzhash );
ui->notarizedtxidvalue->setText( ntztxid );
ui->lagvalue->setText( QString::number(lag) );
ui->version->setText( QString::number(version) );
ui->kmdversion->setText( kmdver );
ui->protocolversion->setText( QString::number(protocolversion) );
ui->p2pport->setText( QString::number(p2pport) );
ui->rpcport->setText( QString::number(rpcport) );
if ( force || (curBlock != lastBlock) ) {
// Something changed, so refresh everything.
@ -779,6 +785,9 @@ void RPC::refreshBalances() {
ui->balSheilded ->setToolTip(Settings::getUSDFormat(balZ));
ui->balTransparent->setToolTip(Settings::getUSDFormat(balT));
ui->balTotal ->setToolTip(Settings::getUSDFormat(balTotal));
ui->balUSDTotal ->setText(Settings::getUSDFormat(balTotal));
ui->balUSDTotal ->setToolTip(Settings::getUSDFormat(balTotal));
});
// 2. Get the UTXOs

4
src/sendtab.cpp

@ -454,7 +454,7 @@ Tx MainWindow::createTxFromSendPage() {
addr = AddressBook::addressFromAddressLabel(addr);
// If address is sprout, then we can't send change to sapling, because of turnstile.
sendChangeToSapling = sendChangeToSapling && !Settings::getInstance()->isSproutAddress(addr);
//sendChangeToSapling = sendChangeToSapling && !Settings::getInstance()->isSproutAddress(addr);
double amt = ui->sendToWidgets->findChild<QLineEdit*>(QString("Amount") % QString::number(i+1))->text().trimmed().toDouble();
totalAmt += amt;
@ -473,6 +473,7 @@ Tx MainWindow::createTxFromSendPage() {
if (Settings::getInstance()->getAutoShield() && sendChangeToSapling) {
auto saplingAddr = std::find_if(rpc->getAllZAddresses()->begin(), rpc->getAllZAddresses()->end(), [=](auto i) -> bool {
// We're finding a sapling address that is not one of the To addresses, because zcash doesn't allow duplicated addresses
// TODO: Should we disable this in Hush? What are the privacy and chain analysis considerations?
bool isSapling = Settings::getInstance()->isSaplingAddress(i);
if (!isSapling) return false;
@ -685,6 +686,7 @@ void MainWindow::sendButton() {
}
QString MainWindow::doSendTxValidations(Tx tx) {
//TODO: Feedback fromAddr is empty for some reason
if (!Settings::isValidAddress(tx.fromAddr)) return QString(tr("From Address is Invalid"));
for (auto toAddr : tx.toAddrs) {

3
src/settings.cpp

@ -270,9 +270,10 @@ QString Settings::getZboardAddr() {
}
bool Settings::isValidAddress(QString addr) {
QRegExp zsexp("^z[a-z0-9]{77}$", Qt::CaseInsensitive);
QRegExp zsexp("^zs1[a-z0-9]{75}$", Qt::CaseInsensitive);
QRegExp ztsexp("^ztestsapling[a-z0-9]{76}", Qt::CaseInsensitive);
QRegExp texp("^R[a-z0-9]{33}$", Qt::CaseInsensitive);
qDebug() << "isValidAddress(" << addr << ")";
return texp.exactMatch(addr) || ztsexp.exactMatch(addr) || zsexp.exactMatch(addr);
}

Loading…
Cancel
Save