parent
317a6d6ec8
commit
81a7172f29
|
@ -1,9 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
Name=Matrique
|
|
||||||
GenericName=Matrix Client
|
|
||||||
Comment=IM client for the Matrix protocol
|
|
||||||
Exec=matrique
|
|
||||||
Terminal=false
|
|
||||||
Icon=org.eu.encom.matrique
|
|
||||||
Type=Application
|
|
||||||
Categories=Network;InstantMessaging;
|
|
|
@ -1,27 +1,27 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<component type="desktop">
|
<component type="desktop">
|
||||||
<id>org.eu.encom.matrique</id>
|
<id>org.eu.encom.spectral</id>
|
||||||
<launchable type="desktop-id">org.eu.encom.matrique.desktop</launchable>
|
<launchable type="desktop-id">org.eu.encom.spectral.desktop</launchable>
|
||||||
<metadata_license>GFDL</metadata_license>
|
<metadata_license>GFDL</metadata_license>
|
||||||
<project_license>GPL-3.0</project_license>
|
<project_license>GPL-3.0</project_license>
|
||||||
<name>Matrique</name>
|
<name>Spectral</name>
|
||||||
<summary>IM client for the Matrix protocol</summary>
|
<summary>IM client for the Matrix protocol</summary>
|
||||||
<description>
|
<description>
|
||||||
<p>
|
<p>
|
||||||
Matrique is a glossy cross-platform client for Matrix, the decentralized communication protocol for instant messaging.
|
Spectral is a glossy cross-platform client for Matrix, the decentralized communication protocol for instant messaging.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
The source code is generally available at https://gitlab.com/b0/matrique
|
The source code is generally available at https://gitlab.com/b0/spectral
|
||||||
</p>
|
</p>
|
||||||
</description>
|
</description>
|
||||||
<screenshots>
|
<screenshots>
|
||||||
<screenshot type="default">
|
<screenshot type="default">
|
||||||
<caption>Overview</caption>
|
<caption>Overview</caption>
|
||||||
<image>https://raw.githubusercontent.com/encombhat/flathub/org.eu.encom.matrique/screenshots/overview.png</image>
|
<image>https://raw.githubusercontent.com/encombhat/flathub/org.eu.encom.spectral/screenshots/overview.png</image>
|
||||||
</screenshot>
|
</screenshot>
|
||||||
<screenshot>
|
<screenshot>
|
||||||
<caption>Room Config</caption>
|
<caption>Room Config</caption>
|
||||||
<image>https://raw.githubusercontent.com/encombhat/flathub/org.eu.encom.matrique/screenshots/room_config.png</image>
|
<image>https://raw.githubusercontent.com/encombhat/flathub/org.eu.encom.spectral/screenshots/room_config.png</image>
|
||||||
</screenshot>
|
</screenshot>
|
||||||
</screenshots>
|
</screenshots>
|
||||||
<developer_name>Black Hat</developer_name>
|
<developer_name>Black Hat</developer_name>
|
||||||
|
@ -30,9 +30,9 @@
|
||||||
<category>Internet</category>
|
<category>Internet</category>
|
||||||
<category>Qt</category>
|
<category>Qt</category>
|
||||||
</categories>
|
</categories>
|
||||||
<url type="homepage">https://gitlab.com/b0/matrique</url>
|
<url type="homepage">https://gitlab.com/b0/spectral</url>
|
||||||
<url type="bugtracker">https://gitlab.com/b0/matrique/issues</url>
|
<url type="bugtracker">https://gitlab.com/b0/spectral/issues</url>
|
||||||
<url type="help">https://doc.matrique.encom.eu.org</url>
|
<url type="help">https://doc.spectral.encom.eu.org</url>
|
||||||
<content_rating type="oars-1.0">
|
<content_rating type="oars-1.0">
|
||||||
<content_attribute id="social-chat">intense</content_attribute>
|
<content_attribute id="social-chat">intense</content_attribute>
|
||||||
<content_attribute id="social-audio">intense</content_attribute>
|
<content_attribute id="social-audio">intense</content_attribute>
|
|
@ -4,7 +4,7 @@ import QtGraphicalEffects 1.0
|
||||||
import QtQuick.Controls 2.2
|
import QtQuick.Controls 2.2
|
||||||
import QtQuick.Controls.Material 2.2
|
import QtQuick.Controls.Material 2.2
|
||||||
import Qt.labs.settings 1.0
|
import Qt.labs.settings 1.0
|
||||||
import Matrique.Settings 0.1
|
import Spectral.Settings 0.1
|
||||||
|
|
||||||
import "component"
|
import "component"
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@ import QtQuick 2.9
|
||||||
import QtQuick.Controls 2.2
|
import QtQuick.Controls 2.2
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
import QtQuick.Controls.Material 2.2
|
import QtQuick.Controls.Material 2.2
|
||||||
import Matrique 0.1
|
import Spectral 0.1
|
||||||
import Matrique.Settings 0.1
|
import Spectral.Settings 0.1
|
||||||
|
|
||||||
import "form"
|
import "form"
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ Page {
|
||||||
id: roomListModel
|
id: roomListModel
|
||||||
|
|
||||||
onRoomAdded: room.getPreviousContent(20)
|
onRoomAdded: room.getPreviousContent(20)
|
||||||
onNewMessage: if (!window.active) matriqueController.showMessage(roomName, content, icon)
|
onNewMessage: if (!window.active) spectralController.showMessage(roomName, content, icon)
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
|
@ -2,8 +2,8 @@ import QtQuick 2.9
|
||||||
import QtQuick.Controls 2.2
|
import QtQuick.Controls 2.2
|
||||||
import QtQuick.Controls.Material 2.2
|
import QtQuick.Controls.Material 2.2
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
import Matrique 0.1
|
import Spectral 0.1
|
||||||
import Matrique.Settings 0.1
|
import Spectral.Settings 0.1
|
||||||
|
|
||||||
import "component"
|
import "component"
|
||||||
import "form"
|
import "form"
|
||||||
|
@ -81,7 +81,7 @@ Page {
|
||||||
color: "white"
|
color: "white"
|
||||||
}
|
}
|
||||||
|
|
||||||
SwipeDelegate.onClicked: matriqueController.logout(connection)
|
SwipeDelegate.onClicked: spectralController.logout(connection)
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: expanded = !expanded
|
onClicked: expanded = !expanded
|
||||||
|
@ -116,7 +116,7 @@ Page {
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
onClicked: matriqueController.setColor(connection.localUserId, modelData)
|
onClicked: spectralController.setColor(connection.localUserId, modelData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -246,7 +246,7 @@ Page {
|
||||||
|
|
||||||
source: "qrc:/asset/img/icon.png"
|
source: "qrc:/asset/img/icon.png"
|
||||||
}
|
}
|
||||||
Label { text: "Matrique, an IM client for the Matrix protocol." }
|
Label { text: "Spectral, an IM client for the Matrix protocol." }
|
||||||
Label { text: "Released under GNU General Public License, version 3." }
|
Label { text: "Released under GNU General Public License, version 3." }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import QtQuick 2.9
|
import QtQuick 2.9
|
||||||
import QtQuick.Controls 2.2
|
import QtQuick.Controls 2.2
|
||||||
import QtQuick.Controls.Material 2.2
|
import QtQuick.Controls.Material 2.2
|
||||||
import Matrique.Settings 0.1
|
import Spectral.Settings 0.1
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
property bool coloredBackground
|
property bool coloredBackground
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import QtQuick 2.9
|
import QtQuick 2.9
|
||||||
import Matrique.Settings 0.1
|
import Spectral.Settings 0.1
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
signal primaryClicked()
|
signal primaryClicked()
|
||||||
|
|
|
@ -2,7 +2,7 @@ import QtQuick 2.9
|
||||||
import QtQuick.Controls 2.2
|
import QtQuick.Controls 2.2
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
import QtQuick.Controls.Material 2.2
|
import QtQuick.Controls.Material 2.2
|
||||||
import Matrique 0.1
|
import Spectral 0.1
|
||||||
|
|
||||||
Popup {
|
Popup {
|
||||||
property var textArea
|
property var textArea
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import QtQuick 2.9
|
import QtQuick 2.9
|
||||||
import QtQuick.Controls 2.2
|
import QtQuick.Controls 2.2
|
||||||
import QtQuick.Controls.Material 2.2
|
import QtQuick.Controls.Material 2.2
|
||||||
import Matrique.Settings 0.1
|
import Spectral.Settings 0.1
|
||||||
|
|
||||||
Control {
|
Control {
|
||||||
property bool highlighted: false
|
property bool highlighted: false
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import QtQuick 2.9
|
import QtQuick 2.9
|
||||||
import QtQuick.Controls 2.2
|
import QtQuick.Controls 2.2
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
import Matrique.Settings 0.1
|
import Spectral.Settings 0.1
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
property alias icon: materialLabel.text
|
property alias icon: materialLabel.text
|
||||||
|
|
|
@ -2,8 +2,8 @@ import QtQuick 2.9
|
||||||
import QtQuick.Controls 2.2
|
import QtQuick.Controls 2.2
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
import QtQuick.Controls.Material 2.2
|
import QtQuick.Controls.Material 2.2
|
||||||
import Matrique 0.1
|
import Spectral 0.1
|
||||||
import Matrique.Settings 0.1
|
import Spectral.Settings 0.1
|
||||||
import "qrc:/js/util.js" as Util
|
import "qrc:/js/util.js" as Util
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
@ -206,7 +206,7 @@ RowLayout {
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (downloadable.downloaded)
|
if (downloadable.downloaded)
|
||||||
matriqueController.playAudio(progressInfo.localPath)
|
spectralController.playAudio(progressInfo.localPath)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
playOnFinished = true
|
playOnFinished = true
|
||||||
|
@ -218,7 +218,7 @@ RowLayout {
|
||||||
background: DownloadableContent {
|
background: DownloadableContent {
|
||||||
id: downloadable
|
id: downloadable
|
||||||
|
|
||||||
onDownloadedChanged: downloaded && playOnFinished ? matriqueController.playAudio(progressInfo.localPath) : {}
|
onDownloadedChanged: downloaded && playOnFinished ? spectralController.playAudio(progressInfo.localPath) : {}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
messageRow.saveFileAs.connect(saveFileAs)
|
messageRow.saveFileAs.connect(saveFileAs)
|
||||||
|
|
|
@ -2,7 +2,7 @@ import QtQuick 2.9
|
||||||
import QtQuick.Controls 2.2
|
import QtQuick.Controls 2.2
|
||||||
import QtQuick.Controls.Material 2.2
|
import QtQuick.Controls.Material 2.2
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
import Matrique 0.1
|
import Spectral 0.1
|
||||||
|
|
||||||
import "qrc:/js/util.js" as Util
|
import "qrc:/js/util.js" as Util
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ Drawer {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
|
||||||
hint: room ? room.displayName : "No name"
|
hint: room ? room.displayName : "No name"
|
||||||
image: matriqueController.safeImage(room ? room.avatar : null)
|
image: spectralController.safeImage(room ? room.avatar : null)
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import QtQuick 2.9
|
||||||
import QtQuick.Controls 2.2
|
import QtQuick.Controls 2.2
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
import QtQuick.Controls.Material 2.2
|
import QtQuick.Controls.Material 2.2
|
||||||
import Matrique.Settings 0.1
|
import Spectral.Settings 0.1
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
|
|
@ -3,8 +3,8 @@ import QtQuick.Controls 2.2
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
import QtQuick.Controls.Material 2.2
|
import QtQuick.Controls.Material 2.2
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
import Matrique 0.1
|
import Spectral 0.1
|
||||||
import Matrique.Settings 0.1
|
import Spectral.Settings 0.1
|
||||||
|
|
||||||
import "qrc:/qml/component"
|
import "qrc:/qml/component"
|
||||||
import "qrc:/qml/menu"
|
import "qrc:/qml/menu"
|
||||||
|
@ -63,7 +63,7 @@ Item {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|
||||||
hint: currentRoom ? currentRoom.displayName : "No name"
|
hint: currentRoom ? currentRoom.displayName : "No name"
|
||||||
image: matriqueController.safeImage(currentRoom ? currentRoom.avatar : null)
|
image: spectralController.safeImage(currentRoom ? currentRoom.avatar : null)
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
|
|
@ -4,9 +4,9 @@ import QtQuick.Layouts 1.3
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
import QtQuick.Controls.Material 2.2
|
import QtQuick.Controls.Material 2.2
|
||||||
import QtQml.Models 2.3
|
import QtQml.Models 2.3
|
||||||
import Matrique 0.1
|
import Spectral 0.1
|
||||||
import SortFilterProxyModel 0.2
|
import SortFilterProxyModel 0.2
|
||||||
import Matrique.Settings 0.1
|
import Spectral.Settings 0.1
|
||||||
|
|
||||||
import "qrc:/qml/component"
|
import "qrc:/qml/component"
|
||||||
import "qrc:/qml/menu"
|
import "qrc:/qml/menu"
|
||||||
|
|
26
qml/main.qml
26
qml/main.qml
|
@ -4,8 +4,8 @@ import QtQuick.Layouts 1.3
|
||||||
import QtQuick.Controls.Material 2.2
|
import QtQuick.Controls.Material 2.2
|
||||||
import Qt.labs.settings 1.0
|
import Qt.labs.settings 1.0
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
import Matrique 0.1
|
import Spectral 0.1
|
||||||
import Matrique.Settings 0.1
|
import Spectral.Settings 0.1
|
||||||
|
|
||||||
import "component"
|
import "component"
|
||||||
import "form"
|
import "form"
|
||||||
|
@ -22,16 +22,16 @@ ApplicationWindow {
|
||||||
id: window
|
id: window
|
||||||
|
|
||||||
visible: true
|
visible: true
|
||||||
title: qsTr("Matrique")
|
title: qsTr("Spectral")
|
||||||
|
|
||||||
Material.theme: MSettings.darkTheme ? Material.Dark : Material.Light
|
Material.theme: MSettings.darkTheme ? Material.Dark : Material.Light
|
||||||
|
|
||||||
Material.accent: matriqueController.color(currentConnection ? currentConnection.localUserId : "")
|
Material.accent: spectralController.color(currentConnection ? currentConnection.localUserId : "")
|
||||||
|
|
||||||
FontLoader { id: materialFont; source: "qrc:/asset/font/material.ttf" }
|
FontLoader { id: materialFont; source: "qrc:/asset/font/material.ttf" }
|
||||||
|
|
||||||
Controller {
|
Controller {
|
||||||
id: matriqueController
|
id: spectralController
|
||||||
|
|
||||||
onShowWindow: {
|
onShowWindow: {
|
||||||
window.show()
|
window.show()
|
||||||
|
@ -43,11 +43,11 @@ ApplicationWindow {
|
||||||
|
|
||||||
AccountListModel {
|
AccountListModel {
|
||||||
id: accountListModel
|
id: accountListModel
|
||||||
controller: matriqueController
|
controller: spectralController
|
||||||
}
|
}
|
||||||
|
|
||||||
Popup {
|
Popup {
|
||||||
property bool busy: matriqueController.busy
|
property bool busy: spectralController.busy
|
||||||
|
|
||||||
x: (window.width - width) / 2
|
x: (window.width - width) / 2
|
||||||
y: (window.height - height) / 2
|
y: (window.height - height) / 2
|
||||||
|
@ -67,7 +67,7 @@ ApplicationWindow {
|
||||||
Component {
|
Component {
|
||||||
id: loginPage
|
id: loginPage
|
||||||
|
|
||||||
Login { controller: matriqueController }
|
Login { controller: spectralController }
|
||||||
}
|
}
|
||||||
|
|
||||||
Room {
|
Room {
|
||||||
|
@ -130,7 +130,7 @@ ApplicationWindow {
|
||||||
image: user.avatar
|
image: user.avatar
|
||||||
}
|
}
|
||||||
|
|
||||||
highlightColor: matriqueController.color(user.id)
|
highlightColor: spectralController.color(user.id)
|
||||||
|
|
||||||
page: roomPage
|
page: roomPage
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onAccepted: matriqueController.createRoom(currentConnection, addRoomDialogNameTextField.text, addRoomDialogTopicTextField.text)
|
onAccepted: spectralController.createRoom(currentConnection, addRoomDialogNameTextField.text, addRoomDialogTopicTextField.text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
|
@ -213,7 +213,7 @@ ApplicationWindow {
|
||||||
placeholderText: "#matrix:matrix.org"
|
placeholderText: "#matrix:matrix.org"
|
||||||
}
|
}
|
||||||
|
|
||||||
onAccepted: matriqueController.joinRoom(currentConnection, joinRoomDialogTextField.text)
|
onAccepted: spectralController.joinRoom(currentConnection, joinRoomDialogTextField.text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,8 +292,8 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
matriqueController.initiated.connect(function() {
|
spectralController.initiated.connect(function() {
|
||||||
if (matriqueController.accountCount == 0) stackView.push(loginPage)
|
if (spectralController.accountCount == 0) stackView.push(loginPage)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import QtQuick 2.9
|
import QtQuick 2.9
|
||||||
import QtQuick.Controls 2.2
|
import QtQuick.Controls 2.2
|
||||||
import Matrique 0.1
|
import Spectral 0.1
|
||||||
|
|
||||||
Menu {
|
Menu {
|
||||||
property var model: null
|
property var model: null
|
||||||
|
|
2
res.qrc
2
res.qrc
|
@ -22,7 +22,7 @@
|
||||||
<file>asset/img/icon.ico</file>
|
<file>asset/img/icon.ico</file>
|
||||||
<file>asset/img/icon.icns</file>
|
<file>asset/img/icon.icns</file>
|
||||||
<file>qml/component/AutoMouseArea.qml</file>
|
<file>qml/component/AutoMouseArea.qml</file>
|
||||||
<file>qml/MatriqueSettings.qml</file>
|
<file>qml/SpectralSettings.qml</file>
|
||||||
<file>qml/menu/MessageContextMenu.qml</file>
|
<file>qml/menu/MessageContextMenu.qml</file>
|
||||||
<file>qml/menu/RoomContextMenu.qml</file>
|
<file>qml/menu/RoomContextMenu.qml</file>
|
||||||
<file>qml/component/GenericBubble.qml</file>
|
<file>qml/component/GenericBubble.qml</file>
|
||||||
|
|
|
@ -5,7 +5,7 @@ CONFIG += object_parallel_to_source
|
||||||
# Enable this to use QtQuick Compiler.
|
# Enable this to use QtQuick Compiler.
|
||||||
#CONFIG += qtquickcompiler
|
#CONFIG += qtquickcompiler
|
||||||
|
|
||||||
TARGET = matrique
|
TARGET = spectral
|
||||||
|
|
||||||
packagesExist(QMatrixClient) {
|
packagesExist(QMatrixClient) {
|
||||||
message("Found libQMatrixClient via pkg-config.")
|
message("Found libQMatrixClient via pkg-config.")
|
||||||
|
@ -33,11 +33,11 @@ SOURCES += src/main.cpp \
|
||||||
src/imageprovider.cpp \
|
src/imageprovider.cpp \
|
||||||
src/messageeventmodel.cpp \
|
src/messageeventmodel.cpp \
|
||||||
src/emojimodel.cpp \
|
src/emojimodel.cpp \
|
||||||
src/matriqueroom.cpp \
|
src/spectralroom.cpp \
|
||||||
src/userlistmodel.cpp \
|
src/userlistmodel.cpp \
|
||||||
src/imageitem.cpp \
|
src/imageitem.cpp \
|
||||||
src/accountlistmodel.cpp \
|
src/accountlistmodel.cpp \
|
||||||
src/matriqueuser.cpp
|
src/spectraluser.cpp
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
res.qrc
|
res.qrc
|
||||||
|
@ -58,9 +58,9 @@ win32:target.path = $$PREFIX
|
||||||
!isEmpty(target.path): INSTALLS += target
|
!isEmpty(target.path): INSTALLS += target
|
||||||
|
|
||||||
unix:!mac {
|
unix:!mac {
|
||||||
metainfo.files = $$PWD/org.eu.encom.matrique.appdata.xml
|
metainfo.files = $$PWD/org.eu.encom.spectral.appdata.xml
|
||||||
metainfo.path = $$PREFIX/share/metainfo
|
metainfo.path = $$PREFIX/share/metainfo
|
||||||
desktop.files = $$PWD/org.eu.encom.matrique.desktop
|
desktop.files = $$PWD/org.eu.encom.spectral.desktop
|
||||||
desktop.path = $$PREFIX/share/applications
|
desktop.path = $$PREFIX/share/applications
|
||||||
icons.files = $$PWD/icons/hicolor/*
|
icons.files = $$PWD/icons/hicolor/*
|
||||||
icons.path = $$PREFIX/share/icons/hicolor
|
icons.path = $$PREFIX/share/icons/hicolor
|
||||||
|
@ -95,8 +95,8 @@ HEADERS += \
|
||||||
src/imageprovider.h \
|
src/imageprovider.h \
|
||||||
src/messageeventmodel.h \
|
src/messageeventmodel.h \
|
||||||
src/emojimodel.h \
|
src/emojimodel.h \
|
||||||
src/matriqueroom.h \
|
src/spectralroom.h \
|
||||||
src/userlistmodel.h \
|
src/userlistmodel.h \
|
||||||
src/imageitem.h \
|
src/imageitem.h \
|
||||||
src/accountlistmodel.h \
|
src/accountlistmodel.h \
|
||||||
src/matriqueuser.h
|
src/spectraluser.h
|
|
@ -1,7 +1,7 @@
|
||||||
#include "controller.h"
|
#include "controller.h"
|
||||||
|
|
||||||
#include "matriqueroom.h"
|
#include "spectralroom.h"
|
||||||
#include "matriqueuser.h"
|
#include "spectraluser.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
#include "events/eventcontent.h"
|
#include "events/eventcontent.h"
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
Controller::Controller(QObject* parent) : QObject(parent) {
|
Controller::Controller(QObject* parent) : QObject(parent) {
|
||||||
tray->setIcon(QIcon(":/asset/img/icon.png"));
|
tray->setIcon(QIcon(":/asset/img/icon.png"));
|
||||||
tray->setToolTip("Matrique");
|
tray->setToolTip("Spectral");
|
||||||
connect(tray, &QSystemTrayIcon::activated,
|
connect(tray, &QSystemTrayIcon::activated,
|
||||||
[this](QSystemTrayIcon::ActivationReason r) {
|
[this](QSystemTrayIcon::ActivationReason r) {
|
||||||
if (r != QSystemTrayIcon::Context) emit showWindow();
|
if (r != QSystemTrayIcon::Context) emit showWindow();
|
||||||
|
@ -39,8 +39,8 @@ Controller::Controller(QObject* parent) : QObject(parent) {
|
||||||
tray->setContextMenu(trayMenu);
|
tray->setContextMenu(trayMenu);
|
||||||
tray->show();
|
tray->show();
|
||||||
|
|
||||||
Connection::setRoomType<MatriqueRoom>();
|
Connection::setRoomType<SpectralRoom>();
|
||||||
Connection::setUserType<MatriqueUser>();
|
Connection::setUserType<SpectralUser>();
|
||||||
|
|
||||||
QTimer::singleShot(0, this, SLOT(invokeLogin()));
|
QTimer::singleShot(0, this, SLOT(invokeLogin()));
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ void Controller::loginWithCredentials(QString serverAddr, QString user,
|
||||||
account.clearAccessToken(); // Drop the legacy - just in case
|
account.clearAccessToken(); // Drop the legacy - just in case
|
||||||
account.setHomeserver(m_connection->homeserver());
|
account.setHomeserver(m_connection->homeserver());
|
||||||
account.setDeviceId(m_connection->deviceId());
|
account.setDeviceId(m_connection->deviceId());
|
||||||
account.setDeviceName("Matrique");
|
account.setDeviceName("Spectral");
|
||||||
if (!saveAccessToken(account, m_connection->accessToken()))
|
if (!saveAccessToken(account, m_connection->accessToken()))
|
||||||
qWarning() << "Couldn't save access token";
|
qWarning() << "Couldn't save access token";
|
||||||
account.sync();
|
account.sync();
|
||||||
|
|
30
src/main.cpp
30
src/main.cpp
|
@ -8,7 +8,7 @@
|
||||||
#include "emojimodel.h"
|
#include "emojimodel.h"
|
||||||
#include "imageitem.h"
|
#include "imageitem.h"
|
||||||
#include "imageprovider.h"
|
#include "imageprovider.h"
|
||||||
#include "matriqueroom.h"
|
#include "spectralroom.h"
|
||||||
#include "messageeventmodel.h"
|
#include "messageeventmodel.h"
|
||||||
#include "room.h"
|
#include "room.h"
|
||||||
#include "roomlistmodel.h"
|
#include "roomlistmodel.h"
|
||||||
|
@ -28,27 +28,27 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
app.setOrganizationName("ENCOM");
|
app.setOrganizationName("ENCOM");
|
||||||
app.setOrganizationDomain("encom.eu.org");
|
app.setOrganizationDomain("encom.eu.org");
|
||||||
app.setApplicationName("Matrique");
|
app.setApplicationName("Spectral");
|
||||||
|
|
||||||
app.setQuitOnLastWindowClosed(false);
|
app.setQuitOnLastWindowClosed(false);
|
||||||
|
|
||||||
qRegisterMetaType<MatriqueRoom *>("MatriqueRoom*");
|
qRegisterMetaType<SpectralRoom *>("SpectralRoom*");
|
||||||
qRegisterMetaType<User *>("User*");
|
qRegisterMetaType<User *>("User*");
|
||||||
qRegisterMetaType<MessageEventType>("MessageEventType");
|
qRegisterMetaType<MessageEventType>("MessageEventType");
|
||||||
qRegisterMetaType<MatriqueRoom *>("MatriqueRoom");
|
qRegisterMetaType<SpectralRoom *>("SpectralRoom");
|
||||||
|
|
||||||
qmlRegisterType<ImageItem>("Matrique", 0, 1, "ImageItem");
|
qmlRegisterType<ImageItem>("Spectral", 0, 1, "ImageItem");
|
||||||
qmlRegisterType<Controller>("Matrique", 0, 1, "Controller");
|
qmlRegisterType<Controller>("Spectral", 0, 1, "Controller");
|
||||||
qmlRegisterType<AccountListModel>("Matrique", 0, 1, "AccountListModel");
|
qmlRegisterType<AccountListModel>("Spectral", 0, 1, "AccountListModel");
|
||||||
qmlRegisterType<RoomListModel>("Matrique", 0, 1, "RoomListModel");
|
qmlRegisterType<RoomListModel>("Spectral", 0, 1, "RoomListModel");
|
||||||
qmlRegisterType<UserListModel>("Matrique", 0, 1, "UserListModel");
|
qmlRegisterType<UserListModel>("Spectral", 0, 1, "UserListModel");
|
||||||
qmlRegisterType<MessageEventModel>("Matrique", 0, 1, "MessageEventModel");
|
qmlRegisterType<MessageEventModel>("Spectral", 0, 1, "MessageEventModel");
|
||||||
qmlRegisterType<EmojiModel>("Matrique", 0, 1, "EmojiModel");
|
qmlRegisterType<EmojiModel>("Spectral", 0, 1, "EmojiModel");
|
||||||
qmlRegisterUncreatableType<RoomMessageEvent>("Matrique", 0, 1,
|
qmlRegisterUncreatableType<RoomMessageEvent>("Spectral", 0, 1,
|
||||||
"RoomMessageEvent", "ENUM");
|
"RoomMessageEvent", "ENUM");
|
||||||
qmlRegisterUncreatableType<RoomType>("Matrique", 0, 1, "RoomType", "ENUM");
|
qmlRegisterUncreatableType<RoomType>("Spectral", 0, 1, "RoomType", "ENUM");
|
||||||
qmlRegisterSingletonType(QUrl("qrc:/qml/MatriqueSettings.qml"),
|
qmlRegisterSingletonType(QUrl("qrc:/qml/SpectralSettings.qml"),
|
||||||
"Matrique.Settings", 0, 1, "MSettings");
|
"Spectral.Settings", 0, 1, "MSettings");
|
||||||
|
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
#include "matriqueuser.h"
|
|
||||||
|
|
||||||
MatriqueUser::MatriqueUser(QString userId, Connection* connection)
|
|
||||||
: User(userId, connection) {
|
|
||||||
connect(this, &User::avatarChanged, this, &MatriqueUser::inheritedAvatarChanged);
|
|
||||||
}
|
|
|
@ -42,12 +42,12 @@ MessageEventModel::MessageEventModel(QObject* parent)
|
||||||
qmlRegisterType<FileTransferInfo>();
|
qmlRegisterType<FileTransferInfo>();
|
||||||
qRegisterMetaType<FileTransferInfo>();
|
qRegisterMetaType<FileTransferInfo>();
|
||||||
qmlRegisterUncreatableType<EventStatus>(
|
qmlRegisterUncreatableType<EventStatus>(
|
||||||
"Matrique", 0, 1, "EventStatus", "EventStatus is not an creatable type");
|
"Spectral", 0, 1, "EventStatus", "EventStatus is not an creatable type");
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageEventModel::~MessageEventModel() {}
|
MessageEventModel::~MessageEventModel() {}
|
||||||
|
|
||||||
void MessageEventModel::setRoom(MatriqueRoom* room) {
|
void MessageEventModel::setRoom(SpectralRoom* room) {
|
||||||
if (room == m_currentRoom) return;
|
if (room == m_currentRoom) return;
|
||||||
|
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
#ifndef MESSAGEEVENTMODEL_H
|
#ifndef MESSAGEEVENTMODEL_H
|
||||||
#define MESSAGEEVENTMODEL_H
|
#define MESSAGEEVENTMODEL_H
|
||||||
|
|
||||||
#include "matriqueroom.h"
|
#include "spectralroom.h"
|
||||||
#include "room.h"
|
#include "room.h"
|
||||||
|
|
||||||
#include <QtCore/QAbstractListModel>
|
#include <QtCore/QAbstractListModel>
|
||||||
|
|
||||||
class MessageEventModel : public QAbstractListModel {
|
class MessageEventModel : public QAbstractListModel {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(MatriqueRoom* room READ getRoom WRITE setRoom NOTIFY roomChanged)
|
Q_PROPERTY(SpectralRoom* room READ getRoom WRITE setRoom NOTIFY roomChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum EventRoles {
|
enum EventRoles {
|
||||||
|
@ -37,8 +37,8 @@ class MessageEventModel : public QAbstractListModel {
|
||||||
explicit MessageEventModel(QObject* parent = nullptr);
|
explicit MessageEventModel(QObject* parent = nullptr);
|
||||||
~MessageEventModel();
|
~MessageEventModel();
|
||||||
|
|
||||||
MatriqueRoom* getRoom() { return m_currentRoom; }
|
SpectralRoom* getRoom() { return m_currentRoom; }
|
||||||
void setRoom(MatriqueRoom* room);
|
void setRoom(SpectralRoom* room);
|
||||||
|
|
||||||
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||||
QVariant data(const QModelIndex& index,
|
QVariant data(const QModelIndex& index,
|
||||||
|
@ -50,7 +50,7 @@ class MessageEventModel : public QAbstractListModel {
|
||||||
void refreshRow(int row);
|
void refreshRow(int row);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MatriqueRoom* m_currentRoom = nullptr;
|
SpectralRoom* m_currentRoom = nullptr;
|
||||||
QString lastReadEventId;
|
QString lastReadEventId;
|
||||||
int rowBelowInserted = -1;
|
int rowBelowInserted = -1;
|
||||||
bool movingEvent = 0;
|
bool movingEvent = 0;
|
||||||
|
|
|
@ -27,7 +27,7 @@ void RoomListModel::setConnection(Connection* connection) {
|
||||||
|
|
||||||
m_connection = connection;
|
m_connection = connection;
|
||||||
|
|
||||||
for (MatriqueRoom* room : m_rooms) room->disconnect(this);
|
for (SpectralRoom* room : m_rooms) room->disconnect(this);
|
||||||
|
|
||||||
connect(connection, &Connection::connected, this,
|
connect(connection, &Connection::connected, this,
|
||||||
&RoomListModel::doResetModel);
|
&RoomListModel::doResetModel);
|
||||||
|
@ -49,10 +49,10 @@ void RoomListModel::doResetModel() {
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
MatriqueRoom* RoomListModel::roomAt(int row) { return m_rooms.at(row); }
|
SpectralRoom* RoomListModel::roomAt(int row) { return m_rooms.at(row); }
|
||||||
|
|
||||||
void RoomListModel::doAddRoom(Room* r) {
|
void RoomListModel::doAddRoom(Room* r) {
|
||||||
if (auto* room = static_cast<MatriqueRoom*>(r)) {
|
if (auto* room = static_cast<SpectralRoom*>(r)) {
|
||||||
m_rooms.append(room);
|
m_rooms.append(room);
|
||||||
connectRoomSignals(room);
|
connectRoomSignals(room);
|
||||||
emit roomAdded(room);
|
emit roomAdded(room);
|
||||||
|
@ -62,7 +62,7 @@ void RoomListModel::doAddRoom(Room* r) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RoomListModel::connectRoomSignals(MatriqueRoom* room) {
|
void RoomListModel::connectRoomSignals(SpectralRoom* room) {
|
||||||
connect(room, &Room::displaynameChanged, this, [=] { namesChanged(room); });
|
connect(room, &Room::displaynameChanged, this, [=] { namesChanged(room); });
|
||||||
connect(room, &Room::unreadMessagesChanged, this,
|
connect(room, &Room::unreadMessagesChanged, this,
|
||||||
[=] { unreadMessagesChanged(room); });
|
[=] { unreadMessagesChanged(room); });
|
||||||
|
@ -94,7 +94,7 @@ void RoomListModel::updateRoom(Room* room, Room* prev) {
|
||||||
// the previously left room (in both cases prev has the previous state).
|
// the previously left room (in both cases prev has the previous state).
|
||||||
if (prev == room) {
|
if (prev == room) {
|
||||||
qCritical() << "RoomListModel::updateRoom: room tried to replace itself";
|
qCritical() << "RoomListModel::updateRoom: room tried to replace itself";
|
||||||
refresh(static_cast<MatriqueRoom*>(room));
|
refresh(static_cast<SpectralRoom*>(room));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (prev && room->id() != prev->id()) {
|
if (prev && room->id() != prev->id()) {
|
||||||
|
@ -103,10 +103,10 @@ void RoomListModel::updateRoom(Room* room, Room* prev) {
|
||||||
// That doesn't look right but technically we still can do it.
|
// That doesn't look right but technically we still can do it.
|
||||||
}
|
}
|
||||||
// Ok, we're through with pre-checks, now for the real thing.
|
// Ok, we're through with pre-checks, now for the real thing.
|
||||||
auto* newRoom = static_cast<MatriqueRoom*>(room);
|
auto* newRoom = static_cast<SpectralRoom*>(room);
|
||||||
const auto it = std::find_if(
|
const auto it = std::find_if(
|
||||||
m_rooms.begin(), m_rooms.end(),
|
m_rooms.begin(), m_rooms.end(),
|
||||||
[=](const MatriqueRoom* r) { return r == prev || r == newRoom; });
|
[=](const SpectralRoom* r) { return r == prev || r == newRoom; });
|
||||||
if (it != m_rooms.end()) {
|
if (it != m_rooms.end()) {
|
||||||
const int row = it - m_rooms.begin();
|
const int row = it - m_rooms.begin();
|
||||||
// There's no guarantee that prev != newRoom
|
// There's no guarantee that prev != newRoom
|
||||||
|
@ -146,7 +146,7 @@ QVariant RoomListModel::data(const QModelIndex& index, int role) const {
|
||||||
qDebug() << "UserListModel: something wrong here...";
|
qDebug() << "UserListModel: something wrong here...";
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
MatriqueRoom* room = m_rooms.at(index.row());
|
SpectralRoom* room = m_rooms.at(index.row());
|
||||||
if (role == NameRole) return room->displayName();
|
if (role == NameRole) return room->displayName();
|
||||||
if (role == AvatarRole) {
|
if (role == AvatarRole) {
|
||||||
if (!room->avatarUrl().isEmpty()) return room->avatar(64, 64);
|
if (!room->avatarUrl().isEmpty()) return room->avatar(64, 64);
|
||||||
|
@ -167,12 +167,12 @@ QVariant RoomListModel::data(const QModelIndex& index, int role) const {
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RoomListModel::namesChanged(MatriqueRoom* room) {
|
void RoomListModel::namesChanged(SpectralRoom* room) {
|
||||||
int row = m_rooms.indexOf(room);
|
int row = m_rooms.indexOf(room);
|
||||||
emit dataChanged(index(row), index(row));
|
emit dataChanged(index(row), index(row));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RoomListModel::refresh(MatriqueRoom* room, const QVector<int>& roles) {
|
void RoomListModel::refresh(SpectralRoom* room, const QVector<int>& roles) {
|
||||||
const auto it = std::find(m_rooms.begin(), m_rooms.end(), room);
|
const auto it = std::find(m_rooms.begin(), m_rooms.end(), room);
|
||||||
if (it == m_rooms.end()) {
|
if (it == m_rooms.end()) {
|
||||||
qCritical() << "Room" << room->id() << "not found in the room list";
|
qCritical() << "Room" << room->id() << "not found in the room list";
|
||||||
|
@ -182,7 +182,7 @@ void RoomListModel::refresh(MatriqueRoom* room, const QVector<int>& roles) {
|
||||||
emit dataChanged(idx, idx, roles);
|
emit dataChanged(idx, idx, roles);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RoomListModel::unreadMessagesChanged(MatriqueRoom* room) {
|
void RoomListModel::unreadMessagesChanged(SpectralRoom* room) {
|
||||||
int row = m_rooms.indexOf(room);
|
int row = m_rooms.indexOf(room);
|
||||||
emit dataChanged(index(row), index(row));
|
emit dataChanged(index(row), index(row));
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "connection.h"
|
#include "connection.h"
|
||||||
#include "events/roomevent.h"
|
#include "events/roomevent.h"
|
||||||
#include "matriqueroom.h"
|
#include "spectralroom.h"
|
||||||
#include "room.h"
|
#include "room.h"
|
||||||
|
|
||||||
#include <QtCore/QAbstractListModel>
|
#include <QtCore/QAbstractListModel>
|
||||||
|
@ -47,7 +47,7 @@ class RoomListModel : public QAbstractListModel {
|
||||||
void setConnection(Connection* connection);
|
void setConnection(Connection* connection);
|
||||||
void doResetModel();
|
void doResetModel();
|
||||||
|
|
||||||
Q_INVOKABLE MatriqueRoom* roomAt(int row);
|
Q_INVOKABLE SpectralRoom* roomAt(int row);
|
||||||
|
|
||||||
QVariant data(const QModelIndex& index,
|
QVariant data(const QModelIndex& index,
|
||||||
int role = Qt::DisplayRole) const override;
|
int role = Qt::DisplayRole) const override;
|
||||||
|
@ -57,22 +57,22 @@ class RoomListModel : public QAbstractListModel {
|
||||||
QHash<int, QByteArray> roleNames() const;
|
QHash<int, QByteArray> roleNames() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void namesChanged(MatriqueRoom* room);
|
void namesChanged(SpectralRoom* room);
|
||||||
void unreadMessagesChanged(MatriqueRoom* room);
|
void unreadMessagesChanged(SpectralRoom* room);
|
||||||
|
|
||||||
void doAddRoom(Room* room);
|
void doAddRoom(Room* room);
|
||||||
void updateRoom(Room* room, Room* prev);
|
void updateRoom(Room* room, Room* prev);
|
||||||
void deleteRoom(Room* room);
|
void deleteRoom(Room* room);
|
||||||
void refresh(MatriqueRoom* room, const QVector<int>& roles = {});
|
void refresh(SpectralRoom* room, const QVector<int>& roles = {});
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Connection* m_connection = nullptr;
|
Connection* m_connection = nullptr;
|
||||||
QList<MatriqueRoom*> m_rooms;
|
QList<SpectralRoom*> m_rooms;
|
||||||
void connectRoomSignals(MatriqueRoom* room);
|
void connectRoomSignals(SpectralRoom* room);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void connectionChanged();
|
void connectionChanged();
|
||||||
void roomAdded(MatriqueRoom* room);
|
void roomAdded(SpectralRoom* room);
|
||||||
void newMessage(const QString& roomName, const QString& content,
|
void newMessage(const QString& roomName, const QString& content,
|
||||||
const QIcon& icon);
|
const QIcon& icon);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "matriqueroom.h"
|
#include "spectralroom.h"
|
||||||
|
|
||||||
#include "connection.h"
|
#include "connection.h"
|
||||||
#include "user.h"
|
#include "user.h"
|
||||||
|
@ -10,16 +10,16 @@
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMimeDatabase>
|
#include <QMimeDatabase>
|
||||||
|
|
||||||
MatriqueRoom::MatriqueRoom(Connection* connection, QString roomId,
|
SpectralRoom::SpectralRoom(Connection* connection, QString roomId,
|
||||||
JoinState joinState)
|
JoinState joinState)
|
||||||
: Room(connection, std::move(roomId), joinState) {
|
: Room(connection, std::move(roomId), joinState) {
|
||||||
connect(this, &MatriqueRoom::notificationCountChanged, this,
|
connect(this, &SpectralRoom::notificationCountChanged, this,
|
||||||
&MatriqueRoom::countChanged);
|
&SpectralRoom::countChanged);
|
||||||
connect(this, &MatriqueRoom::highlightCountChanged, this,
|
connect(this, &SpectralRoom::highlightCountChanged, this,
|
||||||
&MatriqueRoom::countChanged);
|
&SpectralRoom::countChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatriqueRoom::chooseAndUploadFile() {
|
void SpectralRoom::chooseAndUploadFile() {
|
||||||
auto localFile = QFileDialog::getOpenFileUrl(Q_NULLPTR, tr("Save File as"));
|
auto localFile = QFileDialog::getOpenFileUrl(Q_NULLPTR, tr("Save File as"));
|
||||||
if (!localFile.isEmpty()) {
|
if (!localFile.isEmpty()) {
|
||||||
uploadFile(localFile.toString(), localFile, getMIME(localFile));
|
uploadFile(localFile.toString(), localFile, getMIME(localFile));
|
||||||
|
@ -32,7 +32,7 @@ void MatriqueRoom::chooseAndUploadFile() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatriqueRoom::postFile(const QUrl& localFile, const QUrl& mxcUrl) {
|
void SpectralRoom::postFile(const QUrl& localFile, const QUrl& mxcUrl) {
|
||||||
const QString mime = getMIME(localFile);
|
const QString mime = getMIME(localFile);
|
||||||
const QString fileName = localFile.fileName();
|
const QString fileName = localFile.fileName();
|
||||||
QString msgType = "m.file";
|
QString msgType = "m.file";
|
||||||
|
@ -46,21 +46,21 @@ void MatriqueRoom::postFile(const QUrl& localFile, const QUrl& mxcUrl) {
|
||||||
postJson("m.room.message", json);
|
postJson("m.room.message", json);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MatriqueRoom::getMIME(const QUrl& fileUrl) const {
|
QString SpectralRoom::getMIME(const QUrl& fileUrl) const {
|
||||||
return QMimeDatabase().mimeTypeForFile(fileUrl.toLocalFile()).name();
|
return QMimeDatabase().mimeTypeForFile(fileUrl.toLocalFile()).name();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatriqueRoom::saveFileAs(QString eventId) {
|
void SpectralRoom::saveFileAs(QString eventId) {
|
||||||
auto fileName = QFileDialog::getSaveFileName(Q_NULLPTR, tr("Save File as"),
|
auto fileName = QFileDialog::getSaveFileName(Q_NULLPTR, tr("Save File as"),
|
||||||
fileNameToDownload(eventId));
|
fileNameToDownload(eventId));
|
||||||
if (!fileName.isEmpty()) downloadFile(eventId, QUrl::fromLocalFile(fileName));
|
if (!fileName.isEmpty()) downloadFile(eventId, QUrl::fromLocalFile(fileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatriqueRoom::acceptInvitation() { connection()->joinRoom(id()); }
|
void SpectralRoom::acceptInvitation() { connection()->joinRoom(id()); }
|
||||||
|
|
||||||
void MatriqueRoom::forget() { connection()->forgetRoom(id()); }
|
void SpectralRoom::forget() { connection()->forgetRoom(id()); }
|
||||||
|
|
||||||
bool MatriqueRoom::hasUsersTyping() {
|
bool SpectralRoom::hasUsersTyping() {
|
||||||
QList<User*> users = usersTyping();
|
QList<User*> users = usersTyping();
|
||||||
if (users.isEmpty()) return false;
|
if (users.isEmpty()) return false;
|
||||||
int count = users.length();
|
int count = users.length();
|
||||||
|
@ -68,7 +68,7 @@ bool MatriqueRoom::hasUsersTyping() {
|
||||||
return count != 0;
|
return count != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MatriqueRoom::getUsersTyping() {
|
QString SpectralRoom::getUsersTyping() {
|
||||||
QString usersTypingStr;
|
QString usersTypingStr;
|
||||||
QList<User*> users = usersTyping();
|
QList<User*> users = usersTyping();
|
||||||
users.removeOne(localUser());
|
users.removeOne(localUser());
|
||||||
|
@ -80,12 +80,12 @@ QString MatriqueRoom::getUsersTyping() {
|
||||||
return usersTypingStr;
|
return usersTypingStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatriqueRoom::sendTypingNotification(bool isTyping) {
|
void SpectralRoom::sendTypingNotification(bool isTyping) {
|
||||||
connection()->callApi<SetTypingJob>(BackgroundRequest, localUser()->id(),
|
connection()->callApi<SetTypingJob>(BackgroundRequest, localUser()->id(),
|
||||||
id(), isTyping, 10000);
|
id(), isTyping, 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MatriqueRoom::lastEvent() {
|
QString SpectralRoom::lastEvent() {
|
||||||
if (timelineSize() == 0) return "";
|
if (timelineSize() == 0) return "";
|
||||||
const RoomEvent* lastEvent = messageEvents().rbegin()->get();
|
const RoomEvent* lastEvent = messageEvents().rbegin()->get();
|
||||||
if (lastEvent->contentJson().value("body").toString() == "") return "";
|
if (lastEvent->contentJson().value("body").toString() == "") return "";
|
||||||
|
@ -93,11 +93,11 @@ QString MatriqueRoom::lastEvent() {
|
||||||
lastEvent->contentJson().value("body").toString();
|
lastEvent->contentJson().value("body").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MatriqueRoom::isEventHighlighted(const RoomEvent* e) const {
|
bool SpectralRoom::isEventHighlighted(const RoomEvent* e) const {
|
||||||
return highlights.contains(e);
|
return highlights.contains(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatriqueRoom::checkForHighlights(const QMatrixClient::TimelineItem& ti) {
|
void SpectralRoom::checkForHighlights(const QMatrixClient::TimelineItem& ti) {
|
||||||
auto localUserId = localUser()->id();
|
auto localUserId = localUser()->id();
|
||||||
if (ti->senderId() == localUserId) return;
|
if (ti->senderId() == localUserId) return;
|
||||||
if (auto* e = ti.viewAs<RoomMessageEvent>()) {
|
if (auto* e = ti.viewAs<RoomMessageEvent>()) {
|
||||||
|
@ -108,30 +108,31 @@ void MatriqueRoom::checkForHighlights(const QMatrixClient::TimelineItem& ti) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatriqueRoom::onAddNewTimelineEvents(timeline_iter_t from) {
|
void SpectralRoom::onAddNewTimelineEvents(timeline_iter_t from) {
|
||||||
std::for_each(from, messageEvents().cend(),
|
std::for_each(from, messageEvents().cend(),
|
||||||
[this](const TimelineItem& ti) { checkForHighlights(ti); });
|
[this](const TimelineItem& ti) { checkForHighlights(ti); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatriqueRoom::onAddHistoricalTimelineEvents(rev_iter_t from) {
|
void SpectralRoom::onAddHistoricalTimelineEvents(rev_iter_t from) {
|
||||||
std::for_each(from, messageEvents().crend(),
|
std::for_each(from, messageEvents().crend(),
|
||||||
[this](const TimelineItem& ti) { checkForHighlights(ti); });
|
[this](const TimelineItem& ti) { checkForHighlights(ti); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatriqueRoom::countChanged() {
|
void SpectralRoom::countChanged() {
|
||||||
if (displayed() && !hasUnreadMessages()) {
|
if (displayed() && !hasUnreadMessages()) {
|
||||||
resetNotificationCount();
|
resetNotificationCount();
|
||||||
resetHighlightCount();
|
resetHighlightCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatriqueRoom::sendReply(QString userId, QString eventId,
|
void SpectralRoom::sendReply(QString userId, QString eventId,
|
||||||
QString replyContent, QString sendContent) {
|
QString replyContent, QString sendContent) {
|
||||||
QJsonObject json{
|
QJsonObject json{
|
||||||
{"msgtype", "m.text"},
|
{"msgtype", "m.text"},
|
||||||
{"body", "> <" + userId + "> " + replyContent + "\n\n" + sendContent},
|
{"body", "> <" + userId + "> " + replyContent + "\n\n" + sendContent},
|
||||||
{"format", "org.matrix.custom.html"},
|
{"format", "org.matrix.custom.html"},
|
||||||
{"m.relates_to", QJsonObject{{"m.in_reply_to", QJsonObject{{"event_id", eventId}}}}},
|
{"m.relates_to",
|
||||||
|
QJsonObject{{"m.in_reply_to", QJsonObject{{"event_id", eventId}}}}},
|
||||||
{"formatted_body",
|
{"formatted_body",
|
||||||
"<mx-reply><blockquote><a href=\"https://matrix.to/#/" + id() + "/" +
|
"<mx-reply><blockquote><a href=\"https://matrix.to/#/" + id() + "/" +
|
||||||
eventId + "\">In reply to</a> <a href=\"https://matrix.to/#/" +
|
eventId + "\">In reply to</a> <a href=\"https://matrix.to/#/" +
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef MATRIQUEROOM_H
|
#ifndef SpectralRoom_H
|
||||||
#define MATRIQUEROOM_H
|
#define SpectralRoom_H
|
||||||
|
|
||||||
#include "room.h"
|
#include "room.h"
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
using namespace QMatrixClient;
|
using namespace QMatrixClient;
|
||||||
|
|
||||||
class MatriqueRoom : public Room {
|
class SpectralRoom : public Room {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QImage avatar READ getAvatar NOTIFY avatarChanged)
|
Q_PROPERTY(QImage avatar READ getAvatar NOTIFY avatarChanged)
|
||||||
Q_PROPERTY(bool hasUsersTyping READ hasUsersTyping NOTIFY typingChanged)
|
Q_PROPERTY(bool hasUsersTyping READ hasUsersTyping NOTIFY typingChanged)
|
||||||
|
@ -16,7 +16,7 @@ class MatriqueRoom : public Room {
|
||||||
Q_PROPERTY(QString cachedInput READ cachedInput WRITE setCachedInput NOTIFY
|
Q_PROPERTY(QString cachedInput READ cachedInput WRITE setCachedInput NOTIFY
|
||||||
cachedInputChanged)
|
cachedInputChanged)
|
||||||
public:
|
public:
|
||||||
explicit MatriqueRoom(Connection* connection, QString roomId,
|
explicit SpectralRoom(Connection* connection, QString roomId,
|
||||||
JoinState joinState = {});
|
JoinState joinState = {});
|
||||||
|
|
||||||
QImage getAvatar() { return avatar(128); }
|
QImage getAvatar() { return avatar(128); }
|
||||||
|
@ -62,4 +62,4 @@ class MatriqueRoom : public Room {
|
||||||
void sendReply(QString userId, QString eventId, QString replyContent, QString sendContent);
|
void sendReply(QString userId, QString eventId, QString replyContent, QString sendContent);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MATRIQUEROOM_H
|
#endif // SpectralRoom_H
|
|
@ -0,0 +1,6 @@
|
||||||
|
#include "spectraluser.h"
|
||||||
|
|
||||||
|
SpectralUser::SpectralUser(QString userId, Connection* connection)
|
||||||
|
: User(userId, connection) {
|
||||||
|
connect(this, &User::avatarChanged, this, &SpectralUser::inheritedAvatarChanged);
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef MATRIQUEUSER_H
|
#ifndef SpectralUser_H
|
||||||
#define MATRIQUEUSER_H
|
#define SpectralUser_H
|
||||||
|
|
||||||
#include "user.h"
|
#include "user.h"
|
||||||
#include "room.h"
|
#include "room.h"
|
||||||
|
@ -8,11 +8,11 @@
|
||||||
|
|
||||||
using namespace QMatrixClient;
|
using namespace QMatrixClient;
|
||||||
|
|
||||||
class MatriqueUser : public User {
|
class SpectralUser : public User {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QImage avatar READ getAvatar NOTIFY inheritedAvatarChanged)
|
Q_PROPERTY(QImage avatar READ getAvatar NOTIFY inheritedAvatarChanged)
|
||||||
public:
|
public:
|
||||||
MatriqueUser(QString userId, Connection* connection);
|
SpectralUser(QString userId, Connection* connection);
|
||||||
|
|
||||||
QImage getAvatar() { return avatar(128); }
|
QImage getAvatar() { return avatar(128); }
|
||||||
|
|
||||||
|
@ -20,4 +20,4 @@ class MatriqueUser : public User {
|
||||||
void inheritedAvatarChanged(User* user, const Room* roomContext); // https://bugreports.qt.io/browse/QTBUG-7684
|
void inheritedAvatarChanged(User* user, const Room* roomContext); // https://bugreports.qt.io/browse/QTBUG-7684
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MATRIQUEUSER_H
|
#endif // SpectralUser_H
|
Loading…
Reference in New Issue