Verified Commit a5c5a99e authored by Fushan Wen's avatar Fushan Wen 💬
Browse files

applets/taskmanager: be declarative in width and height of TaskList

It saves a few lines of code, and makes the code more readable.
parent 98e0e17a
Pipeline #207262 passed with stage
in 3 minutes and 56 seconds
......@@ -45,7 +45,7 @@ function logicalTaskCount() {
}
function maxStripes() {
var length = tasks.vertical ? taskList.width : taskList.height;
var length = tasks.vertical ? tasks.width : tasks.height;
var minimum = tasks.vertical ? preferredMinWidth() : preferredMinHeight();
return Math.min(plasmoid.configuration.maxStripes, Math.max(1, Math.floor(length / minimum)));
......
......@@ -70,22 +70,6 @@ MouseArea {
signal windowsHovered(variant winIds, bool hovered)
signal activateWindowView(variant winIds)
onWidthChanged: {
taskList.width = LayoutManager.layoutWidth();
if (plasmoid.configuration.forceStripes) {
taskList.height = LayoutManager.layoutHeight();
}
}
onHeightChanged: {
if (plasmoid.configuration.forceStripes) {
taskList.width = LayoutManager.layoutWidth();
}
taskList.height = LayoutManager.layoutHeight();
}
onDragSourceChanged: {
if (dragSource == null) {
tasksModel.syncLaunchers();
......@@ -430,9 +414,8 @@ MouseArea {
left: parent.left
top: parent.top
}
onWidthChanged: LayoutManager.layout(taskRepeater)
onHeightChanged: LayoutManager.layout(taskRepeater)
width: LayoutManager.layoutWidth()
height: LayoutManager.layoutHeight()
flow: {
if (tasks.vertical) {
......@@ -446,10 +429,10 @@ MouseArea {
TaskTools.publishIconGeometries(children);
}
}
onWidthChanged: layoutTimer.restart()
onHeightChanged: layoutTimer.restart()
function layout() {
taskList.width = LayoutManager.layoutWidth();
taskList.height = LayoutManager.layoutHeight();
LayoutManager.layout(taskRepeater);
}
......
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