LCOV - code coverage report
Current view: top level - src/qt - bitcoinamountfield.h (source / functions) Hit Total Coverage
Test: total_coverage.info Lines: 0 1 0.0 %
Date: 2020-09-26 01:30:44 Functions: 0 3 0.0 %

          Line data    Source code
       1             : // Copyright (c) 2011-2018 The Bitcoin Core developers
       2             : // Distributed under the MIT software license, see the accompanying
       3             : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       4             : 
       5             : #ifndef BITCOIN_QT_BITCOINAMOUNTFIELD_H
       6             : #define BITCOIN_QT_BITCOINAMOUNTFIELD_H
       7             : 
       8             : #include <amount.h>
       9             : 
      10             : #include <QWidget>
      11             : 
      12             : class AmountSpinBox;
      13             : 
      14             : QT_BEGIN_NAMESPACE
      15             : class QValueComboBox;
      16             : QT_END_NAMESPACE
      17             : 
      18             : /** Widget for entering bitcoin amounts.
      19             :   */
      20           0 : class BitcoinAmountField: public QWidget
      21             : {
      22             :     Q_OBJECT
      23             : 
      24             :     // ugly hack: for some unknown reason CAmount (instead of qint64) does not work here as expected
      25             :     // discussion: https://github.com/bitcoin/bitcoin/pull/5117
      26             :     Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY valueChanged USER true)
      27             : 
      28             : public:
      29             :     explicit BitcoinAmountField(QWidget *parent = nullptr);
      30             : 
      31             :     CAmount value(bool *value=nullptr) const;
      32             :     void setValue(const CAmount& value);
      33             : 
      34             :     /** If allow empty is set to false the field will be set to the minimum allowed value if left empty. **/
      35             :     void SetAllowEmpty(bool allow);
      36             : 
      37             :     /** Set the minimum value in satoshis **/
      38             :     void SetMinValue(const CAmount& value);
      39             : 
      40             :     /** Set the maximum value in satoshis **/
      41             :     void SetMaxValue(const CAmount& value);
      42             : 
      43             :     /** Set single step in satoshis **/
      44             :     void setSingleStep(const CAmount& step);
      45             : 
      46             :     /** Make read-only **/
      47             :     void setReadOnly(bool fReadOnly);
      48             : 
      49             :     /** Mark current value as invalid in UI. */
      50             :     void setValid(bool valid);
      51             :     /** Perform input validation, mark field as invalid if entered value is not valid. */
      52             :     bool validate();
      53             : 
      54             :     /** Change unit used to display amount. */
      55             :     void setDisplayUnit(int unit);
      56             : 
      57             :     /** Make field empty and ready for new input. */
      58             :     void clear();
      59             : 
      60             :     /** Enable/Disable. */
      61             :     void setEnabled(bool fEnabled);
      62             : 
      63             :     /** Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project.org/browse/QTBUG-10907),
      64             :         in these cases we have to set it up manually.
      65             :     */
      66             :     QWidget *setupTabChain(QWidget *prev);
      67             : 
      68             : Q_SIGNALS:
      69             :     void valueChanged();
      70             : 
      71             : protected:
      72             :     /** Intercept focus-in event and ',' key presses */
      73             :     bool eventFilter(QObject *object, QEvent *event) override;
      74             : 
      75             : private:
      76             :     AmountSpinBox *amount;
      77             :     QValueComboBox *unit;
      78             : 
      79             : private Q_SLOTS:
      80             :     void unitChanged(int idx);
      81             : 
      82             : };
      83             : 
      84             : #endif // BITCOIN_QT_BITCOINAMOUNTFIELD_H

Generated by: LCOV version 1.15