2019-07-08 13:52:41 +10:00
|
|
|
// Copyright 2019 miruka
|
|
|
|
// This file is part of harmonyqml, licensed under LGPLv3.
|
|
|
|
|
2019-07-13 19:39:01 +10:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Layouts 1.12
|
2019-04-29 05:18:36 +10:00
|
|
|
import "../Base"
|
2019-03-22 14:28:14 +11:00
|
|
|
|
2019-05-12 07:51:00 +10:00
|
|
|
HRectangle {
|
2019-07-07 07:58:59 +10:00
|
|
|
property string displayName: ""
|
2019-04-21 07:36:21 +10:00
|
|
|
property string topic: ""
|
|
|
|
|
2019-05-13 09:03:51 +10:00
|
|
|
property alias buttonsImplicitWidth: viewButtons.implicitWidth
|
2019-05-14 00:52:26 +10:00
|
|
|
property int buttonsWidth: viewButtons.Layout.preferredWidth
|
2019-05-14 02:01:57 +10:00
|
|
|
property var activeButton: "members"
|
2019-05-13 09:03:51 +10:00
|
|
|
|
2019-05-13 08:59:29 +10:00
|
|
|
property bool collapseButtons: width < 400
|
2019-05-13 03:17:42 +10:00
|
|
|
|
2019-04-29 04:20:30 +10:00
|
|
|
id: roomHeader
|
2019-07-07 07:50:55 +10:00
|
|
|
color: theme.chat.roomHeader.background
|
2019-03-22 14:28:14 +11:00
|
|
|
|
2019-04-29 05:18:36 +10:00
|
|
|
HRowLayout {
|
2019-04-21 07:45:51 +10:00
|
|
|
id: row
|
2019-07-16 19:29:47 +10:00
|
|
|
spacing: theme.spacing
|
2019-03-26 09:29:46 +11:00
|
|
|
anchors.fill: parent
|
2019-03-22 14:28:14 +11:00
|
|
|
|
2019-07-07 14:24:23 +10:00
|
|
|
HRoomAvatar {
|
2019-04-21 07:45:51 +10:00
|
|
|
id: avatar
|
2019-07-07 14:24:23 +10:00
|
|
|
roomId: chatPage.roomId
|
2019-04-29 04:20:30 +10:00
|
|
|
Layout.alignment: Qt.AlignTop
|
2019-03-26 09:29:46 +11:00
|
|
|
}
|
|
|
|
|
2019-04-29 05:18:36 +10:00
|
|
|
HLabel {
|
2019-04-21 07:45:51 +10:00
|
|
|
id: roomName
|
2019-04-21 07:36:21 +10:00
|
|
|
text: displayName
|
2019-07-07 07:50:55 +10:00
|
|
|
font.pixelSize: theme.fontSize.big
|
2019-03-26 09:29:46 +11:00
|
|
|
elide: Text.ElideRight
|
2019-05-13 03:17:42 +10:00
|
|
|
|
2019-05-13 08:59:29 +10:00
|
|
|
Layout.maximumWidth: Math.max(
|
|
|
|
0,
|
2019-05-17 05:50:14 +10:00
|
|
|
row.width - row.totalSpacing - avatar.width -
|
2019-05-13 03:17:42 +10:00
|
|
|
viewButtons.width -
|
|
|
|
(expandButton.visible ? expandButton.width : 0)
|
2019-05-13 08:59:29 +10:00
|
|
|
)
|
2019-03-26 09:29:46 +11:00
|
|
|
}
|
2019-03-22 14:28:14 +11:00
|
|
|
|
2019-04-29 05:18:36 +10:00
|
|
|
HLabel {
|
2019-04-21 07:45:51 +10:00
|
|
|
id: roomTopic
|
2019-04-21 07:36:21 +10:00
|
|
|
text: topic
|
2019-07-07 07:50:55 +10:00
|
|
|
font.pixelSize: theme.fontSize.small
|
2019-03-26 09:29:46 +11:00
|
|
|
elide: Text.ElideRight
|
2019-05-13 03:17:42 +10:00
|
|
|
|
2019-05-13 08:59:29 +10:00
|
|
|
Layout.maximumWidth: Math.max(
|
|
|
|
0,
|
|
|
|
row.width - row.totalSpacing - avatar.width -
|
2019-05-13 03:17:42 +10:00
|
|
|
roomName.width - viewButtons.width -
|
|
|
|
(expandButton.visible ? expandButton.width : 0)
|
2019-05-13 08:59:29 +10:00
|
|
|
)
|
2019-03-22 14:28:14 +11:00
|
|
|
}
|
2019-03-26 09:29:46 +11:00
|
|
|
|
2019-04-29 05:22:53 +10:00
|
|
|
HSpacer {}
|
2019-05-13 03:17:42 +10:00
|
|
|
|
|
|
|
Row {
|
|
|
|
id: viewButtons
|
2019-05-13 08:59:29 +10:00
|
|
|
Layout.preferredWidth: collapseButtons ? 0 : implicitWidth
|
2019-05-13 11:29:52 +10:00
|
|
|
Layout.fillHeight: true
|
|
|
|
|
|
|
|
Repeater {
|
|
|
|
model: [
|
|
|
|
"members", "files", "notifications", "history", "settings"
|
|
|
|
]
|
2019-07-11 05:03:05 +10:00
|
|
|
HUIButton {
|
2019-05-13 11:29:52 +10:00
|
|
|
iconName: "room_view_" + modelData
|
|
|
|
iconDimension: 22
|
2019-05-14 00:52:26 +10:00
|
|
|
autoExclusive: true
|
2019-05-14 02:01:57 +10:00
|
|
|
checked: activeButton == modelData
|
|
|
|
onClicked: activeButton = activeButton == modelData ?
|
|
|
|
null : modelData
|
2019-05-13 11:29:52 +10:00
|
|
|
}
|
2019-05-13 03:17:42 +10:00
|
|
|
}
|
|
|
|
|
2019-05-13 08:59:29 +10:00
|
|
|
Behavior on Layout.preferredWidth {
|
2019-07-07 07:42:04 +10:00
|
|
|
HNumberAnimation { id: buttonsAnimation }
|
2019-05-13 03:17:42 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-11 05:03:05 +10:00
|
|
|
HUIButton {
|
2019-05-13 03:17:42 +10:00
|
|
|
id: expandButton
|
|
|
|
z: 1
|
|
|
|
anchors.right: parent.right
|
|
|
|
opacity: collapseButtons ? 1 : 0
|
|
|
|
visible: opacity > 0
|
|
|
|
iconName: "reduced_room_buttons"
|
|
|
|
|
|
|
|
Behavior on opacity {
|
2019-07-07 07:42:04 +10:00
|
|
|
HNumberAnimation { duration: buttonsAnimation.duration * 2 }
|
2019-05-13 03:17:42 +10:00
|
|
|
}
|
2019-03-22 14:28:14 +11:00
|
|
|
}
|
|
|
|
}
|