1
0

qml: fix Switch layout issues and add section headings to preferences

This commit is contained in:
Sander van Grieken
2023-01-03 18:22:59 +01:00
parent 89aea77213
commit 3a31c0df1b
2 changed files with 189 additions and 63 deletions

View File

@@ -29,10 +29,17 @@ Pane {
Pane { Pane {
id: prefsPane id: prefsPane
width: parent.width
GridLayout { GridLayout {
columns: 2 columns: 2
width: parent.width width: parent.width
PrefsHeading {
Layout.columnSpan: 2
text: qsTr('User Interface')
}
Label { Label {
text: qsTr('Language') text: qsTr('Language')
} }
@@ -55,31 +62,57 @@ Pane {
} }
} }
RowLayout {
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.leftMargin: -constants.paddingSmall
spacing: 0
Switch { Switch {
id: thousands id: thousands
Layout.columnSpan: 2
text: qsTr('Add thousands separators to bitcoin amounts')
onCheckedChanged: { onCheckedChanged: {
if (activeFocus) if (activeFocus)
Config.thousandsSeparator = checked Config.thousandsSeparator = checked
} }
} }
Label {
Switch { Layout.fillWidth: true
id: checkSoftware text: qsTr('Add thousands separators to bitcoin amounts')
Layout.columnSpan: 2 wrapMode: Text.Wrap
text: qsTr('Automatically check for software updates') }
enabled: false
} }
RowLayout {
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.leftMargin: -constants.paddingSmall
spacing: 0
Switch {
id: checkSoftware
enabled: false
}
Label {
Layout.fillWidth: true
text: qsTr('Automatically check for software updates')
wrapMode: Text.Wrap
}
}
RowLayout {
Layout.leftMargin: -constants.paddingSmall
spacing: 0
Switch { Switch {
id: fiatEnable id: fiatEnable
text: qsTr('Fiat Currency')
onCheckedChanged: { onCheckedChanged: {
if (activeFocus) if (activeFocus)
Daemon.fx.enabled = checked Daemon.fx.enabled = checked
} }
} }
Label {
Layout.fillWidth: true
text: qsTr('Fiat Currency')
wrapMode: Text.Wrap
}
}
ElComboBox { ElComboBox {
id: currencies id: currencies
@@ -91,19 +124,28 @@ Pane {
} }
} }
RowLayout {
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.leftMargin: -constants.paddingSmall
spacing: 0
Switch { Switch {
id: historicRates id: historicRates
text: qsTr('Historic rates')
enabled: Daemon.fx.enabled enabled: Daemon.fx.enabled
Layout.columnSpan: 2
onCheckedChanged: { onCheckedChanged: {
if (activeFocus) if (activeFocus)
Daemon.fx.historicRates = checked Daemon.fx.historicRates = checked
} }
} }
Label {
Layout.fillWidth: true
text: qsTr('Historic rates')
wrapMode: Text.Wrap
}
}
Label { Label {
text: qsTr('Source') text: qsTr('Exchange rate provider')
enabled: Daemon.fx.enabled enabled: Daemon.fx.enabled
} }
@@ -120,26 +162,9 @@ Pane {
} }
} }
Switch { PrefsHeading {
id: spendUnconfirmed
text: qsTr('Spend unconfirmed')
Layout.columnSpan: 2 Layout.columnSpan: 2
onCheckedChanged: { text: qsTr('Wallet behavior')
if (activeFocus)
Config.spendUnconfirmed = checked
}
}
Label {
text: qsTr('Default request expiry')
Layout.fillWidth: false
}
RequestExpiryComboBox {
onCurrentValueChanged: {
if (activeFocus)
Config.requestExpiry = currentValue
}
} }
Label { Label {
@@ -185,6 +210,41 @@ Pane {
} }
} }
RowLayout {
Layout.columnSpan: 2
Layout.leftMargin: -constants.paddingSmall
spacing: 0
Switch {
id: spendUnconfirmed
onCheckedChanged: {
if (activeFocus)
Config.spendUnconfirmed = checked
}
}
Label {
Layout.fillWidth: true
text: qsTr('Spend unconfirmed')
wrapMode: Text.Wrap
}
}
Label {
text: qsTr('Default request expiry')
Layout.fillWidth: false
}
RequestExpiryComboBox {
onCurrentValueChanged: {
if (activeFocus)
Config.requestExpiry = currentValue
}
}
PrefsHeading {
Layout.columnSpan: 2
text: qsTr('Lightning')
}
Label { Label {
text: qsTr('Lightning Routing') text: qsTr('Lightning Routing')
} }
@@ -205,37 +265,68 @@ Pane {
} }
} }
RowLayout {
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.leftMargin: -constants.paddingSmall
spacing: 0
Switch { Switch {
id: useRecoverableChannels id: useRecoverableChannels
text: qsTr('Create recoverable channels')
Layout.columnSpan: 2
onCheckedChanged: { onCheckedChanged: {
if (activeFocus) if (activeFocus)
Config.useRecoverableChannels = checked Config.useRecoverableChannels = checked
} }
} }
Label {
Layout.fillWidth: true
text: qsTr('Create recoverable channels')
wrapMode: Text.Wrap
}
}
RowLayout {
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.leftMargin: -constants.paddingSmall
spacing: 0
Switch { Switch {
id: useFallbackAddress id: useFallbackAddress
text: qsTr('Use onchain fallback address for Lightning invoices')
Layout.columnSpan: 2
onCheckedChanged: { onCheckedChanged: {
if (activeFocus) if (activeFocus)
Config.useFallbackAddress = checked Config.useFallbackAddress = checked
} }
} }
Label {
Layout.fillWidth: true
text: qsTr('Use onchain fallback address for Lightning invoices')
wrapMode: Text.Wrap
}
}
PrefsHeading {
Layout.columnSpan: 2
text: qsTr('Advanced')
}
RowLayout {
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.leftMargin: -constants.paddingSmall
spacing: 0
Switch { Switch {
id: enableDebugLogs id: enableDebugLogs
text: qsTr('Enable debug logs (for developers)')
Layout.columnSpan: 2
onCheckedChanged: { onCheckedChanged: {
if (activeFocus) if (activeFocus)
Config.enableDebugLogs = checked Config.enableDebugLogs = checked
} }
enabled: Config.canToggleDebugLogs enabled: Config.canToggleDebugLogs
} }
Label {
Layout.fillWidth: true
text: qsTr('Enable debug logs (for developers)')
wrapMode: Text.Wrap
}
}
} }
} }

View File

@@ -0,0 +1,35 @@
import QtQuick 2.6
import QtQuick.Layouts 1.0
import QtQuick.Controls 2.1
RowLayout {
id: root
property string text
Layout.fillWidth: true
Layout.topMargin: constants.paddingXLarge
spacing: constants.paddingLarge
Rectangle {
color: constants.mutedForeground
height: 1
Layout.fillWidth: true
}
Label {
Layout.leftMargin: constants.paddingMedium
Layout.rightMargin: constants.paddingMedium
text: root.text
color: constants.mutedForeground
font.pixelSize: constants.fontSizeLarge
}
Rectangle {
color: constants.mutedForeground
height: 1
Layout.fillWidth: true
}
}