peerplays_migrated/programs/light_client/Transaction.hpp
Nathan Hourt 5d7ae4e6a8 [GUI] More work to support transactions
- Refactor GUI with FormBase.qml
- Fix memo handling in TransferOperation
- Add TransactionConfirmationForm.qml which will eventually display a
transaction for confirmation
2015-07-27 16:01:22 -04:00

55 lines
1.4 KiB
C++

#pragma once
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#include <graphene/chain/protocol/transaction.hpp>
#include <QObject>
#include <QQmlListProperty>
class OperationBase;
class Transaction : public QObject {
Q_OBJECT
public:
enum Status { Unbroadcasted, Pending, Complete, Failed };
Q_ENUM(Status);
Status status() const { return m_status; }
QQmlListProperty<OperationBase> operations();
OperationBase* operationAt(int index) const;
int operationCount() const {
return m_transaction.operations.size();
}
public slots:
void setStatus(Status status)
{
if (status == m_status)
return;
m_status = status;
emit statusChanged(status);
}
/**
* @brief Append the operation to the transaction
* @param op The operation to append. This Transaction will take ownership of the operation.
*/
void appendOperation(OperationBase* op);
void clearOperations() {
m_transaction.operations.clear();
Q_EMIT operationsChanged();
}
signals:
void statusChanged(Status status);
void operationsChanged();
private:
Q_PROPERTY(Status status READ status WRITE setStatus NOTIFY statusChanged)
Q_PROPERTY(QQmlListProperty<OperationBase> operations READ operations NOTIFY operationsChanged)
Status m_status = Unbroadcasted;
graphene::chain::transaction m_transaction;
};