monero-gui/src/libwalletqt/TransactionInfo.h

73 lines
2.1 KiB
C
Raw Normal View History

2016-06-08 10:53:24 +00:00
#ifndef TRANSACTIONINFO_H
#define TRANSACTIONINFO_H
#include <wallet/wallet2_api.h>
2016-10-04 20:12:58 +00:00
#include <QObject>
#include <QDateTime>
2016-06-08 10:53:24 +00:00
class TransactionInfo : public QObject
{
Q_OBJECT
Q_PROPERTY(Direction direction READ direction)
Q_PROPERTY(bool isPending READ isPending)
Q_PROPERTY(bool isFailed READ isFailed)
2016-10-07 20:05:51 +00:00
Q_PROPERTY(double amount READ amount)
Q_PROPERTY(quint64 atomicAmount READ atomicAmount)
2016-10-07 20:05:51 +00:00
Q_PROPERTY(QString displayAmount READ displayAmount)
Q_PROPERTY(QString fee READ fee)
2016-06-08 10:53:24 +00:00
Q_PROPERTY(quint64 blockHeight READ blockHeight)
Q_PROPERTY(QString hash READ hash)
2016-10-04 20:12:58 +00:00
Q_PROPERTY(QDateTime timestamp READ timestamp)
Q_PROPERTY(QString date READ date)
Q_PROPERTY(QString time READ time)
2016-06-08 10:53:24 +00:00
Q_PROPERTY(QString paymentId READ paymentId)
public:
enum Direction {
Direction_In = Bitmonero::TransactionInfo::Direction_In,
2016-10-08 00:26:45 +00:00
Direction_Out = Bitmonero::TransactionInfo::Direction_Out,
Direction_Both // invalid direction value, used for filtering
2016-06-08 10:53:24 +00:00
};
Q_ENUM(Direction)
2016-06-08 10:53:24 +00:00
// TODO: implement as separate class;
// struct Transfer {
// Transfer(uint64_t _amount, const std::string &address);
// const uint64_t amount;
// const std::string address;
// };
2016-06-08 10:53:24 +00:00
Direction direction() const;
bool isPending() const;
bool isFailed() const;
2016-10-07 20:05:51 +00:00
double amount() const;
quint64 atomicAmount() const;
2016-10-07 20:05:51 +00:00
QString displayAmount() const;
QString fee() const;
2016-06-08 10:53:24 +00:00
quint64 blockHeight() const;
//! transaction_id
QString hash() const;
2016-10-04 20:12:58 +00:00
QDateTime timestamp() const;
QString date() const;
QString time() const;
QString paymentId() const;
2016-06-08 10:53:24 +00:00
// TODO: implement it
//! only applicable for output transactions
// virtual const std::vector<Transfer> & transfers() const = 0;
private:
explicit TransactionInfo(Bitmonero::TransactionInfo * pimpl, QObject *parent = 0);
private:
friend class TransactionHistory;
Bitmonero::TransactionInfo * m_pimpl;
};
// in order to wrap it to QVariant
Q_DECLARE_METATYPE(TransactionInfo*)
2016-10-04 20:12:58 +00:00
2016-06-08 10:53:24 +00:00
#endif // TRANSACTIONINFO_H