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

View File

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