diff --git a/src/apps/qml/qml/messages/JitsiVideoMessage.qml b/src/apps/qml/qml/messages/JitsiVideoMessage.qml --- a/src/apps/qml/qml/messages/JitsiVideoMessage.qml +++ b/src/apps/qml/qml/messages/JitsiVideoMessage.qml @@ -33,67 +33,87 @@ MessageBase { id: root - implicitHeight: rowLayout.height + implicitHeight: mainLayout.height - RowLayout { - id: rowLayout + ColumnLayout { + id: mainLayout width: parent.width - AvatarImage { - id: avatarRect - - Layout.alignment: Qt.AlignTop - avatarurl: i_avatar - aliasname: i_aliasname - username: i_username - onShowUserInfo: { - //TODO - } - } + spacing: 0 Item { - Layout.fillWidth: true + id: topSpacer + + width: parent.width + height: Kirigami.Units.smallSpacing } - Rectangle { - Layout.alignment: Qt.AlignCenter - width: textLabel.implicitWidth + 6*Kirigami.Units.smallSpacing - height: textLabel.height + RowLayout { + AvatarImage { + id: avatarRect + + Layout.alignment: Qt.AlignTop + avatarurl: i_avatar + aliasname: i_aliasname + username: i_username + onShowUserInfo: { + //TODO + } + } + + Item { + Layout.fillWidth: true + } + + Rectangle { + Layout.alignment: Qt.AlignCenter | Qt.AlignTop + width: textLabel.implicitWidth + 6*Kirigami.Units.smallSpacing + height: textLabel.height - color: Kirigami.Theme.disabledTextColor - radius: 4*Kirigami.Units.smallSpacing + color: Kirigami.Theme.disabledTextColor + radius: 4*Kirigami.Units.smallSpacing - QQC2.Label { - id: textLabel + QQC2.Label { + id: textLabel - color: Kirigami.Theme.textColor - opacity: 1 + color: Kirigami.Theme.textColor + opacity: 1 - anchors.centerIn: parent - anchors.leftMargin: Kirigami.Units.smallSpacing - anchors.rightMargin: Kirigami.Units.smallSpacing + anchors.centerIn: parent + anchors.leftMargin: Kirigami.Units.smallSpacing + anchors.rightMargin: Kirigami.Units.smallSpacing - width: Math.min(implicitWidth, parent.width - Kirigami.Units.largeSpacing) + width: Math.min(implicitWidth, parent.width - Kirigami.Units.largeSpacing) - text: i18n("Click To Join to Video") + text: i18n("Click To Join to Video") - wrapMode: QQC2.Label.Wrap + wrapMode: QQC2.Label.Wrap - MouseArea { - anchors.fill: parent - onClicked: { - messageMain.jitsiCallConfActivated() + MouseArea { + anchors.fill: parent + onClicked: { + messageMain.jitsiCallConfActivated() + } } } } + Item { + Layout.fillWidth: true + } + TimestampText { + id: timestampText + + Layout.alignment: Qt.AlignTop + timestamp: i_timestamp + } } + Item { - Layout.fillWidth: true - } - TimestampText { - id: timestampText - timestamp: i_timestamp + id: bottomSpacer + + width: parent.width + height: Kirigami.Units.smallSpacing } } } diff --git a/src/apps/qml/qml/messages/UserMessage.qml b/src/apps/qml/qml/messages/UserMessage.qml --- a/src/apps/qml/qml/messages/UserMessage.qml +++ b/src/apps/qml/qml/messages/UserMessage.qml @@ -36,7 +36,7 @@ property alias attachments: attachmentsLayout.children - implicitHeight: rowLayout.height + implicitHeight: mainLayout.height Loader { id: messageMenuLoader @@ -61,223 +61,247 @@ } } - RowLayout { - id: rowLayout + ColumnLayout { + id: mainLayout width: parent.width - AvatarImage { - id: avatarRect + spacing: 0 - Layout.alignment: Qt.AlignTop - avatarurl: i_avatar - aliasname: i_aliasname - username: i_username - onShowUserInfo: { - messageMain.showUserInfo(i_own_username) - } - visible: !i_groupable + Item { + id: topSpacer + + width: parent.width + height: Kirigami.Units.smallSpacing } - ColumnLayout { - spacing: Kirigami.Units.smallSpacing / 2 // reduce spacing a little - GridLayout { - rowSpacing: 0 - columnSpacing: Kirigami.Units.smallSpacing - columns: compactViewMode ? -1 : 1 // user name label + roles info in one row - RowLayout { - Layout.alignment: Qt.AlignLeft | Qt.AlignTop - Layout.rightMargin: Kirigami.Units.smallSpacing - QQC2.Label { - id: usernameLabel - font.bold: true - text: i_aliasname !== "" ? i_aliasname + ' @' + i_username : '@' + i_username + RowLayout { + AvatarImage { + id: avatarRect - MouseArea { - anchors.fill: parent - enabled: i_username !== appid.rocketChatAccount.userName - hoverEnabled: true - cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor - acceptedButtons: Qt.LeftButton | Qt.RightButton - onClicked: { - if (mouse.button === Qt.RightButton) { - if (i_useMenuMessage) { - messageMenuLoader.posX = mouse.x - messageMenuLoader.posY = mouse.y - if (messageMenuLoader.active) - messageMenuLoader.active = false - else - messageMenuLoader.active = true + Layout.alignment: Qt.AlignTop + avatarurl: i_avatar + aliasname: i_aliasname + username: i_username + onShowUserInfo: { + messageMain.showUserInfo(i_own_username) + } + visible: !i_groupable + } + ColumnLayout { + spacing: Kirigami.Units.smallSpacing / 2 // reduce spacing a little + Layout.alignment: Qt.AlignTop + + GridLayout { + rowSpacing: 0 + columnSpacing: Kirigami.Units.smallSpacing + columns: compactViewMode ? -1 : 1 // user name label + roles info in one row + RowLayout { + Layout.alignment: Qt.AlignLeft | Qt.AlignTop + Layout.rightMargin: Kirigami.Units.smallSpacing + + QQC2.Label { + id: usernameLabel + font.bold: true + text: i_aliasname !== "" ? i_aliasname + ' @' + i_username : '@' + i_username + + MouseArea { + anchors.fill: parent + enabled: i_username !== appid.rocketChatAccount.userName + hoverEnabled: true + cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: { + if (mouse.button === Qt.RightButton) { + if (i_useMenuMessage) { + messageMenuLoader.posX = mouse.x + messageMenuLoader.posY = mouse.y + if (messageMenuLoader.active) + messageMenuLoader.active = false + else + messageMenuLoader.active = true + } + } else { + messageMain.linkActivated("ruqola:/user/" + i_username) } - } else { - messageMain.linkActivated("ruqola:/user/" + i_username) } } + visible: !i_groupable } - visible: !i_groupable - } - Kirigami.Icon { - id: rolesInfo - source: "documentinfo" - width: height - height: 18 - visible: i_roles.length > 0 - opacity: rolesInfoMA.containsMouse ? 1.0 : 0.6 - MouseArea { - id: rolesInfoMA - hoverEnabled: true - anchors.fill: parent + Kirigami.Icon { + id: rolesInfo + source: "documentinfo" + width: height + height: 18 + visible: i_roles.length > 0 + opacity: rolesInfoMA.containsMouse ? 1.0 : 0.6 + MouseArea { + id: rolesInfoMA + hoverEnabled: true + anchors.fill: parent + } + QQC2.ToolTip.visible: rolesInfoMA.containsMouse + QQC2.ToolTip.text: i_roles } - QQC2.ToolTip.visible: rolesInfoMA.containsMouse - QQC2.ToolTip.text: i_roles - } - Kirigami.Icon { - id: editedInfo - source: "document-edit" - width: height - height: 18 - visible: i_editedByUserName !== "" - opacity: editedInfoMA.containsMouse ? 1.0 : 0.6 - MouseArea { - id: editedInfoMA - hoverEnabled: true - anchors.fill: parent + Kirigami.Icon { + id: editedInfo + source: "document-edit" + width: height + height: 18 + visible: i_editedByUserName !== "" + opacity: editedInfoMA.containsMouse ? 1.0 : 0.6 + MouseArea { + id: editedInfoMA + hoverEnabled: true + anchors.fill: parent + } + QQC2.ToolTip.visible: editedInfoMA.containsMouse + QQC2.ToolTip.text: visible ? i18n("Edited by %1", i_editedByUserName) : "" } - QQC2.ToolTip.visible: editedInfoMA.containsMouse - QQC2.ToolTip.text: visible ? i18n("Edited by %1", i_editedByUserName) : "" } - } - QQC2.Label { - id: threadPreview - - // TODO: I think the whole thread preview item needs to be visually redesigned... - /// no eliding possible with rich text, cf. QTBUG-16567, fake it - /// not ideal, see: https://stackoverflow.com/a/29923358 - function elidedText(s, length) { - var elidedText = s.substring(0, length) - if (s.length > length) - elidedText += "..." - return elidedText - } + QQC2.Label { + id: threadPreview + + // TODO: I think the whole thread preview item needs to be visually redesigned... + /// no eliding possible with rich text, cf. QTBUG-16567, fake it + /// not ideal, see: https://stackoverflow.com/a/29923358 + function elidedText(s, length) { + var elidedText = s.substring(0, length) + if (s.length > length) + elidedText += "..." + return elidedText + } + + Layout.fillWidth: !compactViewMode + Layout.alignment: Qt.AlignLeft | Qt.AlignTop + visible: i_threadPreview.length > 0 + textFormat: Text.RichText + color: "red" //Convert to kirigami color + font.pointSize: textLabel.font.pointSize - 1 + text: compactViewMode ? elidedText(i_threadPreview, 30) : i_threadPreview + wrapMode: compactViewMode ? Text.NoWrap : Text.Wrap + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.RightButton | Qt.LeftButton - Layout.fillWidth: !compactViewMode - Layout.alignment: Qt.AlignLeft | Qt.AlignTop - visible: i_threadPreview.length > 0 - textFormat: Text.RichText - color: "red" //Convert to kirigami color - font.pointSize: textLabel.font.pointSize - 1 - text: compactViewMode ? elidedText(i_threadPreview, 30) : i_threadPreview - wrapMode: compactViewMode ? Text.NoWrap : Text.Wrap - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.RightButton | Qt.LeftButton - - onClicked: { - //console.log("open thread " + i_tmid) - messageMain.openThread(i_tmid, i_threadPreview) + onClicked: { + //console.log("open thread " + i_tmid) + messageMain.openThread(i_tmid, i_threadPreview) + } } } - } - QQC2.Label { - id: textLabel - Layout.fillWidth: true + QQC2.Label { + id: textLabel + Layout.fillWidth: true - textFormat: Text.RichText + textFormat: Text.RichText - text: i_messageText - wrapMode: QQC2.Label.Wrap + text: i_messageText + wrapMode: QQC2.Label.Wrap - onLinkActivated: messageMain.linkActivated(link) - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.RightButton + onLinkActivated: messageMain.linkActivated(link) + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.RightButton - onClicked: { - if (i_useMenuMessage) { - if (mouse.button === Qt.RightButton) { - messageMenuLoader.posX = mouse.x - messageMenuLoader.posY = mouse.y - if (messageMenuLoader.active) - messageMenuLoader.active = false - else - messageMenuLoader.active = true + onClicked: { + if (i_useMenuMessage) { + if (mouse.button === Qt.RightButton) { + messageMenuLoader.posX = mouse.x + messageMenuLoader.posY = mouse.y + if (messageMenuLoader.active) + messageMenuLoader.active = false + else + messageMenuLoader.active = true + } } } } } - } - - ColumnLayout { - id: urlColumn - Layout.fillWidth: true - //TODO - //Reactivate when we have a parsed url ! - //see info about bugs - - // Repeater { - // id: repeaterUrl - - // model: i_urls - // Text { - // //Display it only if url != text otherwise it's not necessary - // visible: model.modelData.url !== i_originalMessage - // width: urlColumn.width - // text: model.modelData.description === "" ? - // RuqolaUtils.markdownToRichText(model.modelData.url) : - // RuqolaUtils.markdownToRichText(model.modelData.description) - // wrapMode: QQC2.Label.Wrap - // textFormat: Text.RichText - - // onLinkActivated: messageMain.linkActivated(link) - // } - // } - RowLayout { + ColumnLayout { + id: urlColumn Layout.fillWidth: true - RepeaterReactions { - id: repearterReactions - model: i_reactions - onAddReaction: { - messageMain.addReaction(i_messageID, emoji) - } - onDeleteReaction: { - messageMain.deleteReaction(i_messageID, emoji) + //TODO + //Reactivate when we have a parsed url ! + //see info about bugs + + // Repeater { + // id: repeaterUrl + + // model: i_urls + // Text { + // //Display it only if url != text otherwise it's not necessary + // visible: model.modelData.url !== i_originalMessage + // width: urlColumn.width + // text: model.modelData.description === "" ? + // RuqolaUtils.markdownToRichText(model.modelData.url) : + // RuqolaUtils.markdownToRichText(model.modelData.description) + // wrapMode: QQC2.Label.Wrap + // textFormat: Text.RichText + + // onLinkActivated: messageMain.linkActivated(link) + // } + // } + + RowLayout { + Layout.fillWidth: true + RepeaterReactions { + id: repearterReactions + model: i_reactions + onAddReaction: { + messageMain.addReaction(i_messageID, emoji) + } + onDeleteReaction: { + messageMain.deleteReaction(i_messageID, emoji) + } } } } } - } - ColumnLayout { - id: attachmentsLayout - Layout.fillWidth: true + ColumnLayout { + id: attachmentsLayout + Layout.fillWidth: true + } + + ThreadLabel { + Layout.fillWidth: true + onOpenThread: { + console.log(RuqolaDebugCategorySingleton.category, " OPen thread " + i_messageID) + messageMain.openThread(i_messageID, i_messageText) + } + } } - ThreadLabel { - Layout.fillWidth: true - onOpenThread: { - console.log(RuqolaDebugCategorySingleton.category, " OPen thread " + i_messageID) - messageMain.openThread(i_messageID, i_messageText) + ReactionsPopup { + Layout.alignment: Qt.AlignTop + visible: i_useMenuMessage + showIcon: root.hovered + onInsertReaction: { + messageMain.addReaction(i_messageID, emoji) } } - } - ReactionsPopup { - visible: i_useMenuMessage - showIcon: root.hovered - onInsertReaction: { - messageMain.addReaction(i_messageID, emoji) + TimestampText { + id: timestampText + + Layout.alignment: Qt.AlignTop + timestamp: i_timestamp + visible: !i_groupable } } - TimestampText { - id: timestampText - timestamp: i_timestamp - visible: !i_groupable + Item { + id: bottomSpacer + + width: parent.width + height: Kirigami.Units.smallSpacing } } + }