From 0dae893cd21ada3c2fb84a88ef9ab9d74d5587d7 Mon Sep 17 00:00:00 2001 From: Devin Lin Date: Fri, 11 Feb 2022 13:09:19 -0500 Subject: [PATCH] taskswitcher: Remove global variable calls --- .../mobileshell/qml/taskswitcher/TaskList.qml | 2 +- .../qml/taskswitcher/TaskSwitcher.qml | 16 ++++++------- .../homescreen/package/contents/ui/main.qml | 23 +++++++++---------- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/components/mobileshell/qml/taskswitcher/TaskList.qml b/components/mobileshell/qml/taskswitcher/TaskList.qml index 5462016b..c6748912 100644 --- a/components/mobileshell/qml/taskswitcher/TaskList.qml +++ b/components/mobileshell/qml/taskswitcher/TaskList.qml @@ -46,7 +46,7 @@ Item { Repeater { id: repeater - model: taskSwitcher.model + model: taskSwitcher.tasksModel // left margin from root edge such that the task is centered readonly property real leftMargin: (root.width / 2) - (taskSwitcherState.taskWidth / 2) diff --git a/components/mobileshell/qml/taskswitcher/TaskSwitcher.qml b/components/mobileshell/qml/taskswitcher/TaskSwitcher.qml index 9f989e91..feaefb52 100644 --- a/components/mobileshell/qml/taskswitcher/TaskSwitcher.qml +++ b/components/mobileshell/qml/taskswitcher/TaskSwitcher.qml @@ -1,6 +1,6 @@ /* * SPDX-FileCopyrightText: 2015 Marco Martin - * SPDX-FileCopyrightText: 2021 Devin Lin + * SPDX-FileCopyrightText: 2021-2022 Devin Lin * * SPDX-License-Identifier: GPL-2.0-or-later */ @@ -29,8 +29,8 @@ Item { } // task list model - property TaskManager.TasksModel model - readonly property int tasksCount: model.count + property TaskManager.TasksModel tasksModel + readonly property int tasksCount: tasksModel.count property var displaysModel: MobileShell.DisplaysModel {} @@ -65,12 +65,12 @@ Item { taskSwitcherState.cancelAnimations(); taskSwitcherState.yPosition = 0; taskSwitcherState.xPosition = 0; - taskSwitcherState.wasInActiveTask = root.model.activeTask.row >= 0; + taskSwitcherState.wasInActiveTask = tasksModel.activeTask.row >= 0; taskSwitcherState.currentlyBeingOpened = true; // skip to first active task if (taskSwitcherState.wasInActiveTask) { - taskSwitcherState.goToTaskIndex(root.model.activeTask.row); + taskSwitcherState.goToTaskIndex(tasksModel.activeTask.row); } // show task switcher, hide all running apps @@ -103,12 +103,12 @@ Item { return; } - var newActiveIdx = root.model.index(id, 0) + var newActiveIdx = tasksModel.index(id, 0) var newActiveGeo = tasksModel.data(newActiveIdx, TaskManager.AbstractTasksModel.ScreenGeometry) for (var i = 0 ; i < tasksModel.count; i++) { - var idx = root.model.index(i, 0) + var idx = tasksModel.index(i, 0) if (i == id) { - root.model.requestActivate(idx); + tasksModel.requestActivate(idx); } else if (!tasksModel.data(idx, TaskManager.AbstractTasksModel.IsMinimized)) { var geo = tasksModel.data(idx, TaskManager.AbstractTasksModel.ScreenGeometry) // only minimize the other windows in the same screen diff --git a/containments/homescreen/package/contents/ui/main.qml b/containments/homescreen/package/contents/ui/main.qml index 0682d38e..33f6ab5c 100644 --- a/containments/homescreen/package/contents/ui/main.qml +++ b/containments/homescreen/package/contents/ui/main.qml @@ -168,16 +168,6 @@ FocusScope { } // task switcher component - TaskManager.TasksModel { - id: tasksModel - groupMode: TaskManager.TasksModel.GroupDisabled - - screenGeometry: plasmoid.screenGeometry - sortMode: TaskManager.TasksModel.SortAlpha - - virtualDesktop: virtualDesktopInfo.currentDesktop - activity: activityInfo.currentActivity - } TaskManager.VirtualDesktopInfo { id: virtualDesktopInfo @@ -189,7 +179,16 @@ FocusScope { MobileShell.TaskSwitcher { id: taskSwitcher - model: tasksModel + + tasksModel: TaskManager.TasksModel { + groupMode: TaskManager.TasksModel.GroupDisabled + + screenGeometry: plasmoid.screenGeometry + sortMode: TaskManager.TasksModel.SortAlpha + + virtualDesktop: virtualDesktopInfo.currentDesktop + activity: activityInfo.currentActivity + } anchors.fill: parent @@ -213,7 +212,7 @@ FocusScope { } } - // start app animation + // start app animation component MobileShell.StartupFeedback { id: startupFeedback anchors.fill: parent