mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-06-12 01:07:43 +00:00
Extract RunningAppsPanelButton to its own file
qmllint shipped with Qt 6.12 segfaults on the inline component definition inside RunningAppsPanel.qml, breaking the suse_tumbleweed_qt612 KDE Invent CI job. Move PanelIconButton out to a sibling RunningAppsPanelButton.qml so qmllint never has to parse a UiInlineComponent here. The extracted file inlines its own colour-mix helper to keep it self-contained and avoid leaking RunningAppsPanel internals.
This commit is contained in:
parent
3fa5f90ed1
commit
462ceddd66
3 changed files with 67 additions and 51 deletions
|
|
@ -21,6 +21,7 @@ plasma_add_applet(org.kde.plasma.mobile.homescreen.folio
|
||||||
qml/PipeWireThumbnail.qml
|
qml/PipeWireThumbnail.qml
|
||||||
qml/PlaceholderDelegate.qml
|
qml/PlaceholderDelegate.qml
|
||||||
qml/RunningAppsPanel.qml
|
qml/RunningAppsPanel.qml
|
||||||
|
qml/RunningAppsPanelButton.qml
|
||||||
qml/WidgetDragItem.qml
|
qml/WidgetDragItem.qml
|
||||||
qml/config.qml
|
qml/config.qml
|
||||||
CPP_SOURCES
|
CPP_SOURCES
|
||||||
|
|
|
||||||
|
|
@ -79,53 +79,6 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component PanelIconButton: MouseArea {
|
|
||||||
id: button
|
|
||||||
|
|
||||||
property string iconName
|
|
||||||
property string toolTipText
|
|
||||||
property bool checked: false
|
|
||||||
|
|
||||||
signal triggered()
|
|
||||||
|
|
||||||
width: Kirigami.Units.iconSizes.smallMedium + Kirigami.Units.smallSpacing * 2
|
|
||||||
height: width
|
|
||||||
hoverEnabled: enabled
|
|
||||||
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
|
||||||
opacity: enabled ? 1 : 0.35
|
|
||||||
|
|
||||||
onClicked: button.triggered()
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.fill: parent
|
|
||||||
radius: Kirigami.Units.cornerRadius
|
|
||||||
color: button.containsPress
|
|
||||||
? root.mixColor(Kirigami.Theme.backgroundColor, Kirigami.Theme.textColor, 0.16)
|
|
||||||
: button.checked
|
|
||||||
? root.mixColor(Kirigami.Theme.backgroundColor, Kirigami.Theme.highlightColor, button.containsMouse ? 0.22 : 0.16)
|
|
||||||
: button.containsMouse
|
|
||||||
? root.mixColor(Kirigami.Theme.backgroundColor, Kirigami.Theme.textColor, 0.08)
|
|
||||||
: "transparent"
|
|
||||||
|
|
||||||
Behavior on color {
|
|
||||||
ColorAnimation { duration: Kirigami.Units.shortDuration; easing.type: Easing.OutCubic }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Kirigami.Icon {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
width: Kirigami.Units.iconSizes.small
|
|
||||||
height: width
|
|
||||||
source: button.iconName
|
|
||||||
active: button.containsMouse || button.checked
|
|
||||||
}
|
|
||||||
|
|
||||||
PC3.ToolTip {
|
|
||||||
text: button.toolTipText
|
|
||||||
visible: button.containsMouse && button.toolTipText.length > 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TaskManager.VirtualDesktopInfo { id: virtualDesktopInfo }
|
TaskManager.VirtualDesktopInfo { id: virtualDesktopInfo }
|
||||||
TaskManager.ActivityInfo { id: activityInfo }
|
TaskManager.ActivityInfo { id: activityInfo }
|
||||||
|
|
||||||
|
|
@ -692,7 +645,7 @@ Item {
|
||||||
|
|
||||||
Item { Layout.fillWidth: true }
|
Item { Layout.fillWidth: true }
|
||||||
|
|
||||||
PanelIconButton {
|
RunningAppsPanelButton {
|
||||||
iconName: taskCard.pinned ? "emblem-favorite" : "window-pin"
|
iconName: taskCard.pinned ? "emblem-favorite" : "window-pin"
|
||||||
toolTipText: taskCard.pinned ? i18n("Pinned") : i18n("Pin to Dock")
|
toolTipText: taskCard.pinned ? i18n("Pinned") : i18n("Pin to Dock")
|
||||||
checked: taskCard.pinned
|
checked: taskCard.pinned
|
||||||
|
|
@ -700,20 +653,20 @@ Item {
|
||||||
onTriggered: root.folio.FavouritesModel.addApplication(taskCard.storageId)
|
onTriggered: root.folio.FavouritesModel.addApplication(taskCard.storageId)
|
||||||
}
|
}
|
||||||
|
|
||||||
PanelIconButton {
|
RunningAppsPanelButton {
|
||||||
iconName: taskCard.minimizedTask ? "window-restore" : "window-minimize"
|
iconName: taskCard.minimizedTask ? "window-restore" : "window-minimize"
|
||||||
toolTipText: taskCard.minimizedTask ? i18n("Restore") : i18n("Minimize")
|
toolTipText: taskCard.minimizedTask ? i18n("Restore") : i18n("Minimize")
|
||||||
onTriggered: tasksModel.requestToggleMinimized(taskCard.modelIndex)
|
onTriggered: tasksModel.requestToggleMinimized(taskCard.modelIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
PanelIconButton {
|
RunningAppsPanelButton {
|
||||||
iconName: taskCard.maximizedTask ? "window-restore" : "window-maximize"
|
iconName: taskCard.maximizedTask ? "window-restore" : "window-maximize"
|
||||||
toolTipText: taskCard.maximizedTask ? i18n("Restore") : i18n("Maximize")
|
toolTipText: taskCard.maximizedTask ? i18n("Restore") : i18n("Maximize")
|
||||||
enabled: !taskCard.groupTask
|
enabled: !taskCard.groupTask
|
||||||
onTriggered: tasksModel.requestToggleMaximized(taskCard.modelIndex)
|
onTriggered: tasksModel.requestToggleMaximized(taskCard.modelIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
PanelIconButton {
|
RunningAppsPanelButton {
|
||||||
iconName: "window-close"
|
iconName: "window-close"
|
||||||
toolTipText: taskCard.winIds.length > 1 ? i18n("Close All") : i18n("Close")
|
toolTipText: taskCard.winIds.length > 1 ? i18n("Close All") : i18n("Close")
|
||||||
onTriggered: tasksModel.requestClose(taskCard.modelIndex)
|
onTriggered: tasksModel.requestClose(taskCard.modelIndex)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
// SPDX-FileCopyrightText: 2026 Marco Allegretti
|
||||||
|
// SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
import org.kde.kirigami as Kirigami
|
||||||
|
import org.kde.plasma.components 3.0 as PC3
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: button
|
||||||
|
|
||||||
|
property string iconName
|
||||||
|
property string toolTipText
|
||||||
|
property bool checked: false
|
||||||
|
|
||||||
|
signal triggered()
|
||||||
|
|
||||||
|
function _mix(base, overlay, ratio) {
|
||||||
|
return Qt.rgba(
|
||||||
|
base.r + (overlay.r - base.r) * ratio,
|
||||||
|
base.g + (overlay.g - base.g) * ratio,
|
||||||
|
base.b + (overlay.b - base.b) * ratio,
|
||||||
|
base.a + (overlay.a - base.a) * ratio)
|
||||||
|
}
|
||||||
|
|
||||||
|
width: Kirigami.Units.iconSizes.smallMedium + Kirigami.Units.smallSpacing * 2
|
||||||
|
height: width
|
||||||
|
hoverEnabled: enabled
|
||||||
|
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
|
opacity: enabled ? 1 : 0.35
|
||||||
|
|
||||||
|
onClicked: button.triggered()
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
radius: Kirigami.Units.cornerRadius
|
||||||
|
color: button.containsPress
|
||||||
|
? button._mix(Kirigami.Theme.backgroundColor, Kirigami.Theme.textColor, 0.16)
|
||||||
|
: button.checked
|
||||||
|
? button._mix(Kirigami.Theme.backgroundColor, Kirigami.Theme.highlightColor, button.containsMouse ? 0.22 : 0.16)
|
||||||
|
: button.containsMouse
|
||||||
|
? button._mix(Kirigami.Theme.backgroundColor, Kirigami.Theme.textColor, 0.08)
|
||||||
|
: "transparent"
|
||||||
|
|
||||||
|
Behavior on color {
|
||||||
|
ColorAnimation { duration: Kirigami.Units.shortDuration; easing.type: Easing.OutCubic }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Kirigami.Icon {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
width: Kirigami.Units.iconSizes.small
|
||||||
|
height: width
|
||||||
|
source: button.iconName
|
||||||
|
active: button.containsMouse || button.checked
|
||||||
|
}
|
||||||
|
|
||||||
|
PC3.ToolTip {
|
||||||
|
text: button.toolTipText
|
||||||
|
visible: button.containsMouse && button.toolTipText.length > 0
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue