Files
pay/desktop/SettingsPane.qml
T

130 lines
3.7 KiB
QML
Raw Permalink Normal View History

2021-11-03 13:33:49 +01:00
/*
* This file is part of the Flowee project
* Copyright (C) 2020-2021 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 2.15
import QtQuick.Controls 2.15
2021-08-09 18:46:38 +02:00
import QtQuick.Layouts 1.11
import QtGraphicalEffects 1.0
import "./ControlColors.js" as ControlColors
2021-11-02 19:35:38 +01:00
import "widgets" as Flowee
2021-08-09 18:46:38 +02:00
Pane {
property string title: qsTr("Settings")
2021-11-02 19:38:36 +01:00
property string icon: "qrc:/settingsIcon-light.png"
2021-08-09 18:46:38 +02:00
GridLayout {
columns: 3
Label {
text: qsTr("Night mode") + ":"
}
2021-11-02 19:35:38 +01:00
Flowee.CheckBox {
2021-08-09 18:46:38 +02:00
Layout.columnSpan: 2
2021-11-02 19:29:14 +01:00
checked: Pay.useDarkSkin
2021-08-09 18:46:38 +02:00
onClicked: {
2021-11-02 19:29:14 +01:00
Pay.useDarkSkin = checked;
2021-08-09 18:46:38 +02:00
ControlColors.applySkin(mainWindow);
}
}
Label {
text: qsTr("Unit") + ":"
}
2021-11-03 13:33:49 +01:00
Flowee.ComboBox {
id: unitSelector
2021-08-09 18:46:38 +02:00
width: 210
model: {
var answer = [];
for (let i = 0; i < 5; ++i) {
2021-11-02 19:29:14 +01:00
answer[i] = Pay.nameOfUnit(i);
2021-08-09 18:46:38 +02:00
}
return answer;
}
2021-11-02 19:29:14 +01:00
currentIndex: Pay.unit
2021-11-03 13:33:49 +01:00
onCurrentIndexChanged: Pay.unit = currentIndex
2021-08-09 18:46:38 +02:00
}
Rectangle {
color: "#00000000"
radius: 6
border.color: mainWindow.palette.button
border.width: 2
implicitHeight: units.height + 10
implicitWidth: units.width + 10
GridLayout {
id: units
columns: 3
x: 5; y: 5
rowSpacing: 0
Label {
text: {
var answer = "1";
2021-11-02 19:29:14 +01:00
for (let i = Pay.unitAllowedDecimals; i < 8; ++i) {
2021-08-09 18:46:38 +02:00
answer += "0";
}
2021-11-02 19:29:14 +01:00
return answer + " " + Pay.unitName;
2021-08-09 18:46:38 +02:00
}
Layout.alignment: Qt.AlignRight
}
Label { text: "=" }
Label { text: "1 Bitcoin Cash" }
2021-11-02 19:29:14 +01:00
Label { text: "1 " + Pay.unitName; Layout.alignment: Qt.AlignRight; visible: Pay.isMainChain}
Label { text: "="; visible: Pay.isMainChain}
2021-08-09 18:46:38 +02:00
Label {
text: {
var amount = 1;
2021-11-02 19:29:14 +01:00
for (let i = 0; i < Pay.unitAllowedDecimals; ++i) {
2021-08-09 18:46:38 +02:00
amount = amount * 10;
}
return Fiat.formattedPrice(amount, Fiat.price);
}
2021-11-02 19:29:14 +01:00
visible: Pay.isMainChain
2021-08-09 18:46:38 +02:00
}
}
}
Label {
text: qsTr("Version") + ":"
}
Label {
2021-11-02 19:29:14 +01:00
text: Pay.version
2021-08-09 18:46:38 +02:00
Layout.columnSpan: 2
}
Label {
text: qsTr("Library Version") + ":"
}
Label {
2021-11-02 19:29:14 +01:00
text: Pay.libsVersion
2021-08-09 18:46:38 +02:00
Layout.columnSpan: 2
}
}
Button {
anchors.right: parent.right
text: qsTr("Network Status")
onClicked: {
netView.source = "./NetView.qml"
netView.item.show();
}
}
}