From 32bc73dad3cf6cc9f042de1f9edebc2820d38459 Mon Sep 17 00:00:00 2001 From: Faye Li Si Fi Date: Wed, 4 Jan 2017 12:20:41 -0800 Subject: [PATCH 1/3] added activeText and activeIcon properties in QML --- interface/resources/qml/hifi/tablet/TabletButton.qml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/interface/resources/qml/hifi/tablet/TabletButton.qml b/interface/resources/qml/hifi/tablet/TabletButton.qml index 5dfef31112..636b6dbebc 100644 --- a/interface/resources/qml/hifi/tablet/TabletButton.qml +++ b/interface/resources/qml/hifi/tablet/TabletButton.qml @@ -6,6 +6,8 @@ Item { property var uuid; property string text: "EDIT" property string icon: "icons/edit-icon.svg" + property string activeText: tabletButton.text + property string activeIcon: tabletButton.icon property bool isActive: false property bool inDebugMode: false property bool isEntered: false @@ -170,12 +172,18 @@ Item { PropertyChanges { target: text color: "#333333" + text: tabletButton.activeText } PropertyChanges { target: iconColorOverlay color: "#333333" } + + PropertyChanges { + target: icon + source: "../../../" + tabletButton.activeIcon + } }, State { name: "hover active state" From 475430c1e0069d9e3d6c54f821c72fb279503442 Mon Sep 17 00:00:00 2001 From: Faye Li Si Fi Date: Wed, 4 Jan 2017 12:25:27 -0800 Subject: [PATCH 2/3] testing new active state with mute.js --- scripts/system/mute.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/system/mute.js b/scripts/system/mute.js index 97a00fb0b2..e665972b76 100644 --- a/scripts/system/mute.js +++ b/scripts/system/mute.js @@ -20,7 +20,9 @@ function muteURL() { } var button = tablet.addButton({ icon: "icons/tablet-icons/mic-a.svg", - text: "MUTE" + text: "MUTE", + activeIcon: "icons/tablet-icons/mic-i.svg", + activeText: "UNMUTE" }); function onMuteToggled() { From 934b56bd504e580fdd55bf21adab2054543239b7 Mon Sep 17 00:00:00 2001 From: Faye Li Si Fi Date: Wed, 4 Jan 2017 12:41:49 -0800 Subject: [PATCH 3/3] replace redundant toggle logic --- scripts/system/mute.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/system/mute.js b/scripts/system/mute.js index e665972b76..03e0d784f1 100644 --- a/scripts/system/mute.js +++ b/scripts/system/mute.js @@ -15,9 +15,6 @@ var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); -function muteURL() { - return "icons/tablet-icons/" + (AudioDevice.getMuted() ? "mic-a.svg" : "mic-i.svg"); -} var button = tablet.addButton({ icon: "icons/tablet-icons/mic-a.svg", text: "MUTE", @@ -26,7 +23,7 @@ var button = tablet.addButton({ }); function onMuteToggled() { - button.editProperties({icon: muteURL()}); + button.editProperties({isActive: AudioDevice.getMuted()}); } onMuteToggled(); function onClicked(){