Port settings to MobileForm components

This commit is contained in:
Devin Lin 2022-11-26 01:03:24 -05:00 committed by Bart De Vries
parent bcfcaf3bfd
commit 6c8d0fa404
5 changed files with 411 additions and 221 deletions

View File

@ -25,6 +25,7 @@ include(ECMQtDeclareLoggingCategory)
include(ECMGenerateExportHeader)
include(KDEInstallDirs)
include(KDEGitCommitHooks)
include(ECMFindQmlModule)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(ECMAddAppIcon)
@ -68,6 +69,8 @@ add_definitions(-DQT_NO_CAST_FROM_ASCII
ki18n_install(po)
ecm_find_qmlmodule(org.kde.kirigamiaddons.labs.mobileform 0.1)
install(PROGRAMS org.kde.kasts.desktop DESTINATION ${KDE_INSTALL_APPDIR})
install(FILES org.kde.kasts.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
install(FILES kasts.svg DESTINATION ${KDE_INSTALL_FULL_ICONDIR}/hicolor/scalable/apps)

View File

@ -9,10 +9,11 @@ import QtQuick.Controls 2.14 as Controls
import QtQuick.Layouts 1.14
import org.kde.kirigami 2.12 as Kirigami
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm
import org.kde.kasts 1.0
Kirigami.AboutPage {
MobileForm.AboutPage {
title: i18n("About")
aboutData: About
}

View File

@ -10,83 +10,113 @@ import QtQuick.Controls 2.15 as Controls
import QtQuick.Layouts 1.14
import org.kde.kirigami 2.12 as Kirigami
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm
import org.kde.kasts 1.0
Kirigami.ScrollablePage {
id: page
title: i18n("General Settings")
Kirigami.FormLayout {
leftPadding: 0
rightPadding: 0
topPadding: Kirigami.Units.gridUnit
bottomPadding: Kirigami.Units.gridUnit
Kirigami.Heading {
Kirigami.FormData.isSection: true
text: i18n("Appearance")
Kirigami.Theme.colorSet: Kirigami.Theme.Window
Kirigami.Theme.inherit: false
ColumnLayout {
spacing: 0
width: page.width
MobileForm.FormCard {
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("Appearance")
}
Controls.CheckBox {
MobileForm.FormCheckDelegate {
id: alwaysShowFeedTitles
checked: SettingsManager.alwaysShowFeedTitles
text: i18n("Always show podcast titles in subscription view")
onToggled: SettingsManager.alwaysShowFeedTitles = checked
}
Kirigami.Heading {
Kirigami.FormData.isSection: true
text: i18n("Play Settings")
}
}
Controls.CheckBox {
MobileForm.FormCard {
Layout.fillWidth: true
Layout.topMargin: Kirigami.Units.largeSpacing
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("Playback settings")
}
MobileForm.FormCheckDelegate {
id: showTimeLeft
Kirigami.FormData.label: i18nc("Label for settings related to the play time, e.g. whether the total track time is shown or a countdown of the remaining play time", "Play Time:")
checked: SettingsManager.toggleRemainingTime
text: i18n("Show time left instead of total track time")
onToggled: SettingsManager.toggleRemainingTime = checked
}
Controls.CheckBox {
MobileForm.FormCheckDelegate {
id: adjustTimeLeft
checked: SettingsManager.adjustTimeLeft
enabled: SettingsManager.toggleRemainingTime
text: i18n("Adjust time left based on current playback speed")
onToggled: SettingsManager.adjustTimeLeft = checked
}
Controls.CheckBox {
MobileForm.FormCheckDelegate {
id: prioritizeStreaming
Kirigami.FormData.label: i18nc("Label for settings related to streaming of episodes (as opposed to playing back locally downloaded files)", "Streaming:")
checked: SettingsManager.prioritizeStreaming
text: i18n("Prioritize streaming over downloading")
onToggled: SettingsManager.prioritizeStreaming = checked
}
Kirigami.Heading {
Kirigami.FormData.isSection: true
text: i18n("Queue Settings")
}
}
Controls.CheckBox {
MobileForm.FormCard {
Layout.fillWidth: true
Layout.topMargin: Kirigami.Units.largeSpacing
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("Queue settings")
}
MobileForm.FormCheckDelegate {
id: continuePlayingNextEntry
checked: SettingsManager.continuePlayingNextEntry
text: i18n("Continue playing next episode after current one finishes")
onToggled: SettingsManager.continuePlayingNextEntry = checked
}
Controls.CheckBox {
MobileForm.FormCheckDelegate {
id: refreshOnStartup
Kirigami.FormData.label: i18nc("Label for settings related to podcast updates", "Update Settings:")
checked: SettingsManager.refreshOnStartup
text: i18n("Automatically fetch podcast updates on startup")
onToggled: SettingsManager.refreshOnStartup = checked
}
Controls.CheckBox {
MobileForm.FormCheckDelegate {
id: doFullUpdate
checked: SettingsManager.doFullUpdate
text: i18n("Update existing episode data on refresh (slower)")
onToggled: SettingsManager.doFullUpdate = checked
}
Controls.CheckBox {
MobileForm.FormCheckDelegate {
id: autoQueue
Kirigami.FormData.label: i18n("New Episodes:")
checked: SettingsManager.autoQueue
text: i18n("Automatically Queue")
text: i18n("Automatically queue new episodes")
onToggled: {
SettingsManager.autoQueue = checked
@ -97,18 +127,20 @@ Kirigami.ScrollablePage {
}
}
Controls.CheckBox {
MobileForm.FormCheckDelegate {
id: autoDownload
checked: SettingsManager.autoDownload
text: i18n("Automatically Download")
text: i18n("Automatically download new episodes")
enabled: autoQueue.checked
onToggled: SettingsManager.autoDownload = checked
}
Controls.ComboBox {
Kirigami.FormData.label: i18n("Played Episodes:")
Layout.alignment: Qt.AlignHCenter
MobileForm.FormDelegateSeparator { above: autoDownload; below: episodeBehavior }
MobileForm.FormComboBoxDelegate {
id: episodeBehavior
text: i18n("Played episode behavior")
textRole: "text"
valueRole: "value"
model: [{"text": i18n("Do Not Delete"), "value": 0},
@ -120,28 +152,46 @@ Kirigami.ScrollablePage {
}
}
Controls.CheckBox {
MobileForm.FormDelegateSeparator { above: episodeBehavior; below: resetPositionOnPlayed }
MobileForm.FormCheckDelegate {
id: resetPositionOnPlayed
checked: SettingsManager.resetPositionOnPlayed
text: i18n("Reset Play Position")
text: i18n("Reset play position after an episode is played")
onToggled: SettingsManager.resetPositionOnPlayed = checked
}
}
}
Controls.RadioButton {
Kirigami.FormData.label: i18n("When adding new podcasts:")
MobileForm.FormCard {
Layout.fillWidth: true
Layout.topMargin: Kirigami.Units.largeSpacing
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("When adding new podcasts")
}
MobileForm.FormRadioDelegate {
checked: SettingsManager.markUnreadOnNewFeed === 0
text: i18n("Mark all episodes as played")
onToggled: SettingsManager.markUnreadOnNewFeed = 0
}
RowLayout {
Controls.RadioButton {
Layout.fillWidth: true
MobileForm.FormRadioDelegate {
id: markCustomUnreadNumberButton
checked: SettingsManager.markUnreadOnNewFeed === 1
text: i18n("Mark most recent episodes as unplayed:")
text: i18n("Mark most recent episodes as unplayed")
onToggled: SettingsManager.markUnreadOnNewFeed = 1
}
Controls.SpinBox {
Layout.rightMargin: Kirigami.Units.gridUnit
id: markCustomUnreadNumberSpinBox
enabled: markCustomUnreadNumberButton.checked
value: SettingsManager.markUnreadOnNewFeedCustomAmount
@ -152,15 +202,33 @@ Kirigami.ScrollablePage {
}
}
Controls.RadioButton {
MobileForm.FormRadioDelegate {
checked: SettingsManager.markUnreadOnNewFeed === 2
text: i18n("Mark all episodes as unplayed")
onToggled: SettingsManager.markUnreadOnNewFeed = 2
}
}
}
Kirigami.Heading {
Kirigami.FormData.isSection: true
text: i18n("Article")
MobileForm.FormCard {
Layout.fillWidth: true
Layout.topMargin: Kirigami.Units.largeSpacing
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("Article")
}
MobileForm.AbstractFormDelegate {
id: fontSize
background: Item {}
contentItem: RowLayout {
Controls.Label {
Layout.fillWidth: true
text: i18n("Font size")
}
Controls.SpinBox {
@ -174,28 +242,52 @@ Kirigami.ScrollablePage {
onValueModified: SettingsManager.articleFontSize = value
}
}
}
Controls.CheckBox {
MobileForm.FormDelegateSeparator { above: fontSize; below: useSystemFontCheckBox }
MobileForm.FormCheckDelegate {
id: useSystemFontCheckBox
checked: SettingsManager.articleFontUseSystem
text: i18n("Use system default")
onToggled: SettingsManager.articleFontUseSystem = checked
}
}
}
Kirigami.Heading {
Kirigami.FormData.isSection: true
text: i18n("Errors")
MobileForm.FormCard {
Layout.fillWidth: true
Layout.topMargin: Kirigami.Units.largeSpacing
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
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("Show Error Log")
text: i18n("Open Log")
onClicked: settingsErrorOverlay.open()
}
}
}
ErrorListOverlay {
id: settingsErrorOverlay
}
}
}
}
}

View File

@ -10,40 +10,64 @@ import QtQuick.Controls 2.14 as Controls
import QtQuick.Layouts 1.14
import org.kde.kirigami 2.12 as Kirigami
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm
import org.kde.kasts 1.0
Kirigami.ScrollablePage {
id: page
title: i18n("Network Settings")
Kirigami.FormLayout {
Controls.CheckBox {
leftPadding: 0
rightPadding: 0
topPadding: Kirigami.Units.gridUnit
bottomPadding: Kirigami.Units.gridUnit
Kirigami.Theme.colorSet: Kirigami.Theme.Window
Kirigami.Theme.inherit: false
ColumnLayout {
spacing: 0
width: page.width
MobileForm.FormCard {
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("On metered connections")
}
MobileForm.FormCheckDelegate {
id: allowMeteredFeedUpdates
checked: SettingsManager.allowMeteredFeedUpdates
Kirigami.FormData.label: i18n("On metered connections:")
text: i18n("Allow podcast updates")
onToggled: SettingsManager.allowMeteredFeedUpdates = checked
}
Controls.CheckBox {
MobileForm.FormCheckDelegate {
id: allowMeteredEpisodeDownloads
checked: SettingsManager.allowMeteredEpisodeDownloads
text: i18n("Allow episode downloads")
onToggled: SettingsManager.allowMeteredEpisodeDownloads = checked
}
Controls.CheckBox {
MobileForm.FormCheckDelegate {
id: allowMeteredImageDownloads
checked: SettingsManager.allowMeteredImageDownloads
text: i18n("Allow image downloads")
onToggled: SettingsManager.allowMeteredImageDownloads = checked
}
Controls.CheckBox {
MobileForm.FormCheckDelegate {
id: allowMeteredStreaming
checked: SettingsManager.allowMeteredStreaming
text: i18n("Allow streaming")
onToggled: SettingsManager.allowMeteredStreaming = checked
}
}
}
}
}

View File

@ -11,25 +11,60 @@ import QtQuick.Layouts 1.14
import QtQuick.Dialogs 1.3
import org.kde.kirigami 2.12 as Kirigami
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm
import org.kde.kasts 1.0
Kirigami.ScrollablePage {
id: page
title: i18n("Storage Settings")
Kirigami.FormLayout {
RowLayout {
visible: Qt.platform.os !== "android" // not functional on android
Kirigami.FormData.label: i18n("Storage path:")
leftPadding: 0
rightPadding: 0
topPadding: Kirigami.Units.gridUnit
bottomPadding: Kirigami.Units.gridUnit
Kirigami.Theme.colorSet: Kirigami.Theme.Window
Kirigami.Theme.inherit: false
ColumnLayout {
spacing: 0
width: page.width
MobileForm.FormCard {
Layout.fillWidth: true
Controls.TextField {
Layout.fillWidth: true
readOnly: true
text: StorageManager.storagePath
enabled: !defaultStoragePath.checked
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("Storage path")
}
MobileForm.AbstractFormDelegate {
id: storagePath
visible: Qt.platform.os !== "android" // not functional on android
background: Item {}
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
}
}
Controls.Button {
Layout.leftMargin: Kirigami.Units.largeSpacing
icon.name: "document-open-folder"
text: i18n("Select folder...")
enabled: !defaultStoragePath.checked
@ -45,8 +80,11 @@ Kirigami.ScrollablePage {
}
}
}
}
Controls.CheckBox {
MobileForm.FormDelegateSeparator { above: storagePath; below: defaultStoragePath }
MobileForm.FormCheckDelegate {
id: defaultStoragePath
visible: Qt.platform.os !== "android" // not functional on android
checked: SettingsManager.storagePath == ""
@ -57,17 +95,46 @@ Kirigami.ScrollablePage {
}
}
}
Controls.Label {
Kirigami.FormData.label: i18n("Podcast Downloads:")
text: i18nc("Using <amount of bytes> of disk space", "Using %1 of disk space", StorageManager.formattedEnclosureDirSize)
}
}
RowLayout {
Kirigami.FormData.label: i18n("Image Cache:")
MobileForm.FormCard {
Layout.topMargin: Kirigami.Units.largeSpacing
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("Information")
}
MobileForm.FormTextDelegate {
text: i18n("Podcast downloads")
description: i18nc("Using <amount of bytes> of disk space", "Using %1 of disk space", StorageManager.formattedEnclosureDirSize)
}
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)
}
}
Controls.Button {
icon.name: "edit-clear-all"
text: i18n("Clear Cache")
@ -75,4 +142,7 @@ Kirigami.ScrollablePage {
}
}
}
}
}
}
}