Browse Source

fix bug with Balances

pull/14/head
DenioD 5 years ago
parent
commit
f31fe35613
  1. 6
      .gitignore
  2. 14
      res/zec_qt_wallet_template.ts
  3. 18
      res/zec_qt_wallet_tr.ts
  4. 22
      src/controller.cpp
  5. 2
      src/mainwindow.cpp
  6. 4
      src/recurring.cpp
  7. 6
      src/requestdialog.cpp
  8. 20
      src/scripts/dobuild.ps1
  9. 2
      src/scripts/dotranslations.sh
  10. 2
      src/scripts/dounifiedbuild.ps1
  11. 2
      src/scripts/mkmacdmg.sh
  12. 14
      src/scripts/mkrelease.sh
  13. 6
      src/scripts/mkwininstaller.ps1
  14. 10
      src/scripts/zec-qt-wallet.wxs
  15. 14
      src/sendtab.cpp
  16. 3
      src/settings.cpp
  17. 2
      src/settings.h
  18. 2
      src/txtablemodel.cpp
  19. 2
      src/websockets.cpp

6
.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

14
res/zec_qt_wallet_template.ts

@ -18,7 +18,7 @@
<name>ConnectionDialog</name>
<message>
<location filename="../src/connection.ui" line="17"/>
<source>hush-qt-wallet</source>
<source>silentdragonlite</source>
<translation type="unfinished">YOUR_TRANSLATION_HERE</translation>
</message>
<message>
@ -31,7 +31,7 @@
<name>MainWindow</name>
<message>
<location filename="../src/mainwindow.ui" line="14"/>
<source>hush-qt-wallet</source>
<source>silentdragonlite</source>
<translation type="unfinished">YOUR_TRANSLATION_HERE</translation>
</message>
<message>
@ -345,7 +345,7 @@
</message>
<message>
<location filename="../src/mainwindow.cpp" line="471"/>
<source>Thanks for supporting hush-qt-wallet!</source>
<source>Thanks for supporting silentdragonlite!</source>
<translation type="unfinished">YOUR_TRANSLATION_HERE</translation>
</message>
<message>
@ -355,7 +355,7 @@
</message>
<message>
<location filename="../src/mainwindow.cpp" line="473"/>
<source> to support hush-qt-wallet</source>
<source> to support silentdragonlite</source>
<translation type="unfinished">YOUR_TRANSLATION_HERE</translation>
</message>
<message>
@ -592,9 +592,9 @@ doesn&apos;t look like a z-address</source>
</message>
<message>
<location filename="../src/connection.cpp" line="75"/>
<source>You have hushd set to start as a daemon, which can cause problems with hush-qt-wallet
<source>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</source>
<translation type="unfinished">YOUR_TRANSLATION_HERE</translation>
</message>
@ -714,7 +714,7 @@ Not starting embedded hushd because --no-embedded was passed</source>
</message>
<message>
<location filename="../src/rpc.cpp" line="953"/>
<source>Please wait for hush-qt-wallet to exit</source>
<source>Please wait for silentdragonlite to exit</source>
<translation type="unfinished">YOUR_TRANSLATION_HERE</translation>
</message>
<message>

18
res/zec_qt_wallet_tr.ts

@ -30,7 +30,7 @@
<context>
<name>ConnectionDialog</name>
<message>
<source>hush-qt-wallet</source>
<source>silentdragonlite</source>
<translation type="vanished">silentdragon</translation>
</message>
<message>
@ -47,7 +47,7 @@
<context>
<name>MainWindow</name>
<message>
<source>hush-qt-wallet</source>
<source>silentdragonlite</source>
<translation type="vanished">silentdragon</translation>
</message>
<message>
@ -456,7 +456,7 @@
<translation>wallet.dat dosyasını yedekle</translation>
</message>
<message>
<source>Thanks for supporting hush-qt-wallet!</source>
<source>Thanks for supporting silentdragonlite!</source>
<translation type="vanished">silentdragon&apos;i desteklediğiniz için teşekkür ederiz!</translation>
</message>
<message>
@ -464,7 +464,7 @@
<translation type="vanished">0.01 Bağış yap </translation>
</message>
<message>
<source> to support hush-qt-wallet</source>
<source> to support silentdragonlite</source>
<translatorcomment>0.01 Bağış yap yazısının devamı</translatorcomment>
<translation type="vanished">ve silentdragon&apos;i destekle</translation>
</message>
@ -995,11 +995,11 @@ z-adres&apos;i gibi görünmüyor</translation>
<translation type="vanished">hushd bekleniyor</translation>
</message>
<message>
<source>You have hushd set to start as a daemon, which can cause problems with hush-qt-wallet
<source>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</source>
<translation type="vanished">hushd, hush-qt-wallet ile sorunlara neden olan bir daemon olarak başlayacak şekilde ayarladınız.
<translation type="vanished">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&apos;i yeniden başlatın
daemon=1</translation>
@ -1045,7 +1045,7 @@ Not starting embedded hushd because --no-embedded was passed</source>
.Please remove the following line from your hush.conf and restart silentdragon
daemon=1</source>
<translation type="vanished">hushd&apos;yi, hush-qt-wallet ile sorunlara neden olabilecek bir daemon olacak şekilde ayarladınız.
<translation type="vanished">hushd&apos;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&apos;i yeniden başlatın
daemon=1</translation>
@ -1205,7 +1205,7 @@ Yayınlanan sürümler sayfasını ziyaret etmek ister misiniz?</translation>
<translation type="vanished"> tx hesaplanıyor. Bu birkaç dakika sürebilir.</translation>
</message>
<message>
<source>Please wait for hush-qt-wallet to exit</source>
<source>Please wait for silentdragonlite to exit</source>
<translation type="vanished">Lütfen çıkmak için silentdragon&apos;i bekleyin</translation>
</message>
<message>

22
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<QString, double>* balanc
newUtxos->push_back(UnspentOutput{ qsAddr, txid, amount, block, true });
(*balancesMap)[qsAddr] = ((*balancesMap)[qsAddr] + (it["value"].get<json::number_float_t>()) /10000000);
(*balancesMap)[qsAddr] = ((*balancesMap)[qsAddr] + (it["value"].get<json::number_float_t>()) /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<json::array_t>()) {
QString address = QString::fromStdString(o["address"]);
double amount = -1 * o ["value"].get<json::number_float_t>() /10000000; // Sent items are -ve
double amount = -1 * o ["value"].get<json::number_float_t>() /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<json::number_float_t>() /10000000,
"."
it["amount"].get<json::number_float_t>() /100000000,
""
});
TransactionItem tx{

2
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();

4
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));

6
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);

20
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;
}

2
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

2
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]"

2
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]"

14
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]"

6
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;
}

10
src/scripts/zec-qt-wallet.wxs

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="silentdragon vRELEASE_VERSION" Language="1033" Version="RELEASE_VERSION" Manufacturer="hush-qt-wallet-org" UpgradeCode="fb9bf166-b55f-46b5-a990-9189bdf64533">
<Product Id="*" Name="silentdragon vRELEASE_VERSION" Language="1033" Version="RELEASE_VERSION" Manufacturer="silentdragonlite-org" UpgradeCode="fb9bf166-b55f-46b5-a990-9189bdf64533">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
@ -9,7 +9,7 @@
<Icon Id="hushqtwalleticon.exe" SourceFile="res/icon.ico"/>
<Property Id="ARPPRODUCTICON" Value="hushqtwalleticon.exe" />
<Feature Id="ProductFeature" Title="hush-qt-wallet" Level="1">
<Feature Id="ProductFeature" Title="silentdragonlite" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentRef Id="ProgramMenuDir"/>
</Feature>
@ -37,13 +37,13 @@
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="hush-qt-wallet" />
<Directory Id="INSTALLFOLDER" Name="silentdragonlite" />
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ApplicationProgramsFolder" Name="hush-qt-wallet">
<Directory Id="ApplicationProgramsFolder" Name="silentdragonlite">
<Component Id="ProgramMenuDir" Guid="0D560F5A-53E0-4E7E-ADDA-15A26995505E">
<RemoveFolder Id="ProgramMenuDir" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\hush-qt-wallet\WixSetup"
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\silentdragonlite\WixSetup"
Type="integer" Value="1" Name="installed" KeyPath="yes" />
</Component>
</Directory>

14
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<QLabel*>(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);

3
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);

2
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);

2
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);
}
}
}

2
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

Loading…
Cancel
Save