From f31fe35613aca62253799278f3dd4d9ae96c5f62 Mon Sep 17 00:00:00 2001 From: DenioD Date: Sat, 26 Oct 2019 16:27:56 +0200 Subject: [PATCH] fix bug with Balances --- .gitignore | 6 +++--- res/zec_qt_wallet_template.ts | 14 +++++++------- res/zec_qt_wallet_tr.ts | 18 +++++++++--------- src/controller.cpp | 22 +++++++++++----------- src/mainwindow.cpp | 2 +- src/recurring.cpp | 4 ++-- src/requestdialog.cpp | 6 +++--- src/scripts/dobuild.ps1 | 20 ++++++++++---------- src/scripts/dotranslations.sh | 2 +- src/scripts/dounifiedbuild.ps1 | 2 +- src/scripts/mkmacdmg.sh | 2 +- src/scripts/mkrelease.sh | 14 +++++++------- src/scripts/mkwininstaller.ps1 | 6 +++--- src/scripts/zec-qt-wallet.wxs | 10 +++++----- src/sendtab.cpp | 14 +++++++------- src/settings.cpp | 3 --- src/settings.h | 2 +- src/txtablemodel.cpp | 2 +- src/websockets.cpp | 2 +- 19 files changed, 74 insertions(+), 77 deletions(-) diff --git a/.gitignore b/.gitignore index c299741..104bfd1 100644 --- a/.gitignore +++ b/.gitignore @@ -22,9 +22,9 @@ silentdragon-lite.pro.user /Makefile /Makefile.* qrc_application.cpp -hush-qt-wallet_plugin_import.cpp +silentdragonlite_plugin_import.cpp silentdragon_plugin_import.cpp -hush-qt-wallet_resource* +silentdragonlite_resource* silentdragon_resource* workspace.code-workspace *.zip @@ -36,4 +36,4 @@ hushd IDEWorkspaceChecks.plist *.sln node_modules -hush-qt-wallet.pro.user.4.10-pre1 +silentdragonlite.pro.user.4.10-pre1 diff --git a/res/zec_qt_wallet_template.ts b/res/zec_qt_wallet_template.ts index 0f895c2..99b3922 100644 --- a/res/zec_qt_wallet_template.ts +++ b/res/zec_qt_wallet_template.ts @@ -18,7 +18,7 @@ ConnectionDialog - hush-qt-wallet + silentdragonlite YOUR_TRANSLATION_HERE @@ -31,7 +31,7 @@ MainWindow - hush-qt-wallet + silentdragonlite YOUR_TRANSLATION_HERE @@ -345,7 +345,7 @@ - Thanks for supporting hush-qt-wallet! + Thanks for supporting silentdragonlite! YOUR_TRANSLATION_HERE @@ -355,7 +355,7 @@ - to support hush-qt-wallet + to support silentdragonlite YOUR_TRANSLATION_HERE @@ -592,9 +592,9 @@ doesn't look like a z-address - You have hushd set to start as a daemon, which can cause problems with hush-qt-wallet + You have hushd set to start as a daemon, which can cause problems with silentdragonlite -.Please remove the following line from your hush.conf and restart hush-qt-wallet +.Please remove the following line from your hush.conf and restart silentdragonlite daemon=1 YOUR_TRANSLATION_HERE @@ -714,7 +714,7 @@ Not starting embedded hushd because --no-embedded was passed - Please wait for hush-qt-wallet to exit + Please wait for silentdragonlite to exit YOUR_TRANSLATION_HERE diff --git a/res/zec_qt_wallet_tr.ts b/res/zec_qt_wallet_tr.ts index 0887e3f..4cef86d 100644 --- a/res/zec_qt_wallet_tr.ts +++ b/res/zec_qt_wallet_tr.ts @@ -30,7 +30,7 @@ ConnectionDialog - hush-qt-wallet + silentdragonlite silentdragon @@ -47,7 +47,7 @@ MainWindow - hush-qt-wallet + silentdragonlite silentdragon @@ -456,7 +456,7 @@ wallet.dat dosyasını yedekle - Thanks for supporting hush-qt-wallet! + Thanks for supporting silentdragonlite! silentdragon'i desteklediğiniz için teşekkür ederiz! @@ -464,7 +464,7 @@ 0.01 Bağış yap - to support hush-qt-wallet + to support silentdragonlite 0.01 Bağış yap yazısının devamı ve silentdragon'i destekle @@ -995,11 +995,11 @@ z-adres'i gibi görünmüyor hushd bekleniyor - You have hushd set to start as a daemon, which can cause problems with hush-qt-wallet + You have hushd set to start as a daemon, which can cause problems with silentdragonlite -.Please remove the following line from your hush.conf and restart hush-qt-wallet +.Please remove the following line from your hush.conf and restart silentdragonlite daemon=1 - hushd, hush-qt-wallet ile sorunlara neden olan bir daemon olarak başlayacak şekilde ayarladınız. + hushd, silentdragonlite ile sorunlara neden olan bir daemon olarak başlayacak şekilde ayarladınız. .Lütfen aşağıdaki satırı hush.conf dosyanızdan kaldırın ve silentdragon'i yeniden başlatın daemon=1 @@ -1045,7 +1045,7 @@ Not starting embedded hushd because --no-embedded was passed .Please remove the following line from your hush.conf and restart silentdragon daemon=1 - hushd'yi, hush-qt-wallet ile sorunlara neden olabilecek bir daemon olacak şekilde ayarladınız. + hushd'yi, silentdragonlite ile sorunlara neden olabilecek bir daemon olacak şekilde ayarladınız. .Lütfen aşağıdaki satırı hush.conf dosyanızdan kaldırın ve silentdragon'i yeniden başlatın daemon=1 @@ -1205,7 +1205,7 @@ Yayınlanan sürümler sayfasını ziyaret etmek ister misiniz? tx hesaplanıyor. Bu birkaç dakika sürebilir. - Please wait for hush-qt-wallet to exit + Please wait for silentdragonlite to exit Lütfen çıkmak için silentdragon'i bekleyin diff --git a/src/controller.cpp b/src/controller.cpp index 562096b..9c319ec 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -96,7 +96,7 @@ void Controller::fillTxJsonParams(json& allRecepients, Tx tx) { // Construct the JSON params json rec = json::object(); rec["address"] = toAddr.addr.toStdString(); - rec["amount"] = toAddr.amount * 10000000; + rec["amount"] = toAddr.amount * 100000000; if (Settings::isZAddress(toAddr.addr) && !toAddr.memo.trimmed().isEmpty()) rec["memo"] = toAddr.memo.toStdString(); @@ -267,7 +267,7 @@ bool Controller::processUnspent(const json& reply, QMap* balanc newUtxos->push_back(UnspentOutput{ qsAddr, txid, amount, block, true }); - (*balancesMap)[qsAddr] = ((*balancesMap)[qsAddr] + (it["value"].get()) /10000000); + (*balancesMap)[qsAddr] = ((*balancesMap)[qsAddr] + (it["value"].get()) /100000000); } }; @@ -289,14 +289,14 @@ void Controller::refreshBalances() { AppDataModel::getInstance()->setBalances(balT, balZ); - ui->balSheilded ->setText(Settings::gethushDisplayFormat(balZ /10000000)); - ui->balTransparent->setText(Settings::gethushDisplayFormat(balT /10000000)); - ui->balTotal ->setText(Settings::gethushDisplayFormat(balTotal /10000000)); + ui->balSheilded ->setText(Settings::gethushDisplayFormat(balZ /100000000)); + ui->balTransparent->setText(Settings::gethushDisplayFormat(balT /100000000)); + ui->balTotal ->setText(Settings::gethushDisplayFormat(balTotal /100000000)); - ui->balSheilded ->setToolTip(Settings::gethushDisplayFormat(balZ /10000000)); - ui->balTransparent->setToolTip(Settings::gethushDisplayFormat(balT /10000000)); - ui->balTotal ->setToolTip(Settings::gethushDisplayFormat(balTotal /10000000)); + ui->balSheilded ->setToolTip(Settings::gethushDisplayFormat(balZ /100000000)); + ui->balTransparent->setToolTip(Settings::gethushDisplayFormat(balT /100000000)); + ui->balTotal ->setToolTip(Settings::gethushDisplayFormat(balTotal /100000000)); }); @@ -337,7 +337,7 @@ void Controller::refreshTransactions() { for (auto o: it["outgoing_metadata"].get()) { QString address = QString::fromStdString(o["address"]); - double amount = -1 * o ["value"].get() /10000000; // Sent items are -ve + double amount = -1 * o ["value"].get() /100000000; // Sent items are -ve QString memo; if (!o["memo"].is_null()) { @@ -369,8 +369,8 @@ void Controller::refreshTransactions() { items.push_back(TransactionItemDetail{ address, - it["amount"].get() /10000000, - "." + it["amount"].get() /100000000, + "" }); TransactionItem tx{ diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 10fde0f..0b44cd7 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -39,7 +39,7 @@ MainWindow::MainWindow(QWidget *parent) : ui->setupUi(this); - logger = new Logger(this, QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("hush-qt-wallet.log")); + logger = new Logger(this, QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite-debug.log")); // Status Bar setupStatusBar(); diff --git a/src/recurring.cpp b/src/recurring.cpp index 403af79..1550d37 100644 --- a/src/recurring.cpp +++ b/src/recurring.cpp @@ -135,7 +135,7 @@ RecurringPaymentInfo* Recurring::getNewRecurringFromTx(QWidget* parent, MainWind ui.lblTo->setText(tx.toAddrs[0].addr); // Default is USD - ui.lblAmt->setText(Settings::getUSDFromhushAmount(tx.toAddrs[0].amount)); + ui.lblAmt->setText(Settings::getUSDFormat(tx.toAddrs[0].amount)); ui.txtMemo->setPlainText(tx.toAddrs[0].memo); ui.txtMemo->setEnabled(false); @@ -147,7 +147,7 @@ RecurringPaymentInfo* Recurring::getNewRecurringFromTx(QWidget* parent, MainWind return; if (c == "USD") { - ui.lblAmt->setText(Settings::getUSDFromhushAmount(tx.toAddrs[0].amount)); + ui.lblAmt->setText(Settings::getUSDFormat(tx.toAddrs[0].amount)); } else { ui.lblAmt->setText(Settings::getDecimalString(tx.toAddrs[0].amount)); diff --git a/src/requestdialog.cpp b/src/requestdialog.cpp index 28806cc..5a32155 100644 --- a/src/requestdialog.cpp +++ b/src/requestdialog.cpp @@ -73,7 +73,7 @@ void RequestDialog::showPaymentConfirmation(MainWindow* main, QString paymentURI req.txtFrom->setText(payInfo.addr); req.txtMemo->setPlainText(payInfo.memo); req.txtAmount->setText(payInfo.amt); - req.txtAmountUSD->setText(Settings::getUSDFromhushAmount(req.txtAmount->text().toDouble())); + req.txtAmountUSD->setText(Settings::getUSDFormat(req.txtAmount->text().toDouble())); req.buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Pay")); @@ -112,9 +112,9 @@ void RequestDialog::showRequesthush(MainWindow* main) { // Amount textbox req.txtAmount->setValidator(main->getAmountValidator()); QObject::connect(req.txtAmount, &QLineEdit::textChanged, [=] (auto text) { - req.txtAmountUSD->setText(Settings::getUSDFromhushAmount(text.toDouble())); + req.txtAmountUSD->setText(Settings::getUSDFormat(text.toDouble())); }); - req.txtAmountUSD->setText(Settings::getUSDFromhushAmount(req.txtAmount->text().toDouble())); + req.txtAmountUSD->setText(Settings::getUSDFormat(req.txtAmount->text().toDouble())); req.txtMemo->setAcceptButton(req.buttonBox->button(QDialogButtonBox::Ok)); req.txtMemo->setLenDisplayLabel(req.lblMemoLen); diff --git a/src/scripts/dobuild.ps1 b/src/scripts/dobuild.ps1 index 81ecce4..7382819 100644 --- a/src/scripts/dobuild.ps1 +++ b/src/scripts/dobuild.ps1 @@ -6,11 +6,11 @@ param ( ) Write-Host "[Initializing]" -Remove-Item -Force -ErrorAction Ignore ./artifacts/linux-binaries-hush-qt-wallet-v$version.tar.gz -Remove-Item -Force -ErrorAction Ignore ./artifacts/linux-deb-hush-qt-wallet-v$version.deb -Remove-Item -Force -ErrorAction Ignore ./artifacts/Windows-binaries-hush-qt-wallet-v$version.zip -Remove-Item -Force -ErrorAction Ignore ./artifacts/Windows-installer-hush-qt-wallet-v$version.msi -Remove-Item -Force -ErrorAction Ignore ./artifacts/macOS-hush-qt-wallet-v$version.dmg +Remove-Item -Force -ErrorAction Ignore ./artifacts/linux-binaries-silentdragonlite-v$version.tar.gz +Remove-Item -Force -ErrorAction Ignore ./artifacts/linux-deb-silentdragonlite-v$version.deb +Remove-Item -Force -ErrorAction Ignore ./artifacts/Windows-binaries-silentdragonlite-v$version.zip +Remove-Item -Force -ErrorAction Ignore ./artifacts/Windows-installer-silentdragonlite-v$version.msi +Remove-Item -Force -ErrorAction Ignore ./artifacts/macOS-silentdragonlite-v$version.dmg Remove-Item -Recurse -Force -ErrorAction Ignore ./bin Remove-Item -Recurse -Force -ErrorAction Ignore ./debug @@ -26,7 +26,7 @@ Write-Host "[Building Linux + Windows]" Write-Host -NoNewline "Copying files.........." ssh $server "rm -rf /tmp/zqwbuild" ssh $server "mkdir /tmp/zqwbuild" -scp -r src/ res/ ./hush-qt-wallet.pro ./application.qrc ./LICENSE ./README.md ${server}:/tmp/zqwbuild/ | Out-Null +scp -r src/ res/ ./silentdragonlite.pro ./application.qrc ./LICENSE ./README.md ${server}:/tmp/zqwbuild/ | Out-Null ssh $server "dos2unix -q /tmp/zqwbuild/src/scripts/mkrelease.sh" | Out-Null ssh $server "dos2unix -q /tmp/zqwbuild/src/version.h" Write-Host "[OK]" @@ -51,10 +51,10 @@ Write-Host "[OK]" # Finally, test to make sure all files exist Write-Host -NoNewline "Checking Build........." -if (! (Test-Path ./artifacts/linux-binaries-hush-qt-wallet-v$version.tar.gz) -or - ! (Test-Path ./artifacts/linux-deb-hush-qt-wallet-v$version.deb) -or - ! (Test-Path ./artifacts/Windows-binaries-hush-qt-wallet-v$version.zip) -or - ! (Test-Path ./artifacts/Windows-installer-hush-qt-wallet-v$version.msi) ) { +if (! (Test-Path ./artifacts/linux-binaries-silentdragonlite-v$version.tar.gz) -or + ! (Test-Path ./artifacts/linux-deb-silentdragonlite-v$version.deb) -or + ! (Test-Path ./artifacts/Windows-binaries-silentdragonlite-v$version.zip) -or + ! (Test-Path ./artifacts/Windows-installer-silentdragonlite-v$version.msi) ) { Write-Host "[Error]" exit 1; } diff --git a/src/scripts/dotranslations.sh b/src/scripts/dotranslations.sh index eb7a698..70ff51c 100755 --- a/src/scripts/dotranslations.sh +++ b/src/scripts/dotranslations.sh @@ -6,7 +6,7 @@ if [ -z $QT_STATIC ]; then fi rm -f res/*.qm -$QT_STATIC/bin/lrelease hush-qt-wallet.pro +$QT_STATIC/bin/lrelease silentdragonlite.pro # Then update the qt base translations. First, get all languages ls res/*.qm | awk -F '[_.]' '{print $4}' | while read -r language ; do diff --git a/src/scripts/dounifiedbuild.ps1 b/src/scripts/dounifiedbuild.ps1 index 9afd459..d9b1a16 100644 --- a/src/scripts/dounifiedbuild.ps1 +++ b/src/scripts/dounifiedbuild.ps1 @@ -39,7 +39,7 @@ Write-Host "[Building Linux + Windows]" Write-Host -NoNewline "Copying files.........." ssh $server "rm -rf /tmp/zqwbuild" ssh $server "mkdir /tmp/zqwbuild" -scp -r src/ singleapplication/ res/ ./hush-qt-wallet.pro ./application.qrc ./LICENSE ./README.md ${server}:/tmp/zqwbuild/ | Out-Null +scp -r src/ singleapplication/ res/ ./silentdragonlite.pro ./application.qrc ./LICENSE ./README.md ${server}:/tmp/zqwbuild/ | Out-Null ssh $server "dos2unix -q /tmp/zqwbuild/src/scripts/mkrelease.sh" | Out-Null ssh $server "dos2unix -q /tmp/zqwbuild/src/version.h" Write-Host "[OK]" diff --git a/src/scripts/mkmacdmg.sh b/src/scripts/mkmacdmg.sh index 3d8fe43..efdfe1e 100755 --- a/src/scripts/mkmacdmg.sh +++ b/src/scripts/mkmacdmg.sh @@ -67,7 +67,7 @@ echo "[OK]" echo -n "Configuring............" # Build QT_STATIC=$QT_PATH src/scripts/dotranslations.sh >/dev/null -$QT_PATH/bin/qmake hush-qt-wallet.pro CONFIG+=release >/dev/null +$QT_PATH/bin/qmake silentdragonlite.pro CONFIG+=release >/dev/null echo "[OK]" diff --git a/src/scripts/mkrelease.sh b/src/scripts/mkrelease.sh index f3203e0..1cbe960 100755 --- a/src/scripts/mkrelease.sh +++ b/src/scripts/mkrelease.sh @@ -43,7 +43,7 @@ fi echo -n "Version files.........." # Replace the version number in the .pro file so it gets picked up everywhere -sed -i "s/${PREV_VERSION}/${APP_VERSION}/g" hush-qt-wallet.pro > /dev/null +sed -i "s/${PREV_VERSION}/${APP_VERSION}/g" silentdragonlite.pro > /dev/null # Also update it in the README.md sed -i "s/${PREV_VERSION}/${APP_VERSION}/g" README.md > /dev/null @@ -60,12 +60,12 @@ echo "[Building on" `lsb_release -r`"]" echo -n "Configuring............" QT_STATIC=$QT_STATIC bash src/scripts/dotranslations.sh >/dev/null -$QT_STATIC/bin/qmake hush-qt-wallet.pro -spec linux-clang CONFIG+=release > /dev/null +$QT_STATIC/bin/qmake silentdragonlite.pro -spec linux-clang CONFIG+=release > /dev/null echo "[OK]" echo -n "Building..............." -rm -rf bin/hush-qt-wallet* > /dev/null +rm -rf bin/silentdragonlite* > /dev/null rm -rf bin/silentdragon* > /dev/null make clean > /dev/null make -j$(nproc) > /dev/null @@ -128,7 +128,7 @@ mkdir -p $debdir/usr/share/pixmaps/ cp res/silentdragon.xpm $debdir/usr/share/pixmaps/ mkdir -p $debdir/usr/share/applications -cp src/scripts/desktopentry $debdir/usr/share/applications/hush-qt-wallet.desktop +cp src/scripts/desktopentry $debdir/usr/share/applications/silentdragonlite.desktop dpkg-deb --build $debdir >/dev/null cp $debdir.deb artifacts/linux-deb-silentdragon-v$APP_VERSION.deb @@ -160,15 +160,15 @@ export PATH=$MXE_PATH:$PATH echo -n "Configuring............" make clean > /dev/null -rm -f hush-qt-wallet-mingw.pro +rm -f silentdragonlite-mingw.pro rm -rf release/ #Mingw seems to have trouble with precompiled headers, so strip that option from the .pro file -cat hush-qt-wallet.pro | sed "s/precompile_header/release/g" | sed "s/PRECOMPILED_HEADER.*//g" > hush-qt-wallet-mingw.pro +cat silentdragonlite.pro | sed "s/precompile_header/release/g" | sed "s/PRECOMPILED_HEADER.*//g" > silentdragonlite-mingw.pro echo "[OK]" echo -n "Building..............." -x86_64-w64-mingw32.static-qmake-qt5 hush-qt-wallet-mingw.pro CONFIG+=release > /dev/null +x86_64-w64-mingw32.static-qmake-qt5 silentdragonlite-mingw.pro CONFIG+=release > /dev/null make -j32 > /dev/null echo "[OK]" diff --git a/src/scripts/mkwininstaller.ps1 b/src/scripts/mkwininstaller.ps1 index a3bc73b..1ca536a 100644 --- a/src/scripts/mkwininstaller.ps1 +++ b/src/scripts/mkwininstaller.ps1 @@ -13,14 +13,14 @@ Copy-Item release/$target/README.md release/wininstaller/ Copy-Item release/$target/hushd.exe release/wininstaller/ Copy-Item release/$target/hush-cli.exe release/wininstaller/ -Get-Content src/scripts/hush-qt-wallet.wxs | ForEach-Object { $_ -replace "RELEASE_VERSION", "$version" } | Out-File -Encoding utf8 release/wininstaller/hush-qt-wallet.wxs +Get-Content src/scripts/silentdragonlite.wxs | ForEach-Object { $_ -replace "RELEASE_VERSION", "$version" } | Out-File -Encoding utf8 release/wininstaller/silentdragonlite.wxs -candle.exe release/wininstaller/hush-qt-wallet.wxs -o release/wininstaller/hush-qt-wallet.wixobj +candle.exe release/wininstaller/silentdragonlite.wxs -o release/wininstaller/silentdragonlite.wixobj if (!$?) { exit 1; } -light.exe -ext WixUIExtension -cultures:en-us release/wininstaller/hush-qt-wallet.wixobj -out release/wininstaller/silentdragon.msi +light.exe -ext WixUIExtension -cultures:en-us release/wininstaller/silentdragonlite.wixobj -out release/wininstaller/silentdragon.msi if (!$?) { exit 1; } diff --git a/src/scripts/zec-qt-wallet.wxs b/src/scripts/zec-qt-wallet.wxs index e248fbe..1f9ad6c 100644 --- a/src/scripts/zec-qt-wallet.wxs +++ b/src/scripts/zec-qt-wallet.wxs @@ -1,6 +1,6 @@ - + @@ -9,7 +9,7 @@ - + @@ -37,13 +37,13 @@ - + - + - diff --git a/src/sendtab.cpp b/src/sendtab.cpp index ac0a9f4..7f8d809 100644 --- a/src/sendtab.cpp +++ b/src/sendtab.cpp @@ -62,7 +62,7 @@ void MainWindow::setupSendTab() { // Disable custom fees if settings say no ui->minerFeeAmt->setReadOnly(!Settings::getInstance()->getAllowCustomFees()); QObject::connect(ui->minerFeeAmt, &QLineEdit::textChanged, [=](auto txt) { - ui->lblMinerFeeUSD->setText(Settings::getUSDFromhushAmount(txt.toDouble())); + ui->lblMinerFeeUSD->setText(Settings::getUSDFormat(txt.toDouble())); }); ui->minerFeeAmt->setText(Settings::getDecimalString(Settings::getMinerFee())); @@ -70,7 +70,7 @@ void MainWindow::setupSendTab() { QObject::connect(ui->tabWidget, &QTabWidget::currentChanged, [=] (int pos) { if (pos == 1) { QString txt = ui->minerFeeAmt->text(); - ui->lblMinerFeeUSD->setText(Settings::getUSDFromhushAmount(txt.toDouble())); + ui->lblMinerFeeUSD->setText(Settings::getUSDFormat(txt.toDouble())); } }); @@ -228,7 +228,7 @@ void MainWindow::inputComboTextChanged(int index) { auto balFmt = Settings::gethushDisplayFormat(bal); ui->sendAddressBalance->setText(balFmt); - ui->sendAddressBalanceUSD->setText(Settings::getUSDFromhushAmount(bal)); + ui->sendAddressBalanceUSD->setText(Settings::getUSDFormat(bal)); } @@ -341,7 +341,7 @@ void MainWindow::addressChanged(int itemNumber, const QString& text) { void MainWindow::amountChanged(int item, const QString& text) { auto usd = ui->sendToWidgets->findChild(QString("AmtUSD") % QString::number(item)); - usd->setText(Settings::getUSDFromhushAmount(text.toDouble())); + usd->setText(Settings::getUSDFormat(text.toDouble())); // If there is a recurring payment, update the info there as well if (sendTxRecurringInfo != nullptr) { @@ -545,7 +545,7 @@ Tx MainWindow::createTxFromSendPage() { if (Settings::getDecimalString(change) != "0") { QString changeMemo = tr("Change from ") + tx.fromAddr; - tx.toAddrs.push_back(ToFields{ *saplingAddr, change, changeMemo }); + tx.toAddrs.push_back(ToFields{ *saplingAddr, change, changeMemo}); } } } @@ -639,7 +639,7 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) { // Amount (USD) auto AmtUSD = new QLabel(confirm.sendToAddrs); AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1)); - AmtUSD->setText(Settings::getUSDFromhushAmount(toAddr.amount)); + AmtUSD->setText(Settings::getUSDFormat(toAddr.amount)); AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter); confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1); @@ -690,7 +690,7 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) { minerFeeUSD->setObjectName(QStringLiteral("minerFeeUSD")); minerFeeUSD->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); confirm.gridLayout->addWidget(minerFeeUSD, row, 2, 1, 1); - minerFeeUSD->setText(Settings::getUSDFromhushAmount(tx.fee)); + minerFeeUSD->setText(Settings::getUSDFormat(tx.fee)); if (Settings::getInstance()->getAllowCustomFees() && tx.fee != Settings::getMinerFee()) { confirm.warningLabel->setVisible(true); diff --git a/src/settings.cpp b/src/settings.cpp index baea9c1..5db8d8f 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -216,9 +216,6 @@ void Settings::openTxInExplorer(QString txid) { -QString Settings::getUSDFromhushAmount(double bal) { - return getUSDFormat(bal * Settings::getInstance()->gethushPrice()); -} QString Settings::getUSDFormat(double bal) { return "$" + QLocale(QLocale::English).toString(bal * Settings::getInstance()->gethushPrice(), 'f', 2); diff --git a/src/settings.h b/src/settings.h index d1af60f..fec56e1 100644 --- a/src/settings.h +++ b/src/settings.h @@ -101,7 +101,7 @@ public: static QString getDecimalString(double amt); static QString getUSDFormat(double bal); - static QString getUSDFromhushAmount(double bal); + static QString gethushDisplayFormat(double bal); static QString gethushUSDDisplayFormat(double bal); diff --git a/src/txtablemodel.cpp b/src/txtablemodel.cpp index 44384c5..7676f2c 100644 --- a/src/txtablemodel.cpp +++ b/src/txtablemodel.cpp @@ -145,7 +145,7 @@ bool TxTableModel::exportToCsv(QString fileName) const { for (int i=0; i < dat.items.length(); i++) { total += dat.items[i].amount; } - return Settings::getInstance()->getUSDFromhushAmount(total); + return Settings::getInstance()->getUSDFormat(total); } } } diff --git a/src/websockets.cpp b/src/websockets.cpp index 27c6772..6463fc5 100644 --- a/src/websockets.cpp +++ b/src/websockets.cpp @@ -682,7 +682,7 @@ void AppDataServer::processSendTx(QJsonObject sendTx, MainWindow* mainwindow, st return a.first > b.first; }); - tx.fromAddr = bals[0].first; + tx.fromAddr = bals[0].first; tx.toAddrs = { ToFields{ sendTx["to"].toString(), amt, sendTx["memo"].toString()} }; // TODO: Respect the autoshield change setting