1c031189bc
List the native name only of the display list in order to help keep it short. This uses some string manipulations to remove the stuff we don't need.
239 lines
9.3 KiB
QML
239 lines
9.3 KiB
QML
/*
|
|
* This file is part of the Flowee project
|
|
* Copyright (C) 2022-2026 Tom Zander <tom@flowee.org>
|
|
*
|
|
* 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.Basic as QQC2
|
|
import QtQuick.Layouts
|
|
import "../Flowee" as Flowee
|
|
|
|
Page {
|
|
headerText: qsTr("Display Settings")
|
|
id: root
|
|
|
|
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
|
|
|
|
ColumnLayout {
|
|
id: col
|
|
width: parent.width
|
|
spacing: 10
|
|
|
|
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
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
PageTitledBox {
|
|
title: qsTr("Main View")
|
|
visible: Pay.isMainChain // because we only have one option right now
|
|
|
|
Flowee.CheckBox {
|
|
width: parent.width
|
|
text: qsTr("Show Bitcoin Cash value")
|
|
checked: Pay.activityShowsBch
|
|
onCheckedChanged: Pay.activityShowsBch = checked
|
|
visible: Pay.isMainChain // only mainchain has fiat value
|
|
}
|
|
}
|
|
|
|
PageTitledBox {
|
|
title: qsTr("Payments")
|
|
visible: Pay.isMainChain // because we only have one option right now
|
|
|
|
Flowee.CheckBox {
|
|
width: parent.width
|
|
text: qsTr("Prefer BCH for amount input")
|
|
checked: Pay.preferSatsPayments
|
|
onCheckedChanged: Pay.preferSatsPayments = checked
|
|
visible: Pay.isMainChain // only mainchain has fiat
|
|
}
|
|
}
|
|
|
|
TextButton {
|
|
text: qsTr("Background Synchronization")
|
|
subtext: qsTr("Keep your wallets synchronized by enabling this")
|
|
currentValue: Pay.backgroundUpdates
|
|
pageButton: true
|
|
onClicked: thePile.push("./BackgroundSyncConfig.qml")
|
|
}
|
|
|
|
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
|
|
Flowee.Label {
|
|
text: {
|
|
var answer = "1"
|
|
for (let i = Pay.unitAllowedDecimals; i < 8; ++i) {
|
|
answer += "0"
|
|
}
|
|
return answer + " " + Pay.unitName
|
|
}
|
|
Layout.alignment: Qt.AlignRight
|
|
}
|
|
Flowee.Label { text: "=" }
|
|
Flowee.Label { text: "1 Bitcoin Cash" }
|
|
|
|
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)
|
|
}
|
|
visible: Pay.isMainChain
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
TextButton {
|
|
text: qsTr("Change Language")
|
|
currentValue: {
|
|
let current = Pay.userLanguage
|
|
let list = Pay.languageList
|
|
for (let i = 0; i < list.length; ++i) {
|
|
const parts = list[i].split(";")
|
|
if (parts.length === 2 && parseInt(parts[1], 10) === current) {
|
|
let display = parts[0]
|
|
// Remove trailing " (English)" if present
|
|
const parenStart = display.lastIndexOf(" (")
|
|
if (parenStart !== -1)
|
|
display = display.substring(0, parenStart)
|
|
|
|
// Remove leading flag emoji + optional space if present
|
|
while (display.length >= 4) {
|
|
const cp1 = display.codePointAt(0)
|
|
const cp2 = display.codePointAt(2)
|
|
if (cp1 >= 0x1F1E6 && cp1 <= 0x1F1FF && cp2 >= 0x1F1E6 && cp2 <= 0x1F1FF) {
|
|
let flagLen = 4
|
|
if (display.length > 4 && display.charAt(4) === " ")
|
|
flagLen = 5
|
|
display = display.substring(flagLen)
|
|
}
|
|
else break
|
|
}
|
|
return display.trim()
|
|
}
|
|
}
|
|
return qsTr("System")
|
|
}
|
|
pageButton: true
|
|
onClicked: thePile.push("./LanguageSelector.qml")
|
|
}
|
|
TextButton {
|
|
text: qsTr("Change Currency")
|
|
currentValue: Fiat.currencyName
|
|
pageButton: true
|
|
onClicked: thePile.push("./CurrencySelector.qml")
|
|
}
|
|
|
|
PageTitledBox {
|
|
title: qsTr("Dark Theme")
|
|
Flowee.RadioButton {
|
|
text: qsTr("Follow System")
|
|
checked: Pay.skinFollowsPlatform
|
|
onClicked: Pay.skinFollowsPlatform = true
|
|
width: parent.width
|
|
}
|
|
Flowee.RadioButton {
|
|
text: qsTr("Dark")
|
|
checked: !Pay.skinFollowsPlatform && Pay.useDarkSkin
|
|
width: parent.width
|
|
onClicked: {
|
|
Pay.skinFollowsPlatform = false
|
|
Pay.useDarkSkin = true
|
|
}
|
|
}
|
|
Flowee.RadioButton {
|
|
text: qsTr("Light")
|
|
checked: !Pay.skinFollowsPlatform && !Pay.useDarkSkin
|
|
width: parent.width
|
|
onClicked: {
|
|
Pay.skinFollowsPlatform = false
|
|
Pay.useDarkSkin = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|