From c31111098f6bdcb25202ecbf202cfbfa0e9ab2a8 Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Sun, 21 Oct 2018 21:06:48 -0700 Subject: [PATCH] Make fees on send tab labels --- src/mainwindow.cpp | 1 + src/mainwindow.ui | 24 ++++++++++++++++++++++++ src/sendtab.cpp | 13 +++++++++++++ src/ui_mainwindow.h | 22 ++++++++++++++++++++++ 4 files changed, 60 insertions(+) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 443fc0e..11e4b59 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -328,6 +328,7 @@ void MainWindow::setupRecieveTab() { } }; + // zAddr toggle button QObject::connect(ui->rdioZAddr, &QRadioButton::toggled, addZAddrsToComboList); // Explicitly get new address button. diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 4aae36c..c24a352 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -474,6 +474,27 @@ + + + + Fee + + + + + + + TextLabel + + + + + + + TextLabel + + + @@ -573,6 +594,9 @@ 0 + + false + diff --git a/src/sendtab.cpp b/src/sendtab.cpp index 6f92513..b6727df 100644 --- a/src/sendtab.cpp +++ b/src/sendtab.cpp @@ -55,6 +55,19 @@ void MainWindow::setupSendTab() { QFont f = ui->Address1->font(); f.setPointSize(f.pointSize() - 1); ui->MemoTxt1->setFont(f); + + // Set up focus enter to set fees + QObject::connect(ui->tabWidget, &QTabWidget::currentChanged, [=] (int pos) { + if (pos == 1) { + // 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(); + } + }); + } void MainWindow::setDefaultPayFrom() { diff --git a/src/ui_mainwindow.h b/src/ui_mainwindow.h index 2d0593d..54a12e8 100644 --- a/src/ui_mainwindow.h +++ b/src/ui_mainwindow.h @@ -106,6 +106,9 @@ public: QSpacerItem *horizontalSpacer_3; QSpacerItem *verticalSpacer_2; QHBoxLayout *horizontalLayout_6; + QLabel *label_7; + QLabel *sendTxFees; + QLabel *sendTxFeesUSD; QSpacerItem *horizontalSpacer; QPushButton *sendTransactionButton; QPushButton *cancelSendButton; @@ -466,6 +469,21 @@ public: horizontalLayout_6 = new QHBoxLayout(); horizontalLayout_6->setSpacing(6); horizontalLayout_6->setObjectName(QStringLiteral("horizontalLayout_6")); + label_7 = new QLabel(tab_2); + label_7->setObjectName(QStringLiteral("label_7")); + + horizontalLayout_6->addWidget(label_7); + + sendTxFees = new QLabel(tab_2); + sendTxFees->setObjectName(QStringLiteral("sendTxFees")); + + horizontalLayout_6->addWidget(sendTxFees); + + sendTxFeesUSD = new QLabel(tab_2); + sendTxFeesUSD->setObjectName(QStringLiteral("sendTxFeesUSD")); + + horizontalLayout_6->addWidget(sendTxFeesUSD); + horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); horizontalLayout_6->addItem(horizontalSpacer); @@ -532,6 +550,7 @@ public: sizePolicy1.setVerticalStretch(0); sizePolicy1.setHeightForWidth(listRecieveAddresses->sizePolicy().hasHeightForWidth()); listRecieveAddresses->setSizePolicy(sizePolicy1); + listRecieveAddresses->setDuplicatesEnabled(false); horizontalLayout_10->addWidget(listRecieveAddresses); @@ -673,6 +692,9 @@ public: MemoBtn1->setText(QApplication::translate("MainWindow", "Memo", nullptr)); MemoTxt1->setText(QString()); addAddressButton->setText(QApplication::translate("MainWindow", "Add Address", nullptr)); + label_7->setText(QApplication::translate("MainWindow", "Fee", nullptr)); + sendTxFees->setText(QApplication::translate("MainWindow", "TextLabel", nullptr)); + 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));