Merge pull request 'Update fiat conversion label on donate' (#214) from tobtoht/feather:donation_fix into master

Reviewed-on: https://git.wownero.com/feather/feather/pulls/214
This commit is contained in:
tobtoht 2020-12-14 01:01:00 +00:00
commit 5ec641bc6f
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) { void AppContext::onTransactionCreated(PendingTransaction *tx, const QString &address, const QString &paymentId, quint32 mixin) {
if(address == this->featherDonationAddress) if(address == this->donationAddress)
this->featherDonationSending = true; this->donationSending = true;
// tx created, but not sent yet. ask user to verify first. // tx created, but not sent yet. ask user to verify first.
emit createTransactionSuccess(tx, address, mixin); emit createTransactionSuccess(tx, address, mixin);
@ -768,8 +768,8 @@ void AppContext::onTransactionCommitted(bool status, PendingTransaction *tx, con
emit transactionCommitted(status, tx, txid); emit transactionCommitted(status, tx, txid);
// this tx was a donation to Feather, stop our nagging // this tx was a donation to Feather, stop our nagging
if(this->featherDonationSending) { if(this->donationSending) {
this->featherDonationSending = false; this->donationSending = false;
config()->set(Config::donateBeg, -1); config()->set(Config::donateBeg, -1);
} }
} }

View file

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

View file

@ -1022,11 +1022,11 @@ void MainWindow::closeEvent(QCloseEvent *event) {
} }
void MainWindow::donateButtonClicked() { 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) 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); ui->tabWidget->setCurrentIndex(Tabs::SEND);
} }

View file

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

View file

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