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:
@@ -50,6 +50,13 @@ PlasmoidItem {
|
||||
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)
|
||||
P5Support.DataSource {
|
||||
id: poll
|
||||
@@ -105,12 +112,19 @@ PlasmoidItem {
|
||||
Layout.preferredWidth: implicitWidth
|
||||
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 {
|
||||
id: compactMouse
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
acceptedButtons: Qt.LeftButton
|
||||
onClicked: root.expanded = !root.expanded
|
||||
acceptedButtons: Qt.LeftButton | Qt.MiddleButton
|
||||
onClicked: function(mouse) {
|
||||
if (mouse.button === Qt.MiddleButton)
|
||||
root.expanded = !root.expanded
|
||||
else
|
||||
root.openCalibration()
|
||||
}
|
||||
onContainsMouseChanged: {
|
||||
if (containsMouse)
|
||||
root.refresh()
|
||||
@@ -121,6 +135,17 @@ PlasmoidItem {
|
||||
source: "video-television"
|
||||
active: compactMouse.containsMouse
|
||||
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 {
|
||||
text: i18n("Calibra…")
|
||||
enabled: root.st.daemon && !root.calibrating
|
||||
onClicked: {
|
||||
root.calibrating = true
|
||||
calibrationSource.connectSource("/usr/bin/python3 " + JSON.stringify(root.calibration))
|
||||
}
|
||||
onClicked: root.openCalibration()
|
||||
}
|
||||
PC3.Button {
|
||||
text: i18n("Riavvia demone")
|
||||
|
||||
Reference in New Issue
Block a user