[GUI] Add status readout to transaction
This commit is contained in:
parent
888e174373
commit
4587e19b18
5 changed files with 26 additions and 3 deletions
|
|
@ -19,6 +19,11 @@ struct OperationConverter {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
QString Transaction::statusString() const
|
||||||
|
{
|
||||||
|
return QMetaEnum::fromType<Status>().valueToKey(status());
|
||||||
|
}
|
||||||
|
|
||||||
QQmlListProperty<OperationBase> Transaction::operations()
|
QQmlListProperty<OperationBase> Transaction::operations()
|
||||||
{
|
{
|
||||||
auto append = [](QQmlListProperty<OperationBase>* list, OperationBase* op) {
|
auto append = [](QQmlListProperty<OperationBase>* list, OperationBase* op) {
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ public:
|
||||||
Q_ENUM(Status);
|
Q_ENUM(Status);
|
||||||
|
|
||||||
Status status() const { return m_status; }
|
Status status() const { return m_status; }
|
||||||
|
QString statusString() const;
|
||||||
QQmlListProperty<OperationBase> operations();
|
QQmlListProperty<OperationBase> operations();
|
||||||
|
|
||||||
OperationBase* operationAt(int index) const;
|
OperationBase* operationAt(int index) const;
|
||||||
|
|
@ -72,6 +73,7 @@ signals:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_PROPERTY(Status status READ status WRITE setStatus NOTIFY statusChanged)
|
Q_PROPERTY(Status status READ status WRITE setStatus NOTIFY statusChanged)
|
||||||
|
Q_PROPERTY(QString statusString READ statusString NOTIFY statusChanged STORED false)
|
||||||
Q_PROPERTY(QQmlListProperty<OperationBase> operations READ operations NOTIFY operationsChanged)
|
Q_PROPERTY(QQmlListProperty<OperationBase> operations READ operations NOTIFY operationsChanged)
|
||||||
Q_PROPERTY(QDateTime expiration READ expiration WRITE setExpiration NOTIFY expirationChanged)
|
Q_PROPERTY(QDateTime expiration READ expiration WRITE setExpiration NOTIFY expirationChanged)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ int main(int argc, char *argv[])
|
||||||
qRegisterMetaType<std::function<void()>>();
|
qRegisterMetaType<std::function<void()>>();
|
||||||
qRegisterMetaType<ObjectId>();
|
qRegisterMetaType<ObjectId>();
|
||||||
qRegisterMetaType<QList<OperationBase*>>();
|
qRegisterMetaType<QList<OperationBase*>>();
|
||||||
|
qRegisterMetaType<Transaction::Status>();
|
||||||
|
|
||||||
qmlRegisterType<Asset>("Graphene.Client", 0, 1, "Asset");
|
qmlRegisterType<Asset>("Graphene.Client", 0, 1, "Asset");
|
||||||
qmlRegisterType<Balance>("Graphene.Client", 0, 1, "Balance");
|
qmlRegisterType<Balance>("Graphene.Client", 0, 1, "Balance");
|
||||||
|
|
|
||||||
|
|
@ -48,12 +48,22 @@ FormBase {
|
||||||
transparentBorder: true
|
transparentBorder: true
|
||||||
}
|
}
|
||||||
|
|
||||||
TransactionDelegate {
|
// Debugging shim; disable before release
|
||||||
|
Loader {
|
||||||
|
id: delegateLoader
|
||||||
x: Scaling.mm(2)
|
x: Scaling.mm(2)
|
||||||
y: Scaling.mm(2)
|
y: Scaling.mm(2)
|
||||||
trx: __trx
|
|
||||||
Layout.preferredWidth: Scaling.cm(10)
|
Layout.preferredWidth: Scaling.cm(10)
|
||||||
app: base.app
|
Component.onCompleted: setSource("TransactionDelegate.qml", {"trx": __trx, "app": base.app})
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
console.log("Reloading transaction")
|
||||||
|
delegateLoader.source = ""
|
||||||
|
delegateLoader.setSource("TransactionDelegate.qml", {"trx": __trx, "app": base.app})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,11 @@ ColumnLayout {
|
||||||
property Transaction trx
|
property Transaction trx
|
||||||
property GrapheneApplication app
|
property GrapheneApplication app
|
||||||
|
|
||||||
|
Text {
|
||||||
|
font.bold: true
|
||||||
|
font.pointSize: Scaling.cm(.4)
|
||||||
|
text: qsTr("Transaction Status: %1").arg(trx.statusString)
|
||||||
|
}
|
||||||
Repeater {
|
Repeater {
|
||||||
model: trx.operations
|
model: trx.operations
|
||||||
Loader {
|
Loader {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue