Use trailing components in form

This commit is contained in:
Devin Lin 2022-11-26 18:32:23 -05:00 committed by Bart De Vries
parent 6c8d0fa404
commit 4db4664db3
2 changed files with 46 additions and 95 deletions

View File

@ -181,16 +181,13 @@ Kirigami.ScrollablePage {
}
RowLayout {
Layout.fillWidth: true
MobileForm.FormRadioDelegate {
id: markCustomUnreadNumberButton
checked: SettingsManager.markUnreadOnNewFeed === 1
text: i18n("Mark most recent episodes as unplayed")
onToggled: SettingsManager.markUnreadOnNewFeed = 1
}
MobileForm.FormRadioDelegate {
id: markCustomUnreadNumberButton
checked: SettingsManager.markUnreadOnNewFeed === 1
text: i18n("Mark most recent episodes as unplayed")
onToggled: SettingsManager.markUnreadOnNewFeed = 1
Controls.SpinBox {
trailing: Controls.SpinBox {
Layout.rightMargin: Kirigami.Units.gridUnit
id: markCustomUnreadNumberSpinBox
enabled: markCustomUnreadNumberButton.checked
@ -221,27 +218,20 @@ Kirigami.ScrollablePage {
title: i18n("Article")
}
MobileForm.AbstractFormDelegate {
MobileForm.FormTextDelegate {
id: fontSize
background: Item {}
text: i18n("Font size")
contentItem: RowLayout {
Controls.Label {
Layout.fillWidth: true
text: i18n("Font size")
}
trailing: Controls.SpinBox {
id: articleFontSizeSpinBox
Controls.SpinBox {
id: articleFontSizeSpinBox
enabled: !useSystemFontCheckBox.checked
value: SettingsManager.articleFontSize
Kirigami.FormData.label: i18n("Font size:")
from: 6
to: 20
enabled: !useSystemFontCheckBox.checked
value: SettingsManager.articleFontSize
Kirigami.FormData.label: i18n("Font size:")
from: 6
to: 20
onValueModified: SettingsManager.articleFontSize = value
}
onValueModified: SettingsManager.articleFontSize = value
}
}
@ -268,19 +258,12 @@ Kirigami.ScrollablePage {
title: i18n("Errors")
}
MobileForm.AbstractFormDelegate {
background: Item {}
contentItem: RowLayout {
Controls.Label {
Layout.fillWidth: true
text: i18n("Error log")
}
Controls.Button {
icon.name: "error"
text: i18n("Open Log")
onClicked: settingsErrorOverlay.open()
}
MobileForm.FormTextDelegate {
text: i18n("Error log")
trailing: Controls.Button {
icon.name: "error"
text: i18n("Open Log")
onClicked: settingsErrorOverlay.open()
}
}

View File

@ -41,43 +41,27 @@ Kirigami.ScrollablePage {
title: i18n("Storage path")
}
MobileForm.AbstractFormDelegate {
MobileForm.FormTextDelegate {
id: storagePath
visible: Qt.platform.os !== "android" // not functional on android
background: Item {}
text: i18n("Storage path")
description: StorageManager.storagePath
contentItem: RowLayout {
spacing: 0
ColumnLayout {
spacing: Kirigami.Units.smallSpacing
Controls.Label {
Layout.fillWidth: true
elide: Text.ElideRight
text: i18n("Storage path")
}
Controls.Label {
Layout.fillWidth: true
elide: Text.ElideRight
color: Kirigami.Theme.disabledTextColor
text: StorageManager.storagePath
}
}
trailing: Controls.Button {
Layout.leftMargin: Kirigami.Units.largeSpacing
icon.name: "document-open-folder"
text: i18n("Select folder...")
enabled: !defaultStoragePath.checked
onClicked: storagePathDialog.open()
}
Controls.Button {
Layout.leftMargin: Kirigami.Units.largeSpacing
icon.name: "document-open-folder"
text: i18n("Select folder...")
enabled: !defaultStoragePath.checked
onClicked: storagePathDialog.open()
}
FileDialog {
id: storagePathDialog
title: i18n("Select Storage Path")
selectFolder: true
folder: "file://" + StorageManager.storagePath
onAccepted: {
StorageManager.setStoragePath(fileUrl);
}
FileDialog {
id: storagePathDialog
title: i18n("Select Storage Path")
selectFolder: true
folder: "file://" + StorageManager.storagePath
onAccepted: {
StorageManager.setStoragePath(fileUrl);
}
}
}
@ -116,30 +100,14 @@ Kirigami.ScrollablePage {
MobileForm.FormDelegateSeparator {}
MobileForm.AbstractFormDelegate {
background: Item {}
contentItem: RowLayout {
spacing: Kirigami.Units.largeSpacing
ColumnLayout {
spacing: Kirigami.Units.smallSpacing
Controls.Label {
Layout.fillWidth: true
elide: Text.ElideRight
text: i18n("Image cache")
}
Controls.Label {
Layout.fillWidth: true
elide: Text.ElideRight
color: Kirigami.Theme.disabledTextColor
text: i18nc("Using <amount of bytes> of disk space", "Using %1 of disk space", StorageManager.formattedImageDirSize)
}
}
MobileForm.FormTextDelegate {
text: i18n("Image cache")
description: i18nc("Using <amount of bytes> of disk space", "Using %1 of disk space", StorageManager.formattedImageDirSize)
Controls.Button {
icon.name: "edit-clear-all"
text: i18n("Clear Cache")
onClicked: StorageManager.clearImageCache();
}
trailing: Controls.Button {
icon.name: "edit-clear-all"
text: i18n("Clear Cache")
onClicked: StorageManager.clearImageCache();
}
}
}