Add tab bar and remove filter button.

This commit is contained in:
Black Hat
2019-07-02 13:25:45 +08:00
parent b0bbc6572a
commit 759ae2aa38
2 changed files with 86 additions and 47 deletions

View File

@@ -18,7 +18,7 @@ Item {
property var connection: null property var connection: null
readonly property var user: connection ? connection.localUser : null readonly property var user: connection ? connection.localUser : null
property int filter: 0 property int filter: tabBar.currentIndex
property var enteredRoom: null property var enteredRoom: null
signal enterRoom(var room) signal enterRoom(var room)
@@ -128,40 +128,8 @@ Item {
visible: !searchField.active visible: !searchField.active
contentItem: MaterialIcon { contentItem: MaterialIcon {
icon: { icon: "\ue8b6"
switch (filter) {
case 0: return "\ue8b6"
case 1: return "\ue7ff"
case 2: return "\ue7fc"
}
}
} }
Menu {
id: filterMenu
MenuItem {
text: "New"
onClicked: filter = 0
}
MenuSeparator {}
MenuItem {
text: "People"
onClicked: filter = 1
}
MenuItem {
text: "Group"
onClicked: filter = 2
}
}
onClicked: filterMenu.popup()
} }
ToolButton { ToolButton {
@@ -369,7 +337,7 @@ Item {
MaterialIcon { MaterialIcon {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
icon: "\ue2bf" icon: "\ue5ca"
font.pixelSize: 48 font.pixelSize: 48
color: MPalette.lighter color: MPalette.lighter
} }
@@ -383,6 +351,58 @@ Item {
} }
} }
} }
TabBar {
Layout.fillWidth: true
id: tabBar
TabButton {
contentItem: Item {
MaterialIcon {
anchors.centerIn: parent
icon: "\ue7f5"
color: MPalette.lighter
Rectangle {
anchors.right: parent.right
anchors.top: parent.top
visible: roomListModel.notificationCount > 0
width: 12
height: 12
radius: 6
color: "white"
Rectangle {
anchors.centerIn: parent
width: 8
height: 8
radius: 4
color: "red"
}
}
}
}
}
TabButton {
contentItem: MaterialIcon {
icon: "\ue7ff"
color: MPalette.lighter
}
}
TabButton {
contentItem: MaterialIcon {
icon: "\ue7fc"
color: MPalette.lighter
}
}
}
} }
Component { Component {

View File

@@ -432,26 +432,45 @@ Item {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
visible: currentRoom && currentRoom.hasUsersTyping visible: currentRoom && currentRoom.hasUsersTyping
padding: 8 padding: 4
contentItem: RowLayout { contentItem: RowLayout {
spacing: 8 spacing: 0
Repeater { RowLayout {
model: currentRoom && currentRoom.hasUsersTyping ? currentRoom.usersTyping : null spacing: -8
delegate: Avatar { Repeater {
Layout.preferredWidth: 24 model: currentRoom && currentRoom.hasUsersTyping ? currentRoom.usersTyping : null
Layout.preferredHeight: 24
source: modelData.avatarMediaId delegate: Rectangle {
hint: modelData.displayName Layout.preferredWidth: 28
Layout.preferredHeight: 28
color: "white"
radius: 14
Avatar {
anchors.fill: parent
anchors.margins: 2
source: modelData.avatarMediaId
hint: modelData.displayName
}
}
} }
} }
BusyIndicator { Item {
Layout.preferredWidth: 32 Layout.preferredWidth: 28
Layout.preferredHeight: 32 Layout.preferredHeight: 28
BusyIndicator {
anchors.centerIn: parent
width: 32
height: 32
}
} }
} }