[Qt] extend validate line edit and btc address validator

- remove btc address length from address validator
- add an optional btc address check in validated line edit that defaults
  to off and is used in GUIUtil::setupAddressWidget()
- an isAcceptable() check is added to validated line edit on focus out
  which only kicks in, when a validator is used with that widget
- remove an isAcceptable() check from sendcoinsentry.cpp
- remove obsolete attributes from ui files, which are set by calling
  GUIUtil::setupAddressWidget()
- move some more things to GUIUtil::setupAddressWidget() and remove them
  from normal code e.g. placeholder text
This commit is contained in:
Philip Kaufmann
2013-11-20 15:56:51 +01:00
committed by Wladimir J. van der Laan
parent aab8fc58c6
commit c78bd93701
11 changed files with 140 additions and 55 deletions

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2011-2013 The Bitcoin developers
// Copyright (c) 2011-2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -7,19 +7,29 @@
#include <QValidator>
/** Base58 entry widget validator.
Corrects near-miss characters and refuses characters that are not part of base58.
/** Base58 entry widget validator, checks for valid characters and
* removes some whitespace.
*/
class BitcoinAddressValidator : public QValidator
class BitcoinAddressEntryValidator : public QValidator
{
Q_OBJECT
public:
explicit BitcoinAddressValidator(QObject *parent = 0);
explicit BitcoinAddressEntryValidator(QObject *parent);
State validate(QString &input, int &pos) const;
};
static const int MaxAddressLength = 35;
/** Bitcoin address widget validator, checks for a valid bitcoin address.
*/
class BitcoinAddressCheckValidator : public QValidator
{
Q_OBJECT
public:
explicit BitcoinAddressCheckValidator(QObject *parent);
State validate(QString &input, int &pos) const;
};
#endif // BITCOINADDRESSVALIDATOR_H