Merge pull request #11104 from vladest/audio_mute_mouseover

Audio mic bar show only rectangle on mouse over
This commit is contained in:
anshuman64 2017-08-02 12:32:15 -07:00 committed by GitHub
commit f3a9481123

View file

@ -27,7 +27,7 @@ Rectangle {
color: "#00000000"; color: "#00000000";
border { border {
width: (standalone || Audio.muted || mouseArea.containsMouse) ? 2 : 0; width: mouseArea.containsMouse || mouseArea.containsPress ? 2 : 0;
color: colors.border; color: colors.border;
} }
@ -61,7 +61,7 @@ Rectangle {
drag.target: dragTarget; drag.target: dragTarget;
} }
Item { QtObject {
id: colors; id: colors;
readonly property string unmuted: "#FFF"; readonly property string unmuted: "#FFF";
@ -72,7 +72,7 @@ Rectangle {
readonly property string red: colors.muted; readonly property string red: colors.muted;
readonly property string fill: "#55000000"; readonly property string fill: "#55000000";
readonly property string border: standalone ? "#80FFFFFF" : "#55FFFFFF"; readonly property string border: standalone ? "#80FFFFFF" : "#55FFFFFF";
readonly property string icon: (Audio.muted && !mouseArea.containsMouse) ? muted : unmuted; readonly property string icon: Audio.muted ? muted : unmuted;
} }
Item { Item {
@ -92,10 +92,8 @@ Rectangle {
readonly property string unmutedIcon: "../../../icons/tablet-icons/mic-unmute-i.svg"; readonly property string unmutedIcon: "../../../icons/tablet-icons/mic-unmute-i.svg";
readonly property string mutedIcon: "../../../icons/tablet-icons/mic-mute-i.svg"; readonly property string mutedIcon: "../../../icons/tablet-icons/mic-mute-i.svg";
function exclusiveOr(a, b) { return (a || b) && !(a && b); }
id: image; id: image;
source: exclusiveOr(Audio.muted, mouseArea.containsMouse) ? mutedIcon : unmutedIcon; source: Audio.muted ? mutedIcon : unmutedIcon;
width: 30; width: 30;
height: 30; height: 30;
@ -118,9 +116,9 @@ Rectangle {
Item { Item {
id: status; id: status;
readonly property string color: (Audio.muted && !mouseArea.containsMouse) ? colors.muted : colors.unmuted; readonly property string color: Audio.muted ? colors.muted : colors.unmuted;
visible: Audio.muted || mouseArea.containsMouse; visible: Audio.muted;
anchors { anchors {
left: parent.left; left: parent.left;
@ -133,14 +131,14 @@ Rectangle {
Text { Text {
anchors { anchors {
horizontalCenter: parent.horizontalCenter; horizontalCenter: parent.horizontalCenter;
verticalCenter: parent.verticalCenter; verticalCenter: parent.verticalCenter;
} }
color: parent.color; color: parent.color;
text: Audio.muted ? (mouseArea.containsMouse ? "UNMUTE" : "MUTED") : "MUTE"; text: Audio.muted ? "MUTED" : "MUTE";
font.pointSize: 12; font.pointSize: 12;
} }
Rectangle { Rectangle {
@ -150,7 +148,7 @@ Rectangle {
} }
width: 50; width: 50;
height: 4; height: 4;
color: parent.color; color: parent.color;
} }
@ -161,7 +159,7 @@ Rectangle {
} }
width: 50; width: 50;
height: 4; height: 4;
color: parent.color; color: parent.color;
} }
} }