Add members list menu and support colors in icons on the menu

This commit is contained in:
Richard Ramos 2020-06-12 10:01:46 -04:00 committed by Iuri Matias
parent 95de3b4267
commit 9ef575dc30
4 changed files with 41 additions and 6 deletions

View File

@ -1,5 +1,6 @@
import QtQuick 2.12
import QtQuick.Controls 2.3
import QtQuick.Controls 2.12 as QQC2
import QtQuick.Layouts 1.3
import "../../../../imports"
import "../../../../shared"
@ -135,18 +136,42 @@ ModalPopup {
Text {
visible: model.isAdmin
text: qsTr("Admin")
Layout.alignment: Qt.AlignRight
width: 100
font.pixelSize: 13
}
Text {
visible: !model.isAdmin
id: moreActionsBtn
visible: !model.isAdmin // TODO: && current user is admin
text: "..."
Layout.alignment: Qt.AlignRight
width: 100
MouseArea {
anchors.fill: parent
onClicked: {
contextMenu.popup(moreActionsBtn.x - moreActionsBtn.width, moreActionsBtn.height + 10)
}
cursorShape: Qt.PointingHandCursor
PopupMenu {
id: contextMenu
QQC2.Action {
icon.source: "../../../img/make-admin.svg"
text: qsTr("Make Admin")
onTriggered: chatsModel.leaveActiveChat()
}
QQC2.Action {
icon.source: "../../../img/remove-from-group.svg"
icon.color: Theme.red
text: qsTr("Remove From Group")
onTriggered: chatsModel.leaveActiveChat()
}
}
}
}
}
}
}
}
}

View File

@ -0,0 +1,5 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.3332 5.33333C11.3332 7.17428 9.84079 8.66667 7.99984 8.66667C6.15889 8.66667 4.6665 7.17428 4.6665 5.33333C4.6665 3.49238 6.15889 2 7.99984 2C9.84079 2 11.3332 3.49238 11.3332 5.33333ZM10.3332 5.33333C10.3332 6.622 9.2885 7.66667 7.99984 7.66667C6.71117 7.66667 5.6665 6.622 5.6665 5.33333C5.6665 4.04467 6.71117 3 7.99984 3C9.2885 3 10.3332 4.04467 10.3332 5.33333Z" fill="#4360DF"/>
<path d="M8.07308 11.6671C8.3524 11.6707 8.59967 11.4677 8.62287 11.1893C8.64552 10.9175 8.44575 10.6758 8.17308 10.6689C8.11548 10.6674 8.05769 10.6667 7.99973 10.6667C5.97272 10.6667 4.157 11.5713 2.93429 12.9989C2.77438 13.1856 2.7953 13.4622 2.96912 13.636C3.18499 13.8519 3.54233 13.8208 3.744 13.5916C4.78247 12.4114 6.30413 11.6667 7.99973 11.6667C8.02422 11.6667 8.04867 11.6668 8.07308 11.6671Z" fill="#4360DF"/>
<path d="M11.9987 9.29502C12.1888 9.12388 12.4775 9.12388 12.6677 9.29502L14.3343 10.795C14.5396 10.9797 14.5562 11.2959 14.3715 11.5011C14.1868 11.7064 13.8706 11.723 13.6654 11.5383L13.3895 11.29C13.175 11.097 12.8332 11.2492 12.8332 11.5378V13.3333C12.8332 13.6095 12.6093 13.8333 12.3332 13.8333C12.057 13.8333 11.8332 13.6095 11.8332 13.3333V11.5378C11.8332 11.2492 11.4914 11.097 11.2768 11.29L11.001 11.5383C10.7957 11.723 10.4796 11.7064 10.2949 11.5011C10.1101 11.2959 10.1268 10.9797 10.332 10.795L11.9987 9.29502Z" fill="#4360DF"/>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,5 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.99984 8.66667C9.84079 8.66667 11.3332 7.17428 11.3332 5.33333C11.3332 3.49238 9.84079 2 7.99984 2C6.15889 2 4.6665 3.49238 4.6665 5.33333C4.6665 7.17428 6.15889 8.66667 7.99984 8.66667ZM7.99984 7.66667C9.2885 7.66667 10.3332 6.622 10.3332 5.33333C10.3332 4.04467 9.2885 3 7.99984 3C6.71117 3 5.6665 4.04467 5.6665 5.33333C5.6665 6.622 6.71117 7.66667 7.99984 7.66667Z" fill="#FF2D55"/>
<path d="M8.62287 11.1893C8.59967 11.4677 8.3524 11.6707 8.07308 11.6671C8.04867 11.6668 8.02422 11.6667 7.99973 11.6667C6.30413 11.6667 4.78247 12.4114 3.744 13.5916C3.54233 13.8208 3.18499 13.8519 2.96912 13.636C2.7953 13.4622 2.77438 13.1856 2.93429 12.9989C4.157 11.5713 5.97272 10.6667 7.99973 10.6667C8.05769 10.6667 8.11548 10.6674 8.17308 10.6689C8.44575 10.6758 8.64552 10.9175 8.62287 11.1893Z" fill="#FF2D55"/>
<path d="M10.6665 10.6667C10.3904 10.6667 10.1665 10.8905 10.1665 11.1667C10.1665 11.4428 10.3904 11.6667 10.6665 11.6667H13.9998C14.276 11.6667 14.4998 11.4428 14.4998 11.1667C14.4998 10.8905 14.276 10.6667 13.9998 10.6667H10.6665Z" fill="#FF2D55"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -14,7 +14,7 @@ Menu {
implicitWidth: 200
implicitHeight: 40
font.pixelSize: 15
icon.color: popupMenuItem.highlighted ? Theme.white : Theme.blue
icon.color: popupMenuItem.action.icon.color != "#00000000" ? popupMenuItem.action.icon.color : Theme.blue
contentItem: Item {
Item {
id: menuIcon
@ -33,7 +33,7 @@ Menu {
anchors.fill: popupMenuItemIcon
anchors.verticalCenter: parent.verticalCenter
source: popupMenuItemIcon
color: popupMenuItem.highlighted ? Theme.white : Theme.blue
color: popupMenuItem.highlighted ? Theme.white : popupMenuItem.action.icon.color
}
}
@ -52,7 +52,7 @@ Menu {
background: Rectangle {
implicitWidth: 220
implicitHeight: 40
color: popupMenuItem.highlighted ? Theme.blue : "transparent"
color: popupMenuItem.highlighted ? popupMenuItem.icon.color : "transparent"
}
}