Files
pay/guis/mobile/Settings.qml
T

192 lines
7.1 KiB
QML
Raw Permalink Normal View History

2022-12-15 12:37:21 +01:00
/*
* This file is part of the Flowee project
2025-03-02 19:35:00 +01:00
* Copyright (C) 2022-2025 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
2023-11-06 19:51:57 +01:00
Flickable {
anchors.fill: parent
contentWidth: width
contentHeight: col.height
boundsBehavior: Flickable.StopAtBounds // don't show this is a flickable if there is no space issues
2022-12-15 12:37:21 +01:00
2023-11-06 19:51:57 +01:00
ColumnLayout {
id: col
width: parent.width
spacing: 10
2022-12-15 12:37:21 +01:00
2023-11-06 19:51:57 +01: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
Rectangle {
width: parent.width - 5
x: 2.5
height: 3
color: Pay.fontScaling === target ? palette.highlight : palette.button
}
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
}
2023-05-09 21:20:08 +02:00
}
2023-11-06 19:51:57 +01:00
}
}
}
2022-12-15 12:37:21 +01:00
2023-11-06 19:51:57 +01:00
PageTitledBox {
2025-03-02 19:35:00 +01:00
title: qsTr("Main View")
visible: Pay.isMainChain // because we only have one option right now
Flowee.CheckBox {
2024-05-06 21:17:17 +02:00
width: parent.width
2025-03-02 19:35:00 +01:00
text: qsTr("Show Bitcoin Cash value")
checked: Pay.activityShowsBch
onCheckedChanged: Pay.activityShowsBch = checked
visible: Pay.isMainChain // only mainchain has fiat value
2023-11-06 19:51:57 +01:00
}
2025-03-02 19:35:00 +01:00
}
TextButton {
2025-03-04 13:01:11 +01:00
text: qsTr("Background Synchronization")
2025-03-03 19:04:19 +01:00
subtext: qsTr("Keep your wallets synchronized by enabling this")
2025-03-02 19:35:00 +01:00
currentValue: Pay.backgroundUpdates
pageButton: true
onClicked: thePile.push("./BackgroundSyncConfig.qml")
2023-11-06 19:51:57 +01:00
}
PageTitledBox {
title: qsTr("Unit")
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
}
Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
color: "#00000000"
radius: 6
border.color: palette.button
border.width: 0.8
implicitHeight: units.height + 10
implicitWidth: units.width + 10
GridLayout {
id: units
columns: 3
x: 5; y: 5
rowSpacing: 0
2023-05-09 21:20:08 +02:00
Flowee.Label {
2023-11-06 19:51:57 +01:00
text: {
var answer = "1";
for (let i = Pay.unitAllowedDecimals; i < 8; ++i) {
answer += "0";
}
return answer + " " + Pay.unitName;
2023-05-09 21:20:08 +02:00
}
2023-11-06 19:51:57 +01:00
Layout.alignment: Qt.AlignRight
2023-02-20 11:29:39 +01:00
}
2023-11-06 19:51:57 +01:00
Flowee.Label { text: "=" }
Flowee.Label { text: "1 Bitcoin Cash" }
2023-02-20 11:29:39 +01:00
2023-11-06 19:51:57 +01: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-05-09 21:20:08 +02:00
}
2023-11-06 19:51:57 +01:00
visible: Pay.isMainChain
2023-02-20 11:29:39 +01:00
}
}
}
}
2023-02-20 12:15:49 +01:00
2023-11-06 19:51:57 +01:00
TextButton {
2025-03-02 19:35:00 +01:00
text: qsTr("Change Currency");
currentValue: Fiat.currencyName
2024-12-23 18:51:55 +01:00
pageButton: true
2023-11-06 19:51:57 +01:00
onClicked: thePile.push("./CurrencySelector.qml")
}
2023-03-21 22:25:41 +01:00
2023-11-06 19:51:57 +01:00
PageTitledBox {
2025-03-02 19:35:00 +01:00
title: qsTr("Dark Theme")
Flowee.RadioButton {
2025-03-04 13:01:11 +01:00
text: qsTr("Follow System")
2025-03-02 19:35:00 +01:00
checked: Pay.skinFollowsPlatform
onClicked: Pay.skinFollowsPlatform = true;
2023-11-06 19:51:57 +01:00
width: parent.width
2025-03-02 19:35:00 +01:00
}
Flowee.RadioButton {
2025-03-04 13:01:11 +01:00
text: qsTr("Dark")
2025-03-02 19:35:00 +01:00
checked: !Pay.skinFollowsPlatform && Pay.useDarkSkin
width: parent.width
onClicked: {
Pay.skinFollowsPlatform = false;
Pay.useDarkSkin = true;
}
}
Flowee.RadioButton {
2025-03-04 13:01:11 +01:00
text: qsTr("Light")
2025-03-02 19:35:00 +01:00
checked: !Pay.skinFollowsPlatform && !Pay.useDarkSkin
width: parent.width
onClicked: {
Pay.skinFollowsPlatform = false;
Pay.useDarkSkin = false;
}
2023-11-06 19:51:57 +01:00
}
2023-05-09 21:20:08 +02:00
}
2023-03-21 22:25:41 +01:00
}
2022-12-15 12:37:21 +01:00
}
}