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,33 +44,57 @@ Page {
text: qsTr("Behavior") text: qsTr("Behavior")
} }
TextSwitch { Grid {
checked: appSettings.sendByEnter width: parent.width
text: qsTr("Send message by enter") columns: landscapeLayout ? 2 : 1
description: qsTr("Send your message by pressing the enter key")
automaticCheck: false
onClicked: {
appSettings.sendByEnter = !checked
}
}
TextSwitch { readonly property real columnWidth: width/columns
checked: appSettings.focusTextAreaAfterSend
text: qsTr("Focus text input area after send")
description: qsTr("Focus the text input area after sending a message")
automaticCheck: false
onClicked: {
appSettings.focusTextAreaAfterSend = !checked
}
}
TextSwitch { TextSwitch {
checked: appSettings.useOpenWith width: parent.columnWidth
text: qsTr("Open-with menu integration") checked: appSettings.sendByEnter
description: qsTr("Integrate Fernschreiber into open-with menu of Sailfish OS") text: qsTr("Send message by enter")
automaticCheck: false description: qsTr("Send your message by pressing the enter key")
onClicked: { automaticCheck: false
appSettings.useOpenWith = !checked onClicked: {
appSettings.sendByEnter = !checked
}
}
TextSwitch {
width: parent.columnWidth
checked: appSettings.focusTextAreaAfterSend
text: qsTr("Focus text input area after send")
description: qsTr("Focus the text input area after sending a message")
automaticCheck: false
onClicked: {
appSettings.focusTextAreaAfterSend = !checked
}
}
TextSwitch {
width: parent.columnWidth
checked: appSettings.useOpenWith
text: qsTr("Open-with menu integration")
description: qsTr("Integrate Fernschreiber into open-with menu of Sailfish OS")
automaticCheck: false
onClicked: {
appSettings.useOpenWith = !checked
}
}
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 } }
} }
} }
@ -123,39 +149,35 @@ 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: {
appSettings.animateStickers = !checked
}
}
TextSwitch { readonly property real columnWidth: width/columns
checked: appSettings.showStickersAsImages
text: qsTr("Show stickers as images") TextSwitch {
description: qsTr("Show background for stickers and align them centrally like images") width: parent.columnWidth
automaticCheck: false checked: appSettings.showStickersAsImages
onClicked: { text: qsTr("Show stickers as images")
appSettings.showStickersAsImages = !checked description: qsTr("Show background for stickers and align them centrally like images")
automaticCheck: false
onClicked: {
appSettings.showStickersAsImages = !checked
}
}
TextSwitch {
width: parent.columnWidth
checked: appSettings.animateStickers
text: qsTr("Animate stickers")
automaticCheck: false
onClicked: {
appSettings.animateStickers = !checked
}
} }
} }
@ -177,22 +199,31 @@ 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: {
appSettings.storageOptimizer = !checked
}
}
TextSwitch { readonly property real columnWidth: width/columns
checked: appSettings.onlineOnlyMode
text: qsTr("Enable online-only mode") TextSwitch {
description: qsTr("Disables offline caching. Certain features may be limited or missing in this mode. Changes require a restart of Fernschreiber to take effect.") width: parent.columnWidth
automaticCheck: false checked: appSettings.onlineOnlyMode
onClicked: { text: qsTr("Enable online-only mode")
appSettings.onlineOnlyMode = !checked description: qsTr("Disables offline caching. Certain features may be limited or missing in this mode. Changes require a restart of Fernschreiber to take effect.")
automaticCheck: false
onClicked: {
appSettings.onlineOnlyMode = !checked
}
}
TextSwitch {
width: parent.columnWidth
checked: appSettings.storageOptimizer
text: qsTr("Enable storage optimizer")
automaticCheck: false
onClicked: {
appSettings.storageOptimizer = !checked
}
} }
} }