From 4829ce7c8a4341c37bcd32b17e39bccc74e70b0d Mon Sep 17 00:00:00 2001 From: Vasily Date: Sat, 12 Jan 2019 18:40:12 +0100 Subject: [PATCH] Add QML for audio buttons and add pngs .pngs were chosen because the .svgs were only available in black. Qt currently does not have an easy way of changing colors. The rest of the interface icons are white, so getting them in white was necessary. --- advancedSettings.pro | 3 +- src/res/qml/UtilitiesPage.qml | 118 ++++++++++++++++++ .../media_keys/outline_pause_white_24dp.png | Bin 0 -> 90 bytes .../outline_play_arrow_white_24dp.png | Bin 0 -> 256 bytes .../outline_skip_next_white_24dp.png | Bin 0 -> 257 bytes .../outline_skip_previous_white_24dp.png | Bin 0 -> 254 bytes .../media_keys/outline_stop_white_24dp.png | Bin 0 -> 97 bytes 7 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 src/res/qml/media_keys/outline_pause_white_24dp.png create mode 100644 src/res/qml/media_keys/outline_play_arrow_white_24dp.png create mode 100644 src/res/qml/media_keys/outline_skip_next_white_24dp.png create mode 100644 src/res/qml/media_keys/outline_skip_previous_white_24dp.png create mode 100644 src/res/qml/media_keys/outline_stop_white_24dp.png diff --git a/advancedSettings.pro b/advancedSettings.pro index 17c0b17..00dbaec 100644 --- a/advancedSettings.pro +++ b/advancedSettings.pro @@ -139,4 +139,5 @@ DISTFILES += \ src/res/qml/SettingsPage.qml \ src/res/qml/StatisticsPage.qml \ src/res/qml/SteamVRPage.qml \ - src/res/qml/UtilitiesPage.qml + src/res/qml/UtilitiesPage.qml \ + src/res/qml/media_keys/* diff --git a/src/res/qml/UtilitiesPage.qml b/src/res/qml/UtilitiesPage.qml index 76841cf..70aa9a8 100644 --- a/src/res/qml/UtilitiesPage.qml +++ b/src/res/qml/UtilitiesPage.qml @@ -320,6 +320,124 @@ MyStackViewPage { } } + GroupBox { + id: mediaKeysGroupBox + Layout.fillWidth: true + + label: MyText { + leftPadding: 10 + text: "Media Control Keys" + bottomPadding: -10 + } + background: Rectangle { + color: "transparent" + border.color: "#ffffff" + radius: 8 + } + + RowLayout { + property bool playButtonIsPlay: false + MyPushButton2 { + id: previousSongButton + Layout.preferredHeight: 50 + Layout.preferredWidth: 50 + contentItem: Image { + source: "media_keys/outline_skip_previous_white_24dp.png" + sourceSize.width: 50 + sourceSize.height: 50 + anchors.fill: parent + } + onClicked: { + UtilitiesTabController.sendMediaPreviousSong() + } + + background: Rectangle { + opacity: parent.down ? 1.0 : (parent.activeFocus ? 0.5 : 0.0) + color: "#406288" + radius: 4 + anchors.fill: parent + } + } + MyPushButton2 { + id: stopSongButton + Layout.preferredHeight: 50 + Layout.preferredWidth: 50 + + contentItem: Image { + source: "media_keys/outline_stop_white_24dp.png" + sourceSize.width: 50 + sourceSize.height: 50 + anchors.fill: parent + } + onClicked: { + UtilitiesTabController.sendMediaStopSong() + playPauseSongButton.contentItem.source = "media_keys/outline_play_arrow_white_24dp.png" + parent.playButtonIsPlay = true + } + + background: Rectangle { + opacity: parent.down ? 1.0 : (parent.activeFocus ? 0.5 : 0.0) + color: "#406288" + radius: 4 + anchors.fill: parent + } + } + MyPushButton2 { + id: playPauseSongButton + Layout.preferredHeight: 50 + Layout.preferredWidth: 50 + contentItem: Image { + // Assume that music is playing when people enter VR. + source: "media_keys/outline_pause_white_24dp.png" + sourceSize.width: 50 + sourceSize.height: 50 + + anchors.fill: parent + } + onClicked: { + UtilitiesTabController.sendMediaPausePlay() + if (parent.playButtonIsPlay) { + playPauseSongButton.contentItem.source = "media_keys/outline_pause_white_24dp.png" + parent.playButtonIsPlay = false + } else { + playPauseSongButton.contentItem.source = "media_keys/outline_play_arrow_white_24dp.png" + parent.playButtonIsPlay = true + } + + } + + background: Rectangle { + opacity: parent.down ? 1.0 : (parent.activeFocus ? 0.5 : 0.0) + color: "#406288" + radius: 4 + anchors.fill: parent + } + } + MyPushButton2 { + id: nextSongButton + Layout.preferredHeight: 50 + Layout.preferredWidth: 50 + + contentItem: Image { + source: "media_keys/outline_skip_next_white_24dp.png" + sourceSize.width: 50 + sourceSize.height: 50 + anchors.fill: parent + } + onClicked: { + UtilitiesTabController.sendMediaNextSong() + } + + background: Rectangle { + opacity: parent.down ? 1.0 : (parent.activeFocus ? 0.5 : 0.0) + color: "#406288" + radius: 4 + anchors.fill: parent + } + } + } + } + Item { Layout.fillHeight: true } diff --git a/src/res/qml/media_keys/outline_pause_white_24dp.png b/src/res/qml/media_keys/outline_pause_white_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..f49aed757118a941b567629ec217cde1aaf257e8 GIT binary patch literal 90 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZA`BpB)|k7xlYrjj7PUzopr0AL7>TR0|Qg+LTQlz2Xzi121f=fM}}?&LB$CQT1);!o{Csdp|AUX_kr_g&g?0C zHeWJ%MsS(@gQve4-ekUJdvI`ugYkq8&Qj)rrOQP>ObaPtE>O6{Ip?FA$P?z$q&>X6 z4;zYEdUkv+TkP*=GGW0{zI<0-Abo`Ay^Fh5K*}txlBLr#R&R4*;R&8?qp-ZvXZEG< z4;EEl+@n14U2^!@H^qC^uE@^(d4}(A>!j{fS4TqVM?`Byz%(l&QHco6{ zQhxWxMl#sMTWrBWsqzKc@+XHq)$ literal 0 HcmV?d00001