2023-04-09 05:35:35 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2022-12-18 04:52:52 +00:00
|
|
|
import QtQuick
|
2023-05-19 15:03:39 +00:00
|
|
|
import QtQuick.Controls
|
2022-12-18 04:52:52 +00:00
|
|
|
import QtQuick.Layouts
|
2023-05-19 15:03:39 +00:00
|
|
|
import Fk.Pages
|
2022-12-18 04:52:52 +00:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
property bool isLobby: false
|
|
|
|
|
|
|
|
function append(chatter) {
|
|
|
|
chatLogBox.append(chatter)
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
anchors.fill: parent
|
|
|
|
spacing: 0
|
|
|
|
|
|
|
|
Item {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
|
|
|
LogEdit {
|
|
|
|
id: chatLogBox
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: 10
|
2023-05-13 06:16:09 +00:00
|
|
|
//font.pixelSize: 14
|
2022-12-18 04:52:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-19 15:03:39 +00:00
|
|
|
GridView {
|
|
|
|
id: emojiSelector
|
2022-12-18 04:52:52 +00:00
|
|
|
Layout.fillWidth: true
|
2023-05-19 15:03:39 +00:00
|
|
|
Layout.preferredHeight: 120
|
|
|
|
cellHeight: 48
|
|
|
|
cellWidth: 48
|
2023-05-20 08:00:03 +00:00
|
|
|
model: 50
|
2023-05-19 15:03:39 +00:00
|
|
|
visible: false
|
2023-06-16 15:53:44 +00:00
|
|
|
clip: true
|
2023-05-19 15:03:39 +00:00
|
|
|
delegate: ItemDelegate {
|
|
|
|
Image {
|
|
|
|
height: 32; width: 32
|
|
|
|
anchors.centerIn: parent
|
|
|
|
source: "../../image/emoji/" + index
|
|
|
|
}
|
|
|
|
onClicked: chatEdit.insert(chatEdit.cursorPosition, "{emoji" + index + "}");
|
|
|
|
}
|
|
|
|
}
|
2022-12-18 04:52:52 +00:00
|
|
|
|
2023-05-19 15:03:39 +00:00
|
|
|
RowLayout {
|
|
|
|
Rectangle {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: 28
|
|
|
|
color: "#040403"
|
|
|
|
radius: 3
|
|
|
|
border.width: 1
|
|
|
|
border.color: "#A6967A"
|
|
|
|
|
|
|
|
TextInput {
|
|
|
|
id: chatEdit
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: 6
|
|
|
|
color: "white"
|
|
|
|
clip: true
|
|
|
|
font.pixelSize: 14
|
|
|
|
|
|
|
|
onAccepted: {
|
|
|
|
if (text != "") {
|
|
|
|
ClientInstance.notifyServer(
|
|
|
|
"Chat",
|
|
|
|
JSON.stringify({
|
|
|
|
type: isLobby ? 1 : 2,
|
|
|
|
msg: text
|
|
|
|
})
|
|
|
|
);
|
|
|
|
text = "";
|
|
|
|
}
|
2022-12-18 04:52:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-05-19 15:03:39 +00:00
|
|
|
|
|
|
|
MetroButton {
|
|
|
|
id: emojiBtn
|
|
|
|
text: "😃"
|
|
|
|
onClicked: emojiSelector.visible = !emojiSelector.visible;
|
|
|
|
}
|
|
|
|
|
|
|
|
MetroButton {
|
|
|
|
text: "✔️"
|
|
|
|
onClicked: chatEdit.accepted();
|
|
|
|
}
|
2022-12-18 04:52:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|