Commit 84272eb8 authored by Carl Schwan's avatar Carl Schwan 🚴
Browse files

Refactor view settings



Signed-off-by: Carl Schwan's avatarCarl Schwan <carl@carlschwan.eu>
parent c9f907d1
Pipeline #234864 passed with stage
in 4 minutes and 19 seconds
......@@ -11,13 +11,8 @@ Kirigami.CategorizedSettings {
objectName: "settingsPage"
actions: [
Kirigami.SettingAction {
text: i18n("General")
icon.name: "korganizer"
page: Qt.resolvedUrl("GeneralSettingsPage.qml")
},
Kirigami.SettingAction {
text: i18n("Views")
icon.name: "view-choose"
text: i18n("Appearance")
icon.name: "preferences-desktop-theme-global"
page: Qt.resolvedUrl("ViewSettingsPage.qml")
},
Kirigami.SettingAction {
......
......@@ -7,7 +7,6 @@ import org.kde.kirigami 2.19 as Kirigami
import QtQuick.Layouts 1.15
import org.kde.kalendar 1.0
import org.kde.akonadi 1.0
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm
Kirigami.ScrollablePage {
id: sourcesSettingsPage
......
......@@ -2,182 +2,275 @@
// SPDX-License-Identifier: LGPL-2.0-or-later
import QtQuick 2.15
import org.kde.kirigami 2.14 as Kirigami
import org.kde.kirigami 2.19 as Kirigami
import QtQuick.Controls 2.15 as Controls
import QtQuick.Layouts 1.15
import org.kde.kalendar 1.0
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm
Kirigami.ScrollablePage {
title: i18n("Views")
Kirigami.FormLayout {
title: i18n("Appearance")
Item {
Kirigami.FormData.isSection: true
Kirigami.FormData.label: i18n("General settings")
}
Controls.CheckBox {
text: i18n("Use popup to show incidence information")
checked: Config.useIncidenceInfoPopup
enabled: !Config.isUseIncidenceInfoPopupImmutable && !Kirigami.Settings.isMobile
visible: !Kirigami.Settings.isMobile
onClicked: {
Config.useIncidenceInfoPopup = !Config.useIncidenceInfoPopup;
Config.save();
}
}
Controls.CheckBox {
text: i18n("Show sub-tasks in calendar views")
checked: Config.showSubtodosInCalendarViews
enabled: !Config.isShowSubtodosInCalendarViewsImmutable
onClicked: {
Config.showSubtodosInCalendarViews = !Config.showSubtodosInCalendarViews;
Config.save();
}
}
RowLayout {
Kirigami.FormData.label: i18n("Past event transparency:")
ColumnLayout {
MobileForm.FormCard {
Layout.fillWidth: true
Controls.Slider {
stepSize: 1.0
from: 0.0
to: 100.0
value: Config.pastEventsTransparencyLevel * 100
onMoved: {
Config.pastEventsTransparencyLevel = value / 100;
Config.save();
Layout.topMargin: Kirigami.Units.largeSpacing
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("General settings")
}
}
}
Kirigami.Separator {
Kirigami.FormData.isSection: true
Kirigami.FormData.label: i18n("Month View settings")
}
Controls.ButtonGroup {
buttons: weekdayLabelAlignmentButtonColumn.children
exclusive: true
onClicked: {
Config.weekdayLabelAlignment = button.value;
Config.save();
}
}
Column {
id: weekdayLabelAlignmentButtonColumn
Kirigami.FormData.label: i18n("Weekday label alignment:")
Kirigami.FormData.labelAlignment: Qt.AlignTop
MobileForm.FormSwitchDelegate {
text: i18n("Use popup to show incidence information")
checked: Config.useIncidenceInfoPopup
enabled: !Config.isUseIncidenceInfoPopupImmutable && !Kirigami.Settings.isMobile
visible: !Kirigami.Settings.isMobile
onClicked: {
Config.useIncidenceInfoPopup = !Config.useIncidenceInfoPopup;
Config.save();
}
}
Controls.RadioButton {
property int value: Config.Left
text: i18n("Left")
enabled: !Config.isWeekdayLabelAlignmentImmutable
checked: Config.weekdayLabelAlignment === value
}
Controls.RadioButton {
property int value: Config.Center
text: i18n("Center")
enabled: !Config.isWeekdayLabelAlignmentImmutable
checked: Config.weekdayLabelAlignment === value
}
Controls.RadioButton {
property int value: Config.Right
text: i18n("Right")
enabled: !Config.isWeekdayLabelAlignmentImmutable
checked: Config.weekdayLabelAlignment === value
}
}
Controls.ButtonGroup {
buttons: weekdayLabelLengthButtonColumn.children
exclusive: true
onClicked: {
Config.weekdayLabelLength = button.value;
Config.save();
MobileForm.FormSwitchDelegate {
text: i18n("Show sub-tasks in calendar views")
checked: Config.showSubtodosInCalendarViews
enabled: !Config.isShowSubtodosInCalendarViewsImmutable
onClicked: {
Config.showSubtodosInCalendarViews = !Config.showSubtodosInCalendarViews;
Config.save();
}
}
MobileForm.AbstractFormDelegate {
Layout.fillWidth: true
contentItem: ColumnLayout {
Controls.Label {
text: i18n("Past event transparency:")
Layout.fillWidth: true
}
Controls.Slider {
Layout.fillWidth: true
stepSize: 1.0
from: 0.0
to: 100.0
value: Config.pastEventsTransparencyLevel * 100
onMoved: {
Config.pastEventsTransparencyLevel = value / 100;
Config.save();
}
}
}
}
}
}
Column {
id: weekdayLabelLengthButtonColumn
Kirigami.FormData.label: i18n("Weekday label length:")
Kirigami.FormData.labelAlignment: Qt.AlignTop
Controls.RadioButton {
property int value: Config.Full
text: i18n("Full name (Monday)")
enabled: !Config.isWeekdayLabelLengthImmutable
checked: Config.weekdayLabelLength === value
}
Controls.RadioButton {
property int value: Config.Abbreviated
text: i18n("Abbreviated (Mon)")
enabled: !Config.isWeekdayLabelLengthImmutable
checked: Config.weekdayLabelLength === value
}
Controls.RadioButton {
property int value: Config.Letter
text: i18n("Letter only (M)")
enabled: !Config.isWeekdayLabelLengthImmutable
checked: Config.weekdayLabelLength === value
}
}
Controls.CheckBox {
text: i18n("Show week numbers")
checked: Config.showWeekNumbers
enabled: !Config.isShowWeekNumbersImmutable
onClicked: {
Config.showWeekNumbers = !Config.showWeekNumbers;
Config.save();
}
}
RowLayout {
Kirigami.FormData.label: i18n("Grid border width (pixels):")
MobileForm.FormCard {
Layout.fillWidth: true
Controls.SpinBox {
Layout.fillWidth: true
value: Config.monthGridBorderWidth
onValueModified: {
Config.monthGridBorderWidth = value;
Config.save();
}
from: 0
to: 50
}
Rectangle {
Layout.alignment: Qt.AlignVCenter
width: Kirigami.Units.gridUnit * 4
implicitHeight: height
height: Config.monthGridBorderWidth
color: Kirigami.ColorUtils.linearInterpolation(Kirigami.Theme.backgroundColor, Kirigami.Theme.textColor, 0.15)
Layout.topMargin: Kirigami.Units.largeSpacing
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("Month View settings")
}
Controls.ButtonGroup {
id: weekdayLabelGroup
exclusive: true
onClicked: {
Config.weekdayLabelAlignment = button.value;
Config.save();
}
}
MobileForm.FormSectionText {
text: i18n("Weekday label alignment")
}
ColumnLayout {
spacing: 0
Layout.fillWidth: true
MobileForm.FormRadioDelegate {
property int value: Config.Left
text: i18n("Left")
enabled: !Config.isWeekdayLabelAlignmentImmutable
checked: Config.weekdayLabelAlignment === value
Controls.ButtonGroup.group: weekdayLabelGroup
}
MobileForm.FormRadioDelegate {
property int value: Config.Center
text: i18n("Center")
enabled: !Config.isWeekdayLabelAlignmentImmutable
checked: Config.weekdayLabelAlignment === value
Controls.ButtonGroup.group: weekdayLabelGroup
}
MobileForm.FormRadioDelegate {
property int value: Config.Right
text: i18n("Right")
enabled: !Config.isWeekdayLabelAlignmentImmutable
checked: Config.weekdayLabelAlignment === value
Controls.ButtonGroup.group: weekdayLabelGroup
}
}
Controls.ButtonGroup {
id: weekdayLabelLengthGroup
exclusive: true
onClicked: {
Config.weekdayLabelLength = button.value;
Config.save();
}
}
MobileForm.FormSectionText {
text: i18n("Weekday label length:")
}
MobileForm.FormRadioDelegate {
property int value: Config.Full
text: i18n("Full name (Monday)")
enabled: !Config.isWeekdayLabelLengthImmutable
checked: Config.weekdayLabelLength === value
Controls.ButtonGroup.group: weekdayLabelLengthGroup
}
MobileForm.FormRadioDelegate {
property int value: Config.Abbreviated
text: i18n("Abbreviated (Mon)")
enabled: !Config.isWeekdayLabelLengthImmutable
checked: Config.weekdayLabelLength === value
Controls.ButtonGroup.group: weekdayLabelLengthGroup
}
MobileForm.FormRadioDelegate {
property int value: Config.Letter
text: i18n("Letter only (M)")
enabled: !Config.isWeekdayLabelLengthImmutable
checked: Config.weekdayLabelLength === value
Controls.ButtonGroup.group: weekdayLabelLengthGroup
}
MobileForm.FormCheckDelegate {
text: i18n("Show week numbers")
checked: Config.showWeekNumbers
enabled: !Config.isShowWeekNumbersImmutable
onClicked: {
Config.showWeekNumbers = !Config.showWeekNumbers;
Config.save();
}
}
MobileForm.AbstractFormDelegate {
Layout.fillWidth: true
contentItem: RowLayout {
Controls.Label {
text: i18n("Grid border width (pixels):")
}
Controls.SpinBox {
Layout.fillWidth: true
value: Config.monthGridBorderWidth
onValueModified: {
Config.monthGridBorderWidth = value;
Config.save();
}
from: 0
to: 50
}
Rectangle {
Layout.alignment: Qt.AlignVCenter
width: Kirigami.Units.gridUnit * 4
implicitHeight: height
height: Config.monthGridBorderWidth
color: Kirigami.ColorUtils.linearInterpolation(Kirigami.Theme.backgroundColor, Kirigami.Theme.textColor, 0.15)
}
}
}
}
}
Kirigami.Separator {
Kirigami.FormData.isSection: true
Kirigami.FormData.label: i18n("Schedule View settings")
MobileForm.FormCard {
Layout.fillWidth: true
Layout.topMargin: Kirigami.Units.largeSpacing
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("Schedule View settings")
}
MobileForm.FormCheckDelegate {
text: i18n("Show week headers")
checked: Config.showWeekHeaders
enabled: !Config.isShowWeekHeadersImmutable
onClicked: {
Config.showWeekHeaders = !Config.showWeekHeaders;
Config.save();
}
}
}
}
Column {
Kirigami.FormData.label: i18n("Headers:")
Kirigami.FormData.labelAlignment: Qt.AlignTop
Controls.CheckBox {
text: i18n("Show week headers")
checked: Config.showWeekHeaders
enabled: !Config.isShowWeekHeadersImmutable
onClicked: {
Config.showWeekHeaders = !Config.showWeekHeaders;
Config.save();
MobileForm.FormCard {
Layout.fillWidth: true
Layout.topMargin: Kirigami.Units.largeSpacing
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("Tasks View settings")
}
MobileForm.FormCheckDelegate {
text: i18n("Show completed sub-tasks")
checked: Config.showCompletedSubtodos
enabled: !Config.isShowCompletedSubtodosImmutable
onClicked: {
Config.showCompletedSubtodos = !Config.showCompletedSubtodos;
Config.save();
}
}
}
}
}
MobileForm.FormCard {
Layout.fillWidth: true
Layout.topMargin: Kirigami.Units.largeSpacing
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("Maps")
}
MobileForm.FormCheckDelegate {
text: i18n("Enable maps")
Kirigami.Separator {
Kirigami.FormData.isSection: true
Kirigami.FormData.label: i18n("Tasks View settings")
}
Controls.CheckBox {
text: i18n("Show completed sub-tasks")
checked: Config.showCompletedSubtodos
enabled: !Config.isShowCompletedSubtodosImmutable
onClicked: {
Config.showCompletedSubtodos = !Config.showCompletedSubtodos;
Config.save();
checked: Config.enableMaps
enabled: !Config.isEnableMapsImmutable
onClicked: {
Config.enableMaps = !Config.enableMaps;
Config.save();
}
}
MobileForm.FormTextDelegate {
text: i18n("May cause crashing on some systems.")
}
Controls.ButtonGroup {
id: locationGroup
exclusive: true
onClicked: {
Config.locationMarker = button.value;
Config.save();
}
}
MobileForm.FormSectionText {
text: i18n("Location marker")
}
ColumnLayout {
id: locationMarkerButtonColumn
Layout.fillWidth: true
MobileForm.FormRadioDelegate {
property int value: Config.Circle
text: i18n("Circle (shows area of location)")
enabled: Config.enableMaps && !Config.isLocationMarkerImmutable
checked: Config.locationMarker === value
Controls.ButtonGroup.group: locationGroup
}
MobileForm.FormRadioDelegate {
property int value: Config.Pin
text: i18n("Pin (shows exact location)")
enabled: Config.enableMaps && !Config.isLocationMarkerImmutable
checked: Config.locationMarker === value
Controls.ButtonGroup.group: locationGroup
}
}
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment