Changeset View
Changeset View
Standalone View
Standalone View
src/qt/guiutil.cpp
// Copyright (c) 2011-2016 The Bitcoin Core developers | // Copyright (c) 2011-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <qt/guiutil.h> | #include <qt/guiutil.h> | ||||
#include <cashaddr.h> | #include <cashaddr.h> | ||||
#include <cashaddrenc.h> | #include <cashaddrenc.h> | ||||
#include <chainparams.h> | #include <chainparams.h> | ||||
#include <config.h> | |||||
#include <dstencode.h> | #include <dstencode.h> | ||||
#include <fs.h> | #include <fs.h> | ||||
#include <interfaces/node.h> | #include <interfaces/node.h> | ||||
#include <policy/policy.h> | #include <policy/policy.h> | ||||
#include <primitives/transaction.h> | #include <primitives/transaction.h> | ||||
#include <protocol.h> | #include <protocol.h> | ||||
#include <qt/bitcoinaddressvalidator.h> | #include <qt/bitcoinaddressvalidator.h> | ||||
#include <qt/bitcoinunits.h> | #include <qt/bitcoinunits.h> | ||||
▲ Show 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | |||||
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); | ||||
widget->setAlignment(Qt::AlignRight | Qt::AlignVCenter); | widget->setAlignment(Qt::AlignRight | Qt::AlignVCenter); | ||||
} | } | ||||
QString bitcoinURIScheme(const CChainParams ¶ms, bool useCashAddr) { | |||||
if (!useCashAddr) { | |||||
return "bitcoincash"; | |||||
} | |||||
return QString::fromStdString(params.CashAddrPrefix()); | |||||
} | |||||
QString bitcoinURIScheme(const Config &config) { | |||||
return bitcoinURIScheme(config.GetChainParams(), | |||||
config.UseCashAddrEncoding()); | |||||
} | |||||
static bool IsCashAddrEncoded(const QUrl &uri) { | static bool IsCashAddrEncoded(const QUrl &uri) { | ||||
const std::string addr = (uri.scheme() + ":" + uri.path()).toStdString(); | const std::string addr = (uri.scheme() + ":" + uri.path()).toStdString(); | ||||
auto decoded = cashaddr::Decode(addr, ""); | auto decoded = cashaddr::Decode(addr, ""); | ||||
return !decoded.first.empty(); | return !decoded.first.empty(); | ||||
} | } | ||||
bool parseBitcoinURI(const QString &scheme, const QUrl &uri, | bool parseBitcoinURI(const QString &scheme, const QUrl &uri, | ||||
SendCoinsRecipient *out) { | SendCoinsRecipient *out) { | ||||
▲ Show 20 Lines • Show All 851 Lines • Show Last 20 Lines |