Added overlay and UI changes

This commit is contained in:
targetakhil 2021-04-15 22:21:25 +05:30
parent 6893e3a8d5
commit dff5cfc3ba
1 changed files with 50 additions and 35 deletions

View File

@ -7,14 +7,18 @@ import QtQuick 2.9
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import im.nheko 1.0 import im.nheko 1.0
Dialog { Popup {
id: forwardMessagePopup id: forwardMessagePopup
title: qsTr("Forward Message") palette: colors
parent: Overlay.overlay
modal: true
x: 400 x: 400
y: 400 y: 200
width: 200 width: implicitWidth >= 300 ? implicitWidth : 300
height: replyPreview.height + roomTextInput.height + completerPopup.height + implicitFooterHeight + implicitHeaderHeight height: implicitHeight + completerPopup.height + padding * 2
leftPadding: 10
rightPadding: 10
property var mid property var mid
@ -31,37 +35,43 @@ Dialog {
mid = mid_in; mid = mid_in;
} }
Reply { Column {
id: replyPreview id: forwardColumn
anchors.left: parent.left spacing: 5
anchors.right: parent.right
anchors.top: parent.top Label {
modelData: TimelineManager.timeline ? TimelineManager.timeline.getDump(mid, "") : { id: titleLabel
text: qsTr("Forward Message")
font.bold: true
bottomPadding: 10
} }
userColor: TimelineManager.userColor(modelData.userId, colors.window)
}
MatrixTextField { Reply {
id: roomTextInput id: replyPreview
modelData: TimelineManager.timeline ? TimelineManager.timeline.getDump(mid, "") : {
width: forwardMessagePopup.width - forwardMessagePopup.leftPadding * 2 }
userColor: TimelineManager.userColor(modelData.userId, colors.window)
anchors.top: replyPreview.bottom
color: colors.text
onTextEdited: {
completerPopup.completer.searchString = text;
} }
Keys.onPressed: {
if (event.key == Qt.Key_Up && completerPopup.opened) { MatrixTextField {
event.accepted = true; id: roomTextInput
completerPopup.up();
} else if (event.key == Qt.Key_Down && completerPopup.opened) { width: forwardMessagePopup.width - forwardMessagePopup.leftPadding * 2
event.accepted = true; color: colors.text
completerPopup.down(); onTextEdited: {
} else if (event.matches(StandardKey.InsertParagraphSeparator)) { completerPopup.completer.searchString = text;
completerPopup.finishCompletion(); }
event.accepted = true; Keys.onPressed: {
if (event.key == Qt.Key_Up && completerPopup.opened) {
event.accepted = true;
completerPopup.up();
} else if (event.key == Qt.Key_Down && completerPopup.opened) {
event.accepted = true;
completerPopup.down();
} else if (event.matches(StandardKey.InsertParagraphSeparator)) {
completerPopup.finishCompletion();
event.accepted = true;
}
} }
} }
} }
@ -69,10 +79,11 @@ Dialog {
Completer { Completer {
id: completerPopup id: completerPopup
y: replyPreview.height + roomTextInput.height + roomTextInput.bottomPadding y: titleLabel.height + replyPreview.height + roomTextInput.height + roomTextInput.bottomPadding + forwardColumn.spacing * 3
width: forwardMessagePopup.width - forwardMessagePopup.leftPadding * 2 width: forwardMessagePopup.width - forwardMessagePopup.leftPadding * 2
completerName: "room" completerName: "room"
fullWidth: true
centerRowContent: false
avatarHeight: 24 avatarHeight: 24
avatarWidth: 24 avatarWidth: 24
bottomToTop: false bottomToTop: false
@ -90,4 +101,8 @@ Dialog {
} }
target: completerPopup target: completerPopup
} }
Overlay.modal: Rectangle {
color: "#aa1E1E1E"
}
} }