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 {
|
QtObject {
|
||||||
readonly property real topPanelHeight: Kirigami.Units.gridUnit + Kirigami.Units.smallSpacing
|
readonly property real topPanelHeight: Kirigami.Units.gridUnit + Kirigami.Units.smallSpacing
|
||||||
readonly property real bottomPanelHeight: ShellSettings.Settings.navigationPanelEnabled ? Kirigami.Units.gridUnit * 2 : 0
|
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 leftCornerAction
|
||||||
property NavigationPanelAction rightCornerAction
|
property NavigationPanelAction rightCornerAction
|
||||||
|
|
||||||
|
property bool isVertical: false
|
||||||
|
|
||||||
// drop shadow for icons
|
// drop shadow for icons
|
||||||
MultiEffect {
|
MultiEffect {
|
||||||
anchors.fill: root
|
anchors.fill: root
|
||||||
|
|
@ -117,8 +119,8 @@ Item {
|
||||||
|
|
||||||
states: [
|
states: [
|
||||||
State {
|
State {
|
||||||
name: "landscape"
|
name: "vertical"
|
||||||
when: root.width < root.height
|
when: root.isVertical
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: icons
|
target: icons
|
||||||
buttonLength: Math.min(Kirigami.Units.gridUnit * 10, icons.height * 0.7 / 3)
|
buttonLength: Math.min(Kirigami.Units.gridUnit * 10, icons.height * 0.7 / 3)
|
||||||
|
|
@ -165,8 +167,8 @@ Item {
|
||||||
width: icons.width
|
width: icons.width
|
||||||
}
|
}
|
||||||
}, State {
|
}, State {
|
||||||
name: "portrait"
|
name: "horizontal"
|
||||||
when: root.width >= root.height
|
when: !root.isVertical
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: icons
|
target: icons
|
||||||
buttonLength: Math.min(Kirigami.Units.gridUnit * 8, icons.width * 0.7 / 3)
|
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
|
readonly property real navigationPanelHeight: Kirigami.Units.gridUnit * 2
|
||||||
|
|
||||||
|
|
@ -46,7 +46,9 @@ ContainmentItem {
|
||||||
readonly property int intendedWindowLocation: inLandscape ? PlasmaCore.Types.RightEdge : PlasmaCore.Types.BottomEdge
|
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
|
onIntendedWindowLengthChanged: maximizeTimer.restart() // ensure it always takes up the full length of the screen
|
||||||
onIntendedWindowLocationChanged: locationChangeTimer.restart()
|
onIntendedWindowLocationChanged: {
|
||||||
|
root.panel.location = intendedWindowLocation;
|
||||||
|
}
|
||||||
onIntendedWindowOffsetChanged: {
|
onIntendedWindowOffsetChanged: {
|
||||||
if (root.panel) {
|
if (root.panel) {
|
||||||
root.panel.offset = intendedWindowOffset;
|
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() {
|
function setWindowProperties() {
|
||||||
if (root.panel) {
|
if (root.panel) {
|
||||||
|
|
@ -117,8 +112,10 @@ ContainmentItem {
|
||||||
|
|
||||||
// load appropriate system navigation component
|
// load appropriate system navigation component
|
||||||
NavigationPanelComponent {
|
NavigationPanelComponent {
|
||||||
|
id: navigationPanel
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
opaqueBar: root.opaqueBar
|
opaqueBar: root.opaqueBar
|
||||||
|
isVertical: root.inLandscape
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -164,6 +164,8 @@ FocusScope {
|
||||||
foregroundColorGroup: Kirigami.Theme.Complementary
|
foregroundColorGroup: Kirigami.Theme.Complementary
|
||||||
shadow: false
|
shadow: false
|
||||||
|
|
||||||
|
isVertical: MobileShell.Constants.navigationPanelOnSide(root.width, root.height)
|
||||||
|
|
||||||
leftAction: MobileShell.NavigationPanelAction {
|
leftAction: MobileShell.NavigationPanelAction {
|
||||||
enabled: true
|
enabled: true
|
||||||
iconSource: "mobile-task-switcher"
|
iconSource: "mobile-task-switcher"
|
||||||
|
|
@ -206,7 +208,7 @@ FocusScope {
|
||||||
states: [
|
states: [
|
||||||
State {
|
State {
|
||||||
name: "landscape"
|
name: "landscape"
|
||||||
when: root.width > root.height
|
when: MobileShell.Constants.navigationPanelOnSide(root.width, root.height)
|
||||||
AnchorChanges {
|
AnchorChanges {
|
||||||
target: navigationPanel
|
target: navigationPanel
|
||||||
anchors {
|
anchors {
|
||||||
|
|
@ -223,7 +225,7 @@ FocusScope {
|
||||||
},
|
},
|
||||||
State {
|
State {
|
||||||
name: "portrait"
|
name: "portrait"
|
||||||
when: root.width <= root.height
|
when: !MobileShell.Constants.navigationPanelOnSide(root.width, root.height)
|
||||||
AnchorChanges {
|
AnchorChanges {
|
||||||
target: navigationPanel
|
target: navigationPanel
|
||||||
anchors {
|
anchors {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue