Plasmoide: apri la calibrazione dall'icona del vassoio

Kirigami.Icon dentro una compactRepresentation personalizzata assorbe gli
eventi del mouse (bug KDE 518024), quindi la MouseArea che apriva il popup
non riceveva i clic. Il gesto è ora duplicato anche dentro l'icona.

Clic sinistro sull'icona: apre la pagina di calibrazione a tutto schermo
(fascia bianca + gain RGB e luminosità). Clic centrale: popup dei controlli.
L'avvio della calibrazione è centralizzato in openCalibration(), riusato dal
pulsante Calibra… del popup.
This commit is contained in:
enne2
2026-11-02 17:54:18 +01:00
parent a17021e610
commit 9bc45980f3
@@ -50,6 +50,13 @@ PlasmoidItem {
exec.connectSource(root.ctl + " " + args) exec.connectSource(root.ctl + " " + args)
} }
function openCalibration() {
if (!root.st.daemon || root.calibrating)
return
root.calibrating = true
calibrationSource.connectSource("/usr/bin/python3 " + JSON.stringify(root.calibration))
}
// ---- stato (polling) // ---- stato (polling)
P5Support.DataSource { P5Support.DataSource {
id: poll id: poll
@@ -105,12 +112,19 @@ PlasmoidItem {
Layout.preferredWidth: implicitWidth Layout.preferredWidth: implicitWidth
Layout.preferredHeight: implicitHeight Layout.preferredHeight: implicitHeight
// Kirigami.Icon assorbe i clic se non ha un MouseArea proprio (bug KDE 518024),
// quindi il gesto è duplicato sia sul contenitore sia sull'icona.
MouseArea { MouseArea {
id: compactMouse id: compactMouse
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton | Qt.MiddleButton
onClicked: root.expanded = !root.expanded onClicked: function(mouse) {
if (mouse.button === Qt.MiddleButton)
root.expanded = !root.expanded
else
root.openCalibration()
}
onContainsMouseChanged: { onContainsMouseChanged: {
if (containsMouse) if (containsMouse)
root.refresh() root.refresh()
@@ -121,6 +135,17 @@ PlasmoidItem {
source: "video-television" source: "video-television"
active: compactMouse.containsMouse active: compactMouse.containsMouse
opacity: root.st.running ? 1.0 : 0.45 opacity: root.st.running ? 1.0 : 0.45
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.MiddleButton
onClicked: function(mouse) {
if (mouse.button === Qt.MiddleButton)
root.expanded = !root.expanded
else
root.openCalibration()
}
}
} }
} }
} }
@@ -264,10 +289,7 @@ PlasmoidItem {
PC3.Button { PC3.Button {
text: i18n("Calibra…") text: i18n("Calibra…")
enabled: root.st.daemon && !root.calibrating enabled: root.st.daemon && !root.calibrating
onClicked: { onClicked: root.openCalibration()
root.calibrating = true
calibrationSource.connectSource("/usr/bin/python3 " + JSON.stringify(root.calibration))
}
} }
PC3.Button { PC3.Button {
text: i18n("Riavvia demone") text: i18n("Riavvia demone")