wowlet/src/vr/qml/common/MyStackViewPage.qml

268 lines
7.6 KiB
QML
Raw Normal View History

2021-04-05 11:37:41 +00:00
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.2
import "."
import ".."
import wowlet.Wallet 1.0
Rectangle {
2021-04-06 00:20:42 +00:00
id: root
2021-04-08 01:40:44 +00:00
color: "transparent"
2021-04-05 11:37:41 +00:00
width: 1600
height: 800
property StackView stackView
property string headerText: "Header Title"
property bool headerShowBackButton: true
2021-04-06 00:20:42 +00:00
property string exitedColor: "transparent"
2021-04-05 11:37:41 +00:00
signal backClicked();
property Item header: ColumnLayout {
RowLayout {
2021-04-06 00:20:42 +00:00
Rectangle {
color: "transparent"
Layout.preferredWidth: headerBackButton.width + headerTitleContainer.width + 20
Layout.preferredHeight: 70
RowLayout {
spacing: 20
2021-04-05 11:37:41 +00:00
anchors.fill: parent
2021-04-06 00:20:42 +00:00
Rectangle {
id: headerBackButton
visible: headerShowBackButton
color: "transparent"
Layout.preferredHeight: 50
Layout.preferredWidth: 50
2021-04-08 01:40:44 +00:00
ImageMask {
id: backIcon
2021-04-06 00:20:42 +00:00
anchors.fill: parent
2021-04-08 01:40:44 +00:00
image: "qrc:/backarrow"
color: Style.fontColorBright
width: 50
height: 50
2021-04-06 00:20:42 +00:00
}
}
Rectangle {
id: headerTitleContainer
color: "transparent"
Layout.preferredHeight: 50
Layout.preferredWidth: headerTitle.width + 20
2021-04-06 00:20:42 +00:00
MyText {
id: headerTitle
text: headerText
font.pointSize: 38
2021-04-06 00:20:42 +00:00
anchors.verticalCenter: parent.verticalCenter
2021-04-08 01:40:44 +00:00
fontColor: Style.fontColorBright
2021-04-06 00:20:42 +00:00
}
}
2021-04-05 11:37:41 +00:00
}
2021-04-06 00:20:42 +00:00
MouseArea {
enabled: headerShowBackButton
2021-04-05 11:37:41 +00:00
anchors.fill: parent
2021-04-06 00:20:42 +00:00
hoverEnabled: true
2021-04-08 01:40:44 +00:00
onEntered: {
parent.color = Style.btnEnteredColor
headerTitle.fontColor = Style.btnTextHoverColor
backIcon.color = Style.btnTextHoverColor
}
onExited: {
parent.color = root.exitedColor
headerTitle.fontColor = Style.fontColorBright
backIcon.color = Style.fontColorBright
}
onPressed: {
parent.color = Style.btnPressedColor
headerTitle.fontColor = Style.btnTextHoverColor
backIcon.color = Style.btnTextHoverColor
}
2021-04-06 00:20:42 +00:00
onClicked: {
stackView.pop();
backClicked();
2021-04-05 11:37:41 +00:00
}
}
}
Item {
Layout.fillWidth: true
Layout.preferredHeight: 50
}
2021-04-06 00:20:42 +00:00
2021-04-05 11:37:41 +00:00
Rectangle {
Layout.preferredWidth: 720
Layout.preferredHeight: 50
color: "transparent"
MyText{
anchors.right: parent.right
anchors.bottom: parent.bottom
fontSize: 30
2021-04-05 11:37:41 +00:00
fontBold: true
text: appWindow.balanceFormatted
}
}
}
Rectangle {
2021-04-08 01:40:44 +00:00
color: Style.dividerColor
2021-04-05 11:37:41 +00:00
height: 1
Layout.topMargin: 10
Layout.fillWidth: true
}
}
property Item content: Frame {
MyText {
text: "Content"
}
}
ColumnLayout {
id: mainLayout
anchors.fill: parent
}
Rectangle {
2021-04-08 01:40:44 +00:00
id: bigRect
2021-04-05 11:37:41 +00:00
color: "transparent"
Layout.fillWidth: true
Layout.preferredHeight: 64
Rectangle {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 40
anchors.rightMargin: 40
2021-04-09 16:00:12 +00:00
color: Style.dividerColor
2021-04-05 11:37:41 +00:00
height: 1
}
RowLayout {
spacing: 30
anchors.verticalCenter: parent.verticalCenter
Layout.preferredHeight: 64
Layout.fillWidth: true
MyText {
Layout.leftMargin: 40
fontSize: 21
2021-04-05 11:37:41 +00:00
text: appWindow.statusText
2021-04-08 01:40:44 +00:00
color: Style.fontColorDimmed
2021-04-05 11:37:41 +00:00
}
Rectangle {
Layout.fillHeight: true
Layout.preferredWidth: 1
2021-04-09 16:00:12 +00:00
color: Style.dividerColor
2021-04-05 11:37:41 +00:00
}
RowLayout {
Layout.fillHeight: true
spacing: 0
MyText {
fontSize: 21
2021-04-05 11:37:41 +00:00
text: "Daemon: "
2021-04-08 01:40:44 +00:00
color: Style.fontColorDimmed
2021-04-05 11:37:41 +00:00
}
Image {
opacity: 0.8
Layout.preferredWidth: 32
Layout.preferredHeight: 32
source: {
if(typeof Wallet == 'undefined')
return "qrc:/status_disconnected";
if(appWindow.connectionStatus == Wallet.ConnectionStatus_Connected){
return "qrc:/status_connected";
} else if(appWindow.connectionStatus == Wallet.ConnectionStatus_Connecting) {
return "qrc:/status_lagging";
} else {
return "qrc:/status_disconnected";
}
}
}
}
Rectangle {
Layout.fillHeight: true
Layout.preferredWidth: 1
2021-04-09 16:00:12 +00:00
color: Style.dividerColor
2021-04-05 11:37:41 +00:00
}
RowLayout {
Layout.fillHeight: true
spacing: 0
MyText {
fontSize: 21
2021-04-05 11:37:41 +00:00
text: "WS: "
2021-04-08 01:40:44 +00:00
color: Style.fontColorDimmed
2021-04-05 11:37:41 +00:00
}
Image {
opacity: 0.8
Layout.preferredWidth: 32
Layout.preferredHeight: 32
source: appWindow.wsConnected ? "qrc:/status_connected" : "qrc:/status_disconnected"
}
}
Rectangle {
Layout.fillHeight: true
Layout.preferredWidth: 1
2021-04-09 16:00:12 +00:00
color: Style.dividerColor
2021-04-05 11:37:41 +00:00
}
MyText {
fontSize: 21
2021-04-09 16:00:12 +00:00
text: {
let rtn = "Balance: ";
try {
rtn += WowletVR.wowToFiat(appWindow.spendable);
} catch(err) {
rtn += "ERROR";
}
return rtn + " " + appWindow.fiatSymbol
}
2021-04-08 01:40:44 +00:00
color: Style.fontColorDimmed
2021-04-05 11:37:41 +00:00
}
}
}
Component.onCompleted: {
header.parent = mainLayout
header.Layout.leftMargin = 40
header.Layout.topMargin = 30
header.Layout.rightMargin = 40
content.parent = mainLayout
content.Layout.fillHeight = true
content.Layout.fillWidth = true
content.Layout.topMargin = 10
content.Layout.leftMargin = 40
content.Layout.rightMargin = 40
2021-04-09 16:00:12 +00:00
content.Layout.bottomMargin = 10
2021-04-05 11:37:41 +00:00
2021-04-08 01:40:44 +00:00
bigRect.parent = mainLayout
2021-04-05 11:37:41 +00:00
}
}