Changeset View
Changeset View
Standalone View
Standalone View
src/qt/guiutil.cpp
Show First 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | static std::string MakeAddrInvalid(std::string addr) { | ||||
// Checksum is at the end of the address. Swapping chars to make it invalid. | // Checksum is at the end of the address. Swapping chars to make it invalid. | ||||
std::swap(addr[addr.size() - 1], addr[addr.size() - 2]); | std::swap(addr[addr.size() - 1], addr[addr.size() - 2]); | ||||
if (!IsValidDestinationString(addr)) { | if (!IsValidDestinationString(addr)) { | ||||
return addr; | return addr; | ||||
} | } | ||||
return ""; | return ""; | ||||
} | } | ||||
std::string DummyAddress(const CChainParams ¶ms, const Config &cfg) { | std::string DummyAddress(const Config &config) { | ||||
// Just some dummy data to generate an convincing random-looking (but | // Just some dummy data to generate an convincing random-looking (but | ||||
// consistent) address | // consistent) address | ||||
static const std::vector<uint8_t> dummydata = { | static const std::vector<uint8_t> dummydata = { | ||||
0xeb, 0x15, 0x23, 0x1d, 0xfc, 0xeb, 0x60, 0x92, 0x58, 0x86, | 0xeb, 0x15, 0x23, 0x1d, 0xfc, 0xeb, 0x60, 0x92, 0x58, 0x86, | ||||
0xb6, 0x7d, 0x06, 0x52, 0x99, 0x92, 0x59, 0x15, 0xae, 0xb1}; | 0xb6, 0x7d, 0x06, 0x52, 0x99, 0x92, 0x59, 0x15, 0xae, 0xb1}; | ||||
const CTxDestination dstKey = CKeyID(uint160(dummydata)); | const CTxDestination dstKey = CKeyID(uint160(dummydata)); | ||||
return MakeAddrInvalid(EncodeDestination(dstKey, params, cfg)); | return MakeAddrInvalid(EncodeDestination(dstKey, config)); | ||||
} | } | ||||
void setupAddressWidget(QValidatedLineEdit *widget, QWidget *parent) { | void setupAddressWidget(QValidatedLineEdit *widget, QWidget *parent) { | ||||
parent->setFocusProxy(widget); | parent->setFocusProxy(widget); | ||||
widget->setFont(fixedPitchFont()); | widget->setFont(fixedPitchFont()); | ||||
const CChainParams ¶ms = Params(); | |||||
#if QT_VERSION >= 0x040700 | #if QT_VERSION >= 0x040700 | ||||
// We don't want translators to use own addresses in translations | // We don't want translators to use own addresses in translations | ||||
// and this is the only place, where this address is supplied. | // and this is the only place, where this address is supplied. | ||||
widget->setPlaceholderText( | widget->setPlaceholderText( | ||||
QObject::tr("Enter a Bitcoin address (e.g. %1)") | QObject::tr("Enter a Bitcoin address (e.g. %1)") | ||||
.arg(QString::fromStdString(DummyAddress(params, GetConfig())))); | .arg(QString::fromStdString(DummyAddress(GetConfig())))); | ||||
#endif | #endif | ||||
widget->setValidator( | widget->setValidator( | ||||
new BitcoinAddressEntryValidator(params.CashAddrPrefix(), parent)); | new BitcoinAddressEntryValidator(Params().CashAddrPrefix(), parent)); | ||||
widget->setCheckValidator(new BitcoinAddressCheckValidator(parent)); | widget->setCheckValidator(new BitcoinAddressCheckValidator(parent)); | ||||
} | } | ||||
void setupAmountWidget(QLineEdit *widget, QWidget *parent) { | void setupAmountWidget(QLineEdit *widget, QWidget *parent) { | ||||
QDoubleValidator *amountValidator = new QDoubleValidator(parent); | QDoubleValidator *amountValidator = new QDoubleValidator(parent); | ||||
amountValidator->setDecimals(8); | amountValidator->setDecimals(8); | ||||
amountValidator->setBottom(0.0); | amountValidator->setBottom(0.0); | ||||
widget->setValidator(amountValidator); | widget->setValidator(amountValidator); | ||||
▲ Show 20 Lines • Show All 861 Lines • Show Last 20 Lines |