status-desktop/ui/app/AppLayouts/Chat/ContactsColumn/AddChat.qml

112 lines
2.9 KiB
QML
Raw Normal View History

2020-05-28 11:32:05 +00:00
import QtQuick 2.3
import QtQuick.Controls 2.3
import QtQuick.Controls 2.12 as QQC2
import QtQuick.Layouts 1.3
import Qt.labs.platform 1.1
import "../../../../shared"
import "../../../../imports"
import "../components"
Rectangle {
id: addChat
width: 36
height: 36
color: Theme.blue
radius: 50
anchors.right: parent.right
anchors.rightMargin: 16
anchors.top: parent.top
anchors.topMargin: 59
2020-05-28 19:53:42 +00:00
Image {
2020-05-28 11:32:05 +00:00
id: addChatLbl
2020-05-28 19:53:42 +00:00
fillMode: Image.PreserveAspectFit
source: "../../../img/plusSign.svg"
width: 14
height: 14
2020-05-28 11:32:05 +00:00
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
2020-05-28 19:53:42 +00:00
2020-05-28 11:32:05 +00:00
state: "default"
rotation: 0
states: [
State {
name: "default"
PropertyChanges {
target: addChatLbl
rotation: 0
}
},
State {
name: "rotated"
PropertyChanges {
target: addChatLbl
rotation: 45
}
}
]
transitions: [
Transition {
from: "default"
to: "rotated"
RotationAnimation {
duration: 150
direction: RotationAnimation.Clockwise
easing.type: Easing.InCubic
}
},
Transition {
from: "rotated"
to: "default"
RotationAnimation {
duration: 150
direction: RotationAnimation.Counterclockwise
easing.type: Easing.OutCubic
}
}
]
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
cursorShape: Qt.PointingHandCursor
onClicked: {
addChatLbl.state = "rotated"
let x = addChatLbl.x + addChatLbl.width / 2 - newChatMenu.width / 2
newChatMenu.popup(x, addChatLbl.height + 10)
}
PopupMenu {
id: newChatMenu
QQC2.Action {
text: qsTr("Start new chat")
icon.source: "../../../img/new_chat.svg"
2020-05-28 12:56:43 +00:00
onTriggered: privateChatPopup.open()
2020-05-28 11:32:05 +00:00
}
QQC2.Action {
text: qsTr("Start group chat")
icon.source: "../../../img/group_chat.svg"
onTriggered: {
2020-06-17 15:56:48 +00:00
onTriggered: groupChatPopup.open()
2020-05-28 11:32:05 +00:00
}
}
QQC2.Action {
text: qsTr("Join public chat")
icon.source: "../../../img/public_chat.svg"
onTriggered: publicChatPopup.open()
}
onAboutToHide: {
addChatLbl.state = "default"
}
}
}
}
2020-05-28 19:53:42 +00:00
/*##^##
Designer {
D{i:0;formeditorZoom:3}
}
##^##*/