Files
pay/guis/mobile/GuiSettings.qml
T

147 lines
5.1 KiB
QML
Raw Permalink Normal View History

2022-12-15 12:37:21 +01:00
/*
* This file is part of the Flowee project
* Copyright (C) 2022-2023 Tom Zander <tom@flowee.org>
2022-12-15 12:37:21 +01:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick
import QtQuick.Controls as QQC2
import QtQuick.Layouts
import "../Flowee" as Flowee
Page {
headerText: qsTr("Display Settings")
id: root
ColumnLayout {
width: parent.width
2023-05-09 21:20:08 +02:00
spacing: 10
2022-12-15 12:37:21 +01:00
2023-05-09 21:20:08 +02:00
PageTitledBox {
title: qsTr("Font sizing")
Row {
width: parent.width
id: fontSizing
property double buttonWidth: width / 6
Repeater {
model: 6
delegate: Item {
width: fontSizing.buttonWidth
height: 30
property int target: index * 25 + 75
2022-12-15 12:37:21 +01:00
2023-05-09 21:20:08 +02:00
Rectangle {
width: parent.width - 5
x: 2.5
height: 3
color: Pay.fontScaling === target ? palette.highlight : palette.button
}
2022-12-15 12:37:21 +01:00
2023-05-09 21:20:08 +02:00
Flowee.Label {
font.pixelSize: 15
text: "" + target
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
}
MouseArea {
anchors.fill: parent
anchors.topMargin: -30
onClicked: Pay.fontScaling = target
}
}
2022-12-15 12:37:21 +01:00
}
}
}
2023-02-20 11:29:39 +01:00
2023-05-09 21:20:08 +02:00
PageTitledBox {
title: qsTr("Unit")
2023-02-20 11:29:39 +01:00
Flowee.ComboBox {
id: unitSelector
model: {
var answer = [];
for (let i = 0; i < 5; ++i) {
answer[i] = Pay.nameOfUnit(i);
}
return answer;
}
currentIndex: Pay.unit
onCurrentIndexChanged: Pay.unit = currentIndex
}
2023-05-09 21:20:08 +02:00
Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
color: "#00000000"
radius: 6
border.color: palette.button
border.width: 0.8
2023-02-20 11:29:39 +01:00
2023-05-09 21:20:08 +02:00
implicitHeight: units.height + 10
implicitWidth: units.width + 10
2023-02-20 11:29:39 +01:00
2023-05-09 21:20:08 +02:00
GridLayout {
id: units
columns: 3
x: 5; y: 5
rowSpacing: 0
Flowee.Label {
text: {
var answer = "1";
for (let i = Pay.unitAllowedDecimals; i < 8; ++i) {
answer += "0";
}
return answer + " " + Pay.unitName;
2023-02-20 11:29:39 +01:00
}
2023-05-09 21:20:08 +02:00
Layout.alignment: Qt.AlignRight
2023-02-20 11:29:39 +01:00
}
2023-05-09 21:20:08 +02:00
Flowee.Label { text: "=" }
Flowee.Label { text: "1 Bitcoin Cash" }
2023-02-20 11:29:39 +01:00
2023-05-09 21:20:08 +02:00
Flowee.Label { text: "1 " + Pay.unitName; Layout.alignment: Qt.AlignRight; visible: Pay.isMainChain}
Flowee.Label { text: "="; visible: Pay.isMainChain}
Flowee.Label {
text: {
var amount = 1;
for (let i = 0; i < Pay.unitAllowedDecimals; ++i) {
amount = amount * 10;
}
return Fiat.formattedPrice(amount, Fiat.price);
2023-02-20 11:29:39 +01:00
}
2023-05-09 21:20:08 +02:00
visible: Pay.isMainChain
2023-02-20 11:29:39 +01:00
}
}
}
}
2023-02-20 12:15:49 +01:00
TextButton {
2023-02-20 16:21:08 +01:00
text: qsTr("Change Currency (%1)").arg(Fiat.currencyName)
2023-02-20 12:15:49 +01:00
showPageIcon: true
onClicked: thePile.push("./CurrencySelector.qml")
}
2023-03-21 22:25:41 +01:00
2023-05-09 21:20:08 +02:00
PageTitledBox {
title: qsTr("Main View")
2023-05-02 11:14:15 +02:00
visible: Pay.isMainChain // because we only have one option right now
2023-03-21 22:25:41 +01:00
2023-05-09 21:20:08 +02:00
Flowee.CheckBox {
2023-07-05 12:24:31 +02:00
width: parent.width
2023-05-09 21:20:08 +02:00
text: qsTr("Show Bitcoin Cash value")
checked: Pay.activityShowsBch
onCheckedChanged: Pay.activityShowsBch = checked
visible: Pay.isMainChain // only mainchain has fiat value
}
2023-03-21 22:25:41 +01:00
}
2022-12-15 12:37:21 +01:00
}
}