From 543c505e4030c52e0262ae957a4b40a739f07ff0 Mon Sep 17 00:00:00 2001 From: Nathan Hourt Date: Mon, 3 Aug 2015 14:59:34 -0400 Subject: [PATCH] [GUI] Tweaks, bug fixes, facelifts --- programs/light_client/qml/FormFlipper.qml | 4 +- programs/light_client/qml/Identicon.qml | 2 + .../qml/TransactionConfirmationForm.qml | 71 +++++++++++-------- 3 files changed, 44 insertions(+), 33 deletions(-) diff --git a/programs/light_client/qml/FormFlipper.qml b/programs/light_client/qml/FormFlipper.qml index e104382c..923ee6c5 100644 --- a/programs/light_client/qml/FormFlipper.qml +++ b/programs/light_client/qml/FormFlipper.qml @@ -16,8 +16,8 @@ Flipable { property bool flipped: false Component.onCompleted: { - back = backComponent.createObject(flipable, {app: app, enabled: Qt.binding(function(){return flipped})}) - front = frontComponent.createObject(flipable, {app: app, enabled: Qt.binding(function(){return !flipped})}) + back = backComponent.createObject(flipable, {app: app, enabled: Qt.binding(function(){return rotation.angle > 90})}) + front = frontComponent.createObject(flipable, {app: app, enabled: Qt.binding(function(){return rotation.angle < 90})}) front.canceled.connect(function() { canceled.apply(this, arguments) }) front.completed.connect(function() { back.display.apply(this, arguments) diff --git a/programs/light_client/qml/Identicon.qml b/programs/light_client/qml/Identicon.qml index 0189bdbe..d339c4f4 100644 --- a/programs/light_client/qml/Identicon.qml +++ b/programs/light_client/qml/Identicon.qml @@ -17,6 +17,8 @@ Canvas { Jdenticon.draw(identicon, name) else { var context = identicon.context + if (!context) return + context.reset() var draw_circle = function(context, x, y, radius) { context.beginPath() diff --git a/programs/light_client/qml/TransactionConfirmationForm.qml b/programs/light_client/qml/TransactionConfirmationForm.qml index 8d193f12..2a34f212 100644 --- a/programs/light_client/qml/TransactionConfirmationForm.qml +++ b/programs/light_client/qml/TransactionConfirmationForm.qml @@ -2,6 +2,7 @@ import QtQuick 2.5 import QtQuick.Controls 1.4 import QtQuick.Dialogs 1.2 import QtQuick.Layouts 1.2 +import QtGraphicalEffects 1.0 import Graphene.Client 0.1 @@ -17,47 +18,58 @@ import "." FormBase { id: base - property Transaction trx + readonly property alias trx: __trx Component.onCompleted: console.log("Made a transaction confirmation form") Component.onDestruction: console.log("Destroyed a transaction confirmation form") onDisplay: { - trx = app.createTransaction() + trx.clearOperations() for (var op in arg) trx.appendOperation(arg[op]) } - Rectangle { - width: Scaling.cm(10) - height: childrenRect.height + Scaling.cm(1) - radius: Scaling.mm(3) - color: "#EEEEEE" - border.width: Scaling.mm(.25) - border.color: "black" + Transaction { + id: __trx + } - Column { - y: Scaling.cm(.5) - x: y - width: parent.width - Scaling.cm(1) - Repeater { - model: trx? trx.operations : [] - Label { - property Asset transferAsset: app.model.getAsset(modelData.amountType) - property Asset feeAsset: app.model.getAsset(modelData.feeType) - text: { - return qsTr("Transfer %1 %2 from %3 to %4\nFee: %5 %6").arg(transferAsset.formatAmount(modelData.amount)) - .arg(transferAsset.symbol) - .arg(app.model.getAccount(modelData.sender).name) - .arg(app.model.getAccount(modelData.receiver).name) - .arg(feeAsset.formatAmount(modelData.fee)) - .arg(feeAsset.symbol) - } + Rectangle { + id: trxBackground + anchors.fill: trxColumn + anchors.margins: Scaling.mm(-2) + layer.enabled: true + layer.effect: DropShadow { + radius: 8.0 + samples: 16 + horizontalOffset: Scaling.mm(.5) + verticalOffset: Scaling.mm(.5) + source: trxBackground + color: "#80000000" + transparentBorder: true + } + } + Column { + id: trxColumn + Layout.preferredWidth: Scaling.cm(10) + spacing: Scaling.mm(2) + + Repeater { + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + model: trx.operations + Label { + property Asset transferAsset: app.model.getAsset(modelData.amountType) + property Asset feeAsset: app.model.getAsset(modelData.feeType) + text: { + return qsTr("Transfer %1 %2 from %3 to %4\nFee: %5 %6").arg(transferAsset.formatAmount(modelData.amount)) + .arg(transferAsset.symbol) + .arg(app.model.getAccount(modelData.sender).name) + .arg(app.model.getAccount(modelData.receiver).name) + .arg(feeAsset.formatAmount(modelData.fee)) + .arg(feeAsset.symbol) } } } } - Item { width: 1; height: 1 } RowLayout { Label { text: qsTr("Transaction expires in") @@ -82,10 +94,7 @@ FormBase { app: base.app Layout.fillWidth: true rightButtonText: qsTr("Commit") - onLeftButtonClicked: { - canceled({}) - trx = null - } + onLeftButtonClicked: canceled({}) onRightButtonClicked: { if (app.wallet.isLocked) app.wallet.unlock(passwordField.text)