Add new icons and icons features for future implementations

This commit is contained in:
Angela Mazzurco 2017-06-09 16:36:38 +02:00
parent 5acc8f6d8b
commit 6e3de73501
3 changed files with 82 additions and 10 deletions

View File

@ -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}
}
]
}
}

View File

@ -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() }
}
}

View File

@ -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"
}