Merge pull request #326 from monich/landscape-settings

Optimize settings page for landscape layout
This commit is contained in:
Sebastian Wolf 2021-01-18 18:45:48 +01:00 committed by GitHub
commit c992c3ed00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,6 +25,8 @@ Page {
id: settingsPage id: settingsPage
allowedOrientations: Orientation.All allowedOrientations: Orientation.All
readonly property bool landscapeLayout: (width > height && Screen.sizeCategory > Screen.Small) || Screen.sizeCategory > Screen.Medium
SilicaFlickable { SilicaFlickable {
id: settingsContainer id: settingsContainer
contentHeight: column.height contentHeight: column.height
@ -42,7 +44,14 @@ Page {
text: qsTr("Behavior") text: qsTr("Behavior")
} }
Grid {
width: parent.width
columns: landscapeLayout ? 2 : 1
readonly property real columnWidth: width/columns
TextSwitch { TextSwitch {
width: parent.columnWidth
checked: appSettings.sendByEnter checked: appSettings.sendByEnter
text: qsTr("Send message by enter") text: qsTr("Send message by enter")
description: qsTr("Send your message by pressing the enter key") description: qsTr("Send your message by pressing the enter key")
@ -53,6 +62,7 @@ Page {
} }
TextSwitch { TextSwitch {
width: parent.columnWidth
checked: appSettings.focusTextAreaAfterSend checked: appSettings.focusTextAreaAfterSend
text: qsTr("Focus text input area after send") text: qsTr("Focus text input area after send")
description: qsTr("Focus the text input area after sending a message") description: qsTr("Focus the text input area after sending a message")
@ -63,6 +73,7 @@ Page {
} }
TextSwitch { TextSwitch {
width: parent.columnWidth
checked: appSettings.useOpenWith checked: appSettings.useOpenWith
text: qsTr("Open-with menu integration") text: qsTr("Open-with menu integration")
description: qsTr("Integrate Fernschreiber into open-with menu of Sailfish OS") description: qsTr("Integrate Fernschreiber into open-with menu of Sailfish OS")
@ -72,6 +83,21 @@ Page {
} }
} }
TextSwitch {
width: parent.columnWidth
checked: appSettings.notificationTurnsDisplayOn && enabled
text: qsTr("Notification turns on the display")
height: appSettings.notificationFeedback === AppSettings.NotificationFeedbackNone ? 0 : implicitHeight
clip: height < implicitHeight
visible: height > 0
automaticCheck: false
onClicked: {
appSettings.notificationTurnsDisplayOn = !checked
}
Behavior on height { SmoothedAnimation { duration: 200 } }
}
}
ComboBox { ComboBox {
id: feedbackComboBox id: feedbackComboBox
label: qsTr("Notification feedback") label: qsTr("Notification feedback")
@ -123,33 +149,18 @@ Page {
} }
} }
TextSwitch {
checked: appSettings.notificationTurnsDisplayOn && enabled
text: qsTr("Notification turns on the display")
height: appSettings.notificationFeedback === AppSettings.NotificationFeedbackNone ? 0 : implicitHeight
clip: height < implicitHeight
visible: height > 0
automaticCheck: false
onClicked: {
appSettings.notificationTurnsDisplayOn = !checked
}
Behavior on height { SmoothedAnimation { duration: 200 } }
}
SectionHeader { SectionHeader {
text: qsTr("Appearance") text: qsTr("Appearance")
} }
TextSwitch { Grid {
checked: appSettings.animateStickers width: parent.width
text: qsTr("Animate stickers") columns: landscapeLayout ? 2 : 1
automaticCheck: false
onClicked: { readonly property real columnWidth: width/columns
appSettings.animateStickers = !checked
}
}
TextSwitch { TextSwitch {
width: parent.columnWidth
checked: appSettings.showStickersAsImages checked: appSettings.showStickersAsImages
text: qsTr("Show stickers as images") text: qsTr("Show stickers as images")
description: qsTr("Show background for stickers and align them centrally like images") description: qsTr("Show background for stickers and align them centrally like images")
@ -159,6 +170,17 @@ Page {
} }
} }
TextSwitch {
width: parent.columnWidth
checked: appSettings.animateStickers
text: qsTr("Animate stickers")
automaticCheck: false
onClicked: {
appSettings.animateStickers = !checked
}
}
}
SectionHeader { SectionHeader {
text: qsTr("Privacy") text: qsTr("Privacy")
} }
@ -177,16 +199,14 @@ Page {
text: qsTr("Storage") text: qsTr("Storage")
} }
TextSwitch { Grid {
checked: appSettings.storageOptimizer width: parent.width
text: qsTr("Enable storage optimizer") columns: landscapeLayout ? 2 : 1
automaticCheck: false
onClicked: { readonly property real columnWidth: width/columns
appSettings.storageOptimizer = !checked
}
}
TextSwitch { TextSwitch {
width: parent.columnWidth
checked: appSettings.onlineOnlyMode checked: appSettings.onlineOnlyMode
text: qsTr("Enable online-only mode") text: qsTr("Enable online-only mode")
description: qsTr("Disables offline caching. Certain features may be limited or missing in this mode. Changes require a restart of Fernschreiber to take effect.") description: qsTr("Disables offline caching. Certain features may be limited or missing in this mode. Changes require a restart of Fernschreiber to take effect.")
@ -196,6 +216,17 @@ Page {
} }
} }
TextSwitch {
width: parent.columnWidth
checked: appSettings.storageOptimizer
text: qsTr("Enable storage optimizer")
automaticCheck: false
onClicked: {
appSettings.storageOptimizer = !checked
}
}
}
Item { Item {
width: 1 width: 1
height: Theme.paddingLarge // Some space at the bottom height: Theme.paddingLarge // Some space at the bottom