Add login page and forget room system
This commit is contained in:
@@ -9,6 +9,8 @@ Rectangle {
|
||||
Layout.preferredHeight: 32
|
||||
color: "#BBB"
|
||||
|
||||
signal buttonClicked(string signalId)
|
||||
|
||||
property alias avatarName: bannerAvatar.name
|
||||
property alias avatarSource: bannerAvatar.imageSource
|
||||
property alias labelText: bannerLabel.text
|
||||
@@ -77,8 +79,6 @@ Rectangle {
|
||||
|
||||
text: modelData.text
|
||||
iconName: modelData.iconName
|
||||
icon.color: modelData.iconColor
|
||||
icon.width: 32
|
||||
display: bannerButtons.displayMode
|
||||
|
||||
onClicked: {
|
||||
@@ -87,14 +87,20 @@ Rectangle {
|
||||
iconName = "hourglass"
|
||||
alreadyClicked = true
|
||||
|
||||
// modelData might become undefined after Backend call
|
||||
var signalId = modelData.signalId
|
||||
var iconName_ = modelData.iconName
|
||||
|
||||
var future =
|
||||
Backend.clientManager.clients[chatPage.userId].
|
||||
call(modelData.clientFunction,
|
||||
modelData.clientArgs)
|
||||
|
||||
future.onGotResult.connect(
|
||||
function() { iconName = modelData.iconName }
|
||||
)
|
||||
future.onGotResult.connect(function() {
|
||||
iconName = iconName_
|
||||
})
|
||||
|
||||
if (signalId) { buttonClicked(signalId) }
|
||||
}
|
||||
|
||||
Layout.maximumWidth: bannerButtons.compact ? height : -1
|
||||
|
@@ -16,6 +16,6 @@ Base.HLabel {
|
||||
|
||||
text: dateTime.toLocaleDateString() + (isToday ? qsTr(" (Today)") : "")
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
font.pixelSize: normalSize * 1.1
|
||||
font.pixelSize: Base.HStyle.fontSize.big
|
||||
color: "darkolivegreen"
|
||||
}
|
||||
|
@@ -27,7 +27,8 @@ RowLayout {
|
||||
(displayName.value || dict.sender) +
|
||||
(contentText.startsWith("'s ") ? "" : " ") +
|
||||
contentText +
|
||||
" <font size=" + smallSize + "px color='gray'>" +
|
||||
" <font size=" + Base.HStyle.fontSize.small +
|
||||
"px color='gray'>" +
|
||||
Qt.formatDateTime(dateTime, "hh:mm:ss") +
|
||||
"</font></font>"
|
||||
textFormat: Text.RichText
|
||||
|
@@ -17,15 +17,15 @@ Banner {
|
||||
buttonModel: [
|
||||
{
|
||||
text: "Accept",
|
||||
iconName: "accept",
|
||||
iconColor: Qt.hsla(0.45, 0.9, 0.3, 1),
|
||||
iconName: "invite_accept",
|
||||
//iconColor: Qt.hsla(0.45, 0.9, 0.3, 1),
|
||||
clientFunction: "joinRoom",
|
||||
clientArgs: [chatPage.roomId],
|
||||
},
|
||||
{
|
||||
text: "Decline",
|
||||
iconName: "decline",
|
||||
iconColor: Qt.hsla(0.95, 0.9, 0.35, 1),
|
||||
iconName: "invite_decline",
|
||||
//iconColor: Qt.hsla(0.95, 0.9, 0.35, 1),
|
||||
clientFunction: "leaveRoom",
|
||||
clientArgs: [chatPage.roomId],
|
||||
}
|
||||
|
@@ -7,14 +7,20 @@ import "utils.js" as ChatJS
|
||||
Banner {
|
||||
property var leftEvent: null
|
||||
|
||||
onButtonClicked: if (signalId === "forget") {
|
||||
chatPage.canLoadPastEvents = false
|
||||
pageStack.clear()
|
||||
}
|
||||
|
||||
avatarName: ChatJS.getLeftBannerAvatarName(leftEvent, chatPage.userId)
|
||||
labelText: ChatJS.getLeftBannerText(leftEvent)
|
||||
|
||||
buttonModel: [
|
||||
{
|
||||
signalId: "forget",
|
||||
text: "Forget",
|
||||
iconName: "trash_can",
|
||||
iconColor: Qt.hsla(0.95, 0.9, 0.35, 1),
|
||||
iconName: "forget_room",
|
||||
//iconColor: Qt.hsla(0.95, 0.9, 0.35, 1),
|
||||
clientFunction: "forgetRoom",
|
||||
clientArgs: [chatPage.roomId],
|
||||
}
|
||||
|
@@ -35,11 +35,13 @@ Row {
|
||||
text: (dict.formatted_body ?
|
||||
Backend.htmlFilter.filter(dict.formatted_body) :
|
||||
dict.body) +
|
||||
" <font size=" + smallSize + "px color=gray>" +
|
||||
" <font size=" + Base.HStyle.fontSize.small +
|
||||
"px color=gray>" +
|
||||
Qt.formatDateTime(dateTime, "hh:mm:ss") +
|
||||
"</font>" +
|
||||
(isLocalEcho ?
|
||||
" <font size=" + smallSize + "px>⏳</font>" : "")
|
||||
" <font size=" + Base.HStyle.fontSize.small +
|
||||
"px>⏳</font>" : "")
|
||||
textFormat: Text.RichText
|
||||
background: Rectangle {color: "#DDD"}
|
||||
wrapMode: Text.Wrap
|
||||
|
@@ -4,6 +4,7 @@ import QtQuick.Layouts 1.4
|
||||
import "../base" as Base
|
||||
|
||||
Rectangle {
|
||||
property bool canLoadPastEvents: true
|
||||
property int space: 8
|
||||
|
||||
Layout.fillWidth: true
|
||||
@@ -30,7 +31,7 @@ Rectangle {
|
||||
property real yPos: visibleArea.yPosition
|
||||
|
||||
onYPosChanged: {
|
||||
if (yPos <= 0.1) {
|
||||
if (chatPage.canLoadPastEvents && yPos <= 0.1) {
|
||||
Backend.loadPastEvents(chatPage.roomId)
|
||||
}
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@ Rectangle {
|
||||
Base.HLabel {
|
||||
id: roomName
|
||||
text: displayName
|
||||
font.pixelSize: bigSize
|
||||
font.pixelSize: Base.HStyle.fontSize.big
|
||||
elide: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
Layout.maximumWidth:
|
||||
@@ -39,7 +39,7 @@ Rectangle {
|
||||
Base.HLabel {
|
||||
id: roomTopic
|
||||
text: topic
|
||||
font.pixelSize: smallSize
|
||||
font.pixelSize: Base.HStyle.fontSize.small
|
||||
elide: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
Layout.maximumWidth:
|
||||
|
@@ -9,6 +9,8 @@ ColumnLayout {
|
||||
readonly property var roomInfo:
|
||||
Backend.models.rooms.get(userId).getWhere("roomId", roomId)
|
||||
|
||||
property bool canLoadPastEvents: true
|
||||
|
||||
Component.onCompleted: console.log("replaced")
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user