diff --git a/package/org.enne2.ambilight/contents/ui/main.qml b/package/org.enne2.ambilight/contents/ui/main.qml index 7bc97ac..f6af975 100644 --- a/package/org.enne2.ambilight/contents/ui/main.qml +++ b/package/org.enne2.ambilight/contents/ui/main.qml @@ -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")