diff --git a/src/balancestablemodel.cpp b/src/balancestablemodel.cpp
index afc0ba3..ffdf6a3 100644
--- a/src/balancestablemodel.cpp
+++ b/src/balancestablemodel.cpp
@@ -72,7 +72,7 @@ QVariant BalancesTableModel::data(const QModelIndex &index, int role) const
if (role == Qt::DisplayRole) {
switch (index.column()) {
case 0: return std::get<0>(modeldata->at(index.row()));
- case 1: return QVariant(std::get<1>(modeldata->at(index.row())) % " " % Utils::getTokenName());
+ case 1: return Settings::getInstance()->getZECDisplayFormat(std::get<1>(modeldata->at(index.row())).toDouble());
}
}
diff --git a/src/confirm.ui b/src/confirm.ui
index 6e4f00b..00ccb44 100644
--- a/src/confirm.ui
+++ b/src/confirm.ui
@@ -39,6 +39,33 @@
To
+ -
+
+
+ Dev Fee Amount
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+ TextLabel
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+ Dev Fee
+
+
+
-
@@ -59,8 +86,15 @@
- -
-
+
-
+
+
+ Miner Fee
+
+
+
+ -
+
TextLabel
@@ -69,31 +103,27 @@
- -
+
-
TextLabel
- -
-
+
-
+
- Miner Fee
+ TextLabel
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- -
-
+
-
+
- Dev Fee
-
-
-
- -
-
-
- Dev Fee Amount
+ TextLabel
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 4c920c4..f73aa84 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -22,7 +22,7 @@
-
- 2
+ 1
@@ -242,6 +242,13 @@
+ -
+
+
+
+
+
+
-
@@ -483,6 +490,13 @@
+ -
+
+
+ TextLabel
+
+
+
-
diff --git a/src/rpc.cpp b/src/rpc.cpp
index afff2f0..2494b53 100644
--- a/src/rpc.cpp
+++ b/src/rpc.cpp
@@ -42,10 +42,10 @@ RPC::RPC(QNetworkAccessManager* client, MainWindow* main) {
// Set up timer to refresh Price
priceTimer = new QTimer(main);
- QObject::connect(timer, &QTimer::timeout, [=]() {
+ QObject::connect(priceTimer, &QTimer::timeout, [=]() {
refreshZECPrice();
});
- priceTimer->start(60 * 60 * 60 * 1000); // Every hour
+ priceTimer->start(60 * 60 * 1000); // Every hour
}
RPC::~RPC() {
diff --git a/src/sendtab.cpp b/src/sendtab.cpp
index 743600d..3c86c5a 100644
--- a/src/sendtab.cpp
+++ b/src/sendtab.cpp
@@ -44,7 +44,7 @@ void MainWindow::setupSendTab() {
// Set the fees
ui->sendTxFees->setText(QString::number(Utils::getTotalFee(), 'g', 8) %
" " % Utils::getTokenName());
-
+ ui->sendTxFeesUSD->setText(Settings::getInstance()->getUSDFormat(Utils::getTotalFee()));
// Set focus to the first address box
ui->Address1->setFocus();
}
@@ -85,7 +85,9 @@ void MainWindow::setDefaultPayFrom() {
void MainWindow::inputComboTextChanged(const QString& text) {
auto bal = rpc->getAllBalances()->value(text.split("(")[0].trimmed());
auto balFmt = QString::number(bal, 'g', 8) + " " % Utils::getTokenName();
+
ui->sendAddressBalance->setText(balFmt);
+ ui->sendAddressBalanceUSD->setText(Settings::getInstance()->getUSDFormat(bal));
}
@@ -290,13 +292,15 @@ void MainWindow::sendButton() {
// Remove all existing address/amt qlabels
int totalConfirmAddrItems = confirm.sendToAddrs->children().size();
for (int i = 0; i < totalConfirmAddrItems / 3; i++) {
- auto addr = confirm.sendToAddrs->findChild(QString("Addr") % QString::number(i+1));
- auto amt = confirm.sendToAddrs->findChild(QString("Amt") % QString::number(i+1));
- auto memo = confirm.sendToAddrs->findChild(QString("Memo") % QString::number(i+1));
+ auto addr = confirm.sendToAddrs->findChild(QString("Addr") % QString::number(i+1));
+ auto amt = confirm.sendToAddrs->findChild(QString("Amt") % QString::number(i+1));
+ auto memo = confirm.sendToAddrs->findChild(QString("Memo") % QString::number(i+1));
+ auto amtUSD = confirm.sendToAddrs->findChild(QString("AmtUSD") % QString::number(i+1));
delete memo;
delete addr;
delete amt;
+ delete amtUSD;
}
// For each addr/amt/memo, construct the JSON and also build the confirm dialog box
@@ -314,18 +318,28 @@ void MainWindow::sendButton() {
// Add new Address widgets instead of the same one.
{
+ // Address
auto Addr = new QLabel(confirm.sendToAddrs);
Addr->setObjectName(QString("Addr") % QString::number(i + 1));
Addr->setWordWrap(true);
Addr->setText(fnSplitAddressForWrap(toAddr.addr));
confirm.gridLayout->addWidget(Addr, i*2, 0, 1, 1);
+ // Amount (ZEC)
auto Amt = new QLabel(confirm.sendToAddrs);
Amt->setObjectName(QString("Amt") % QString::number(i + 1));
Amt->setText(Settings::getInstance()->getZECDisplayFormat(toAddr.amount));
Amt->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
confirm.gridLayout->addWidget(Amt, i*2, 1, 1, 1);
+ // Amount (USD)
+ auto AmtUSD = new QLabel(confirm.sendToAddrs);
+ AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
+ AmtUSD->setText(Settings::getInstance()->getUSDFormat(toAddr.amount));
+ Amt->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
+ confirm.gridLayout->addWidget(AmtUSD, i*2, 2, 1, 1);
+
+ // Memo
if (toAddr.addr.startsWith("z")) {
auto Memo = new QLabel(confirm.sendToAddrs);
Memo->setObjectName(QStringLiteral("Memo") % QString::number(i + 1));
@@ -334,7 +348,7 @@ void MainWindow::sendButton() {
font1.setPointSize(10);
Memo->setFont(font1);
- confirm.gridLayout->addWidget(Memo, (i*2)+1, 0, 1, 2);
+ confirm.gridLayout->addWidget(Memo, (i*2)+1, 0, 1, 3);
}
}
}
@@ -350,14 +364,17 @@ void MainWindow::sendButton() {
// Add two rows for fees
{
confirm.labelMinerFee->setText("Miner Fee");
- confirm.minerFee->setText(Settings::getInstance()->getZECDisplayFormat(Utils::getMinerFee()));
+ confirm.minerFee ->setText(Settings::getInstance()->getZECDisplayFormat(Utils::getMinerFee()));
+ confirm.minerFeeUSD ->setText(Settings::getInstance()->getUSDFormat(Utils::getMinerFee()));
if (!devAddress.isEmpty() && Utils::getDevFee() > 0) {
- confirm.labelDevFee->setText("Dev Fee");
- confirm.devFee->setText(Settings::getInstance()->getZECDisplayFormat(Utils::getDevFee()));
+ confirm.labelDevFee ->setText("Dev Fee");
+ confirm.devFee ->setText(Settings::getInstance()->getZECDisplayFormat(Utils::getDevFee()));
+ confirm.devFeeUSD ->setText(Settings::getInstance()->getUSDFormat(Utils::getDevFee()));
} else {
- confirm.labelDevFee->setText("");
- confirm.devFee->setText("");
+ confirm.labelDevFee ->setText("");
+ confirm.devFee ->setText("");
+ confirm.devFeeUSD ->setText("");
}
}
diff --git a/src/settings.cpp b/src/settings.cpp
index be5a85b..1501b96 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -148,24 +148,24 @@ void Settings::setSyncing(bool syncing) {
}
double Settings::getZECPrice() {
- //if (isTestnet())
- // return 0;
- //else
- return zecPrice;
+ return zecPrice;
}
QString Settings::getUSDFormat(double bal) {
- if (getZECPrice() > 0)
+ if (!isTestnet() && getZECPrice() > 0)
return "$" + QString::number(bal * getZECPrice(), 'f', 2);
else
return QString();
}
QString Settings::getZECDisplayFormat(double bal) {
+ return QString::number(bal, 'g', 8) % " " % Utils::getTokenName();
+}
+
+QString Settings::getZECUSDDisplayFormat(double bal) {
auto usdFormat = getUSDFormat(bal);
if (!usdFormat.isEmpty())
- return QString::number(bal, 'g', 8) % " " % Utils::getTokenName() %
- " (" % getUSDFormat(bal) % ")";
+ return getZECDisplayFormat(bal) % " (" % getUSDFormat(bal) % ")";
else
- return QString::number(bal, 'g', 8) % " " % Utils::getTokenName();
+ return getZECDisplayFormat(bal);
}
\ No newline at end of file
diff --git a/src/settings.h b/src/settings.h
index 1768e8d..7c9cd10 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -32,9 +32,11 @@ public:
const QString& getZcashdConfLocation() { return confLocation; }
void setZECPrice(double p) { zecPrice = p; }
- double getZECPrice();
- QString getUSDFormat(double bal);
- QString getZECDisplayFormat(double bal);
+ double getZECPrice();
+
+ QString getUSDFormat (double bal);
+ QString getZECDisplayFormat (double bal);
+ QString getZECUSDDisplayFormat (double bal);
private:
// This class can only be accessed through Settings::getInstance()
diff --git a/src/txtablemodel.cpp b/src/txtablemodel.cpp
index 70a5958..cf82c27 100644
--- a/src/txtablemodel.cpp
+++ b/src/txtablemodel.cpp
@@ -56,7 +56,7 @@ void TxTableModel::setNewData(QList* data) {
case 2: return modeldata->at(index.row()).datetime;
case 3: {
if (role == Qt::DisplayRole)
- return QVariant(QString::number(modeldata->at(index.row()).amount, 'g', 8) % " " % Utils::getTokenName());
+ return Settings::getInstance()->getZECDisplayFormat(modeldata->at(index.row()).amount);
else {
return Settings::getInstance()->getUSDFormat(modeldata->at(index.row()).amount);
}
diff --git a/src/ui_confirm.h b/src/ui_confirm.h
index 05f0771..4e5c62d 100644
--- a/src/ui_confirm.h
+++ b/src/ui_confirm.h
@@ -31,13 +31,16 @@ public:
QLabel *sendFrom;
QGroupBox *sendToAddrs;
QGridLayout *gridLayout;
+ QLabel *devFee;
+ QLabel *Amt1;
+ QLabel *labelDevFee;
QLabel *minerFee;
QLabel *Addr1;
- QLabel *Amt1;
- QLabel *Memo1;
QLabel *labelMinerFee;
- QLabel *labelDevFee;
- QLabel *devFee;
+ QLabel *AmtUSD1;
+ QLabel *Memo1;
+ QLabel *minerFeeUSD;
+ QLabel *devFeeUSD;
QSpacerItem *verticalSpacer;
QFrame *line;
QDialogButtonBox *buttonBox;
@@ -66,6 +69,23 @@ public:
sendToAddrs->setObjectName(QStringLiteral("sendToAddrs"));
gridLayout = new QGridLayout(sendToAddrs);
gridLayout->setObjectName(QStringLiteral("gridLayout"));
+ devFee = new QLabel(sendToAddrs);
+ devFee->setObjectName(QStringLiteral("devFee"));
+ devFee->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
+
+ gridLayout->addWidget(devFee, 3, 1, 1, 1);
+
+ Amt1 = new QLabel(sendToAddrs);
+ Amt1->setObjectName(QStringLiteral("Amt1"));
+ Amt1->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
+
+ gridLayout->addWidget(Amt1, 0, 1, 1, 1);
+
+ labelDevFee = new QLabel(sendToAddrs);
+ labelDevFee->setObjectName(QStringLiteral("labelDevFee"));
+
+ gridLayout->addWidget(labelDevFee, 3, 0, 1, 1);
+
minerFee = new QLabel(sendToAddrs);
minerFee->setObjectName(QStringLiteral("minerFee"));
minerFee->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
@@ -78,32 +98,33 @@ public:
gridLayout->addWidget(Addr1, 0, 0, 1, 1);
- Amt1 = new QLabel(sendToAddrs);
- Amt1->setObjectName(QStringLiteral("Amt1"));
- Amt1->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
-
- gridLayout->addWidget(Amt1, 0, 1, 1, 1);
-
- Memo1 = new QLabel(sendToAddrs);
- Memo1->setObjectName(QStringLiteral("Memo1"));
-
- gridLayout->addWidget(Memo1, 1, 0, 1, 2);
-
labelMinerFee = new QLabel(sendToAddrs);
labelMinerFee->setObjectName(QStringLiteral("labelMinerFee"));
gridLayout->addWidget(labelMinerFee, 2, 0, 1, 1);
- labelDevFee = new QLabel(sendToAddrs);
- labelDevFee->setObjectName(QStringLiteral("labelDevFee"));
+ AmtUSD1 = new QLabel(sendToAddrs);
+ AmtUSD1->setObjectName(QStringLiteral("AmtUSD1"));
+ AmtUSD1->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
- gridLayout->addWidget(labelDevFee, 3, 0, 1, 1);
+ gridLayout->addWidget(AmtUSD1, 0, 2, 1, 1);
- devFee = new QLabel(sendToAddrs);
- devFee->setObjectName(QStringLiteral("devFee"));
- devFee->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
+ Memo1 = new QLabel(sendToAddrs);
+ Memo1->setObjectName(QStringLiteral("Memo1"));
- gridLayout->addWidget(devFee, 3, 1, 1, 1);
+ gridLayout->addWidget(Memo1, 1, 0, 1, 3);
+
+ minerFeeUSD = new QLabel(sendToAddrs);
+ minerFeeUSD->setObjectName(QStringLiteral("minerFeeUSD"));
+ minerFeeUSD->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
+
+ gridLayout->addWidget(minerFeeUSD, 2, 2, 1, 1);
+
+ devFeeUSD = new QLabel(sendToAddrs);
+ devFeeUSD->setObjectName(QStringLiteral("devFeeUSD"));
+ devFeeUSD->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
+
+ gridLayout->addWidget(devFeeUSD, 3, 2, 1, 1);
verticalLayout->addWidget(sendToAddrs);
@@ -140,13 +161,16 @@ public:
groupBox->setTitle(QApplication::translate("confirm", "From", nullptr));
sendFrom->setText(QString());
sendToAddrs->setTitle(QApplication::translate("confirm", "To", nullptr));
+ devFee->setText(QApplication::translate("confirm", "Dev Fee Amount", nullptr));
+ Amt1->setText(QApplication::translate("confirm", "TextLabel", nullptr));
+ labelDevFee->setText(QApplication::translate("confirm", "Dev Fee", nullptr));
minerFee->setText(QApplication::translate("confirm", "Miner Amount", nullptr));
Addr1->setText(QApplication::translate("confirm", "TextLabel", nullptr));
- Amt1->setText(QApplication::translate("confirm", "TextLabel", nullptr));
- Memo1->setText(QApplication::translate("confirm", "TextLabel", nullptr));
labelMinerFee->setText(QApplication::translate("confirm", "Miner Fee", nullptr));
- labelDevFee->setText(QApplication::translate("confirm", "Dev Fee", nullptr));
- devFee->setText(QApplication::translate("confirm", "Dev Fee Amount", nullptr));
+ AmtUSD1->setText(QApplication::translate("confirm", "TextLabel", nullptr));
+ Memo1->setText(QApplication::translate("confirm", "TextLabel", nullptr));
+ minerFeeUSD->setText(QApplication::translate("confirm", "TextLabel", nullptr));
+ devFeeUSD->setText(QApplication::translate("confirm", "TextLabel", nullptr));
} // retranslateUi
};
diff --git a/src/ui_mainwindow.h b/src/ui_mainwindow.h
index e126a9b..63ed96b 100644
--- a/src/ui_mainwindow.h
+++ b/src/ui_mainwindow.h
@@ -80,6 +80,7 @@ public:
QHBoxLayout *horizontalLayout_15;
QLabel *label_5;
QLineEdit *sendAddressBalance;
+ QLabel *sendAddressBalanceUSD;
QSpacerItem *horizontalSpacer_6;
QGroupBox *groupBox_3;
QVBoxLayout *verticalLayout_3;
@@ -106,6 +107,7 @@ public:
QHBoxLayout *horizontalLayout_14;
QLabel *label_7;
QLineEdit *sendTxFees;
+ QLabel *sendTxFeesUSD;
QSpacerItem *horizontalSpacer_5;
QHBoxLayout *horizontalLayout_6;
QSpacerItem *horizontalSpacer;
@@ -330,6 +332,11 @@ public:
horizontalLayout_15->addWidget(sendAddressBalance);
+ sendAddressBalanceUSD = new QLabel(groupBox_4);
+ sendAddressBalanceUSD->setObjectName(QStringLiteral("sendAddressBalanceUSD"));
+
+ horizontalLayout_15->addWidget(sendAddressBalanceUSD);
+
horizontalSpacer_6 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
horizontalLayout_15->addItem(horizontalSpacer_6);
@@ -471,6 +478,11 @@ public:
horizontalLayout_14->addWidget(sendTxFees);
+ sendTxFeesUSD = new QLabel(tab_2);
+ sendTxFeesUSD->setObjectName(QStringLiteral("sendTxFeesUSD"));
+
+ horizontalLayout_14->addWidget(sendTxFeesUSD);
+
horizontalSpacer_5 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
horizontalLayout_14->addItem(horizontalSpacer_5);
@@ -647,7 +659,7 @@ public:
retranslateUi(MainWindow);
- tabWidget->setCurrentIndex(2);
+ tabWidget->setCurrentIndex(1);
QMetaObject::connectSlotsByName(MainWindow);
@@ -674,6 +686,7 @@ public:
tabWidget->setTabText(tabWidget->indexOf(tab), QApplication::translate("MainWindow", "Balance", nullptr));
groupBox_4->setTitle(QApplication::translate("MainWindow", "Pay From", nullptr));
label_5->setText(QApplication::translate("MainWindow", "Address Balance", nullptr));
+ sendAddressBalanceUSD->setText(QString());
groupBox_3->setTitle(QApplication::translate("MainWindow", "Send To", nullptr));
verticalGroupBox->setTitle(QApplication::translate("MainWindow", "Recipient", nullptr));
label_4->setText(QApplication::translate("MainWindow", "Address", nullptr));
@@ -689,6 +702,7 @@ public:
addAddressButton->setText(QApplication::translate("MainWindow", "Add Address", nullptr));
label_7->setText(QApplication::translate("MainWindow", "Fee", nullptr));
sendTxFees->setText(QString());
+ sendTxFeesUSD->setText(QApplication::translate("MainWindow", "TextLabel", nullptr));
sendTransactionButton->setText(QApplication::translate("MainWindow", "Send", nullptr));
cancelSendButton->setText(QApplication::translate("MainWindow", "Cancel", nullptr));
tabWidget->setTabText(tabWidget->indexOf(tab_2), QApplication::translate("MainWindow", "Send", nullptr));