2019-12-03 19:25:11 +03:00
|
|
|
import QtQuick 2.9
|
|
|
|
import QtQuick.Window 2.2
|
|
|
|
import QtQuick.Controls 2.2
|
|
|
|
import QtQuick.Layouts 1.3
|
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
|
2019-12-05 10:21:19 +03:00
|
|
|
Connections {
|
|
|
|
target: systrayBackend
|
|
|
|
onRefreshUserMenu: {
|
|
|
|
userLine.visible = isCurrentUser ? false : true
|
|
|
|
userLine.height = isCurrentUser ? 0 : 60
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-03 19:25:11 +03:00
|
|
|
id: userLine
|
2019-12-05 10:21:19 +03:00
|
|
|
visible: isCurrentUser ? false : true
|
2019-12-04 18:19:42 +03:00
|
|
|
width: 216
|
2019-12-05 10:21:19 +03:00
|
|
|
height: isCurrentUser ? 0 : 60
|
2019-12-03 19:25:11 +03:00
|
|
|
//color: "transparent"
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: userLineBackground
|
2019-12-05 10:21:19 +03:00
|
|
|
height: userLine.height
|
2019-12-03 19:25:11 +03:00
|
|
|
anchors.fill: parent
|
|
|
|
color: "transparent"
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
id: userLineLayout
|
|
|
|
spacing: 0
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
Button {
|
2019-12-04 16:19:23 +03:00
|
|
|
id: accountButton
|
2019-12-04 18:19:42 +03:00
|
|
|
anchors.centerIn: parent
|
|
|
|
Layout.preferredWidth: (userLine.width - 4)
|
|
|
|
Layout.preferredHeight: (userLineBackground.height - 2)
|
2019-12-03 19:25:11 +03:00
|
|
|
display: AbstractButton.IconOnly
|
|
|
|
flat: true
|
|
|
|
|
2019-12-04 18:19:42 +03:00
|
|
|
background: Rectangle {
|
|
|
|
color: "transparent"
|
|
|
|
}
|
|
|
|
|
|
|
|
onClicked: {
|
2019-12-05 10:21:19 +03:00
|
|
|
systrayBackend.switchCurrentUser(index)
|
2019-12-03 19:25:11 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
id: accountControlRowLayout
|
2019-12-04 16:19:23 +03:00
|
|
|
height: accountButton.height
|
|
|
|
width: accountButton.width
|
2019-12-03 19:25:11 +03:00
|
|
|
spacing: 0
|
|
|
|
Image {
|
2019-12-04 16:19:23 +03:00
|
|
|
id: accountAvatar
|
2019-12-05 10:21:19 +03:00
|
|
|
Layout.leftMargin: 4
|
2019-12-03 19:25:11 +03:00
|
|
|
verticalAlignment: Qt.AlignCenter
|
2019-12-05 13:38:29 +03:00
|
|
|
source: ("image://avatars/" + index)
|
2019-12-04 00:15:25 +03:00
|
|
|
Layout.preferredHeight: (userLineBackground.height -16)
|
|
|
|
Layout.preferredWidth: (userLineBackground.height -16)
|
2019-12-03 19:25:11 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: accountLabels
|
|
|
|
spacing: 4
|
|
|
|
Layout.alignment: Qt.AlignLeft
|
2019-12-04 00:15:25 +03:00
|
|
|
Layout.leftMargin: 12
|
2019-12-03 19:25:11 +03:00
|
|
|
Label {
|
2019-12-04 16:19:23 +03:00
|
|
|
id: accountUser
|
2019-12-03 19:25:11 +03:00
|
|
|
text: name
|
|
|
|
color: "black"
|
|
|
|
font.pointSize: 9
|
|
|
|
font.bold: true
|
|
|
|
}
|
|
|
|
Label {
|
2019-12-04 16:19:23 +03:00
|
|
|
id: accountServer
|
2019-12-03 19:25:11 +03:00
|
|
|
text: server
|
|
|
|
color: "black"
|
|
|
|
font.pointSize: 8
|
|
|
|
}
|
|
|
|
}
|
2019-12-04 00:15:25 +03:00
|
|
|
|
|
|
|
Item {
|
|
|
|
id: userLineSpacer
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
2019-12-03 19:25:11 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} // Rectangle userLineBackground
|
|
|
|
} // MenuItem userLine
|