Simplify menu code and tweak UI.
This commit is contained in:
parent
ebe69fd4c0
commit
2d2d35fcf5
|
@ -4,7 +4,7 @@ import Qt.labs.settings 1.0
|
|||
|
||||
Settings {
|
||||
property bool lazyLoad: true
|
||||
property bool richText
|
||||
property bool richText: true
|
||||
property bool pressAndHold
|
||||
property bool rearrangeByActivity
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ Page {
|
|||
delegate: Column {
|
||||
property bool expanded: false
|
||||
|
||||
spacing: 16
|
||||
spacing: 8
|
||||
|
||||
SwipeDelegate {
|
||||
width: accountSettingsListView.width
|
||||
|
@ -99,15 +99,18 @@ Page {
|
|||
|
||||
ListView {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 32
|
||||
Layout.preferredHeight: 24
|
||||
|
||||
orientation: ListView.Horizontal
|
||||
|
||||
spacing: 8
|
||||
|
||||
model: ["#498882", "#42a5f5", "#5c6bc0", "#7e57c2", "#ab47bc", "#ff7043"]
|
||||
|
||||
delegate: Rectangle {
|
||||
width: parent.height
|
||||
height: parent.height
|
||||
radius: width / 2
|
||||
|
||||
color: modelData
|
||||
|
||||
|
@ -122,8 +125,6 @@ Page {
|
|||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
spacing: 16
|
||||
|
||||
Label { text: "Homeserver:" }
|
||||
TextField {
|
||||
Layout.fillWidth: true
|
||||
|
|
|
@ -17,11 +17,7 @@ Control {
|
|||
|
||||
onSecondaryClicked: {
|
||||
messageContextMenu.row = messageRow
|
||||
messageContextMenu.plainText = plainText
|
||||
messageContextMenu.toolTip = toolTip
|
||||
messageContextMenu.eventId = eventId
|
||||
messageContextMenu.eventType = eventType
|
||||
messageContextMenu.canRedact = sentByMe
|
||||
messageContextMenu.model = model
|
||||
messageContextMenu.popup()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ Item {
|
|||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
text: currentRoom ? currentRoom.topic : ""
|
||||
text: currentRoom ? (currentRoom.topic).replace(/(\r\n\t|\n|\r\t)/gm,"") : ""
|
||||
color: "white"
|
||||
elide: Text.ElideRight
|
||||
wrapMode: Text.NoWrap
|
||||
|
|
|
@ -116,7 +116,7 @@ Item {
|
|||
hoverEnabled: MSettings.miniMode
|
||||
|
||||
onSecondaryClicked: {
|
||||
roomContextMenu.room = currentRoom
|
||||
roomContextMenu.model = model
|
||||
roomContextMenu.popup()
|
||||
}
|
||||
onPrimaryClicked: {
|
||||
|
@ -141,11 +141,14 @@ Item {
|
|||
}
|
||||
|
||||
Rectangle {
|
||||
width: 4
|
||||
width: unreadCount > 0 || highlighted ? 4 : 0
|
||||
height: parent.height
|
||||
|
||||
color: Material.accent
|
||||
visible: unreadCount > 0 || highlighted
|
||||
|
||||
Behavior on width {
|
||||
PropertyAnimation { easing.type: Easing.InOutCubic; duration: 200 }
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
|
@ -187,7 +190,7 @@ Item {
|
|||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
text: (lastEvent == "" ? topic : lastEvent).replace(/(\r\n\t|\n|\r\t)/gm,"");
|
||||
text: (lastEvent == "" ? topic : lastEvent).replace(/(\r\n\t|\n|\r\t)/gm,"")
|
||||
elide: Text.ElideRight
|
||||
wrapMode: Text.NoWrap
|
||||
}
|
||||
|
|
|
@ -2,27 +2,23 @@ import QtQuick 2.9
|
|||
import QtQuick.Controls 2.2
|
||||
|
||||
Menu {
|
||||
property var row
|
||||
property bool canRedact
|
||||
property string eventType
|
||||
property string plainText
|
||||
property string toolTip
|
||||
property string eventId
|
||||
property var row: null
|
||||
property var model: null
|
||||
|
||||
readonly property bool isFile: eventType === "video" || eventType === "audio" || eventType === "file" || eventType === "image"
|
||||
readonly property bool isFile: model && (model.eventType === "video" || model.eventType === "audio" || model.eventType === "file" || model.eventType === "image")
|
||||
|
||||
id: messageContextMenu
|
||||
|
||||
MenuItem {
|
||||
text: "Copy"
|
||||
|
||||
onTriggered: matriqueController.copyToClipboard(plainText)
|
||||
onTriggered: matriqueController.copyToClipboard(model.plainText)
|
||||
}
|
||||
MenuItem {
|
||||
text: "View Source"
|
||||
|
||||
onTriggered: {
|
||||
sourceDialog.sourceText = toolTip
|
||||
sourceDialog.sourceText = model.toolTip
|
||||
sourceDialog.open()
|
||||
}
|
||||
}
|
||||
|
@ -41,10 +37,10 @@ Menu {
|
|||
onTriggered: row.saveFileAs()
|
||||
}
|
||||
MenuItem {
|
||||
visible: canRedact
|
||||
visible: model && model.author === currentRoom.localUser
|
||||
height: visible ? undefined : 0
|
||||
text: "Redact"
|
||||
|
||||
onTriggered: currentRoom.redactEvent(eventId)
|
||||
onTriggered: currentRoom.redactEvent(model.eventId)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,34 +1,35 @@
|
|||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import Matrique 0.1
|
||||
|
||||
Menu {
|
||||
property var room: null
|
||||
property var model: null
|
||||
|
||||
id: roomListMenu
|
||||
|
||||
MenuItem {
|
||||
text: "Favourite"
|
||||
checkable: true
|
||||
checked: room && room.isFavourite
|
||||
checked: model && model.category === RoomType.Favorite
|
||||
|
||||
onTriggered: room.isFavourite ? room.removeTag("m.favourite") : room.addTag("m.favourite", "1")
|
||||
onTriggered: model.category === RoomType.Favorite ? model.currentRoom.removeTag("m.favourite") : model.currentRoom.addTag("m.favourite", "1")
|
||||
}
|
||||
MenuItem {
|
||||
text: "Deprioritize"
|
||||
checkable: true
|
||||
checked: room && room.isLowPriority
|
||||
checked: model && model.category === RoomType.Deprioritized
|
||||
|
||||
onTriggered: room.isLowPriority ? room.removeTag("m.lowpriority") : room.addTag("m.lowpriority", "1")
|
||||
onTriggered: model.category === RoomType.Deprioritized ? model.currentRoom.removeTag("m.lowpriority") : model.currentRoom.addTag("m.lowpriority", "1")
|
||||
}
|
||||
MenuSeparator {}
|
||||
MenuItem {
|
||||
text: "Mark as Read"
|
||||
|
||||
onTriggered: room.markAllMessagesAsRead()
|
||||
onTriggered: model.currentRoom.markAllMessagesAsRead()
|
||||
}
|
||||
MenuItem {
|
||||
text: "Leave Room"
|
||||
|
||||
onTriggered: room.forget()
|
||||
onTriggered: model.currentRoom.forget()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue