Rebrand files names Spectral -> NeoChat
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import QtQuick 2.12
|
||||
|
||||
import Spectral.Setting 0.1
|
||||
import NeoChat.Setting 0.1
|
||||
|
||||
MouseArea {
|
||||
signal primaryClicked()
|
||||
468
imports/NeoChat/Component/ChatTextInput.qml
Normal file
468
imports/NeoChat/Component/ChatTextInput.qml
Normal file
@@ -0,0 +1,468 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
|
||||
import NeoChat.Component 2.0
|
||||
import NeoChat.Component.Emoji 2.0
|
||||
import NeoChat.Dialog 2.0
|
||||
import NeoChat.Effect 2.0
|
||||
import NeoChat.Setting 0.1
|
||||
|
||||
import org.kde.neochat 0.1
|
||||
|
||||
Control {
|
||||
id: root
|
||||
|
||||
property alias isReply: replyItem.visible
|
||||
property bool isReaction: false
|
||||
property var replyUser
|
||||
property string replyEventID
|
||||
property string replyContent
|
||||
|
||||
property alias isAutoCompleting: autoCompleteListView.visible
|
||||
property var autoCompleteModel
|
||||
property int autoCompleteBeginPosition
|
||||
property int autoCompleteEndPosition
|
||||
|
||||
property bool hasAttachment: false
|
||||
property url attachmentPath
|
||||
|
||||
padding: 0
|
||||
|
||||
background: Rectangle {
|
||||
color: Kirigami.Theme.backgroundColor
|
||||
Kirigami.Separator {
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Kirigami.Theme.focusColor
|
||||
}
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
top: parent.top
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
contentItem: ColumnLayout {
|
||||
spacing: 0
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.margins: 8
|
||||
|
||||
id: replyItem
|
||||
|
||||
visible: false
|
||||
|
||||
spacing: 8
|
||||
|
||||
Control {
|
||||
Layout.alignment: Qt.AlignTop
|
||||
|
||||
padding: 4
|
||||
|
||||
contentItem: RowLayout {
|
||||
Kirigami.Avatar {
|
||||
Layout.preferredWidth: 24
|
||||
Layout.preferredHeight: 24
|
||||
|
||||
source: replyUser ? "image://mxc/" + replyUser.avatarMediaId: ""
|
||||
name: replyUser ? replyUser.displayName : "No name"
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
text: replyUser ? replyUser.displayName : "No name"
|
||||
rightPadding: 8
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TextEdit {
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: "<style>a{color: " + color + ";} .user-pill{}</style>" + replyContent
|
||||
|
||||
selectByMouse: true
|
||||
readOnly: true
|
||||
wrapMode: Label.Wrap
|
||||
selectedTextColor: "white"
|
||||
textFormat: Text.RichText
|
||||
}
|
||||
}
|
||||
|
||||
EmojiPicker {
|
||||
Layout.fillWidth: true
|
||||
|
||||
id: emojiPicker
|
||||
|
||||
visible: false
|
||||
|
||||
textArea: inputField
|
||||
emojiModel: EmojiModel { id: emojiModel }
|
||||
}
|
||||
|
||||
ListView {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 36
|
||||
Layout.margins: 8
|
||||
|
||||
id: autoCompleteListView
|
||||
|
||||
visible: false
|
||||
|
||||
model: autoCompleteModel
|
||||
|
||||
clip: true
|
||||
spacing: 4
|
||||
orientation: ListView.Horizontal
|
||||
highlightFollowsCurrentItem: true
|
||||
keyNavigationWraps: true
|
||||
|
||||
delegate: Control {
|
||||
property string autoCompleteText: modelData.displayName ?? modelData.unicode
|
||||
property bool isEmoji: modelData.unicode != null
|
||||
readonly property bool highlighted: autoCompleteListView.currentIndex == index
|
||||
|
||||
height: 36
|
||||
padding: 6
|
||||
|
||||
background: Rectangle {
|
||||
visible: !isEmoji
|
||||
color: highlighted ? border.color : "transparent"
|
||||
border.color: isEmoji ? MPalette.accent : modelData.color
|
||||
border.width: 2
|
||||
radius: height / 2
|
||||
}
|
||||
|
||||
contentItem: RowLayout {
|
||||
spacing: 6
|
||||
|
||||
Text {
|
||||
width: 24
|
||||
height: 24
|
||||
visible: isEmoji
|
||||
text: autoCompleteText
|
||||
font.pixelSize: 24
|
||||
font.family: "Emoji"
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
|
||||
Kirigami.Avatar {
|
||||
Layout.preferredWidth: 24
|
||||
Layout.preferredHeight: 24
|
||||
|
||||
source: modelData.avatarMediaId ? "image://mxc/" + modelData.avatarMediaId : ""
|
||||
color: modelData.color ? Qt.darker(modelData.color, 1.1) : null
|
||||
}
|
||||
Label {
|
||||
Layout.fillHeight: true
|
||||
|
||||
visible: !isEmoji
|
||||
text: autoCompleteText
|
||||
color: highlighted ? Kirigami.Theme.highlightTextColor : Kirigami.Theme.textColor
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
rightPadding: 8
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
autoCompleteListView.currentIndex = index
|
||||
inputField.replaceAutoComplete(autoCompleteText)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 1
|
||||
Layout.leftMargin: 12
|
||||
Layout.rightMargin: 12
|
||||
|
||||
visible: emojiPicker.visible || replyItem.visible || autoCompleteListView.visible
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
spacing: 0
|
||||
|
||||
ToolButton {
|
||||
id: uploadButton
|
||||
|
||||
Layout.preferredWidth: 48
|
||||
Layout.preferredHeight: 48
|
||||
Layout.alignment: Qt.AlignBottom
|
||||
|
||||
visible: !isReply && !hasAttachment
|
||||
|
||||
icon.name: "mail-attachment"
|
||||
|
||||
onClicked: {
|
||||
if (Clipboard.hasImage) {
|
||||
attachDialog.open()
|
||||
} else {
|
||||
var fileDialog = openFileDialog.createObject(ApplicationWindow.overlay)
|
||||
|
||||
fileDialog.chosen.connect(function(path) {
|
||||
if (!path) return
|
||||
|
||||
root.attach(path)
|
||||
})
|
||||
|
||||
fileDialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
BusyIndicator {
|
||||
anchors.fill: parent
|
||||
|
||||
running: currentRoom && currentRoom.hasFileUploading
|
||||
}
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
Layout.preferredWidth: 48
|
||||
Layout.preferredHeight: 48
|
||||
Layout.alignment: Qt.AlignBottom
|
||||
|
||||
id: cancelReplyButton
|
||||
|
||||
visible: isReply
|
||||
|
||||
icon.name: "dialog-cancel"
|
||||
|
||||
onClicked: clearReply()
|
||||
}
|
||||
|
||||
Control {
|
||||
Layout.margins: 6
|
||||
Layout.preferredHeight: 36
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
|
||||
visible: hasAttachment
|
||||
|
||||
rightPadding: 8
|
||||
|
||||
contentItem: RowLayout {
|
||||
spacing: 0
|
||||
|
||||
ToolButton {
|
||||
Layout.preferredWidth: height
|
||||
Layout.fillHeight: true
|
||||
|
||||
id: cancelAttachmentButton
|
||||
|
||||
icon.name: "dialog-cancel"
|
||||
|
||||
onClicked: {
|
||||
hasAttachment = false;
|
||||
attachmentPath = "";
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
|
||||
text: attachmentPath !== "" ? attachmentPath.toString().substring(attachmentPath.toString().lastIndexOf('/') + 1, attachmentPath.length) : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TextArea {
|
||||
property real progress: 0
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumHeight: 48
|
||||
|
||||
id: inputField
|
||||
|
||||
wrapMode: Text.Wrap
|
||||
placeholderText: "Send a Message"
|
||||
topPadding: 0
|
||||
bottomPadding: 0
|
||||
selectByMouse: true
|
||||
verticalAlignment: TextEdit.AlignVCenter
|
||||
|
||||
text: currentRoom != null ? currentRoom.cachedInput : ""
|
||||
|
||||
background: Item {}
|
||||
|
||||
Rectangle {
|
||||
width: currentRoom && currentRoom.hasFileUploading ? parent.width * currentRoom.fileUploadingProgress / 100 : 0
|
||||
height: parent.height
|
||||
|
||||
opacity: 0.2
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: timeoutTimer
|
||||
|
||||
repeat: false
|
||||
interval: 2000
|
||||
onTriggered: {
|
||||
repeatTimer.stop()
|
||||
currentRoom.sendTypingNotification(false)
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: repeatTimer
|
||||
|
||||
repeat: true
|
||||
interval: 5000
|
||||
triggeredOnStart: true
|
||||
onTriggered: currentRoom.sendTypingNotification(true)
|
||||
}
|
||||
|
||||
Keys.onReturnPressed: {
|
||||
if (event.modifiers & Qt.ShiftModifier) {
|
||||
insert(cursorPosition, "\n")
|
||||
} else {
|
||||
postMessage(text)
|
||||
text = ""
|
||||
clearReply()
|
||||
closeAll()
|
||||
}
|
||||
}
|
||||
|
||||
Keys.onEscapePressed: closeAll()
|
||||
|
||||
Keys.onBacktabPressed: if (isAutoCompleting) autoCompleteListView.decrementCurrentIndex()
|
||||
|
||||
Keys.onTabPressed: {
|
||||
if (isAutoCompleting) {
|
||||
autoCompleteListView.incrementCurrentIndex()
|
||||
} else {
|
||||
autoCompleteBeginPosition = text.substring(0, cursorPosition).lastIndexOf(" ") + 1
|
||||
var autoCompletePrefix = text.substring(0, cursorPosition).split(" ").pop()
|
||||
if (!autoCompletePrefix) return
|
||||
if (autoCompletePrefix.startsWith(":")) {
|
||||
autoCompleteBeginPosition = text.substring(0, cursorPosition).lastIndexOf(" ") + 1
|
||||
autoCompleteModel = emojiModel.filterModel(autoCompletePrefix)
|
||||
if (autoCompleteModel.length === 0) return
|
||||
isAutoCompleting = true
|
||||
autoCompleteEndPosition = cursorPosition
|
||||
} else {
|
||||
autoCompleteModel = currentRoom.getUsers(autoCompletePrefix)
|
||||
if (autoCompleteModel.length === 0) return
|
||||
isAutoCompleting = true
|
||||
autoCompleteEndPosition = cursorPosition
|
||||
}
|
||||
}
|
||||
replaceAutoComplete(autoCompleteListView.currentItem.autoCompleteText)
|
||||
}
|
||||
|
||||
onTextChanged: {
|
||||
timeoutTimer.restart()
|
||||
repeatTimer.start()
|
||||
currentRoom.cachedInput = text
|
||||
|
||||
if (cursorPosition !== autoCompleteBeginPosition && cursorPosition !== autoCompleteEndPosition) {
|
||||
isAutoCompleting = false
|
||||
autoCompleteListView.currentIndex = 0
|
||||
}
|
||||
}
|
||||
|
||||
function replaceAutoComplete(word) {
|
||||
remove(autoCompleteBeginPosition, autoCompleteEndPosition)
|
||||
autoCompleteEndPosition = autoCompleteBeginPosition + word.length
|
||||
insert(cursorPosition, word)
|
||||
}
|
||||
|
||||
function postMessage(text) {
|
||||
if(!currentRoom) { return }
|
||||
|
||||
if (hasAttachment) {
|
||||
currentRoom.uploadFile(attachmentPath, text)
|
||||
clearAttachment()
|
||||
return
|
||||
}
|
||||
|
||||
if (text.trim().length === 0) { return }
|
||||
|
||||
var PREFIX_ME = '/me '
|
||||
var PREFIX_NOTICE = '/notice '
|
||||
var PREFIX_RAINBOW = '/rainbow '
|
||||
|
||||
var messageEventType = RoomMessageEvent.Text
|
||||
|
||||
if (text.indexOf(PREFIX_RAINBOW) === 0) {
|
||||
text = text.substr(PREFIX_RAINBOW.length)
|
||||
|
||||
var parsedText = ""
|
||||
var rainbowColor = ["#ff2b00", "#ff5500", "#ff8000", "#ffaa00", "#ffd500", "#ffff00", "#d4ff00", "#aaff00", "#80ff00", "#55ff00", "#2bff00", "#00ff00", "#00ff2b", "#00ff55", "#00ff80", "#00ffaa", "#00ffd5", "#00ffff", "#00d4ff", "#00aaff", "#007fff", "#0055ff", "#002bff", "#0000ff", "#2a00ff", "#5500ff", "#7f00ff", "#aa00ff", "#d400ff", "#ff00ff", "#ff00d4", "#ff00aa", "#ff0080", "#ff0055", "#ff002b", "#ff0000"]
|
||||
for (var i = 0; i < text.length; i++) {
|
||||
parsedText = parsedText + "<font color='" + rainbowColor[i % rainbowColor.length] + "'>" + text.charAt(i) + "</font>"
|
||||
}
|
||||
currentRoom.postHtmlMessage(text, parsedText, RoomMessageEvent.Text, replyEventID)
|
||||
return
|
||||
}
|
||||
|
||||
if (text.indexOf(PREFIX_ME) === 0) {
|
||||
text = text.substr(PREFIX_ME.length)
|
||||
messageEventType = RoomMessageEvent.Emote
|
||||
} else if (text.indexOf(PREFIX_NOTICE) === 0) {
|
||||
text = text.substr(PREFIX_NOTICE.length)
|
||||
messageEventType = RoomMessageEvent.Notice
|
||||
}
|
||||
|
||||
console.log(replyContent, replyUser, replyEventID, messageEventType);
|
||||
currentRoom.postArbitaryMessage(text, messageEventType, replyEventID)
|
||||
}
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
Layout.preferredWidth: 48
|
||||
Layout.preferredHeight: 48
|
||||
Layout.alignment: Qt.AlignBottom
|
||||
|
||||
id: emojiButton
|
||||
icon.name: "preferences-desktop-emoticons"
|
||||
|
||||
onClicked: emojiPicker.visible = !emojiPicker.visible
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function insert(str) {
|
||||
inputField.insert(inputField.cursorPosition, str)
|
||||
}
|
||||
|
||||
function clear() {
|
||||
inputField.clear()
|
||||
}
|
||||
|
||||
function clearReply() {
|
||||
isReply = false
|
||||
replyUser = null;
|
||||
replyContent = "";
|
||||
replyEventID = ""
|
||||
}
|
||||
|
||||
function focus() {
|
||||
inputField.forceActiveFocus()
|
||||
}
|
||||
|
||||
function closeAll() {
|
||||
replyItem.visible = false
|
||||
autoCompleteListView.visible = false
|
||||
emojiPicker.visible = false
|
||||
}
|
||||
|
||||
function attach(localPath) {
|
||||
hasAttachment = true
|
||||
attachmentPath = localPath
|
||||
}
|
||||
|
||||
function clearAttachment() {
|
||||
hasAttachment = false
|
||||
attachmentPath = ""
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,10 @@ import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import QtQuick.Controls.Material 2.12
|
||||
|
||||
import Spectral.Component 2.0
|
||||
import NeoChat.Component 2.0
|
||||
|
||||
import Spectral 0.1
|
||||
import Spectral.Setting 0.1
|
||||
import org.kde.neochat 0.1
|
||||
import NeoChat.Setting 0.1
|
||||
|
||||
ColumnLayout {
|
||||
property string emojiCategory: "history"
|
||||
@@ -1,2 +1,2 @@
|
||||
module Spectral.Component.Emoji
|
||||
module NeoChat.Component.Emoji
|
||||
EmojiPicker 2.0 EmojiPicker.qml
|
||||
@@ -6,13 +6,13 @@ import Qt.labs.platform 1.0 as Platform
|
||||
import QtMultimedia 5.12
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
|
||||
import Spectral 0.1
|
||||
import Spectral.Setting 0.1
|
||||
import org.kde.neochat 0.1
|
||||
import NeoChat.Setting 0.1
|
||||
|
||||
import Spectral.Component 2.0
|
||||
import Spectral.Dialog 2.0
|
||||
import Spectral.Menu.Timeline 2.0
|
||||
import Spectral.Effect 2.0
|
||||
import NeoChat.Component 2.0
|
||||
import NeoChat.Dialog 2.0
|
||||
import NeoChat.Menu.Timeline 2.0
|
||||
import NeoChat.Effect 2.0
|
||||
|
||||
RowLayout {
|
||||
readonly property bool avatarVisible: !sentByMe && showAuthor
|
||||
@@ -6,13 +6,13 @@ import QtGraphicalEffects 1.0
|
||||
import Qt.labs.platform 1.0 as Platform
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
|
||||
import Spectral 0.1
|
||||
import Spectral.Setting 0.1
|
||||
import org.kde.neochat 0.1
|
||||
import NeoChat.Setting 0.1
|
||||
|
||||
import Spectral.Component 2.0
|
||||
import Spectral.Dialog 2.0
|
||||
import Spectral.Menu.Timeline 2.0
|
||||
import Spectral.Effect 2.0
|
||||
import NeoChat.Component 2.0
|
||||
import NeoChat.Dialog 2.0
|
||||
import NeoChat.Menu.Timeline 2.0
|
||||
import NeoChat.Effect 2.0
|
||||
|
||||
RowLayout {
|
||||
readonly property bool avatarVisible: !sentByMe && showAuthor
|
||||
@@ -4,13 +4,13 @@ import QtQuick.Layouts 1.12
|
||||
import QtGraphicalEffects 1.0
|
||||
import Qt.labs.platform 1.0 as Platform
|
||||
|
||||
import Spectral 0.1
|
||||
import Spectral.Setting 0.1
|
||||
import org.kde.neochat 0.1
|
||||
import NeoChat.Setting 0.1
|
||||
|
||||
import Spectral.Component 2.0
|
||||
import Spectral.Dialog 2.0
|
||||
import Spectral.Menu.Timeline 2.0
|
||||
import Spectral.Effect 2.0
|
||||
import NeoChat.Component 2.0
|
||||
import NeoChat.Dialog 2.0
|
||||
import NeoChat.Menu.Timeline 2.0
|
||||
import NeoChat.Effect 2.0
|
||||
|
||||
Image {
|
||||
readonly property bool isAnimated: contentType === "image/gif"
|
||||
@@ -11,9 +11,9 @@ import QtGraphicalEffects 1.12
|
||||
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
|
||||
import Spectral 0.1
|
||||
import Spectral.Setting 0.1
|
||||
import Spectral.Component 2.0
|
||||
import org.kde.neochat 0.1
|
||||
import NeoChat.Setting 0.1
|
||||
import NeoChat.Component 2.0
|
||||
|
||||
RowLayout {
|
||||
default property alias innerObject : column.children
|
||||
@@ -4,10 +4,10 @@ import QtQuick.Layouts 1.12
|
||||
import QtQuick.Controls.Material 2.12
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
|
||||
import Spectral.Component 2.0
|
||||
import Spectral.Dialog 2.0
|
||||
import Spectral.Effect 2.0
|
||||
import Spectral.Setting 0.1
|
||||
import NeoChat.Component 2.0
|
||||
import NeoChat.Dialog 2.0
|
||||
import NeoChat.Effect 2.0
|
||||
import NeoChat.Setting 0.1
|
||||
|
||||
RowLayout {
|
||||
id: row
|
||||
@@ -7,14 +7,14 @@ import QtMultimedia 5.12
|
||||
import Qt.labs.platform 1.0 as Platform
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
|
||||
import Spectral 0.1
|
||||
import Spectral.Setting 0.1
|
||||
import org.kde.neochat 0.1
|
||||
import NeoChat.Setting 0.1
|
||||
|
||||
import Spectral.Component 2.0
|
||||
import Spectral.Dialog 2.0
|
||||
import Spectral.Menu.Timeline 2.0
|
||||
import Spectral.Effect 2.0
|
||||
import Spectral.Font 0.1
|
||||
import NeoChat.Component 2.0
|
||||
import NeoChat.Dialog 2.0
|
||||
import NeoChat.Menu.Timeline 2.0
|
||||
import NeoChat.Effect 2.0
|
||||
import NeoChat.Font 0.1
|
||||
|
||||
RowLayout {
|
||||
readonly property bool avatarVisible: showAuthor && !sentByMe
|
||||
@@ -1,4 +1,4 @@
|
||||
module Spectral.Component.Timeline
|
||||
module NeoChat.Component.Timeline
|
||||
TimelineContainer 2.0 TimelineContainer.qml
|
||||
MessageDelegate 2.0 MessageDelegate.qml
|
||||
TextDelegate 2.0 TextDelegate.qml
|
||||
@@ -1,4 +1,4 @@
|
||||
module Spectral.Component
|
||||
module NeoChat.Component
|
||||
AutoMouseArea 2.0 AutoMouseArea.qml
|
||||
MaterialIcon 2.0 MaterialIcon.qml
|
||||
SideNavButton 2.0 SideNavButton.qml
|
||||
@@ -7,3 +7,4 @@ AutoListView 2.0 AutoListView.qml
|
||||
AutoTextField 2.0 AutoTextField.qml
|
||||
FullScreenImage 2.0 FullScreenImage.qml
|
||||
AutoRectangle 2.0 AutoRectangle.qml
|
||||
ChatTextInput 2.0 ChatTextInput.qml
|
||||
@@ -3,11 +3,11 @@ import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
|
||||
import Spectral.Component 2.0
|
||||
import Spectral.Effect 2.0
|
||||
import NeoChat.Component 2.0
|
||||
import NeoChat.Effect 2.0
|
||||
|
||||
import Spectral 0.1
|
||||
import Spectral.Setting 0.1
|
||||
import org.kde.neochat 0.1
|
||||
import NeoChat.Setting 0.1
|
||||
|
||||
Dialog {
|
||||
anchors.centerIn: parent
|
||||
@@ -2,9 +2,9 @@ import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
|
||||
import Spectral.Component 2.0
|
||||
import NeoChat.Component 2.0
|
||||
|
||||
import Spectral 0.1
|
||||
import org.kde.neochat 0.1
|
||||
|
||||
Dialog {
|
||||
anchors.centerIn: parent
|
||||
@@ -2,8 +2,8 @@ import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
|
||||
import Spectral.Component 2.0
|
||||
import Spectral.Setting 0.1
|
||||
import NeoChat.Component 2.0
|
||||
import NeoChat.Setting 0.1
|
||||
|
||||
Dialog {
|
||||
anchors.centerIn: parent
|
||||
@@ -3,11 +3,11 @@ import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
|
||||
import Spectral.Component 2.0
|
||||
import Spectral.Effect 2.0
|
||||
import Spectral.Setting 0.1
|
||||
import NeoChat.Component 2.0
|
||||
import NeoChat.Effect 2.0
|
||||
import NeoChat.Setting 0.1
|
||||
|
||||
import Spectral 0.1
|
||||
import org.kde.neochat 0.1
|
||||
|
||||
Dialog {
|
||||
property var room
|
||||
@@ -3,11 +3,11 @@ import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
|
||||
import Spectral.Component 2.0
|
||||
import Spectral.Effect 2.0
|
||||
import Spectral.Setting 0.1
|
||||
import NeoChat.Component 2.0
|
||||
import NeoChat.Effect 2.0
|
||||
import NeoChat.Setting 0.1
|
||||
|
||||
import Spectral 0.1
|
||||
import org.kde.neochat 0.1
|
||||
|
||||
Dialog {
|
||||
property var connection
|
||||
@@ -3,11 +3,11 @@ import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
|
||||
import Spectral.Component 2.0
|
||||
import Spectral.Effect 2.0
|
||||
import Spectral.Setting 0.1
|
||||
import NeoChat.Component 2.0
|
||||
import NeoChat.Effect 2.0
|
||||
import NeoChat.Setting 0.1
|
||||
|
||||
import Spectral 0.1
|
||||
import org.kde.neochat 0.1
|
||||
|
||||
Dialog {
|
||||
property var room
|
||||
@@ -2,11 +2,11 @@ import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
|
||||
import Spectral.Component 2.0
|
||||
import Spectral.Effect 2.0
|
||||
import Spectral.Setting 0.1
|
||||
import NeoChat.Component 2.0
|
||||
import NeoChat.Effect 2.0
|
||||
import NeoChat.Setting 0.1
|
||||
|
||||
import Spectral 0.1
|
||||
import org.kde.neochat 0.1
|
||||
|
||||
Dialog {
|
||||
property var connection
|
||||
@@ -3,9 +3,9 @@ import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
|
||||
import Spectral.Component 2.0
|
||||
import Spectral.Effect 2.0
|
||||
import Spectral.Setting 0.1
|
||||
import NeoChat.Component 2.0
|
||||
import NeoChat.Effect 2.0
|
||||
import NeoChat.Setting 0.1
|
||||
|
||||
Dialog {
|
||||
property var room
|
||||
@@ -1,4 +1,4 @@
|
||||
module Spectral.Dialog
|
||||
module NeoChat.Dialog
|
||||
RoomSettingsDialog 2.0 RoomSettingsDialog.qml
|
||||
UserDetailDialog 2.0 UserDetailDialog.qml
|
||||
MessageSourceDialog 2.0 MessageSourceDialog.qml
|
||||
@@ -2,8 +2,8 @@ import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
import Spectral.Component 2.0
|
||||
import Spectral.Setting 0.1
|
||||
import NeoChat.Component 2.0
|
||||
import NeoChat.Setting 0.1
|
||||
|
||||
AutoMouseArea {
|
||||
id: ripple
|
||||
@@ -1,3 +1,3 @@
|
||||
module Spectral.Effect
|
||||
module NeoChat.Effect
|
||||
ElevationEffect 2.0 ElevationEffect.qml
|
||||
RippleEffect 2.0 RippleEffect.qml
|
||||
47
imports/NeoChat/Menu/RoomListContextMenu.qml
Normal file
47
imports/NeoChat/Menu/RoomListContextMenu.qml
Normal file
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2019 Black Hat <bhat@encom.eu.org>
|
||||
* SPDX-FileCopyrightText: 2020 Carl Schwan <carl@carlschwan.eu>
|
||||
*
|
||||
* SPDX-LicenseIdentifier: GPL-3.0-only
|
||||
*/
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
/**
|
||||
* Context menu when clicking on a room in the room list
|
||||
*/
|
||||
Menu {
|
||||
id: root
|
||||
property var room
|
||||
|
||||
MenuItem {
|
||||
text: i18n("Favourite")
|
||||
checkable: true
|
||||
checked: room.isFavourite
|
||||
|
||||
onTriggered: room.isFavourite ? room.removeTag("m.favourite") : room.addTag("m.favourite", 1.0)
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: i18n("Deprioritize")
|
||||
checkable: true
|
||||
checked: room.isLowPriority
|
||||
|
||||
onTriggered: room.isLowPriority ? room.removeTag("m.lowpriority") : room.addTag("m.lowpriority", 1.0)
|
||||
}
|
||||
|
||||
MenuSeparator {}
|
||||
|
||||
MenuItem {
|
||||
text: i18n("Mark as Read")
|
||||
|
||||
onTriggered: room.markAllMessagesAsRead()
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: i18n("Leave Room")
|
||||
onTriggered: room.forget()
|
||||
}
|
||||
|
||||
onClosed: destroy()
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
import Spectral.Dialog 2.0
|
||||
import NeoChat.Dialog 2.0
|
||||
|
||||
Menu {
|
||||
signal viewSource()
|
||||
@@ -9,7 +9,7 @@ import QtQuick.Controls 2.12 as QQC2
|
||||
import QtQuick.Layouts 1.12
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
|
||||
import Spectral.Dialog 2.0
|
||||
import NeoChat.Dialog 2.0
|
||||
|
||||
Kirigami.OverlaySheet {
|
||||
id: root
|
||||
@@ -1,3 +1,3 @@
|
||||
module Spectral.Menu.Timeline
|
||||
module NeoChat.Menu.Timeline
|
||||
MessageDelegateContextMenu 2.0 MessageDelegateContextMenu.qml
|
||||
FileDelegateContextMenu 2.0 FileDelegateContextMenu.qml
|
||||
@@ -1,2 +1,2 @@
|
||||
module Spectral.Menu
|
||||
module NeoChat.Menu
|
||||
RoomListContextMenu 2.0 RoomListContextMenu.qml
|
||||
@@ -10,7 +10,7 @@ import QtQuick.Layouts 1.14
|
||||
|
||||
import org.kde.kirigami 2.12 as Kirigami
|
||||
|
||||
import Spectral 0.1
|
||||
import NeoChat 0.1
|
||||
|
||||
Kirigami.ScrollablePage {
|
||||
title: i18n("Accounts")
|
||||
@@ -8,9 +8,9 @@ import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12 as QQC2
|
||||
import QtQuick.Layouts 1.12
|
||||
|
||||
import Spectral 0.1
|
||||
import NeoChat 0.1
|
||||
|
||||
import Spectral.Component 2.0
|
||||
import NeoChat.Component 2.0
|
||||
|
||||
import org.kde.kirigami 2.12 as Kirigami
|
||||
|
||||
@@ -9,12 +9,11 @@ import QtQuick.Controls 2.12 as QQC2
|
||||
import QtQuick.Layouts 1.12
|
||||
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
|
||||
import org.kde.kitemmodels 1.0
|
||||
import Spectral.Component 2.0
|
||||
import Spectral 0.1
|
||||
import org.kde.neochat 0.1
|
||||
|
||||
import org.kde.neochat 1.0
|
||||
import NeoChat.Component 2.0
|
||||
import NeoChat.Menu 2.0
|
||||
|
||||
Kirigami.ScrollablePage {
|
||||
id: page
|
||||
@@ -6,14 +6,13 @@ import QtQuick.Controls.Material 2.12
|
||||
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
import org.kde.kitemmodels 1.0
|
||||
import org.kde.neochat 1.0
|
||||
import org.kde.neochat 0.1
|
||||
|
||||
import Spectral.Component 2.0
|
||||
import Spectral.Component.Timeline 2.0
|
||||
import Spectral.Dialog 2.0
|
||||
import Spectral.Effect 2.0
|
||||
import Spectral.Menu.Timeline 2.0
|
||||
import Spectral 0.1
|
||||
import NeoChat.Component 2.0
|
||||
import NeoChat.Component.Timeline 2.0
|
||||
import NeoChat.Dialog 2.0
|
||||
import NeoChat.Effect 2.0
|
||||
import NeoChat.Menu.Timeline 2.0
|
||||
|
||||
Kirigami.ScrollablePage {
|
||||
id: page
|
||||
5
imports/NeoChat/Page/qmldir
Normal file
5
imports/NeoChat/Page/qmldir
Normal file
@@ -0,0 +1,5 @@
|
||||
module NeoChat.Page
|
||||
LoadingPage 2.0 LoadingPage.qml
|
||||
LoginPage 2.0 LoginPage.qml
|
||||
RoomListPage 2.0 RoomListPage.qml
|
||||
RoomPage 2.0 RoomPage.qml
|
||||
@@ -7,9 +7,9 @@ import org.kde.kirigami 2.12 as Kirigami
|
||||
|
||||
import SortFilterProxyModel 0.2
|
||||
|
||||
import Spectral.Component 2.0
|
||||
import Spectral.Component.Timeline 2.0
|
||||
import Spectral 0.1
|
||||
import NeoChat.Component 2.0
|
||||
import NeoChat.Component.Timeline 2.0
|
||||
import org.kde.neochat 0.1
|
||||
|
||||
Kirigami.GlobalDrawer {
|
||||
id: root
|
||||
@@ -5,12 +5,12 @@ import QtQuick.Layouts 1.12
|
||||
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
|
||||
import Spectral.Component 2.0
|
||||
import Spectral.Dialog 2.0
|
||||
import Spectral.Effect 2.0
|
||||
import Spectral.Setting 0.1
|
||||
import NeoChat.Component 2.0
|
||||
import NeoChat.Dialog 2.0
|
||||
import NeoChat.Effect 2.0
|
||||
import NeoChat.Setting 0.1
|
||||
|
||||
import Spectral 0.1
|
||||
import org.kde.neochat 0.1
|
||||
|
||||
Kirigami.OverlayDrawer {
|
||||
property var room
|
||||
@@ -3,10 +3,10 @@ import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import QtQuick.Controls.Material 2.12
|
||||
|
||||
import Spectral 0.1
|
||||
import Spectral.Effect 2.0
|
||||
import Spectral.Component 2.0
|
||||
import Spectral.Setting 0.1
|
||||
import org.kde.neochat 0.1
|
||||
import NeoChat.Effect 2.0
|
||||
import NeoChat.Component 2.0
|
||||
import NeoChat.Setting 0.1
|
||||
|
||||
Control {
|
||||
signal clicked()
|
||||
@@ -5,8 +5,8 @@ import QtQuick.Layouts 1.12
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
|
||||
import org.kde.kitemmodels 1.0
|
||||
import Spectral.Component 2.0
|
||||
import Spectral 0.1
|
||||
import NeoChat.Component 2.0
|
||||
import org.kde.neochat 0.1
|
||||
|
||||
Kirigami.ScrollablePage {
|
||||
id: page
|
||||
@@ -1,5 +1,5 @@
|
||||
module Spectral.Panel
|
||||
module NeoChat.Panel
|
||||
RoomPanel 2.0 RoomPanel.qml
|
||||
RoomListPanel 2.0 RoomListPanel.qml
|
||||
RoomDrawer 2.0 RoomDrawer.qml
|
||||
SpectralSidebar 2.0 SpectralSidebar.qml
|
||||
NeoChatSidebar 2.0 NeoChatSidebar.qml
|
||||
@@ -1,3 +1,3 @@
|
||||
module Spectral.Setting
|
||||
module NeoChat.Setting
|
||||
singleton MSettings 0.1 Setting.qml
|
||||
singleton MPalette 0.1 Palette.qml
|
||||
@@ -10,9 +10,10 @@ import QtQuick.Layouts 1.14
|
||||
|
||||
import org.kde.kirigami 2.12 as Kirigami
|
||||
|
||||
import Spectral 0.1
|
||||
import Spectral.Component 2.0
|
||||
import Spectral.Panel 2.0
|
||||
import org.kde.neochat 0.1
|
||||
import NeoChat.Component 2.0
|
||||
import NeoChat.Panel 2.0
|
||||
import NeoChat.Page 2.0
|
||||
|
||||
Kirigami.ApplicationWindow {
|
||||
id: root
|
||||
|
||||
114
res.qrc
114
res.qrc
@@ -1,62 +1,62 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>qml/main.qml</file>
|
||||
<file>qml/LoginPage.qml</file>
|
||||
<file>qml/LoadingPage.qml</file>
|
||||
<file>qml/RoomListPage.qml</file>
|
||||
<file>qml/RoomPage.qml</file>
|
||||
<file>qml/ChatTextInput.qml</file>
|
||||
<file>qml/RoomListContextMenu.qml</file>
|
||||
<file>qml/AccountsPage.qml</file>
|
||||
<file>imports/Spectral/Component/Emoji/EmojiPicker.qml</file>
|
||||
<file>imports/Spectral/Component/Emoji/qmldir</file>
|
||||
<file>imports/Spectral/Component/Timeline/MessageDelegate.qml</file>
|
||||
<file>imports/Spectral/Component/Timeline/qmldir</file>
|
||||
<file>imports/Spectral/Component/Timeline/StateDelegate.qml</file>
|
||||
<file>imports/Spectral/Component/AutoMouseArea.qml</file>
|
||||
<file>imports/Spectral/Component/qmldir</file>
|
||||
<file>imports/Spectral/Effect/ElevationEffect.qml</file>
|
||||
<file>imports/Spectral/Effect/qmldir</file>
|
||||
<file>assets/img/icon.png</file>
|
||||
<file>imports/Spectral/Setting/Setting.qml</file>
|
||||
<file>imports/Spectral/Setting/qmldir</file>
|
||||
<file>imports/Spectral/Panel/qmldir</file>
|
||||
<file>imports/Spectral/Panel/RoomDrawer.qml</file>
|
||||
<file>imports/Spectral/Panel/RoomHeader.qml</file>
|
||||
<file>imports/Spectral/Panel/SpectralSidebar.qml</file>
|
||||
<file>imports/Spectral/Component/ScrollHelper.qml</file>
|
||||
<file>imports/Spectral/Component/AutoListView.qml</file>
|
||||
<file>imports/Spectral/Component/AutoTextField.qml</file>
|
||||
<file>imports/Spectral/Component/Timeline/SectionDelegate.qml</file>
|
||||
<file>assets/img/matrix.svg</file>
|
||||
<file>imports/Spectral/Effect/RippleEffect.qml</file>
|
||||
<file>imports/Spectral/Effect/CircleMask.qml</file>
|
||||
<file>imports/Spectral/Component/Timeline/ImageDelegate.qml</file>
|
||||
<file>imports/Spectral/Setting/Palette.qml</file>
|
||||
<file>imports/Spectral/Component/Timeline/FileDelegate.qml</file>
|
||||
<file>imports/Spectral/Component/FullScreenImage.qml</file>
|
||||
<file>imports/Spectral/Dialog/qmldir</file>
|
||||
<file>imports/Spectral/Dialog/RoomSettingsDialog.qml</file>
|
||||
<file>imports/Spectral/Dialog/UserDetailDialog.qml</file>
|
||||
<file>imports/Spectral/Dialog/MessageSourceDialog.qml</file>
|
||||
<file>imports/Spectral/Dialog/CreateRoomDialog.qml</file>
|
||||
<file>imports/Spectral/Dialog/JoinRoomDialog.qml</file>
|
||||
<file>imports/Spectral/Dialog/InviteUserDialog.qml</file>
|
||||
<file>imports/Spectral/Dialog/AcceptInvitationDialog.qml</file>
|
||||
<file>imports/Spectral/Menu/qmldir</file>
|
||||
<file>imports/Spectral/Menu/Timeline/qmldir</file>
|
||||
<file>imports/Spectral/Menu/Timeline/MessageDelegateContextMenu.qml</file>
|
||||
<file>imports/Spectral/Menu/Timeline/FileDelegateContextMenu.qml</file>
|
||||
<file>imports/Spectral/Dialog/FontFamilyDialog.qml</file>
|
||||
<file>imports/Spectral/Dialog/AccountDetailDialog.qml</file>
|
||||
<file>imports/Spectral/Dialog/OpenFileDialog.qml</file>
|
||||
<file>imports/Spectral/Dialog/OpenFolderDialog.qml</file>
|
||||
<file>imports/Spectral/Component/Timeline/VideoDelegate.qml</file>
|
||||
<file>imports/Spectral/Component/AutoRectangle.qml</file>
|
||||
<file>imports/Spectral/Component/Timeline/ReactionDelegate.qml</file>
|
||||
<file>imports/Spectral/Component/Timeline/AudioDelegate.qml</file>
|
||||
<file>imports/Spectral/Dialog/StartChatDialog.qml</file>
|
||||
<file>imports/Spectral/Component/Timeline/TextDelegate.qml</file>
|
||||
<file>imports/Spectral/Component/Timeline/TimelineContainer.qml</file>
|
||||
<file>assets/img/icon.png</file>
|
||||
<file>qml/main.qml</file>
|
||||
<file>imports/NeoChat/Page/qmldir</file>
|
||||
<file>imports/NeoChat/Page/LoginPage.qml</file>
|
||||
<file>imports/NeoChat/Page/LoadingPage.qml</file>
|
||||
<file>imports/NeoChat/Page/RoomListPage.qml</file>
|
||||
<file>imports/NeoChat/Page/RoomPage.qml</file>
|
||||
<file>imports/NeoChat/Component/qmldir</file>
|
||||
<file>imports/NeoChat/Component/ChatTextInput.qml</file>
|
||||
<file>imports/NeoChat/Component/AutoMouseArea.qml</file>
|
||||
<file>imports/NeoChat/Component/ScrollHelper.qml</file>
|
||||
<file>imports/NeoChat/Component/AutoListView.qml</file>
|
||||
<file>imports/NeoChat/Component/AutoTextField.qml</file>
|
||||
<file>imports/NeoChat/Component/AutoRectangle.qml</file>
|
||||
<file>imports/NeoChat/Component/FullScreenImage.qml</file>
|
||||
<file>imports/NeoChat/Component/Emoji/EmojiPicker.qml</file>
|
||||
<file>imports/NeoChat/Component/Emoji/qmldir</file>
|
||||
<file>imports/NeoChat/Component/Timeline/MessageDelegate.qml</file>
|
||||
<file>imports/NeoChat/Component/Timeline/qmldir</file>
|
||||
<file>imports/NeoChat/Component/Timeline/StateDelegate.qml</file>
|
||||
<file>imports/NeoChat/Component/Timeline/TextDelegate.qml</file>
|
||||
<file>imports/NeoChat/Component/Timeline/TimelineContainer.qml</file>
|
||||
<file>imports/NeoChat/Component/Timeline/SectionDelegate.qml</file>
|
||||
<file>imports/NeoChat/Component/Timeline/VideoDelegate.qml</file>
|
||||
<file>imports/NeoChat/Component/Timeline/ReactionDelegate.qml</file>
|
||||
<file>imports/NeoChat/Component/Timeline/AudioDelegate.qml</file>
|
||||
<file>imports/NeoChat/Component/Timeline/FileDelegate.qml</file>
|
||||
<file>imports/NeoChat/Component/Timeline/ImageDelegate.qml</file>
|
||||
<file>imports/NeoChat/Setting/Setting.qml</file>
|
||||
<file>imports/NeoChat/Setting/qmldir</file>
|
||||
<file>imports/NeoChat/Setting/Palette.qml</file>
|
||||
<file>imports/NeoChat/Panel/qmldir</file>
|
||||
<file>imports/NeoChat/Panel/RoomDrawer.qml</file>
|
||||
<file>imports/NeoChat/Panel/RoomHeader.qml</file>
|
||||
<file>imports/NeoChat/Panel/NeoChatSidebar.qml</file>
|
||||
<file>imports/NeoChat/Effect/RippleEffect.qml</file>
|
||||
<file>imports/NeoChat/Effect/CircleMask.qml</file>
|
||||
<file>imports/NeoChat/Effect/ElevationEffect.qml</file>
|
||||
<file>imports/NeoChat/Effect/qmldir</file>
|
||||
<file>imports/NeoChat/Dialog/qmldir</file>
|
||||
<file>imports/NeoChat/Dialog/RoomSettingsDialog.qml</file>
|
||||
<file>imports/NeoChat/Dialog/UserDetailDialog.qml</file>
|
||||
<file>imports/NeoChat/Dialog/MessageSourceDialog.qml</file>
|
||||
<file>imports/NeoChat/Dialog/CreateRoomDialog.qml</file>
|
||||
<file>imports/NeoChat/Dialog/JoinRoomDialog.qml</file>
|
||||
<file>imports/NeoChat/Dialog/InviteUserDialog.qml</file>
|
||||
<file>imports/NeoChat/Dialog/AcceptInvitationDialog.qml</file>
|
||||
<file>imports/NeoChat/Dialog/StartChatDialog.qml</file>
|
||||
<file>imports/NeoChat/Dialog/FontFamilyDialog.qml</file>
|
||||
<file>imports/NeoChat/Dialog/AccountDetailDialog.qml</file>
|
||||
<file>imports/NeoChat/Dialog/OpenFileDialog.qml</file>
|
||||
<file>imports/NeoChat/Dialog/OpenFolderDialog.qml</file>
|
||||
<file>imports/NeoChat/Menu/qmldir</file>
|
||||
<file>imports/NeoChat/Menu/Timeline/qmldir</file>
|
||||
<file>imports/NeoChat/Menu/Timeline/MessageDelegateContextMenu.qml</file>
|
||||
<file>imports/NeoChat/Menu/Timeline/FileDelegateContextMenu.qml</file>
|
||||
<file>imports/NeoChat/Menu/RoomListContextMenu.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -6,8 +6,8 @@ add_executable(neochat
|
||||
matriximageprovider.cpp
|
||||
messageeventmodel.cpp
|
||||
roomlistmodel.cpp
|
||||
spectralroom.cpp
|
||||
spectraluser.cpp
|
||||
neochatroom.cpp
|
||||
neochatuser.cpp
|
||||
trayicon.cpp
|
||||
userlistmodel.cpp
|
||||
publicroomlistmodel.cpp
|
||||
|
||||
@@ -38,8 +38,8 @@
|
||||
#include "events/eventcontent.h"
|
||||
#include "events/roommessageevent.h"
|
||||
#include "settings.h"
|
||||
#include "spectralroom.h"
|
||||
#include "spectraluser.h"
|
||||
#include "neochatroom.h"
|
||||
#include "neochatuser.h"
|
||||
#include "utils.h"
|
||||
|
||||
Controller::Controller(QObject *parent)
|
||||
@@ -47,8 +47,8 @@ Controller::Controller(QObject *parent)
|
||||
{
|
||||
QApplication::setQuitOnLastWindowClosed(false);
|
||||
|
||||
Connection::setRoomType<SpectralRoom>();
|
||||
Connection::setUserType<SpectralUser>();
|
||||
Connection::setRoomType<NeoChatRoom>();
|
||||
Connection::setUserType<NeoChatUser>();
|
||||
|
||||
connect(&m_ncm, &QNetworkConfigurationManager::onlineStateChanged, this, &Controller::isOnlineChanged);
|
||||
|
||||
@@ -83,7 +83,7 @@ void Controller::loginWithCredentials(QString serverAddr, QString user, QString
|
||||
}
|
||||
|
||||
if (deviceName.isEmpty()) {
|
||||
deviceName = "Spectral " + QSysInfo::machineHostName() + " " + QSysInfo::productType() + " " + QSysInfo::productVersion() + " " + QSysInfo::currentCpuArchitecture();
|
||||
deviceName = "NeoChat " + QSysInfo::machineHostName() + " " + QSysInfo::productType() + " " + QSysInfo::productVersion() + " " + QSysInfo::currentCpuArchitecture();
|
||||
}
|
||||
|
||||
QUrl serverUrl(serverAddr);
|
||||
|
||||
36
src/main.cpp
36
src/main.cpp
@@ -31,8 +31,8 @@
|
||||
#include "room.h"
|
||||
#include "roomlistmodel.h"
|
||||
#include "sortfilterroomlistmodel.h"
|
||||
#include "spectralroom.h"
|
||||
#include "spectraluser.h"
|
||||
#include "neochatroom.h"
|
||||
#include "neochatuser.h"
|
||||
#include "trayicon.h"
|
||||
#include "userdirectorylistmodel.h"
|
||||
#include "userlistmodel.h"
|
||||
@@ -60,21 +60,21 @@ int main(int argc, char *argv[])
|
||||
|
||||
Clipboard clipboard;
|
||||
|
||||
qmlRegisterSingletonInstance("Spectral", 0, 1, "Controller", &Controller::instance());
|
||||
qmlRegisterSingletonInstance("org.kde.neochat", 0, 1, "Controller", &Controller::instance());
|
||||
qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "Clipboard", &clipboard);
|
||||
qmlRegisterType<AccountListModel>("Spectral", 0, 1, "AccountListModel");
|
||||
qmlRegisterType<RoomListModel>("Spectral", 0, 1, "RoomListModel");
|
||||
qmlRegisterType<UserListModel>("Spectral", 0, 1, "UserListModel");
|
||||
qmlRegisterType<MessageEventModel>("Spectral", 0, 1, "MessageEventModel");
|
||||
qmlRegisterType<PublicRoomListModel>("Spectral", 0, 1, "PublicRoomListModel");
|
||||
qmlRegisterType<UserDirectoryListModel>("Spectral", 0, 1, "UserDirectoryListModel");
|
||||
qmlRegisterType<EmojiModel>("Spectral", 0, 1, "EmojiModel");
|
||||
qmlRegisterType<NotificationsManager>("Spectral", 0, 1, "NotificationsManager");
|
||||
qmlRegisterType<TrayIcon>("Spectral", 0, 1, "TrayIcon");
|
||||
qmlRegisterType<SortFilterRoomListModel>("org.kde.neochat", 1, 0, "SortFilterRoomListModel");
|
||||
qmlRegisterUncreatableType<RoomMessageEvent>("Spectral", 0, 1, "RoomMessageEvent", "ENUM");
|
||||
qmlRegisterUncreatableType<RoomType>("Spectral", 0, 1, "RoomType", "ENUM");
|
||||
qmlRegisterUncreatableType<UserType>("Spectral", 0, 1, "UserType", "ENUM");
|
||||
qmlRegisterType<AccountListModel>("org.kde.neochat", 0, 1, "AccountListModel");
|
||||
qmlRegisterType<RoomListModel>("org.kde.neochat", 0, 1, "RoomListModel");
|
||||
qmlRegisterType<UserListModel>("org.kde.neochat", 0, 1, "UserListModel");
|
||||
qmlRegisterType<MessageEventModel>("org.kde.neochat", 0, 1, "MessageEventModel");
|
||||
qmlRegisterType<PublicRoomListModel>("org.kde.neochat", 0, 1, "PublicRoomListModel");
|
||||
qmlRegisterType<UserDirectoryListModel>("org.kde.neochat", 0, 1, "UserDirectoryListModel");
|
||||
qmlRegisterType<EmojiModel>("org.kde.neochat", 0, 1, "EmojiModel");
|
||||
qmlRegisterType<NotificationsManager>("org.kde.neochat", 0, 1, "NotificationsManager");
|
||||
qmlRegisterType<TrayIcon>("org.kde.neochat", 0, 1, "TrayIcon");
|
||||
qmlRegisterType<SortFilterRoomListModel>("org.kde.neochat", 0, 1, "SortFilterRoomListModel");
|
||||
qmlRegisterUncreatableType<RoomMessageEvent>("org.kde.neochat", 0, 1, "RoomMessageEvent", "ENUM");
|
||||
qmlRegisterUncreatableType<RoomType>("org.kde.neochat", 0, 1, "RoomType", "ENUM");
|
||||
qmlRegisterUncreatableType<UserType>("org.kde.neochat", 0, 1, "UserType", "ENUM");
|
||||
|
||||
qRegisterMetaType<User *>("User*");
|
||||
qRegisterMetaType<User *>("const User*");
|
||||
@@ -82,8 +82,8 @@ int main(int argc, char *argv[])
|
||||
qRegisterMetaType<Room *>("Room*");
|
||||
qRegisterMetaType<Connection *>("Connection*");
|
||||
qRegisterMetaType<MessageEventType>("MessageEventType");
|
||||
qRegisterMetaType<SpectralRoom *>("SpectralRoom*");
|
||||
qRegisterMetaType<SpectralUser *>("SpectralUser*");
|
||||
qRegisterMetaType<NeoChatRoom *>("NeoChatRoom*");
|
||||
qRegisterMetaType<NeoChatUser *>("NeoChatUser*");
|
||||
qRegisterMetaType<GetRoomEventsJob *>("GetRoomEventsJob*");
|
||||
|
||||
qRegisterMetaTypeStreamOperators<Emoji>();
|
||||
|
||||
@@ -44,16 +44,16 @@ MessageEventModel::MessageEventModel(QObject *parent)
|
||||
, m_currentRoom(nullptr)
|
||||
{
|
||||
using namespace Quotient;
|
||||
qmlRegisterAnonymousType<FileTransferInfo>("Spectral", 1);
|
||||
qmlRegisterAnonymousType<FileTransferInfo>("NeoChat", 1);
|
||||
qRegisterMetaType<FileTransferInfo>();
|
||||
qmlRegisterUncreatableType<EventStatus>("Spectral", 0, 1, "EventStatus", "EventStatus is not an creatable type");
|
||||
qmlRegisterUncreatableType<EventStatus>("NeoChat", 0, 1, "EventStatus", "EventStatus is not an creatable type");
|
||||
}
|
||||
|
||||
MessageEventModel::~MessageEventModel()
|
||||
{
|
||||
}
|
||||
|
||||
void MessageEventModel::setRoom(SpectralRoom *room)
|
||||
void MessageEventModel::setRoom(NeoChatRoom *room)
|
||||
{
|
||||
if (room == m_currentRoom)
|
||||
return;
|
||||
@@ -253,7 +253,7 @@ int MessageEventModel::rowCount(const QModelIndex &parent) const
|
||||
return m_currentRoom->timelineSize();
|
||||
}
|
||||
|
||||
inline QVariantMap userAtEvent(SpectralUser *user, SpectralRoom *room, const RoomEvent &evt)
|
||||
inline QVariantMap userAtEvent(NeoChatUser *user, NeoChatRoom *room, const RoomEvent &evt)
|
||||
{
|
||||
Q_UNUSED(evt)
|
||||
return QVariantMap {
|
||||
@@ -323,7 +323,7 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
return EventTypeRegistry::getMatrixType(evt.type());
|
||||
|
||||
if (role == AuthorRole) {
|
||||
auto author = static_cast<SpectralUser *>(isPending ? m_currentRoom->localUser() : m_currentRoom->user(evt.senderId()));
|
||||
auto author = static_cast<NeoChatUser *>(isPending ? m_currentRoom->localUser() : m_currentRoom->user(evt.senderId()));
|
||||
return userAtEvent(author, m_currentRoom, evt);
|
||||
}
|
||||
|
||||
@@ -423,7 +423,7 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
return {};
|
||||
const auto &replyEvt = **replyIt;
|
||||
|
||||
return QVariantMap {{"eventId", replyEventId}, {"display", m_currentRoom->eventToString(replyEvt, Qt::RichText)}, {"author", userAtEvent(static_cast<SpectralUser *>(m_currentRoom->user(replyEvt.senderId())), m_currentRoom, evt)}};
|
||||
return QVariantMap {{"eventId", replyEventId}, {"display", m_currentRoom->eventToString(replyEvt, Qt::RichText)}, {"author", userAtEvent(static_cast<NeoChatUser *>(m_currentRoom->user(replyEvt.senderId())), m_currentRoom, evt)}};
|
||||
}
|
||||
|
||||
if (role == ShowAuthorRole) {
|
||||
@@ -452,12 +452,12 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
const auto &annotations = m_currentRoom->relatedEvents(evt, EventRelation::Annotation());
|
||||
if (annotations.isEmpty())
|
||||
return {};
|
||||
QMap<QString, QList<SpectralUser *>> reactions = {};
|
||||
QMap<QString, QList<NeoChatUser *>> reactions = {};
|
||||
for (const auto &a : annotations) {
|
||||
if (a->isRedacted()) // Just in case?
|
||||
continue;
|
||||
if (auto e = eventCast<const ReactionEvent>(a))
|
||||
reactions[e->relation().key].append(static_cast<SpectralUser *>(m_currentRoom->user(e->senderId())));
|
||||
reactions[e->relation().key].append(static_cast<NeoChatUser *>(m_currentRoom->user(e->senderId())));
|
||||
}
|
||||
|
||||
if (reactions.isEmpty()) {
|
||||
@@ -471,7 +471,7 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
for (auto author : i.value()) {
|
||||
authors.append(userAtEvent(author, m_currentRoom, evt));
|
||||
}
|
||||
bool hasLocalUser = i.value().contains(static_cast<SpectralUser *>(m_currentRoom->localUser()));
|
||||
bool hasLocalUser = i.value().contains(static_cast<NeoChatUser *>(m_currentRoom->localUser()));
|
||||
res.append(QVariantMap {{"reaction", i.key()}, {"count", i.value().count()}, {"authors", authors}, {"hasLocalUser", hasLocalUser}});
|
||||
++i;
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
#include <QAbstractListModel>
|
||||
|
||||
#include "room.h"
|
||||
#include "spectralroom.h"
|
||||
#include "neochatroom.h"
|
||||
|
||||
class MessageEventModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(SpectralRoom *room READ room WRITE setRoom NOTIFY roomChanged)
|
||||
Q_PROPERTY(NeoChatRoom *room READ room WRITE setRoom NOTIFY roomChanged)
|
||||
|
||||
public:
|
||||
enum EventRoles {
|
||||
@@ -50,11 +50,11 @@ public:
|
||||
explicit MessageEventModel(QObject *parent = nullptr);
|
||||
~MessageEventModel() override;
|
||||
|
||||
SpectralRoom *room() const
|
||||
NeoChatRoom *room() const
|
||||
{
|
||||
return m_currentRoom;
|
||||
}
|
||||
void setRoom(SpectralRoom *room);
|
||||
void setRoom(NeoChatRoom *room);
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
@@ -67,7 +67,7 @@ private Q_SLOTS:
|
||||
void refreshRow(int row);
|
||||
|
||||
private:
|
||||
SpectralRoom *m_currentRoom = nullptr;
|
||||
NeoChatRoom *m_currentRoom = nullptr;
|
||||
QString lastReadEventId;
|
||||
int rowBelowInserted = -1;
|
||||
bool movingEvent = 0;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "spectralroom.h"
|
||||
#include "neochatroom.h"
|
||||
|
||||
#include <cmark.h>
|
||||
|
||||
@@ -27,18 +27,18 @@
|
||||
#include "user.h"
|
||||
#include "utils.h"
|
||||
|
||||
SpectralRoom::SpectralRoom(Connection *connection, QString roomId, JoinState joinState)
|
||||
NeoChatRoom::NeoChatRoom(Connection *connection, QString roomId, JoinState joinState)
|
||||
: Room(connection, std::move(roomId), joinState)
|
||||
{
|
||||
connect(this, &SpectralRoom::notificationCountChanged, this, &SpectralRoom::countChanged);
|
||||
connect(this, &SpectralRoom::highlightCountChanged, this, &SpectralRoom::countChanged);
|
||||
connect(this, &NeoChatRoom::notificationCountChanged, this, &NeoChatRoom::countChanged);
|
||||
connect(this, &NeoChatRoom::highlightCountChanged, this, &NeoChatRoom::countChanged);
|
||||
connect(this, &Room::fileTransferCompleted, this, [=] {
|
||||
setFileUploadingProgress(0);
|
||||
setHasFileUploading(false);
|
||||
});
|
||||
}
|
||||
|
||||
void SpectralRoom::uploadFile(const QUrl &url, const QString &body)
|
||||
void NeoChatRoom::uploadFile(const QUrl &url, const QString &body)
|
||||
{
|
||||
if (url.isEmpty())
|
||||
return;
|
||||
@@ -65,17 +65,17 @@ void SpectralRoom::uploadFile(const QUrl &url, const QString &body)
|
||||
});
|
||||
}
|
||||
|
||||
void SpectralRoom::acceptInvitation()
|
||||
void NeoChatRoom::acceptInvitation()
|
||||
{
|
||||
connection()->joinRoom(id());
|
||||
}
|
||||
|
||||
void SpectralRoom::forget()
|
||||
void NeoChatRoom::forget()
|
||||
{
|
||||
connection()->forgetRoom(id());
|
||||
}
|
||||
|
||||
QVariantList SpectralRoom::getUsersTyping() const
|
||||
QVariantList NeoChatRoom::getUsersTyping() const
|
||||
{
|
||||
auto users = usersTyping();
|
||||
users.removeAll(localUser());
|
||||
@@ -86,12 +86,12 @@ QVariantList SpectralRoom::getUsersTyping() const
|
||||
return userVariants;
|
||||
}
|
||||
|
||||
void SpectralRoom::sendTypingNotification(bool isTyping)
|
||||
void NeoChatRoom::sendTypingNotification(bool isTyping)
|
||||
{
|
||||
connection()->callApi<SetTypingJob>(BackgroundRequest, localUser()->id(), id(), isTyping, 10000);
|
||||
}
|
||||
|
||||
QString SpectralRoom::lastEvent() const
|
||||
QString NeoChatRoom::lastEvent() const
|
||||
{
|
||||
for (auto i = messageEvents().rbegin(); i < messageEvents().rend(); i++) {
|
||||
const RoomEvent *evt = i->get();
|
||||
@@ -118,12 +118,12 @@ QString SpectralRoom::lastEvent() const
|
||||
return "";
|
||||
}
|
||||
|
||||
bool SpectralRoom::isEventHighlighted(const RoomEvent *e) const
|
||||
bool NeoChatRoom::isEventHighlighted(const RoomEvent *e) const
|
||||
{
|
||||
return highlights.contains(e);
|
||||
}
|
||||
|
||||
void SpectralRoom::checkForHighlights(const Quotient::TimelineItem &ti)
|
||||
void NeoChatRoom::checkForHighlights(const Quotient::TimelineItem &ti)
|
||||
{
|
||||
auto localUserId = localUser()->id();
|
||||
if (ti->senderId() == localUserId)
|
||||
@@ -135,21 +135,21 @@ void SpectralRoom::checkForHighlights(const Quotient::TimelineItem &ti)
|
||||
}
|
||||
}
|
||||
|
||||
void SpectralRoom::onAddNewTimelineEvents(timeline_iter_t from)
|
||||
void NeoChatRoom::onAddNewTimelineEvents(timeline_iter_t from)
|
||||
{
|
||||
std::for_each(from, messageEvents().cend(), [this](const TimelineItem &ti) {
|
||||
checkForHighlights(ti);
|
||||
});
|
||||
}
|
||||
|
||||
void SpectralRoom::onAddHistoricalTimelineEvents(rev_iter_t from)
|
||||
void NeoChatRoom::onAddHistoricalTimelineEvents(rev_iter_t from)
|
||||
{
|
||||
std::for_each(from, messageEvents().crend(), [this](const TimelineItem &ti) {
|
||||
checkForHighlights(ti);
|
||||
});
|
||||
}
|
||||
|
||||
void SpectralRoom::onRedaction(const RoomEvent &prevEvent, const RoomEvent & /*after*/)
|
||||
void NeoChatRoom::onRedaction(const RoomEvent &prevEvent, const RoomEvent & /*after*/)
|
||||
{
|
||||
if (const auto &e = eventCast<const ReactionEvent>(&prevEvent)) {
|
||||
if (auto relatedEventId = e->relation().eventId; !relatedEventId.isEmpty()) {
|
||||
@@ -158,7 +158,7 @@ void SpectralRoom::onRedaction(const RoomEvent &prevEvent, const RoomEvent & /*a
|
||||
}
|
||||
}
|
||||
|
||||
void SpectralRoom::countChanged()
|
||||
void NeoChatRoom::countChanged()
|
||||
{
|
||||
if (displayed() && !hasUnreadMessages()) {
|
||||
resetNotificationCount();
|
||||
@@ -166,24 +166,24 @@ void SpectralRoom::countChanged()
|
||||
}
|
||||
}
|
||||
|
||||
QDateTime SpectralRoom::lastActiveTime() const
|
||||
QDateTime NeoChatRoom::lastActiveTime() const
|
||||
{
|
||||
if (timelineSize() == 0)
|
||||
return QDateTime();
|
||||
return messageEvents().rbegin()->get()->originTimestamp();
|
||||
}
|
||||
|
||||
int SpectralRoom::savedTopVisibleIndex() const
|
||||
int NeoChatRoom::savedTopVisibleIndex() const
|
||||
{
|
||||
return firstDisplayedMarker() == timelineEdge() ? 0 : int(firstDisplayedMarker() - messageEvents().rbegin());
|
||||
}
|
||||
|
||||
int SpectralRoom::savedBottomVisibleIndex() const
|
||||
int NeoChatRoom::savedBottomVisibleIndex() const
|
||||
{
|
||||
return lastDisplayedMarker() == timelineEdge() ? 0 : int(lastDisplayedMarker() - messageEvents().rbegin());
|
||||
}
|
||||
|
||||
void SpectralRoom::saveViewport(int topIndex, int bottomIndex)
|
||||
void NeoChatRoom::saveViewport(int topIndex, int bottomIndex)
|
||||
{
|
||||
if (topIndex == -1 || bottomIndex == -1 || (bottomIndex == savedBottomVisibleIndex() && (bottomIndex == 0 || topIndex == savedTopVisibleIndex())))
|
||||
return;
|
||||
@@ -196,7 +196,7 @@ void SpectralRoom::saveViewport(int topIndex, int bottomIndex)
|
||||
setLastDisplayedEvent(maxTimelineIndex() - bottomIndex);
|
||||
}
|
||||
|
||||
QVariantList SpectralRoom::getUsers(const QString &keyword) const
|
||||
QVariantList NeoChatRoom::getUsers(const QString &keyword) const
|
||||
{
|
||||
const auto userList = users();
|
||||
QVariantList matchedList;
|
||||
@@ -208,12 +208,12 @@ QVariantList SpectralRoom::getUsers(const QString &keyword) const
|
||||
return matchedList;
|
||||
}
|
||||
|
||||
QUrl SpectralRoom::urlToMxcUrl(QUrl mxcUrl)
|
||||
QUrl NeoChatRoom::urlToMxcUrl(QUrl mxcUrl)
|
||||
{
|
||||
return DownloadFileJob::makeRequestUrl(connection()->homeserver(), mxcUrl);
|
||||
}
|
||||
|
||||
QString SpectralRoom::avatarMediaId() const
|
||||
QString NeoChatRoom::avatarMediaId() const
|
||||
{
|
||||
if (const auto avatar = Room::avatarMediaId(); !avatar.isEmpty()) {
|
||||
return avatar;
|
||||
@@ -230,7 +230,7 @@ QString SpectralRoom::avatarMediaId() const
|
||||
return {};
|
||||
}
|
||||
|
||||
QString SpectralRoom::eventToString(const RoomEvent &evt, Qt::TextFormat format, bool removeReply) const
|
||||
QString NeoChatRoom::eventToString(const RoomEvent &evt, Qt::TextFormat format, bool removeReply) const
|
||||
{
|
||||
const bool prettyPrint = (format == Qt::RichText);
|
||||
|
||||
@@ -358,7 +358,7 @@ QString SpectralRoom::eventToString(const RoomEvent &evt, Qt::TextFormat format,
|
||||
tr("Unknown event"));
|
||||
}
|
||||
|
||||
void SpectralRoom::changeAvatar(QUrl localFile)
|
||||
void NeoChatRoom::changeAvatar(QUrl localFile)
|
||||
{
|
||||
const auto job = connection()->uploadFile(localFile.toLocalFile());
|
||||
if (isJobRunning(job)) {
|
||||
@@ -368,7 +368,7 @@ void SpectralRoom::changeAvatar(QUrl localFile)
|
||||
}
|
||||
}
|
||||
|
||||
void SpectralRoom::addLocalAlias(const QString &alias)
|
||||
void NeoChatRoom::addLocalAlias(const QString &alias)
|
||||
{
|
||||
auto a = aliases();
|
||||
if (a.contains(alias))
|
||||
@@ -379,7 +379,7 @@ void SpectralRoom::addLocalAlias(const QString &alias)
|
||||
setLocalAliases(a);
|
||||
}
|
||||
|
||||
void SpectralRoom::removeLocalAlias(const QString &alias)
|
||||
void NeoChatRoom::removeLocalAlias(const QString &alias)
|
||||
{
|
||||
auto a = aliases();
|
||||
if (!a.contains(alias))
|
||||
@@ -390,7 +390,7 @@ void SpectralRoom::removeLocalAlias(const QString &alias)
|
||||
setLocalAliases(a);
|
||||
}
|
||||
|
||||
QString SpectralRoom::markdownToHTML(const QString &markdown)
|
||||
QString NeoChatRoom::markdownToHTML(const QString &markdown)
|
||||
{
|
||||
const auto str = markdown.toUtf8();
|
||||
char *tmp_buf = cmark_markdown_to_html(str.constData(), str.size(), CMARK_OPT_DEFAULT);
|
||||
@@ -407,7 +407,7 @@ QString SpectralRoom::markdownToHTML(const QString &markdown)
|
||||
return result;
|
||||
}
|
||||
|
||||
void SpectralRoom::postArbitaryMessage(const QString &text, MessageEventType type, const QString &replyEventId)
|
||||
void NeoChatRoom::postArbitaryMessage(const QString &text, MessageEventType type, const QString &replyEventId)
|
||||
{
|
||||
const auto parsedHTML = markdownToHTML(text);
|
||||
const bool isRichText = Qt::mightBeRichText(parsedHTML);
|
||||
@@ -443,7 +443,7 @@ QString msgTypeToString(MessageEventType msgType)
|
||||
}
|
||||
}
|
||||
|
||||
void SpectralRoom::postPlainMessage(const QString &text, MessageEventType type, const QString &replyEventId)
|
||||
void NeoChatRoom::postPlainMessage(const QString &text, MessageEventType type, const QString &replyEventId)
|
||||
{
|
||||
bool isReply = !replyEventId.isEmpty();
|
||||
const auto replyIt = findInTimeline(replyEventId);
|
||||
@@ -487,7 +487,7 @@ void SpectralRoom::postPlainMessage(const QString &text, MessageEventType type,
|
||||
Room::postMessage(text, type);
|
||||
}
|
||||
|
||||
void SpectralRoom::postHtmlMessage(const QString &text, const QString &html, MessageEventType type, const QString &replyEventId)
|
||||
void NeoChatRoom::postHtmlMessage(const QString &text, const QString &html, MessageEventType type, const QString &replyEventId)
|
||||
{
|
||||
bool isReply = !replyEventId.isEmpty();
|
||||
const auto replyIt = findInTimeline(replyEventId);
|
||||
@@ -531,7 +531,7 @@ void SpectralRoom::postHtmlMessage(const QString &text, const QString &html, Mes
|
||||
Room::postHtmlMessage(text, html, type);
|
||||
}
|
||||
|
||||
void SpectralRoom::toggleReaction(const QString &eventId, const QString &reaction)
|
||||
void NeoChatRoom::toggleReaction(const QString &eventId, const QString &reaction)
|
||||
{
|
||||
if (eventId.isEmpty() || reaction.isEmpty())
|
||||
return;
|
||||
@@ -568,7 +568,7 @@ void SpectralRoom::toggleReaction(const QString &eventId, const QString &reactio
|
||||
}
|
||||
}
|
||||
|
||||
bool SpectralRoom::containsUser(QString userID) const
|
||||
bool NeoChatRoom::containsUser(QString userID) const
|
||||
{
|
||||
auto u = Room::user(userID);
|
||||
|
||||
@@ -578,7 +578,7 @@ bool SpectralRoom::containsUser(QString userID) const
|
||||
return Room::memberJoinState(u) != JoinState::Leave;
|
||||
}
|
||||
|
||||
bool SpectralRoom::canSendEvent(const QString &eventType) const
|
||||
bool NeoChatRoom::canSendEvent(const QString &eventType) const
|
||||
{
|
||||
auto plEvent = getCurrentState<RoomPowerLevelsEvent>();
|
||||
auto pl = plEvent->powerLevelForEvent(eventType);
|
||||
@@ -587,7 +587,7 @@ bool SpectralRoom::canSendEvent(const QString &eventType) const
|
||||
return currentPl >= pl;
|
||||
}
|
||||
|
||||
bool SpectralRoom::canSendState(const QString &eventType) const
|
||||
bool NeoChatRoom::canSendState(const QString &eventType) const
|
||||
{
|
||||
auto plEvent = getCurrentState<RoomPowerLevelsEvent>();
|
||||
auto pl = plEvent->powerLevelForState(eventType);
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef SpectralRoom_H
|
||||
#define SpectralRoom_H
|
||||
#pragma once
|
||||
|
||||
#include <events/encryptionevent.h>
|
||||
#include <events/redactionevent.h>
|
||||
@@ -14,11 +13,11 @@
|
||||
#include <QTimer>
|
||||
|
||||
#include "room.h"
|
||||
#include "spectraluser.h"
|
||||
#include "neochatuser.h"
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
class SpectralRoom : public Room
|
||||
class NeoChatRoom : public Room
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QVariantList usersTyping READ getUsersTyping NOTIFY typingChanged)
|
||||
@@ -28,7 +27,7 @@ class SpectralRoom : public Room
|
||||
Q_PROPERTY(QString avatarMediaId READ avatarMediaId NOTIFY avatarChanged STORED false)
|
||||
|
||||
public:
|
||||
explicit SpectralRoom(Connection *connection, QString roomId, JoinState joinState = {});
|
||||
explicit NeoChatRoom(Connection *connection, QString roomId, JoinState joinState = {});
|
||||
|
||||
QVariantList getUsersTyping() const;
|
||||
|
||||
@@ -118,5 +117,3 @@ public Q_SLOTS:
|
||||
void removeLocalAlias(const QString &alias);
|
||||
void toggleReaction(const QString &eventId, const QString &reaction);
|
||||
};
|
||||
|
||||
#endif // SpectralRoom_H
|
||||
@@ -1,13 +1,13 @@
|
||||
#include "spectraluser.h"
|
||||
#include "neochatuser.h"
|
||||
|
||||
#include "csapi/profile.h"
|
||||
|
||||
QColor SpectralUser::color()
|
||||
QColor NeoChatUser::color()
|
||||
{
|
||||
return QColor::fromHslF(hueF(), 0.7, 0.5, 1);
|
||||
}
|
||||
//TODO libQuotient 0.7: remove default name
|
||||
void SpectralUser::setDefaultName(QString defaultName)
|
||||
void NeoChatUser::setDefaultName(QString defaultName)
|
||||
{
|
||||
rename(defaultName);
|
||||
connect(this, &Quotient::User::defaultNameChanged, this, [this]() {
|
||||
@@ -17,7 +17,7 @@ void SpectralUser::setDefaultName(QString defaultName)
|
||||
});
|
||||
}
|
||||
|
||||
QString SpectralUser::defaultName()
|
||||
QString NeoChatUser::defaultName()
|
||||
{
|
||||
if(m_defaultName.isEmpty()) {
|
||||
GetDisplayNameJob *job = connection()->callApi<GetDisplayNameJob>(id());
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef SpectralUser_H
|
||||
#define SpectralUser_H
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
@@ -8,13 +7,13 @@
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
class SpectralUser : public User
|
||||
class NeoChatUser : public User
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QColor color READ color CONSTANT)
|
||||
Q_PROPERTY(QString defaultName READ defaultName WRITE setDefaultName NOTIFY nameChanged)
|
||||
public:
|
||||
SpectralUser(QString userId, Connection *connection)
|
||||
NeoChatUser(QString userId, Connection *connection)
|
||||
: User(userId, connection)
|
||||
{
|
||||
}
|
||||
@@ -31,5 +30,3 @@ Q_SIGNALS:
|
||||
private:
|
||||
QString m_defaultName;
|
||||
};
|
||||
|
||||
#endif // SpectralUser_H
|
||||
@@ -38,7 +38,7 @@ void RoomListModel::setConnection(Connection *connection)
|
||||
|
||||
m_connection = connection;
|
||||
|
||||
for (SpectralRoom *room : qAsConst(m_rooms)) {
|
||||
for (NeoChatRoom *room : qAsConst(m_rooms)) {
|
||||
room->disconnect(this);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ void RoomListModel::setConnection(Connection *connection)
|
||||
for (const QString &roomID : values) {
|
||||
auto room = connection->room(roomID);
|
||||
if (room)
|
||||
refresh(static_cast<SpectralRoom *>(room));
|
||||
refresh(static_cast<NeoChatRoom *>(room));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -72,14 +72,14 @@ void RoomListModel::doResetModel()
|
||||
refreshNotificationCount();
|
||||
}
|
||||
|
||||
SpectralRoom *RoomListModel::roomAt(int row) const
|
||||
NeoChatRoom *RoomListModel::roomAt(int row) const
|
||||
{
|
||||
return m_rooms.at(row);
|
||||
}
|
||||
|
||||
void RoomListModel::doAddRoom(Room *r)
|
||||
{
|
||||
if (auto room = static_cast<SpectralRoom *>(r)) {
|
||||
if (auto room = static_cast<NeoChatRoom *>(r)) {
|
||||
m_rooms.append(room);
|
||||
connectRoomSignals(room);
|
||||
Q_EMIT roomAdded(room);
|
||||
@@ -89,7 +89,7 @@ void RoomListModel::doAddRoom(Room *r)
|
||||
}
|
||||
}
|
||||
|
||||
void RoomListModel::connectRoomSignals(SpectralRoom *room)
|
||||
void RoomListModel::connectRoomSignals(NeoChatRoom *room)
|
||||
{
|
||||
connect(room, &Room::displaynameChanged, this, [=] {
|
||||
refresh(room);
|
||||
@@ -159,7 +159,7 @@ void RoomListModel::updateRoom(Room *room, Room *prev)
|
||||
// the previously left room (in both cases prev has the previous state).
|
||||
if (prev == room) {
|
||||
qCritical() << "RoomListModel::updateRoom: room tried to replace itself";
|
||||
refresh(static_cast<SpectralRoom *>(room));
|
||||
refresh(static_cast<NeoChatRoom *>(room));
|
||||
return;
|
||||
}
|
||||
if (prev && room->id() != prev->id()) {
|
||||
@@ -167,8 +167,8 @@ void RoomListModel::updateRoom(Room *room, Room *prev)
|
||||
// That doesn't look right but technically we still can do it.
|
||||
}
|
||||
// Ok, we're through with pre-checks, now for the real thing.
|
||||
auto newRoom = static_cast<SpectralRoom *>(room);
|
||||
const auto it = std::find_if(m_rooms.begin(), m_rooms.end(), [=](const SpectralRoom *r) {
|
||||
auto newRoom = static_cast<NeoChatRoom *>(room);
|
||||
const auto it = std::find_if(m_rooms.begin(), m_rooms.end(), [=](const NeoChatRoom *r) {
|
||||
return r == prev || r == newRoom;
|
||||
});
|
||||
if (it != m_rooms.end()) {
|
||||
@@ -216,7 +216,7 @@ QVariant RoomListModel::data(const QModelIndex &index, int role) const
|
||||
qDebug() << "UserListModel: something wrong here...";
|
||||
return QVariant();
|
||||
}
|
||||
SpectralRoom *room = m_rooms.at(index.row());
|
||||
NeoChatRoom *room = m_rooms.at(index.row());
|
||||
if (role == NameRole)
|
||||
return room->displayName();
|
||||
if (role == AvatarRole)
|
||||
@@ -256,7 +256,7 @@ QVariant RoomListModel::data(const QModelIndex &index, int role) const
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
void RoomListModel::refresh(SpectralRoom *room, const QVector<int> &roles)
|
||||
void RoomListModel::refresh(NeoChatRoom *room, const QVector<int> &roles)
|
||||
{
|
||||
const auto it = std::find(m_rooms.begin(), m_rooms.end(), room);
|
||||
if (it == m_rooms.end()) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "connection.h"
|
||||
#include "events/roomevent.h"
|
||||
#include "room.h"
|
||||
#include "spectralroom.h"
|
||||
#include "neochatroom.h"
|
||||
|
||||
#include <QAbstractListModel>
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
void setConnection(Connection *connection);
|
||||
void doResetModel();
|
||||
|
||||
Q_INVOKABLE SpectralRoom *roomAt(int row) const;
|
||||
Q_INVOKABLE NeoChatRoom *roomAt(int row) const;
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
Q_INVOKABLE int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
@@ -78,24 +78,24 @@ private Q_SLOTS:
|
||||
void doAddRoom(Quotient::Room *room);
|
||||
void updateRoom(Quotient::Room *room, Quotient::Room *prev);
|
||||
void deleteRoom(Quotient::Room *room);
|
||||
void refresh(SpectralRoom *room, const QVector<int> &roles = {});
|
||||
void refresh(NeoChatRoom *room, const QVector<int> &roles = {});
|
||||
void refreshNotificationCount();
|
||||
|
||||
private:
|
||||
Connection *m_connection = nullptr;
|
||||
QList<SpectralRoom *> m_rooms;
|
||||
QList<NeoChatRoom *> m_rooms;
|
||||
|
||||
QMap<int, bool> m_categoryVisibility;
|
||||
|
||||
int m_notificationCount = 0;
|
||||
|
||||
void connectRoomSignals(SpectralRoom *room);
|
||||
void connectRoomSignals(NeoChatRoom *room);
|
||||
|
||||
Q_SIGNALS:
|
||||
void connectionChanged();
|
||||
void notificationCountChanged();
|
||||
|
||||
void roomAdded(SpectralRoom *room);
|
||||
void roomAdded(NeoChatRoom *room);
|
||||
void newMessage(const QString &roomId, const QString &eventId, const QString &roomName, const QString &senderName, const QString &text, const QImage &icon);
|
||||
void newHighlight(const QString &roomId, const QString &eventId, const QString &roomName, const QString &senderName, const QString &text, const QImage &icon);
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <QElapsedTimer>
|
||||
#include <QPixmap>
|
||||
|
||||
#include "spectraluser.h"
|
||||
#include "neochatuser.h"
|
||||
|
||||
UserListModel::UserListModel(QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
|
||||
Reference in New Issue
Block a user