mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
navigationpanel: Have it on the bottom if the screen height is large enough
This commit is contained in:
parent
0497da061a
commit
76177166cf
4 changed files with 20 additions and 15 deletions
|
|
@ -14,4 +14,8 @@ pragma Singleton
|
|||
QtObject {
|
||||
readonly property real topPanelHeight: Kirigami.Units.gridUnit + Kirigami.Units.smallSpacing
|
||||
readonly property real bottomPanelHeight: ShellSettings.Settings.navigationPanelEnabled ? Kirigami.Units.gridUnit * 2 : 0
|
||||
|
||||
function navigationPanelOnSide(screenWidth: real, screenHeight: real): bool {
|
||||
return screenWidth > screenHeight && screenHeight < 500;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ Item {
|
|||
property NavigationPanelAction leftCornerAction
|
||||
property NavigationPanelAction rightCornerAction
|
||||
|
||||
property bool isVertical: false
|
||||
|
||||
// drop shadow for icons
|
||||
MultiEffect {
|
||||
anchors.fill: root
|
||||
|
|
@ -117,8 +119,8 @@ Item {
|
|||
|
||||
states: [
|
||||
State {
|
||||
name: "landscape"
|
||||
when: root.width < root.height
|
||||
name: "vertical"
|
||||
when: root.isVertical
|
||||
PropertyChanges {
|
||||
target: icons
|
||||
buttonLength: Math.min(Kirigami.Units.gridUnit * 10, icons.height * 0.7 / 3)
|
||||
|
|
@ -165,8 +167,8 @@ Item {
|
|||
width: icons.width
|
||||
}
|
||||
}, State {
|
||||
name: "portrait"
|
||||
when: root.width >= root.height
|
||||
name: "horizontal"
|
||||
when: !root.isVertical
|
||||
PropertyChanges {
|
||||
target: icons
|
||||
buttonLength: Math.min(Kirigami.Units.gridUnit * 8, icons.width * 0.7 / 3)
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ ContainmentItem {
|
|||
}
|
||||
}
|
||||
|
||||
readonly property bool inLandscape: Screen.width > Screen.height;
|
||||
readonly property bool inLandscape: MobileShell.Constants.navigationPanelOnSide(Screen.width, Screen.height)
|
||||
|
||||
readonly property real navigationPanelHeight: Kirigami.Units.gridUnit * 2
|
||||
|
||||
|
|
@ -46,7 +46,9 @@ ContainmentItem {
|
|||
readonly property int intendedWindowLocation: inLandscape ? PlasmaCore.Types.RightEdge : PlasmaCore.Types.BottomEdge
|
||||
|
||||
onIntendedWindowLengthChanged: maximizeTimer.restart() // ensure it always takes up the full length of the screen
|
||||
onIntendedWindowLocationChanged: locationChangeTimer.restart()
|
||||
onIntendedWindowLocationChanged: {
|
||||
root.panel.location = intendedWindowLocation;
|
||||
}
|
||||
onIntendedWindowOffsetChanged: {
|
||||
if (root.panel) {
|
||||
root.panel.offset = intendedWindowOffset;
|
||||
|
|
@ -66,13 +68,6 @@ ContainmentItem {
|
|||
}
|
||||
}
|
||||
|
||||
// use a timer so that rotation events are faster (offload the panel movement to later, after everything is figured out)
|
||||
Timer {
|
||||
id: locationChangeTimer
|
||||
running: false
|
||||
interval: 100
|
||||
onTriggered: root.panel.location = intendedWindowLocation
|
||||
}
|
||||
|
||||
function setWindowProperties() {
|
||||
if (root.panel) {
|
||||
|
|
@ -117,8 +112,10 @@ ContainmentItem {
|
|||
|
||||
// load appropriate system navigation component
|
||||
NavigationPanelComponent {
|
||||
id: navigationPanel
|
||||
anchors.fill: parent
|
||||
opaqueBar: root.opaqueBar
|
||||
isVertical: root.inLandscape
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -164,6 +164,8 @@ FocusScope {
|
|||
foregroundColorGroup: Kirigami.Theme.Complementary
|
||||
shadow: false
|
||||
|
||||
isVertical: MobileShell.Constants.navigationPanelOnSide(root.width, root.height)
|
||||
|
||||
leftAction: MobileShell.NavigationPanelAction {
|
||||
enabled: true
|
||||
iconSource: "mobile-task-switcher"
|
||||
|
|
@ -206,7 +208,7 @@ FocusScope {
|
|||
states: [
|
||||
State {
|
||||
name: "landscape"
|
||||
when: root.width > root.height
|
||||
when: MobileShell.Constants.navigationPanelOnSide(root.width, root.height)
|
||||
AnchorChanges {
|
||||
target: navigationPanel
|
||||
anchors {
|
||||
|
|
@ -223,7 +225,7 @@ FocusScope {
|
|||
},
|
||||
State {
|
||||
name: "portrait"
|
||||
when: root.width <= root.height
|
||||
when: !MobileShell.Constants.navigationPanelOnSide(root.width, root.height)
|
||||
AnchorChanges {
|
||||
target: navigationPanel
|
||||
anchors {
|
||||
|
|
|
|||
Loading…
Reference in a new issue