6 #include "ui_sendcustomfeedialog.h"
23 throw std::runtime_error(
strprintf(
"%s: No wallet model set", __func__));
27 this->setStyleSheet(parent->styleSheet());
37 ui->comboBoxRecommended->setView(
new QListView());
38 ui->comboBoxRecommended->addItem(tr(
"Normal"), 5);
39 ui->comboBoxRecommended->addItem(tr(
"Slow"), 20);
40 ui->comboBoxRecommended->addItem(tr(
"Fast"), 1);
52 connect(
ui->btnEsc, &QPushButton::clicked,
this, &SendCustomFeeDialog::close);
53 connect(
ui->btnCancel, &QPushButton::clicked,
this, &SendCustomFeeDialog::close);
57 connect(
ui->comboBoxRecommended,
static_cast<void (QComboBox::*)(
const QString &)
>(&QComboBox::currentIndexChanged),
61 ui->checkBoxRecommended->setChecked(
true);
72 ui->checkBoxCustom->setChecked(
true);
75 ui->checkBoxRecommended->setChecked(
true);
82 bool isChecked =
ui->checkBoxCustom->checkState() == Qt::Checked;
83 ui->lineEditCustomFee->setEnabled(isChecked);
84 ui->comboBoxRecommended->setEnabled(!isChecked);
85 ui->checkBoxRecommended->setChecked(!isChecked);
92 ui->lineEditCustomFee->clear();
98 bool isChecked =
ui->checkBoxRecommended->checkState() == Qt::Checked;
99 ui->lineEditCustomFee->setEnabled(!isChecked);
100 ui->comboBoxRecommended->setEnabled(isChecked);
101 ui->checkBoxCustom->setChecked(!isChecked);
103 ui->lineEditCustomFee->clear();
114 QVariant num =
ui->comboBoxRecommended->currentData();
116 int nBlocksToConfirm = num.toInt(&res);
127 const bool fUseCustomFee =
ui->checkBoxCustom->checkState() == Qt::Checked;
131 if (customFee >= insaneFee) {
133 inform(tr(
"Fee too high. Must be below: %1").arg(
135 }
else if (customFee < walletModel->getNetMinFee()) {
143 inform(tr(
"Fee too low. Must be at least: %1").arg(
153 ui->comboBoxRecommended->setCurrentIndex(0);
158 if (
ui->checkBoxRecommended->isChecked()) {
165 inform(tr(
"Invalid custom fee amount"));
172 return ui->checkBoxCustom->checkState() == Qt::Checked;
177 this->setStyleSheet(theme);
int64_t CAmount
Amount in PIV (Can be negative)
static QString format(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard, bool cleanRemainderZeros=true)
Format as string.
static QString formatWithUnit(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
Format as string (with unit)
static QString name(int unit, bool isZpiv=false)
Short name.
Fee rate in PIV per kilobyte: CAmount / kB.
CAmount GetFeePerK() const
CFeeRate estimateFee(int nBlocks) const
Estimate fee rate needed to get into the next nBlocks.
static CFeeRate minTxFee
Fees smaller than this (in upiv) are considered zero fee (for transaction creation) We are ~100 times...
void showEvent(QShowEvent *event)
void themeChanged(bool isLightTheme, QString &theme)
void inform(const QString &text)
Ui::SendCustomFeeDialog * ui
bool isCustomFeeChecked()
void showEvent(QShowEvent *event) override
WalletModel * walletModel
void onRecommendedChecked()
void onChangeTheme(bool isLightTheme, QString &theme)
SendCustomFeeDialog(PIVXGUI *parent, WalletModel *model)
void setText(const QString &text)
Interface to PIVX wallet from Qt view code.
void setWalletCustomFee(bool fUseCustomFee, const CAmount nFee=DEFAULT_TRANSACTION_FEE)
bool getWalletCustomFee(CAmount &nFeeRet)
OptionsModel * getOptionsModel()
bool hasWalletCustomFee()
void setupAmountWidget(QLineEdit *widget, QWidget *parent)
void initCssEditLine(QLineEdit *edit, bool isDialog)
void setCssProperty(std::initializer_list< QWidget * > args, const QString &value)
void setCssBtnPrimary(QPushButton *btn, bool forceUpdate)
bool openDialog(QDialog *widget, QWidget *gui)
void updateStyle(QWidget *widget)
CTxMemPool mempool(::minRelayTxFee)
CFeeRate minRelayTxFee
Fees smaller than this (in upiv) are considered zero fee (for relaying, mining and transaction creati...