taskpanel: Refactor and cleanup

This commit is contained in:
Devin Lin 2021-12-25 00:11:28 -05:00
parent cb30fd1a06
commit 57175abcf4

View file

@ -87,26 +87,10 @@ PlasmaCore.ColorScope {
}); });
} }
// bottom navigation panel // navigation panel actions
MobileShell.NavigationPanel { MobileShell.NavigationPanelAction {
id: panel id: taskSwitcherAction
anchors.fill: parent
taskSwitcher: root.taskSwitcher
backgroundColor: {
if (taskSwitcher.visible) {
return Qt.rgba(0, 0, 0, 0.1);
} else {
return root.showingApp ? root.backgroundColor : "transparent";
}
}
foregroundColorGroup: (!taskSwitcher.visible && root.showingApp) ? PlasmaCore.Theme.NormalColorGroup : PlasmaCore.Theme.ComplementaryColorGroup
// do not enable drag gesture when task switcher is already open
// also don't disable drag gesture mid-drag
dragGestureEnabled: !taskSwitcher.visible || taskSwitcher.currentlyDragging
leftAction: MobileShell.NavigationPanelAction {
enabled: hasTasks || taskSwitcher.visible enabled: hasTasks || taskSwitcher.visible
iconSource: "mobile-task-switcher" iconSource: "mobile-task-switcher"
iconSizeFactor: 0.75 iconSizeFactor: 0.75
@ -128,7 +112,9 @@ PlasmaCore.ColorScope {
} }
} }
middleAction: MobileShell.NavigationPanelAction { MobileShell.NavigationPanelAction {
id: homeAction
enabled: true enabled: true
iconSource: "start-here-kde" iconSource: "start-here-kde"
iconSizeFactor: 1 iconSizeFactor: 1
@ -138,7 +124,9 @@ PlasmaCore.ColorScope {
} }
} }
rightAction: MobileShell.NavigationPanelAction { MobileShell.NavigationPanelAction {
id: closeAppAction
enabled: MobileShell.KWinVirtualKeyboard.visible || taskSwitcher.visible || plasmoid.nativeInterface.hasCloseableActiveWindow enabled: MobileShell.KWinVirtualKeyboard.visible || taskSwitcher.visible || plasmoid.nativeInterface.hasCloseableActiveWindow
// mobile-close-app (from plasma-frameworks) seems to have less margins than icons from breeze-icons // mobile-close-app (from plasma-frameworks) seems to have less margins than icons from breeze-icons
iconSizeFactor: MobileShell.KWinVirtualKeyboard.visible ? 1 : 0.75 iconSizeFactor: MobileShell.KWinVirtualKeyboard.visible ? 1 : 0.75
@ -163,6 +151,29 @@ PlasmaCore.ColorScope {
} }
} }
} }
// bottom navigation panel
MobileShell.NavigationPanel {
id: panel
anchors.fill: parent
taskSwitcher: root.taskSwitcher
backgroundColor: {
if (taskSwitcher.visible) {
return Qt.rgba(0, 0, 0, 0.1);
} else {
return root.showingApp ? root.backgroundColor : "transparent";
}
}
foregroundColorGroup: (!taskSwitcher.visible && root.showingApp) ? PlasmaCore.Theme.NormalColorGroup : PlasmaCore.Theme.ComplementaryColorGroup
// do not enable drag gesture when task switcher is already open
// also don't disable drag gesture mid-drag
dragGestureEnabled: !taskSwitcher.visible || taskSwitcher.currentlyDragging
leftAction: taskSwitcherAction
middleAction: homeAction
rightAction: closeAppAction
} }
states: [ states: [