From 6e3de735016bf804e6742f6565c4aafa452d1975 Mon Sep 17 00:00:00 2001 From: Angela Mazzurco Date: Fri, 9 Jun 2017 16:36:38 +0200 Subject: [PATCH] Add new icons and icons features for future implementations --- retroshare-qml-app/src/ChatView.qml | 78 +++++++++++++++++-- retroshare-qml-app/src/components/BtnIcon.qml | 8 +- .../src/styles/ChatBubblesStyle.qml | 6 ++ 3 files changed, 82 insertions(+), 10 deletions(-) diff --git a/retroshare-qml-app/src/ChatView.qml b/retroshare-qml-app/src/ChatView.qml index efbe38d81..46c78125c 100644 --- a/retroshare-qml-app/src/ChatView.qml +++ b/retroshare-qml-app/src/ChatView.qml @@ -114,17 +114,28 @@ Item anchors.bottom: parent.bottom anchors.left: attachButton.right - width: chatView.width - sendButton.width - attachButton.width + width: chatView.width - sendButton.width - attachButton.width - emojiButton.width height: parent.height -5 placeholderText: styles.placeHolder background: styles.background + onTextChanged: { + if (msgComposer.length == 0) + { + sendButton.state = "" + } + else if (msgComposer.length > 0) + { + sendButton.state = "SENDBTN" + } + } + } BtnIcon { - id: sendButton + id: emojiButton property var styles: StyleChat.inferiorPanel.btnIcon @@ -134,14 +145,69 @@ Item anchors.verticalCenter: parent.verticalCenter anchors.left: msgComposer.right - imgUrl: styles.sendIconUrl + imgUrl: styles.emojiIconUrl + } + + BtnIcon { + + id: sendButton + + property var styles: StyleChat.inferiorPanel.btnIcon + property alias icon: sendButton.imgUrl + + height: styles.height + width: styles.width + + anchors.verticalCenter: parent.verticalCenter + anchors.left: emojiButton.right + + imgUrl: styles.microIconUrl onClicked: { - var jsonData = {"chat_id":chatView.chatId, "msg":msgComposer.text} - rsApi.request( "/chat/send_message", JSON.stringify(jsonData), - function(par) { msgComposer.text = ""; } ) + if (sendButton.state == "SENDBTN" ) { + var jsonData = {"chat_id":chatView.chatId, "msg":msgComposer.text} + rsApi.request( "/chat/send_message", JSON.stringify(jsonData), + function(par) { msgComposer.text = ""; } ) + } } + + onPressed: + { + if (sendButton.state == "RECORDING" ) + { + sendButton.state = "" + } + else if (sendButton.state == "" ) + { + sendButton.state = "RECORDING" + } + } + + onReleased: + { + if (sendButton.state == "RECORDING" ) + { + sendButton.state = "" + } + + } + + + states: [ + State { + name: "" + PropertyChanges { target: sendButton; icon: styles.microIconUrl} + }, + State { + name: "RECORDING" + PropertyChanges { target: sendButton; icon: styles.microMuteIconUrl} + }, + State { + name: "SENDBTN" + PropertyChanges { target: sendButton; icon: styles.sendIconUrl} + } + ] } } diff --git a/retroshare-qml-app/src/components/BtnIcon.qml b/retroshare-qml-app/src/components/BtnIcon.qml index 0f707f0cf..6ce4f9e99 100644 --- a/retroshare-qml-app/src/components/BtnIcon.qml +++ b/retroshare-qml-app/src/components/BtnIcon.qml @@ -4,8 +4,8 @@ Item { id: root signal clicked -// signal pressed -// signal released + signal pressed + signal released property var imgUrl: "" @@ -21,7 +21,7 @@ Item { MouseArea { anchors.fill: root onClicked: { root.clicked() } -// onPressed: { root.pressed() } -// onReleased: { root.released() } + onPressed: { root.pressed() } + onReleased: { root.released() } } } diff --git a/retroshare-qml-app/src/styles/ChatBubblesStyle.qml b/retroshare-qml-app/src/styles/ChatBubblesStyle.qml index 9490b33ef..63a836c58 100644 --- a/retroshare-qml-app/src/styles/ChatBubblesStyle.qml +++ b/retroshare-qml-app/src/styles/ChatBubblesStyle.qml @@ -46,8 +46,14 @@ QtObject { readonly property int width: 30 readonly property int height: 30 + readonly property int margin: 10 + readonly property string sendIconUrl: "/icons/send-message.svg" readonly property string attachIconUrl: "/icons/attach.svg" + readonly property string microIconUrl: "/icons/microphone.svg" + readonly property string microMuteIconUrl: "/icons/microphone_mute.svg" + readonly property string emojiIconUrl: "/icons/smiley.svg" + }