taskswitcher: Restore status bar and navigation panel

This commit is contained in:
Devin Lin 2023-03-31 22:10:02 -07:00
parent 7b77c9072f
commit 372626b786
4 changed files with 110 additions and 4 deletions

View file

@ -15,7 +15,6 @@ import Qt5Compat.GraphicalEffects
import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.plasma5support 2.0 as P5Support import org.kde.plasma.plasma5support 2.0 as P5Support
import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.plasma.private.mobileshell.state 1.0 as MobileShellState
import "indicators" as Indicators import "indicators" as Indicators
import "../dataproviders" as DataProviders import "../dataproviders" as DataProviders

View file

@ -141,7 +141,7 @@ void Settings::saveConfigSetting(const QString &fileName, const QString &group,
auto keyGroup = KConfigGroup{&fileGroup, group}; auto keyGroup = KConfigGroup{&fileGroup, group};
if (!keyGroup.hasKey(key)) { if (!keyGroup.hasKey(key)) {
qCDebug(LOGGING_CATEGORY) << "In" << fileName << "set" << key << "to" << value; qCDebug(LOGGING_CATEGORY) << "In" << fileName << "saved" << key << "to" << value;
keyGroup.writeEntry(key, value); keyGroup.writeEntry(key, value);
} }
} }

View file

@ -32,6 +32,10 @@ MouseArea {
return baseY + diff / 2 - shellTopMargin; return baseY + diff / 2 - shellTopMargin;
} }
function getTaskAt(index) {
return repeater.itemAt(index);
}
function closeAll() { function closeAll() {
for (var i = 0; i < repeater.count; i++) { for (var i = 0; i < repeater.count; i++) {
repeater.itemAt(i).closeApp(); repeater.itemAt(i).closeApp();

View file

@ -11,6 +11,7 @@ import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.plasma.extras as PlasmaExtras import org.kde.plasma.extras as PlasmaExtras
import org.kde.plasma.private.mobileshell as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.private.mobileshell.state as MobileShellState import org.kde.plasma.private.mobileshell.state as MobileShellState
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
import org.kde.kwin 3.0 as KWinComponents import org.kde.kwin 3.0 as KWinComponents
import org.kde.kwin.private.effects 1.0 import org.kde.kwin.private.effects 1.0
@ -25,10 +26,13 @@ FocusScope {
readonly property QtObject effect: KWinComponents.SceneView.effect readonly property QtObject effect: KWinComponents.SceneView.effect
readonly property QtObject targetScreen: KWinComponents.SceneView.screen readonly property QtObject targetScreen: KWinComponents.SceneView.screen
readonly property bool inLandscape: width > height;
readonly property bool isInLandscapeNavPanelMode: inLandscape && ShellSettings.Settings.navigationPanelEnabled
readonly property real topMargin: MobileShell.Constants.topPanelHeight readonly property real topMargin: MobileShell.Constants.topPanelHeight
readonly property real bottomMargin: MobileShell.Constants.bottomPanelHeight readonly property real bottomMargin: isInLandscapeNavPanelMode ? 0 : MobileShell.Constants.bottomPanelHeight
readonly property real leftMargin: 0 readonly property real leftMargin: 0
readonly property real rightMargin: 0 readonly property real rightMargin: isInLandscapeNavPanelMode ? MobileShell.Constants.bottomPanelHeight : 0
property var taskSwitcherState: TaskSwitcherState { property var taskSwitcherState: TaskSwitcherState {
taskSwitcher: root taskSwitcher: root
@ -114,6 +118,7 @@ FocusScope {
} }
} }
// view of the desktop background
KWinComponents.DesktopBackground { KWinComponents.DesktopBackground {
id: backgroundItem id: backgroundItem
activity: KWinComponents.Workspace.currentActivity activity: KWinComponents.Workspace.currentActivity
@ -137,6 +142,104 @@ FocusScope {
} }
} }
// status bar
MobileShell.StatusBar {
id: statusBar
z: 1
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
backgroundColor: "transparent"
height: root.topMargin
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
}
// navigation panel
MobileShell.NavigationPanel {
id: navigationPanel
z: 1
visible: ShellSettings.Settings.navigationPanelEnabled
backgroundColor: Qt.rgba(0, 0, 0, 0.1)
foregroundColorGroup: PlasmaCore.Theme.ComplementaryColorGroup
shadow: false
leftAction: MobileShell.NavigationPanelAction {
enabled: true
iconSource: "mobile-task-switcher"
iconSizeFactor: 0.75
onTriggered: {
if (taskList.count === 0) {
root.hide();
} else {
const currentIndex = taskSwitcherState.currentTaskIndex;
taskSwitcherState.openApp(taskSwitcherState.currentTaskIndex, taskList.getTaskAt(currentIndex).window);
}
}
}
// home button
middleAction: MobileShell.NavigationPanelAction {
enabled: true
iconSource: "start-here-kde"
iconSizeFactor: 1
onTriggered: root.hide()
}
// close app/keyboard button
rightAction: MobileShell.NavigationPanelAction {
enabled: true
iconSource: "mobile-close-app"
iconSizeFactor: 0.75
onTriggered: {
taskList.getTaskAt(taskSwitcherState.currentTaskIndex).closeApp();
}
}
rightCornerAction: MobileShell.NavigationPanelAction {
visible: false
}
}
states: [
State {
name: "landscape"
when: root.width > root.height
AnchorChanges {
target: navigationPanel
anchors {
right: root.right
top: root.top
bottom: root.bottom
}
}
PropertyChanges {
target: navigationPanel
width: root.rightMargin
anchors.topMargin: root.topMargin
}
},
State {
name: "portrait"
when: root.width <= root.height
AnchorChanges {
target: navigationPanel
anchors {
right: root.right
left: root.left
bottom: root.bottom
}
}
PropertyChanges {
target: navigationPanel
height: root.bottomMargin
}
}
]
// task list
Item { Item {
id: container id: container