Update fiat conversion label on donate

This commit is contained in:
tobtoht 2020-12-14 01:59:32 +01:00
parent d1b4db2be4
commit 4a37be1ce7
5 changed files with 18 additions and 21 deletions

View file

@ -753,8 +753,8 @@ void AppContext::onHeightRefreshed(quint64 walletHeight, quint64 daemonHeight, q
}
void AppContext::onTransactionCreated(PendingTransaction *tx, const QString &address, const QString &paymentId, quint32 mixin) {
if(address == this->featherDonationAddress)
this->featherDonationSending = true;
if(address == this->donationAddress)
this->donationSending = true;
// tx created, but not sent yet. ask user to verify first.
emit createTransactionSuccess(tx, address, mixin);
@ -768,8 +768,8 @@ void AppContext::onTransactionCommitted(bool status, PendingTransaction *tx, con
emit transactionCommitted(status, tx, txid);
// this tx was a donation to Feather, stop our nagging
if(this->featherDonationSending) {
this->featherDonationSending = false;
if(this->donationSending) {
this->donationSending = false;
config()->set(Config::donateBeg, -1);
}
}

View file

@ -39,9 +39,11 @@ public:
bool isTails = false;
bool isWhonix = false;
bool isDebug = false;
const QString featherDonationAddress = "47ntfT2Z5384zku39pTM6hGcnLnvpRYW2Azm87GiAAH2bcTidtq278TL6HmwyL8yjMeERqGEBs3cqC8vvHPJd1cWQrGC65f";
const int featherDonationAmount = 50; // euro
bool featherDonationSending = false;
// Donation config
const QString donationAddress = "47ntfT2Z5384zku39pTM6hGcnLnvpRYW2Azm87GiAAH2bcTidtq278TL6HmwyL8yjMeERqGEBs3cqC8vvHPJd1cWQrGC65f";
const int donationAmount = 25; // euro
bool donationSending = false;
QCommandLineParser *cmdargs;

View file

@ -1022,11 +1022,11 @@ void MainWindow::closeEvent(QCloseEvent *event) {
}
void MainWindow::donateButtonClicked() {
double donation = AppContext::prices->convert("EUR", "XMR", m_ctx->featherDonationAmount);
double donation = AppContext::prices->convert("EUR", "XMR", m_ctx->donationAmount);
if (donation <= 0)
donation = 1.337;
donation = 0.1337;
ui->sendWidget->fill(m_ctx->featherDonationAddress, "Donation to the Feather development team", donation);
ui->sendWidget->fill(m_ctx->donationAddress, "Donation to the Feather development team", donation);
ui->tabWidget->setCurrentIndex(Tabs::SEND);
}

View file

@ -55,17 +55,13 @@ void SendWidget::fill(double amount) {
ui->lineAmount->setText(QString::number(amount));
}
void SendWidget::fill(const QString &address, const QString& description){
ui->lineDescription->setText(description);
ui->lineAddress->setText(address);
ui->lineAddress->setCursorPosition(0);
}
void SendWidget::fill(const QString &address, const QString &description, double amount) {
ui->lineDescription->setText(description);
ui->lineAmount->setText(QString::number(amount));
ui->lineAddress->setText(address);
ui->lineAddress->setCursorPosition(0);
if (amount > 0)
ui->lineAmount->setText(QString::number(amount));
this->updateConversionLabel();
}
void SendWidget::fillAddress(const QString &address) {
@ -74,7 +70,7 @@ void SendWidget::fillAddress(const QString &address) {
}
void SendWidget::sendClicked() {
double amount = 0.0;
double amount;
QString currency = ui->comboCurrencySelection->currentText();
QString recipient = ui->lineAddress->text().simplified().remove(' ');
QString description = ui->lineDescription->text();

View file

@ -19,8 +19,7 @@ Q_OBJECT
public:
explicit SendWidget(QWidget *parent = nullptr);
void fill(const CCSEntry &entry);
void fill(const QString &address, const QString& description);
void fill(const QString &address, const QString& description, double amount);
void fill(const QString &address, const QString& description, double amount = 0);
void fill(double amount);
void clearFields();
~SendWidget() override;