transaction color based on confirmed/not confirmed, basic transaction model impl
This commit is contained in:
94
gui/include/transactionrecord.h
Normal file
94
gui/include/transactionrecord.h
Normal file
@@ -0,0 +1,94 @@
|
||||
#ifndef TRANSACTIONRECORD_H
|
||||
#define TRANSACTIONRECORD_H
|
||||
|
||||
#include "main.h"
|
||||
|
||||
#include <QList>
|
||||
|
||||
class TransactionStatus
|
||||
{
|
||||
public:
|
||||
TransactionStatus():
|
||||
confirmed(false), sortKey(""), maturity(Mature),
|
||||
matures_in(0), status(Offline), depth(0), open_for(0)
|
||||
{ }
|
||||
|
||||
enum Maturity
|
||||
{
|
||||
Immature,
|
||||
Mature,
|
||||
MaturesIn,
|
||||
MaturesWarning, /* Will likely not mature because no nodes have confirmed */
|
||||
NotAccepted
|
||||
};
|
||||
|
||||
enum Status {
|
||||
OpenUntilDate,
|
||||
OpenUntilBlock,
|
||||
Offline,
|
||||
Unconfirmed,
|
||||
HaveConfirmations
|
||||
};
|
||||
|
||||
bool confirmed;
|
||||
std::string sortKey;
|
||||
|
||||
/* For "Generated" transactions */
|
||||
Maturity maturity;
|
||||
int matures_in;
|
||||
|
||||
/* Reported status */
|
||||
Status status;
|
||||
int64 depth;
|
||||
int64 open_for; /* Timestamp if status==OpenUntilDate, otherwise number of blocks */
|
||||
};
|
||||
|
||||
class TransactionRecord
|
||||
{
|
||||
public:
|
||||
enum Type
|
||||
{
|
||||
Other,
|
||||
Generated,
|
||||
SendToAddress,
|
||||
SendToIP,
|
||||
RecvFromAddress,
|
||||
RecvFromIP,
|
||||
SendToSelf
|
||||
};
|
||||
|
||||
TransactionRecord():
|
||||
hash(), time(0), type(Other), address(""), debit(0), credit(0)
|
||||
{
|
||||
}
|
||||
|
||||
TransactionRecord(uint256 hash, int64 time, const TransactionStatus &status):
|
||||
hash(hash), time(time), type(Other), address(""), debit(0),
|
||||
credit(0), status(status)
|
||||
{
|
||||
}
|
||||
|
||||
TransactionRecord(uint256 hash, int64 time, const TransactionStatus &status,
|
||||
Type type, const std::string &address,
|
||||
int64 debit, int64 credit):
|
||||
hash(hash), time(time), type(type), address(address), debit(debit), credit(credit),
|
||||
status(status)
|
||||
{
|
||||
}
|
||||
|
||||
static bool showTransaction(const CWalletTx &wtx);
|
||||
static QList<TransactionRecord> decomposeTransaction(const CWalletTx &wtx);
|
||||
|
||||
/* Fixed */
|
||||
uint256 hash;
|
||||
int64 time;
|
||||
Type type;
|
||||
std::string address;
|
||||
int64 debit;
|
||||
int64 credit;
|
||||
|
||||
/* Status: can change with block chain update */
|
||||
TransactionStatus status;
|
||||
};
|
||||
|
||||
#endif // TRANSACTIONRECORD_H
|
||||
@@ -29,7 +29,6 @@ public:
|
||||
/* TypeRole values */
|
||||
static const QString Sent;
|
||||
static const QString Received;
|
||||
static const QString Generated;
|
||||
static const QString Other;
|
||||
|
||||
int rowCount(const QModelIndex &parent) const;
|
||||
|
||||
Reference in New Issue
Block a user