Commit e1d50b5f authored by Devin Lin's avatar Devin Lin 🎨
Browse files

taskswitcher: Remove global variable calls

parent cfa7fa4f
......@@ -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)
......
/*
* SPDX-FileCopyrightText: 2015 Marco Martin <notmart@gmail.com>
* SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
* SPDX-FileCopyrightText: 2021-2022 Devin Lin <devin@kde.org>
*
* 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
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment