Use modules.
This commit is contained in:
162
qml/Login.qml
162
qml/Login.qml
@@ -1,162 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Controls.Material 2.2
|
||||
import Qt.labs.settings 1.0
|
||||
import Spectral.Settings 0.1
|
||||
|
||||
import "component"
|
||||
|
||||
Page {
|
||||
property var controller
|
||||
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
|
||||
Pane {
|
||||
width: parent.width / 2
|
||||
height: parent.height
|
||||
|
||||
background: Item {
|
||||
Image {
|
||||
id: background
|
||||
anchors.fill: parent
|
||||
source: "qrc:/asset/img/background.jpg"
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
cache: false
|
||||
}
|
||||
|
||||
ColorOverlay {
|
||||
anchors.fill: background
|
||||
source: background
|
||||
color: Material.accent
|
||||
opacity: 0.7
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
x: 32
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
Label {
|
||||
text: "MATRIX LOGIN."
|
||||
font.pointSize: 28
|
||||
font.bold: true
|
||||
color: "white"
|
||||
}
|
||||
|
||||
Label {
|
||||
text: "A NEW METHOD OF MESSAGING"
|
||||
font.pointSize: 12
|
||||
color: "white"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Pane {
|
||||
width: parent.width / 2
|
||||
height: parent.height
|
||||
|
||||
padding: 64
|
||||
|
||||
ColumnLayout {
|
||||
width: parent.width
|
||||
|
||||
id: mainCol
|
||||
|
||||
TextField {
|
||||
Layout.fillWidth: true
|
||||
|
||||
id: serverField
|
||||
|
||||
leftPadding: 16
|
||||
topPadding: 0
|
||||
bottomPadding: 0
|
||||
|
||||
text: "https://matrix.org"
|
||||
placeholderText: "Server"
|
||||
|
||||
background: Rectangle {
|
||||
implicitHeight: 48
|
||||
|
||||
color: MSettings.darkTheme ? "#242424" : "#eaeaea"
|
||||
border.color: parent.activeFocus ? Material.accent : "transparent"
|
||||
border.width: 2
|
||||
}
|
||||
}
|
||||
|
||||
TextField {
|
||||
Layout.fillWidth: true
|
||||
|
||||
id: usernameField
|
||||
|
||||
leftPadding: 16
|
||||
topPadding: 0
|
||||
bottomPadding: 0
|
||||
|
||||
placeholderText: "Username"
|
||||
|
||||
background: Rectangle {
|
||||
implicitHeight: 48
|
||||
|
||||
color: MSettings.darkTheme ? "#242424" : "#eaeaea"
|
||||
border.color: parent.activeFocus ? Material.accent : "transparent"
|
||||
border.width: 2
|
||||
}
|
||||
}
|
||||
|
||||
TextField {
|
||||
Layout.fillWidth: true
|
||||
|
||||
id: passwordField
|
||||
|
||||
leftPadding: 16
|
||||
topPadding: 0
|
||||
bottomPadding: 0
|
||||
|
||||
placeholderText: "Password"
|
||||
echoMode: TextInput.Password
|
||||
|
||||
background: Rectangle {
|
||||
implicitHeight: 48
|
||||
|
||||
color: MSettings.darkTheme ? "#242424" : "#eaeaea"
|
||||
border.color: parent.activeFocus ? Material.accent : "transparent"
|
||||
border.width: 2
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
|
||||
id: loginButton
|
||||
|
||||
text: "LOGIN"
|
||||
highlighted: true
|
||||
|
||||
ToolTip {
|
||||
id: loginButtonTooltip
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
if (!(serverField.text.startsWith("http") && serverField.text.includes("://"))) {
|
||||
loginButtonTooltip.text = "Server address should start with http(s)://"
|
||||
loginButtonTooltip.open()
|
||||
return
|
||||
}
|
||||
if (!(usernameField.text.startsWith("@") && usernameField.text.includes(":"))) {
|
||||
loginButtonTooltip.text = "Username should be in format of @example:example.com"
|
||||
loginButtonTooltip.open()
|
||||
return
|
||||
}
|
||||
|
||||
controller.loginWithCredentials(serverField.text, usernameField.text, passwordField.text)
|
||||
|
||||
controller.connectionAdded.connect(function() { stackView.pop() })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
53
qml/Room.qml
53
qml/Room.qml
@@ -1,53 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Controls.Material 2.2
|
||||
import Spectral 0.1
|
||||
import Spectral.Settings 0.1
|
||||
|
||||
import "form"
|
||||
import "component"
|
||||
|
||||
Page {
|
||||
property alias connection: roomListModel.connection
|
||||
property alias filter: roomListForm.filter
|
||||
|
||||
id: page
|
||||
|
||||
RoomListModel {
|
||||
id: roomListModel
|
||||
|
||||
onNewMessage: if (!window.active) spectralController.showMessage(roomName, content, icon)
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
|
||||
spacing: 0
|
||||
|
||||
RoomListForm {
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredWidth: MSettings.miniMode ? 64 : page.width * 0.35
|
||||
Layout.minimumWidth: 64
|
||||
Layout.maximumWidth: 360
|
||||
|
||||
id: roomListForm
|
||||
|
||||
listModel: roomListModel
|
||||
|
||||
layer.enabled: true
|
||||
layer.effect: ElevationEffect {
|
||||
elevation: 2
|
||||
}
|
||||
}
|
||||
|
||||
RoomForm {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
id: roomForm
|
||||
|
||||
currentRoom: roomListForm.enteredRoom
|
||||
}
|
||||
}
|
||||
}
|
||||
295
qml/Setting.qml
295
qml/Setting.qml
@@ -1,295 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Controls.Material 2.2
|
||||
import QtQuick.Layouts 1.3
|
||||
import Spectral 0.1
|
||||
import Spectral.Settings 0.1
|
||||
|
||||
import "component"
|
||||
import "form"
|
||||
import "qrc:/js/util.js" as Util
|
||||
|
||||
Page {
|
||||
property alias listModel: accountSettingsListView.model
|
||||
|
||||
Page {
|
||||
id: accountForm
|
||||
|
||||
parent: null
|
||||
|
||||
padding: 64
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
|
||||
ListView {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
id: accountSettingsListView
|
||||
|
||||
boundsBehavior: Flickable.DragOverBounds
|
||||
|
||||
clip: true
|
||||
|
||||
delegate: Column {
|
||||
property bool expanded: false
|
||||
|
||||
spacing: 8
|
||||
|
||||
ItemDelegate {
|
||||
width: accountSettingsListView.width
|
||||
height: 64
|
||||
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 8
|
||||
|
||||
spacing: 8
|
||||
|
||||
ImageItem {
|
||||
width: parent.height
|
||||
height: parent.height
|
||||
|
||||
hint: user.displayName
|
||||
image: user.avatar
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Label {
|
||||
text: user.displayName
|
||||
}
|
||||
Label {
|
||||
text: user.id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: expanded = !expanded
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
width: parent.width - 32
|
||||
height: expanded ? implicitHeight : 0
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
spacing: 0
|
||||
|
||||
clip: true
|
||||
|
||||
ListView {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 24
|
||||
|
||||
orientation: ListView.Horizontal
|
||||
|
||||
spacing: 8
|
||||
|
||||
model: ["#498882", "#42a5f5", "#5c6bc0", "#7e57c2", "#ab47bc", "#ff7043"]
|
||||
|
||||
delegate: Rectangle {
|
||||
width: parent.height
|
||||
height: parent.height
|
||||
radius: width / 2
|
||||
|
||||
color: modelData
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
|
||||
onClicked: spectralController.setColor(connection.localUserId, modelData)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
Label { text: "Homeserver:" }
|
||||
TextField {
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: connection.homeserver
|
||||
selectByMouse: true
|
||||
readOnly: true
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
spacing: 16
|
||||
|
||||
Label { text: "Device ID:" }
|
||||
TextField {
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: connection.deviceId
|
||||
selectByMouse: true
|
||||
readOnly: true
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
spacing: 16
|
||||
|
||||
Label { text: "Access Token:" }
|
||||
TextField {
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: connection.accessToken
|
||||
selectByMouse: true
|
||||
readOnly: true
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
|
||||
highlighted: true
|
||||
text: "Logout"
|
||||
|
||||
onClicked: spectralController.logout(connection)
|
||||
}
|
||||
|
||||
Behavior on height {
|
||||
PropertyAnimation { easing.type: Easing.InOutCubic; duration: 200 }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: "Add Account"
|
||||
flat: true
|
||||
highlighted: true
|
||||
|
||||
onClicked: stackView.push(loginPage)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Page {
|
||||
id: generalForm
|
||||
|
||||
parent: null
|
||||
|
||||
padding: 64
|
||||
|
||||
Column {
|
||||
Switch {
|
||||
text: "Use press and hold instead of right click"
|
||||
checked: MSettings.pressAndHold
|
||||
|
||||
onCheckedChanged: MSettings.pressAndHold = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Page {
|
||||
id: appearanceForm
|
||||
|
||||
parent: null
|
||||
|
||||
padding: 64
|
||||
|
||||
Column {
|
||||
Switch {
|
||||
text: "Dark theme"
|
||||
checked: MSettings.darkTheme
|
||||
|
||||
onCheckedChanged: MSettings.darkTheme = checked
|
||||
}
|
||||
|
||||
Switch {
|
||||
text: "Mini Room List"
|
||||
checked: MSettings.miniMode
|
||||
|
||||
onCheckedChanged: MSettings.miniMode = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Page {
|
||||
id: aboutForm
|
||||
|
||||
parent: null
|
||||
|
||||
padding: 64
|
||||
|
||||
ColumnLayout {
|
||||
spacing: 16
|
||||
Image {
|
||||
Layout.preferredWidth: 64
|
||||
Layout.preferredHeight: 64
|
||||
|
||||
source: "qrc:/asset/img/icon.png"
|
||||
}
|
||||
Label { text: "Spectral, an IM client for the Matrix protocol." }
|
||||
Label { text: "Released under GNU General Public License, version 3." }
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: 240
|
||||
height: parent.height
|
||||
z: 10
|
||||
|
||||
id: settingDrawer
|
||||
|
||||
color: MSettings.darkTheme ? "#323232" : "#f3f3f3"
|
||||
|
||||
layer.enabled: true
|
||||
layer.effect: ElevationEffect {
|
||||
elevation: 4
|
||||
}
|
||||
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
|
||||
ItemDelegate {
|
||||
width: parent.width
|
||||
|
||||
text: "Account"
|
||||
onClicked: pushToStack(accountForm)
|
||||
}
|
||||
|
||||
ItemDelegate {
|
||||
width: parent.width
|
||||
|
||||
text: "General"
|
||||
onClicked: pushToStack(generalForm)
|
||||
}
|
||||
|
||||
ItemDelegate {
|
||||
width: parent.width
|
||||
|
||||
text: "Appearance"
|
||||
onClicked: pushToStack(appearanceForm)
|
||||
}
|
||||
|
||||
ItemDelegate {
|
||||
width: parent.width
|
||||
|
||||
text: "About"
|
||||
onClicked: pushToStack(aboutForm)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StackView {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: settingDrawer.width
|
||||
|
||||
id: settingStackView
|
||||
}
|
||||
|
||||
function pushToStack(item) {
|
||||
settingStackView.clear()
|
||||
settingStackView.push(item)
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
pragma Singleton
|
||||
import QtQuick 2.9
|
||||
import Qt.labs.settings 1.0
|
||||
|
||||
Settings {
|
||||
property bool pressAndHold
|
||||
|
||||
property bool darkTheme
|
||||
property bool miniMode
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
|
||||
Item {
|
||||
property alias source: baseImage.source
|
||||
property alias sourceSize: baseImage.sourceSize.width
|
||||
|
||||
readonly property bool loading: baseImage.status == Image.Loading
|
||||
|
||||
signal clicked()
|
||||
|
||||
width: loading ? 128 : baseImage.implicitWidth
|
||||
height: loading ? progressBar.height : baseImage.implicitHeight
|
||||
|
||||
id: rekt
|
||||
|
||||
Image { id: baseImage }
|
||||
|
||||
ProgressBar {
|
||||
width: parent.width
|
||||
visible: loading
|
||||
|
||||
id: progressBar
|
||||
|
||||
indeterminate: true
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
propagateComposedEvents: true
|
||||
|
||||
onClicked: rekt.clicked()
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Controls.Material 2.2
|
||||
import Spectral.Settings 0.1
|
||||
|
||||
Label {
|
||||
property bool coloredBackground
|
||||
|
||||
color: coloredBackground ? "white": Material.foreground
|
||||
|
||||
wrapMode: Label.Wrap
|
||||
linkColor: coloredBackground ? "white" : Material.accent
|
||||
textFormat: MSettings.richText ? Text.RichText : Text.StyledText
|
||||
|
||||
onLinkActivated: Qt.openUrlExternally(link)
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
import Spectral.Settings 0.1
|
||||
|
||||
MouseArea {
|
||||
signal primaryClicked()
|
||||
signal secondaryClicked()
|
||||
|
||||
acceptedButtons: MSettings.pressAndHold ? Qt.LeftButton : (Qt.LeftButton | Qt.RightButton)
|
||||
|
||||
onClicked: mouse.button == Qt.RightButton ? secondaryClicked() : primaryClicked()
|
||||
onPressAndHold: MSettings.pressAndHold ? secondaryClicked() : {}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Controls.Material 2.2
|
||||
import Qt.labs.platform 1.0
|
||||
|
||||
Item {
|
||||
property bool openOnFinished: false
|
||||
readonly property bool downloaded: progressInfo && progressInfo.completed
|
||||
|
||||
Rectangle {
|
||||
z: -2
|
||||
height: parent.height
|
||||
width: progressInfo.active && !progressInfo.completed ? progressInfo.progress / progressInfo.total * parent.width : 0
|
||||
|
||||
color: Material.accent
|
||||
opacity: 0.4
|
||||
}
|
||||
|
||||
onDownloadedChanged: if (downloaded && openOnFinished) openSavedFile()
|
||||
|
||||
function saveFileAs() { currentRoom.saveFileAs(eventId) }
|
||||
|
||||
function downloadAndOpen()
|
||||
{
|
||||
if (downloaded) openSavedFile()
|
||||
else
|
||||
{
|
||||
openOnFinished = true
|
||||
currentRoom.downloadFile(eventId, StandardPaths.writableLocation(StandardPaths.CacheLocation) + "/" + eventId.replace(":", "_") + ".tmp")
|
||||
}
|
||||
}
|
||||
|
||||
function openSavedFile()
|
||||
{
|
||||
if (Qt.openUrlExternally(progressInfo.localPath)) return;
|
||||
if (Qt.openUrlExternally(progressInfo.localDir)) return;
|
||||
}
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
/*!
|
||||
An effect for standard Material Design elevation shadows
|
||||
*/
|
||||
Item {
|
||||
id: effect
|
||||
|
||||
property variant source
|
||||
|
||||
property int elevation: 0
|
||||
|
||||
// Shadow details follow Material Design (taken from Angular Material)
|
||||
readonly property var _shadows: [
|
||||
[{offset: 0, blur: 0, spread: 0},
|
||||
{offset: 0, blur: 0, spread: 0},
|
||||
{offset: 0, blur: 0, spread: 0}],
|
||||
|
||||
[{offset: 1, blur: 3, spread: 0},
|
||||
{offset: 1, blur: 1, spread: 0},
|
||||
{offset: 2, blur: 1, spread: -1}],
|
||||
|
||||
[{offset: 1, blur: 5, spread: 0},
|
||||
{offset: 2, blur: 2, spread: 0},
|
||||
{offset: 3, blur: 1, spread: -2}],
|
||||
|
||||
[{offset: 1, blur: 8, spread: 0},
|
||||
{offset: 3, blur: 4, spread: 0},
|
||||
{offset: 3, blur: 3, spread: -2}],
|
||||
|
||||
[{offset: 2, blur: 4, spread: -1},
|
||||
{offset: 4, blur: 5, spread: 0},
|
||||
{offset: 1, blur: 10, spread: 0}],
|
||||
|
||||
[{offset: 3, blur: 5, spread: -1},
|
||||
{offset: 5, blur: 8, spread: 0},
|
||||
{offset: 1, blur: 14, spread: 0}],
|
||||
|
||||
[{offset: 3, blur: 5, spread: -1},
|
||||
{offset: 6, blur: 10, spread: 0},
|
||||
{offset: 1, blur: 18, spread: 0}],
|
||||
|
||||
[{offset: 4, blur: 5, spread: -2},
|
||||
{offset: 7, blur: 10, spread: 1},
|
||||
{offset: 2, blur: 16, spread: 1}],
|
||||
|
||||
[{offset: 5, blur: 5, spread: -3},
|
||||
{offset: 8, blur: 10, spread: 1},
|
||||
{offset: 3, blur: 14, spread: 2}],
|
||||
|
||||
[{offset: 5, blur: 6, spread: -3},
|
||||
{offset: 9, blur: 12, spread: 1},
|
||||
{offset: 3, blur: 16, spread: 2}],
|
||||
|
||||
[{offset: 6, blur: 6, spread: -3},
|
||||
{offset: 10, blur: 14, spread: 1},
|
||||
{offset: 4, blur: 18, spread: 3}],
|
||||
|
||||
[{offset: 6, blur: 7, spread: -4},
|
||||
{offset: 11, blur: 15, spread: 1},
|
||||
{offset: 4, blur: 20, spread: 3}],
|
||||
|
||||
[{offset: 7, blur: 8, spread: -4},
|
||||
{offset: 12, blur: 17, spread: 2},
|
||||
{offset: 5, blur: 22, spread: 4}],
|
||||
|
||||
[{offset: 7, blur: 8, spread: -4},
|
||||
{offset: 13, blur: 19, spread: 2},
|
||||
{offset: 5, blur: 24, spread: 4}],
|
||||
|
||||
[{offset: 7, blur: 9, spread: -4},
|
||||
{offset: 14, blur: 21, spread: 2},
|
||||
{offset: 5, blur: 26, spread: 4}],
|
||||
|
||||
[{offset: 8, blur: 9, spread: -5},
|
||||
{offset: 15, blur: 22, spread: 2},
|
||||
{offset: 6, blur: 28, spread: 5}],
|
||||
|
||||
[{offset: 8, blur: 10, spread: -5},
|
||||
{offset: 16, blur: 24, spread: 2},
|
||||
{offset: 6, blur: 30, spread: 5}],
|
||||
|
||||
[{offset: 8, blur: 11, spread: -5},
|
||||
{offset: 17, blur: 26, spread: 2},
|
||||
{offset: 6, blur: 32, spread: 5}],
|
||||
|
||||
[{offset: 9, blur: 11, spread: -5},
|
||||
{offset: 18, blur: 28, spread: 2},
|
||||
{offset: 7, blur: 34, spread: 6}],
|
||||
|
||||
[{offset: 9, blur: 12, spread: -6},
|
||||
{offset: 19, blur: 29, spread: 2},
|
||||
{offset: 7, blur: 36, spread: 6}],
|
||||
|
||||
[{offset: 10, blur: 13, spread: -6},
|
||||
{offset: 20, blur: 31, spread: 3},
|
||||
{offset: 8, blur: 38, spread: 7}],
|
||||
|
||||
[{offset: 10, blur: 13, spread: -6},
|
||||
{offset: 21, blur: 33, spread: 3},
|
||||
{offset: 8, blur: 40, spread: 7}],
|
||||
|
||||
[{offset: 10, blur: 14, spread: -6},
|
||||
{offset: 22, blur: 35, spread: 3},
|
||||
{offset: 8, blur: 42, spread: 7}],
|
||||
|
||||
[{offset: 11, blur: 14, spread: -7},
|
||||
{offset: 23, blur: 36, spread: 3},
|
||||
{offset: 9, blur: 44, spread: 8}],
|
||||
|
||||
[{offset: 11, blur: 15, spread: -7},
|
||||
{offset: 24, blur: 38, spread: 3},
|
||||
{offset: 9, blur: 46, spread: 8}]
|
||||
]
|
||||
|
||||
readonly property var _shadowColors: [
|
||||
Qt.rgba(0,0,0, 0.2),
|
||||
Qt.rgba(0,0,0, 0.14),
|
||||
Qt.rgba(0,0,0, 0.12)
|
||||
]
|
||||
|
||||
Repeater {
|
||||
model: _shadows[elevation]
|
||||
|
||||
delegate: RectangularGlow {
|
||||
anchors {
|
||||
centerIn: parent
|
||||
verticalCenterOffset: modelData.offset
|
||||
}
|
||||
|
||||
width: parent.width + 2 * modelData.spread
|
||||
height: parent.height + 2 * modelData.spread
|
||||
glowRadius: modelData.blur/2
|
||||
spread: 0.05
|
||||
color: _shadowColors[index]
|
||||
cornerRadius: modelData.blur + (effect.source.radius || 0)
|
||||
}
|
||||
}
|
||||
|
||||
ShaderEffect {
|
||||
anchors.fill: parent
|
||||
property alias source: effect.source;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
|
||||
Text {
|
||||
property string category
|
||||
|
||||
width: 36
|
||||
height: 36
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
||||
font.pointSize: 20
|
||||
font.family: "Emoji"
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: emojiCategory = category
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Controls.Material 2.2
|
||||
import Spectral 0.1
|
||||
|
||||
Popup {
|
||||
property var textArea
|
||||
property string emojiCategory: "people"
|
||||
|
||||
EmojiModel {
|
||||
id: emojiModel
|
||||
category: emojiCategory
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
|
||||
GridView {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
cellWidth: 36
|
||||
cellHeight: 36
|
||||
|
||||
boundsBehavior: Flickable.DragOverBounds
|
||||
|
||||
clip: true
|
||||
|
||||
model: emojiModel.model
|
||||
|
||||
delegate: Text {
|
||||
width: 36
|
||||
height: 36
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
||||
font.pointSize: 20
|
||||
font.family: "Emoji"
|
||||
text: modelData
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: textArea.insert(textArea.cursorPosition, modelData)
|
||||
}
|
||||
}
|
||||
|
||||
ScrollBar.vertical: ScrollBar {}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 2
|
||||
|
||||
color: Material.accent
|
||||
}
|
||||
|
||||
Row {
|
||||
EmojiButton { text: "😏"; category: "people" }
|
||||
EmojiButton { text: "🌲"; category: "nature" }
|
||||
EmojiButton { text: "🍛"; category: "food"}
|
||||
EmojiButton { text: "🚁"; category: "activity" }
|
||||
EmojiButton { text: "🚅"; category: "travel" }
|
||||
EmojiButton { text: "💡"; category: "objects" }
|
||||
EmojiButton { text: "🔣"; category: "symbols" }
|
||||
EmojiButton { text: "🏁"; category: "flags" }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Controls.Material 2.2
|
||||
import Spectral.Settings 0.1
|
||||
|
||||
Control {
|
||||
property bool highlighted: false
|
||||
property bool colored: false
|
||||
|
||||
readonly property bool darkBackground: highlighted ? true : MSettings.darkTheme
|
||||
|
||||
padding: 12
|
||||
|
||||
AutoMouseArea {
|
||||
anchors.fill: parent
|
||||
|
||||
onSecondaryClicked: {
|
||||
messageContextMenu.row = messageRow
|
||||
messageContextMenu.model = model
|
||||
messageContextMenu.selectedText = contentLabel.selectedText
|
||||
messageContextMenu.popup()
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
color: colored ? Material.accent : highlighted ? Material.primary : Material.background
|
||||
|
||||
layer.enabled: true
|
||||
layer.effect: ElevationEffect {
|
||||
elevation: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Layouts 1.3
|
||||
import Spectral.Settings 0.1
|
||||
|
||||
Text {
|
||||
property alias icon: materialLabel.text
|
||||
|
||||
id: materialLabel
|
||||
|
||||
color: MSettings.darkTheme ? "white" : "dark"
|
||||
font.pointSize: 16
|
||||
font.family: materialFont.name
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
@@ -1,232 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Controls.Material 2.2
|
||||
import Spectral 0.1
|
||||
import Spectral.Settings 0.1
|
||||
import "qrc:/js/util.js" as Util
|
||||
|
||||
RowLayout {
|
||||
readonly property bool avatarVisible: !sentByMe && (aboveAuthor !== author || aboveSection !== section || aboveEventType === "state" || aboveEventType === "emote" || aboveEventType === "other")
|
||||
readonly property bool highlighted: !(sentByMe || eventType === "notice" )
|
||||
readonly property bool sentByMe: author === currentRoom.localUser
|
||||
readonly property bool isText: eventType === "notice" || eventType === "message"
|
||||
|
||||
signal saveFileAs()
|
||||
signal openExternally()
|
||||
|
||||
z: -5
|
||||
|
||||
id: messageRow
|
||||
|
||||
Layout.alignment: sentByMe ? Qt.AlignRight : Qt.AlignLeft
|
||||
|
||||
spacing: 6
|
||||
|
||||
ImageItem {
|
||||
Layout.preferredWidth: 40
|
||||
Layout.preferredHeight: 40
|
||||
Layout.alignment: Qt.AlignTop
|
||||
|
||||
round: false
|
||||
visible: avatarVisible
|
||||
hint: author.displayName
|
||||
image: author.avatar
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Layout.preferredWidth: 40
|
||||
Layout.preferredHeight: 40
|
||||
Layout.alignment: Qt.AlignTop
|
||||
|
||||
color: "transparent"
|
||||
visible: !(sentByMe || avatarVisible)
|
||||
}
|
||||
|
||||
GenericBubble {
|
||||
Layout.maximumWidth: messageListView.width - (!sentByMe ? 40 + messageRow.spacing : 0)
|
||||
|
||||
id: genericBubble
|
||||
|
||||
highlighted: messageRow.highlighted
|
||||
colored: highlighted && (eventType === "notice" || highlight)
|
||||
|
||||
contentItem: ColumnLayout {
|
||||
id: messageColumn
|
||||
|
||||
spacing: 0
|
||||
|
||||
AutoLabel {
|
||||
visible: messageRow.avatarVisible
|
||||
text: author.displayName
|
||||
Material.foreground: Material.accent
|
||||
coloredBackground: highlighted
|
||||
font.bold: true
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: inputField.insert(inputField.cursorPosition, author.displayName)
|
||||
}
|
||||
}
|
||||
|
||||
TextEdit {
|
||||
Layout.fillWidth: true
|
||||
|
||||
id: contentLabel
|
||||
|
||||
text: (highlighted ? "<style>a{color: white;} .user-pill{color: white}</style>" : "<style>a{color: " + Material.accent + ";} .user-pill{color: " + Material.accent + "}</style>") + display
|
||||
|
||||
visible: isText
|
||||
color: highlighted ? "white": Material.foreground
|
||||
|
||||
font: Qt.font({pointSize: 10})
|
||||
selectByMouse: true
|
||||
readOnly: true
|
||||
wrapMode: Label.Wrap
|
||||
selectedTextColor: highlighted ? Material.accent : "white"
|
||||
selectionColor: highlighted ? "white" : Material.accent
|
||||
textFormat: Text.RichText
|
||||
|
||||
onLinkActivated: Qt.openUrlExternally(link)
|
||||
}
|
||||
|
||||
Loader {
|
||||
sourceComponent: {
|
||||
switch (eventType) {
|
||||
case "image":
|
||||
return imageComponent
|
||||
case "file":
|
||||
return fileComponent
|
||||
case "audio":
|
||||
return audioComponent
|
||||
}
|
||||
}
|
||||
|
||||
active: eventType === "image" || eventType === "file" || eventType === "audio"
|
||||
}
|
||||
|
||||
Row {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
|
||||
spacing: 4
|
||||
|
||||
AutoLabel {
|
||||
visible: userMarker.length > 5
|
||||
text: userMarker.length - 5 + "+"
|
||||
coloredBackground: highlighted
|
||||
Material.foreground: "grey"
|
||||
font.pointSize: 8
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: userMarker.length > 5 ? userMarker.slice(0, 5) : userMarker
|
||||
|
||||
ImageItem {
|
||||
width: parent.height
|
||||
height: parent.height
|
||||
|
||||
hint: modelData.displayName
|
||||
image: modelData.avatar
|
||||
}
|
||||
}
|
||||
|
||||
AutoLabel {
|
||||
id: timeLabel
|
||||
|
||||
visible: Math.abs(time - aboveTime) > 600000 || index == 0
|
||||
text: Qt.formatTime(time, "hh:mm")
|
||||
coloredBackground: highlighted
|
||||
Material.foreground: "grey"
|
||||
font.pointSize: 8
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: imageComponent
|
||||
|
||||
DownloadableContent {
|
||||
width: messageImage.width
|
||||
height: messageImage.height
|
||||
|
||||
id: downloadable
|
||||
|
||||
AutoImage {
|
||||
z: -4
|
||||
|
||||
id: messageImage
|
||||
|
||||
sourceSize: 128
|
||||
source: "image://mxc/" + (content.thumbnail_url ? content.thumbnail_url : content.url)
|
||||
|
||||
onClicked: downloadAndOpen()
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
messageRow.saveFileAs.connect(saveFileAs)
|
||||
messageRow.openExternally.connect(downloadAndOpen)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: fileComponent
|
||||
|
||||
AutoLabel {
|
||||
Layout.fillWidth: true
|
||||
|
||||
id: downloadDelegate
|
||||
|
||||
text: "<b>File: </b>" + content.body
|
||||
coloredBackground: highlighted
|
||||
|
||||
background: DownloadableContent {
|
||||
id: downloadable
|
||||
|
||||
Component.onCompleted: {
|
||||
messageRow.saveFileAs.connect(saveFileAs)
|
||||
messageRow.openExternally.connect(downloadAndOpen)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: audioComponent
|
||||
|
||||
AutoLabel {
|
||||
id: downloadDelegate
|
||||
|
||||
text: content.info.duration / 1000 + '"'
|
||||
coloredBackground: highlighted
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
|
||||
propagateComposedEvents: true
|
||||
|
||||
onClicked: {
|
||||
if (downloadable.downloaded)
|
||||
spectralController.playAudio(progressInfo.localPath)
|
||||
else
|
||||
{
|
||||
playOnFinished = true
|
||||
currentRoom.downloadFile(eventId, StandardPaths.writableLocation(StandardPaths.CacheLocation) + "/" + eventId.replace(":", "_") + ".tmp")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
background: DownloadableContent {
|
||||
id: downloadable
|
||||
|
||||
onDownloadedChanged: downloaded && playOnFinished ? spectralController.playAudio(progressInfo.localPath) : {}
|
||||
|
||||
Component.onCompleted: {
|
||||
messageRow.saveFileAs.connect(saveFileAs)
|
||||
messageRow.openExternally.connect(downloadAndOpen)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,203 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Controls.Material 2.2
|
||||
import QtQuick.Layouts 1.3
|
||||
import Spectral 0.1
|
||||
|
||||
import "qrc:/js/util.js" as Util
|
||||
|
||||
Drawer {
|
||||
property var room
|
||||
|
||||
id: roomDrawer
|
||||
|
||||
edge: Qt.RightEdge
|
||||
interactive: false
|
||||
|
||||
ToolButton {
|
||||
contentItem: MaterialIcon { icon: "\ue5c4" }
|
||||
|
||||
onClicked: roomDrawer.close()
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 32
|
||||
|
||||
ImageItem {
|
||||
Layout.preferredWidth: 64
|
||||
Layout.preferredHeight: 64
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
hint: room ? room.displayName : "No name"
|
||||
image: spectralController.safeImage(room ? room.avatar : null)
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: room && room.id ? room.id : ""
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: room && room.canonicalAlias ? room.canonicalAlias : "No Canonical Alias"
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: room ? room.memberCount + " Members" : "No Member Count"
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
TextField {
|
||||
Layout.fillWidth: true
|
||||
|
||||
id: roomNameField
|
||||
text: room && room.name ? room.name : ""
|
||||
selectByMouse: true
|
||||
}
|
||||
|
||||
ItemDelegate {
|
||||
Layout.preferredWidth: height
|
||||
Layout.preferredHeight: parent.height
|
||||
|
||||
contentItem: MaterialIcon { icon: "\ue5ca" }
|
||||
|
||||
onClicked: room.setName(roomNameField.text)
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
TextField {
|
||||
Layout.fillWidth: true
|
||||
|
||||
id: roomTopicField
|
||||
|
||||
text: room && room.topic ? room.topic : ""
|
||||
selectByMouse: true
|
||||
}
|
||||
|
||||
ItemDelegate {
|
||||
Layout.preferredWidth: height
|
||||
Layout.preferredHeight: parent.height
|
||||
|
||||
contentItem: MaterialIcon { icon: "\ue5ca" }
|
||||
|
||||
onClicked: room.setTopic(roomTopicField.text)
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
id: userListView
|
||||
|
||||
clip: true
|
||||
|
||||
boundsBehavior: Flickable.DragOverBounds
|
||||
|
||||
model: UserListModel {
|
||||
room: roomDrawer.room
|
||||
}
|
||||
|
||||
delegate: Column {
|
||||
property bool expanded: false
|
||||
|
||||
ItemDelegate {
|
||||
width: userListView.width
|
||||
height: 48
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 8
|
||||
spacing: 12
|
||||
|
||||
ImageItem {
|
||||
Layout.preferredWidth: height
|
||||
Layout.fillHeight: true
|
||||
|
||||
image: avatar
|
||||
hint: name
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: name
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: expanded = !expanded
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
width: parent.width - 32
|
||||
height: expanded ? implicitHeight : 0
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
spacing: 0
|
||||
|
||||
clip: true
|
||||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: "Kick"
|
||||
highlighted: true
|
||||
|
||||
onClicked: room.kickMember(userId)
|
||||
}
|
||||
|
||||
Behavior on height {
|
||||
PropertyAnimation { easing.type: Easing.InOutCubic; duration: 200 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScrollBar.vertical: ScrollBar {}
|
||||
}
|
||||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: "Invite User"
|
||||
flat: true
|
||||
highlighted: true
|
||||
|
||||
onClicked: inviteUserDialog.open()
|
||||
|
||||
Dialog {
|
||||
x: (window.width - width) / 2
|
||||
y: (window.height - height) / 2
|
||||
width: 360
|
||||
|
||||
id: inviteUserDialog
|
||||
|
||||
parent: ApplicationWindow.overlay
|
||||
|
||||
title: "Input User ID"
|
||||
modal: true
|
||||
standardButtons: Dialog.Ok | Dialog.Cancel
|
||||
|
||||
contentItem: TextField {
|
||||
id: inviteUserDialogTextField
|
||||
placeholderText: "@bot:matrix.org"
|
||||
}
|
||||
|
||||
onAccepted: room.inviteToRoom(inviteUserDialogTextField.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Controls.Material 2.2
|
||||
|
||||
import "qrc:/js/util.js" as Util
|
||||
|
||||
ItemDelegate {
|
||||
property var page
|
||||
property bool selected: stackView.currentItem === page
|
||||
property color highlightColor: Material.accent
|
||||
|
||||
Rectangle {
|
||||
width: selected ? 4 : 0
|
||||
height: parent.height
|
||||
|
||||
color: highlightColor
|
||||
|
||||
Behavior on width {
|
||||
PropertyAnimation { easing.type: Easing.InOutCubic; duration: 200 }
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: Util.pushToStack(stackView, page)
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Controls.Material 2.2
|
||||
import Spectral.Settings 0.1
|
||||
|
||||
Label {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
text: "<b>" + author.displayName + "</b> " + display
|
||||
color: "white"
|
||||
|
||||
padding: 8
|
||||
|
||||
wrapMode: Label.Wrap
|
||||
linkColor: "white"
|
||||
textFormat: MSettings.richText ? Text.RichText : Text.StyledText
|
||||
onLinkActivated: Qt.openUrlExternally(link)
|
||||
|
||||
background: Rectangle {
|
||||
color: MSettings.darkTheme ? "#484848" : "grey"
|
||||
}
|
||||
}
|
||||
@@ -1,535 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Controls.Material 2.2
|
||||
import Spectral 0.1
|
||||
import Spectral.Settings 0.1
|
||||
import SortFilterProxyModel 0.2
|
||||
|
||||
import "../component"
|
||||
import "../menu"
|
||||
import "qrc:/js/md.js" as Markdown
|
||||
import "qrc:/js/util.js" as Util
|
||||
|
||||
Item {
|
||||
property var currentRoom: null
|
||||
|
||||
id: item
|
||||
|
||||
MessageEventModel {
|
||||
id: messageEventModel
|
||||
room: currentRoom
|
||||
}
|
||||
|
||||
RoomDrawer {
|
||||
width: Math.min(item.width * 0.7, 480)
|
||||
height: item.height
|
||||
|
||||
id: roomDrawer
|
||||
|
||||
room: currentRoom
|
||||
}
|
||||
|
||||
Label {
|
||||
anchors.centerIn: parent
|
||||
visible: !currentRoom
|
||||
text: "Please choose a room."
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
spacing: 0
|
||||
|
||||
visible: currentRoom
|
||||
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 64
|
||||
|
||||
z: 10
|
||||
|
||||
color: Material.accent
|
||||
|
||||
ItemDelegate {
|
||||
anchors.fill: parent
|
||||
|
||||
onClicked: roomDrawer.open()
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 12
|
||||
|
||||
spacing: 12
|
||||
|
||||
ImageItem {
|
||||
Layout.preferredWidth: height
|
||||
Layout.fillHeight: true
|
||||
|
||||
hint: currentRoom ? currentRoom.displayName : "No name"
|
||||
image: spectralController.safeImage(currentRoom ? currentRoom.avatar : null)
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
visible: parent.width > 64
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
text: currentRoom ? currentRoom.displayName : ""
|
||||
color: "white"
|
||||
font.pointSize: 12
|
||||
elide: Text.ElideRight
|
||||
wrapMode: Text.NoWrap
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
text: currentRoom ? (currentRoom.topic).replace(/(\r\n\t|\n|\r\t)/gm,"") : ""
|
||||
color: "white"
|
||||
elide: Text.ElideRight
|
||||
wrapMode: Text.NoWrap
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ProgressBar {
|
||||
Layout.fillWidth: true
|
||||
z: 10
|
||||
|
||||
visible: currentRoom && currentRoom.busy
|
||||
indeterminate: true
|
||||
}
|
||||
|
||||
ListView {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
Layout.leftMargin: 16
|
||||
Layout.rightMargin: 16
|
||||
|
||||
id: messageListView
|
||||
|
||||
displayMarginBeginning: 40
|
||||
displayMarginEnd: 40
|
||||
verticalLayoutDirection: ListView.BottomToTop
|
||||
spacing: 8
|
||||
|
||||
cacheBuffer: 200
|
||||
flickDeceleration: 4096
|
||||
|
||||
boundsBehavior: Flickable.DragOverBounds
|
||||
|
||||
property int largestVisibleIndex: count > 0 ? indexAt(contentX, contentY + height - 1) : -1
|
||||
|
||||
onContentYChanged: {
|
||||
// Check whether we're about to bump into the ceiling in 2 seconds
|
||||
var curVelocity = verticalVelocity // Snapshot the current speed
|
||||
if(curVelocity < 0 && contentY - 5000 < originY)
|
||||
{
|
||||
currentRoom.getPreviousContent(50);
|
||||
}
|
||||
}
|
||||
|
||||
onMovementEnded: currentRoom.saveViewport(sortedMessageEventModel.mapToSource(indexAt(contentX, contentY)), sortedMessageEventModel.mapToSource(largestVisibleIndex))
|
||||
|
||||
displaced: Transition {
|
||||
NumberAnimation {
|
||||
property: "y"; duration: 200
|
||||
easing.type: Easing.OutQuad
|
||||
}
|
||||
}
|
||||
|
||||
model: SortFilterProxyModel {
|
||||
id: sortedMessageEventModel
|
||||
|
||||
sourceModel: messageEventModel
|
||||
|
||||
filters: ExpressionFilter {
|
||||
expression: marks !== 0x08 && marks !== 0x10
|
||||
}
|
||||
|
||||
onModelReset: {
|
||||
if (currentRoom)
|
||||
{
|
||||
var lastScrollPosition = mapFromSource(currentRoom.savedTopVisibleIndex())
|
||||
if (lastScrollPosition === 0)
|
||||
messageListView.positionViewAtBeginning()
|
||||
else
|
||||
{
|
||||
console.log("Scrolling to position", lastScrollPosition)
|
||||
messageListView.currentIndex = lastScrollPosition
|
||||
}
|
||||
if (messageListView.contentY < messageListView.originY + 10 || currentRoom.timelineSize === 0)
|
||||
currentRoom.getPreviousContent(50)
|
||||
}
|
||||
console.log("Model timeline reset")
|
||||
}
|
||||
}
|
||||
|
||||
delegate: ColumnLayout {
|
||||
width: parent.width
|
||||
|
||||
id: delegateColumn
|
||||
|
||||
spacing: 8
|
||||
|
||||
Label {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
visible: section !== aboveSection
|
||||
|
||||
text: section
|
||||
color: "white"
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
leftPadding: 8
|
||||
rightPadding: 8
|
||||
topPadding: 4
|
||||
bottomPadding: 4
|
||||
|
||||
background: Rectangle {
|
||||
color: MSettings.darkTheme ? "#484848" : "grey"
|
||||
}
|
||||
}
|
||||
|
||||
MessageDelegate {
|
||||
visible: eventType === "notice" || eventType === "message" || eventType === "image" || eventType === "video" || eventType === "audio" || eventType === "file"
|
||||
}
|
||||
|
||||
StateDelegate {
|
||||
Layout.maximumWidth: messageListView.width * 0.8
|
||||
|
||||
visible: eventType === "emote" || eventType === "state"
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
visible: eventType === "other"
|
||||
|
||||
text: display
|
||||
color: "grey"
|
||||
font.italic: true
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
visible: readMarker === true && index !== 0
|
||||
|
||||
text: "And Now"
|
||||
color: "white"
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
leftPadding: 8
|
||||
rightPadding: 8
|
||||
topPadding: 4
|
||||
bottomPadding: 4
|
||||
|
||||
background: Rectangle { color: MSettings.darkTheme ? "#484848" : "grey" }
|
||||
}
|
||||
}
|
||||
|
||||
RoundButton {
|
||||
width: 64
|
||||
height: 64
|
||||
|
||||
id: goTopFab
|
||||
|
||||
visible: !(parent.atYEnd || messageListView.moving)
|
||||
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
contentItem: MaterialIcon {
|
||||
anchors.fill: parent
|
||||
|
||||
icon: "\ue313"
|
||||
color: "white"
|
||||
}
|
||||
|
||||
Material.background: Material.accent
|
||||
|
||||
onClicked: parent.positionViewAtBeginning()
|
||||
|
||||
Behavior on opacity { NumberAnimation { duration: 200 } }
|
||||
}
|
||||
|
||||
MessageContextMenu { id: messageContextMenu }
|
||||
|
||||
Popup {
|
||||
property string sourceText
|
||||
|
||||
x: (window.width - width) / 2
|
||||
y: (window.height - height) / 2
|
||||
width: 480
|
||||
|
||||
id: sourceDialog
|
||||
|
||||
parent: ApplicationWindow.overlay
|
||||
|
||||
modal: true
|
||||
|
||||
padding: 16
|
||||
|
||||
closePolicy: Dialog.CloseOnEscape | Dialog.CloseOnPressOutside
|
||||
|
||||
contentItem: ScrollView {
|
||||
TextArea {
|
||||
readOnly: true
|
||||
selectByMouse: true
|
||||
|
||||
text: sourceDialog.sourceText
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Popup {
|
||||
property alias listModel: readMarkerListView.model
|
||||
|
||||
x: (window.width - width) / 2
|
||||
y: (window.height - height) / 2
|
||||
width: 320
|
||||
|
||||
id: readMarkerDialog
|
||||
|
||||
parent: ApplicationWindow.overlay
|
||||
|
||||
modal: true
|
||||
padding: 16
|
||||
|
||||
closePolicy: Dialog.CloseOnEscape | Dialog.CloseOnPressOutside
|
||||
|
||||
contentItem: ListView {
|
||||
implicitHeight: Math.min(window.height - 64, readMarkerListView.contentHeight)
|
||||
|
||||
id: readMarkerListView
|
||||
|
||||
clip: true
|
||||
boundsBehavior: Flickable.DragOverBounds
|
||||
|
||||
delegate: ItemDelegate {
|
||||
width: parent.width
|
||||
height: 48
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 8
|
||||
spacing: 12
|
||||
|
||||
ImageItem {
|
||||
Layout.preferredWidth: height
|
||||
Layout.fillHeight: true
|
||||
|
||||
image: modelData.avatar
|
||||
hint: modelData.displayName
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: modelData.displayName
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScrollBar.vertical: ScrollBar {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 40
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 40
|
||||
Layout.leftMargin: 16
|
||||
Layout.rightMargin: 16
|
||||
|
||||
color: Material.background
|
||||
|
||||
Rectangle {
|
||||
anchors.verticalCenter: parent.top
|
||||
width: parent.width
|
||||
height: 48
|
||||
|
||||
color: MSettings.darkTheme ? "#303030" : "#fafafa"
|
||||
|
||||
layer.enabled: true
|
||||
layer.effect: ElevationEffect {
|
||||
elevation: 2
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
|
||||
spacing: 0
|
||||
|
||||
ItemDelegate {
|
||||
Layout.preferredWidth: 48
|
||||
Layout.preferredHeight: 48
|
||||
|
||||
contentItem: MaterialIcon { icon: "\ue226" }
|
||||
|
||||
onClicked: currentRoom.chooseAndUploadFile()
|
||||
}
|
||||
|
||||
ScrollView {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 48
|
||||
|
||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||
|
||||
clip: true
|
||||
|
||||
TextArea {
|
||||
property real progress: 0
|
||||
|
||||
id: inputField
|
||||
|
||||
wrapMode: Text.Wrap
|
||||
placeholderText: "Send a Message"
|
||||
leftPadding: 16
|
||||
topPadding: 0
|
||||
bottomPadding: 0
|
||||
selectByMouse: true
|
||||
verticalAlignment: TextEdit.AlignVCenter
|
||||
|
||||
text: currentRoom ? currentRoom.cachedInput : ""
|
||||
|
||||
background: Item {}
|
||||
|
||||
onTextChanged: {
|
||||
timeoutTimer.restart()
|
||||
repeatTimer.start()
|
||||
currentRoom.cachedInput = text
|
||||
}
|
||||
|
||||
ToolTip.visible: currentRoom && currentRoom.hasUsersTyping
|
||||
ToolTip.text: currentRoom ? currentRoom.usersTyping : ""
|
||||
|
||||
Keys.onReturnPressed: {
|
||||
if (event.modifiers & Qt.ShiftModifier) {
|
||||
inputField.insert(inputField.cursorPosition, "\n")
|
||||
} else {
|
||||
inputField.postMessage(inputField.text)
|
||||
inputField.text = ""
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
function postMessage(text) {
|
||||
if (text.trim().length === 0) { return }
|
||||
if(!currentRoom) { return }
|
||||
|
||||
var PREFIX_ME = '/me '
|
||||
var PREFIX_NOTICE = '/notice '
|
||||
var PREFIX_RAINBOW = '/rainbow '
|
||||
var PREFIX_HTML = '/html '
|
||||
var PREFIX_MARKDOWN = '/md '
|
||||
|
||||
var replyRe = new RegExp("^> <(.*)><(.*)> (.*)\n\n(.*)")
|
||||
if (text.match(replyRe)) {
|
||||
var matches = text.match(replyRe)
|
||||
currentRoom.sendReply(matches[1], matches[2], matches[3], matches[4])
|
||||
return
|
||||
}
|
||||
|
||||
if (text.indexOf(PREFIX_ME) === 0) {
|
||||
text = text.substr(PREFIX_ME.length)
|
||||
currentRoom.postMessage(text, RoomMessageEvent.Emote)
|
||||
return
|
||||
}
|
||||
if (text.indexOf(PREFIX_NOTICE) === 0) {
|
||||
text = text.substr(PREFIX_NOTICE.length)
|
||||
currentRoom.postMessage(text, RoomMessageEvent.Notice)
|
||||
return
|
||||
}
|
||||
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)
|
||||
return
|
||||
}
|
||||
if (text.indexOf(PREFIX_HTML) === 0) {
|
||||
text = text.substr(PREFIX_HTML.length)
|
||||
var re = new RegExp("<.*?>")
|
||||
var plainText = text.replace(re, "")
|
||||
currentRoom.postHtmlMessage(plainText, text, RoomMessageEvent.Text)
|
||||
return
|
||||
}
|
||||
if (text.indexOf(PREFIX_MARKDOWN) === 0) {
|
||||
text = text.substr(PREFIX_MARKDOWN.length)
|
||||
var parsedText = Markdown.markdown_parser(text)
|
||||
currentRoom.postHtmlMessage(text, parsedText, RoomMessageEvent.Text)
|
||||
return
|
||||
}
|
||||
|
||||
currentRoom.postPlainText(text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ItemDelegate {
|
||||
Layout.preferredWidth: 48
|
||||
Layout.preferredHeight: 48
|
||||
|
||||
id: emojiButton
|
||||
|
||||
contentItem: MaterialIcon { icon: "\ue24e" }
|
||||
|
||||
onClicked: emojiPicker.visible ? emojiPicker.close() : emojiPicker.open()
|
||||
|
||||
EmojiPicker {
|
||||
x: window.width - 370
|
||||
y: window.height - 400
|
||||
|
||||
width: 360
|
||||
height: 320
|
||||
|
||||
id: emojiPicker
|
||||
|
||||
parent: ApplicationWindow.overlay
|
||||
|
||||
Material.elevation: 2
|
||||
|
||||
textArea: inputField
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,263 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtQuick.Controls.Material 2.2
|
||||
import QtQml.Models 2.3
|
||||
import Spectral 0.1
|
||||
import SortFilterProxyModel 0.2
|
||||
import Spectral.Settings 0.1
|
||||
|
||||
import "../component"
|
||||
import "../menu"
|
||||
import "qrc:/js/util.js" as Util
|
||||
|
||||
Rectangle {
|
||||
property alias listModel: sortedRoomListModel.sourceModel
|
||||
property int filter: 0
|
||||
property var enteredRoom: null
|
||||
|
||||
color: MSettings.darkTheme ? "#323232" : "#f3f3f3"
|
||||
|
||||
Label {
|
||||
text: MSettings.miniMode ? "Empty" : "Here? No, not here."
|
||||
anchors.centerIn: parent
|
||||
visible: listView.count === 0
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
spacing: 0
|
||||
|
||||
TextField {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 40
|
||||
Layout.margins: 12
|
||||
|
||||
id: searchField
|
||||
|
||||
leftPadding: MSettings.miniMode ? 4 : 32
|
||||
topPadding: 0
|
||||
bottomPadding: 0
|
||||
placeholderText: "Search..."
|
||||
|
||||
background: Rectangle {
|
||||
color: MSettings.darkTheme ? "#303030" : "#fafafa"
|
||||
layer.enabled: true
|
||||
layer.effect: ElevationEffect {
|
||||
elevation: searchField.focus ? 2 : 1
|
||||
}
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
sequence: StandardKey.Find
|
||||
onActivated: searchField.forceActiveFocus()
|
||||
}
|
||||
}
|
||||
|
||||
SortFilterProxyModel {
|
||||
id: sortedRoomListModel
|
||||
|
||||
proxyRoles: ExpressionRole {
|
||||
name: "display"
|
||||
expression: {
|
||||
switch (category) {
|
||||
case 1: return "Invited"
|
||||
case 2: return "Favorites"
|
||||
case 3: return "Rooms"
|
||||
case 4: return "People"
|
||||
case 5: return "Low Priority"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sorters: [
|
||||
RoleSorter { roleName: "category" },
|
||||
RoleSorter {
|
||||
roleName: "lastActiveTime"
|
||||
sortOrder: Qt.DescendingOrder
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
SortFilterProxyModel {
|
||||
id: roomListProxyModel
|
||||
|
||||
sourceModel: sortedRoomListModel
|
||||
|
||||
filters: [
|
||||
RegExpFilter {
|
||||
roleName: "name"
|
||||
pattern: searchField.text
|
||||
caseSensitivity: Qt.CaseInsensitive
|
||||
},
|
||||
ExpressionFilter {
|
||||
enabled: filter === 1
|
||||
expression: unreadCount > 0
|
||||
},
|
||||
ExpressionFilter {
|
||||
enabled: filter === 2
|
||||
expression: category === 1 || category === 2 || category === 4
|
||||
},
|
||||
ExpressionFilter {
|
||||
enabled: filter === 3
|
||||
expression: category === 3 || category === 5
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
ListView {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
id: listView
|
||||
|
||||
spacing: 1
|
||||
clip: true
|
||||
|
||||
model: roomListProxyModel
|
||||
|
||||
currentIndex: -1
|
||||
|
||||
highlightFollowsCurrentItem: true
|
||||
|
||||
highlightMoveDuration: 200
|
||||
highlightResizeDuration: 0
|
||||
|
||||
boundsBehavior: Flickable.DragOverBounds
|
||||
|
||||
ScrollBar.vertical: ScrollBar {}
|
||||
|
||||
delegate: Rectangle {
|
||||
readonly property bool highlighted: currentRoom === enteredRoom
|
||||
|
||||
width: parent.width
|
||||
height: 64
|
||||
|
||||
color: MSettings.darkTheme ? "#303030" : "#fafafa"
|
||||
|
||||
AutoMouseArea {
|
||||
anchors.fill: parent
|
||||
|
||||
hoverEnabled: MSettings.miniMode
|
||||
|
||||
onSecondaryClicked: {
|
||||
roomContextMenu.model = model
|
||||
roomContextMenu.popup()
|
||||
}
|
||||
onPrimaryClicked: {
|
||||
if (category === RoomType.Invited) {
|
||||
inviteDialog.currentRoom = currentRoom
|
||||
inviteDialog.open()
|
||||
} else {
|
||||
enteredRoom = currentRoom
|
||||
}
|
||||
}
|
||||
|
||||
ToolTip.visible: MSettings.miniMode && containsMouse
|
||||
ToolTip.text: name
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
|
||||
visible: highlightCount > 0 || highlighted
|
||||
color: Material.accent
|
||||
opacity: 0.1
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: unreadCount > 0 || highlighted ? 4 : 0
|
||||
height: parent.height
|
||||
|
||||
color: Material.accent
|
||||
|
||||
Behavior on width {
|
||||
PropertyAnimation { easing.type: Easing.InOutCubic; duration: 200 }
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 12
|
||||
|
||||
spacing: 12
|
||||
|
||||
ImageItem {
|
||||
id: imageItem
|
||||
|
||||
Layout.preferredWidth: height
|
||||
Layout.fillHeight: true
|
||||
|
||||
hint: name || "No Name"
|
||||
|
||||
image: avatar
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
visible: parent.width > 64
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
text: name || "No Name"
|
||||
font.pointSize: 12
|
||||
elide: Text.ElideRight
|
||||
wrapMode: Text.NoWrap
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
text: (lastEvent == "" ? topic : lastEvent).replace(/(\r\n\t|\n|\r\t)/gm,"")
|
||||
elide: Text.ElideRight
|
||||
wrapMode: Text.NoWrap
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
section.property: "display"
|
||||
section.criteria: ViewSection.FullString
|
||||
section.delegate: Label {
|
||||
width: parent.width
|
||||
height: 24
|
||||
|
||||
text: section
|
||||
color: "grey"
|
||||
leftPadding: MSettings.miniMode ? undefined : 16
|
||||
elide: Text.ElideRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: MSettings.miniMode ? Text.AlignHCenter : undefined
|
||||
}
|
||||
|
||||
RoomContextMenu { id: roomContextMenu }
|
||||
|
||||
Dialog {
|
||||
property var currentRoom
|
||||
|
||||
id: inviteDialog
|
||||
parent: ApplicationWindow.overlay
|
||||
|
||||
x: (window.width - width) / 2
|
||||
y: (window.height - height) / 2
|
||||
width: 360
|
||||
|
||||
title: "Action Required"
|
||||
modal: true
|
||||
standardButtons: Dialog.Ok | Dialog.Cancel
|
||||
|
||||
contentItem: Label { text: "Accept this invitation?" }
|
||||
|
||||
onAccepted: currentRoom.acceptInvitation()
|
||||
onRejected: currentRoom.forget()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
qml/main.qml
13
qml/main.qml
@@ -3,12 +3,13 @@ import QtQuick.Controls 2.2
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Controls.Material 2.2
|
||||
import Qt.labs.settings 1.0
|
||||
import QtGraphicalEffects 1.0
|
||||
import Spectral 0.1
|
||||
import Spectral.Settings 0.1
|
||||
|
||||
import "component"
|
||||
import "form"
|
||||
import Spectral.Component 2.0
|
||||
import Spectral.Page 2.0
|
||||
|
||||
import Spectral 0.1
|
||||
import Spectral.Setting 0.1
|
||||
|
||||
import "qrc:/js/util.js" as Util
|
||||
|
||||
ApplicationWindow {
|
||||
@@ -28,8 +29,6 @@ ApplicationWindow {
|
||||
|
||||
Material.accent: spectralController.color(currentConnection ? currentConnection.localUserId : "")
|
||||
|
||||
FontLoader { id: materialFont; source: "qrc:/asset/font/material.ttf" }
|
||||
|
||||
Controller {
|
||||
id: spectralController
|
||||
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
|
||||
Menu {
|
||||
property var row: null
|
||||
property var model: null
|
||||
property string selectedText
|
||||
|
||||
readonly property bool isFile: model && (model.eventType === "video" || model.eventType === "audio" || model.eventType === "file" || model.eventType === "image")
|
||||
|
||||
id: messageContextMenu
|
||||
|
||||
MenuItem {
|
||||
text: "View Source"
|
||||
|
||||
onTriggered: {
|
||||
sourceDialog.sourceText = model.toolTip
|
||||
sourceDialog.open()
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
visible: model && model.userMarker.length > 0
|
||||
height: visible ? undefined : 0
|
||||
text: "View Receipts"
|
||||
|
||||
onTriggered: {
|
||||
readMarkerDialog.listModel = model.userMarker
|
||||
readMarkerDialog.open()
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
visible: isFile
|
||||
height: visible ? undefined : 0
|
||||
text: "Open Externally"
|
||||
|
||||
onTriggered: row.openExternally()
|
||||
}
|
||||
MenuItem {
|
||||
visible: isFile
|
||||
height: visible ? undefined : 0
|
||||
text: "Save As"
|
||||
|
||||
onTriggered: row.saveFileAs()
|
||||
}
|
||||
MenuItem {
|
||||
visible: model && model.author !== currentRoom.localUser
|
||||
height: visible ? undefined : 0
|
||||
text: "Reply"
|
||||
|
||||
onTriggered: {
|
||||
inputField.clear()
|
||||
inputField.insert(0, "> <" + model.author.id + "><" + model.eventId + "> " + (selectedText != "" ? selectedText : model.message) + "\n\n")
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
visible: model && model.author === currentRoom.localUser
|
||||
height: visible ? undefined : 0
|
||||
text: "Redact"
|
||||
|
||||
onTriggered: currentRoom.redactEvent(model.eventId)
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import Spectral 0.1
|
||||
|
||||
Menu {
|
||||
property var model: null
|
||||
|
||||
id: roomListMenu
|
||||
|
||||
MenuItem {
|
||||
text: "Favourite"
|
||||
checkable: true
|
||||
checked: model && model.category === RoomType.Favorite
|
||||
|
||||
onTriggered: model.category === RoomType.Favorite ? model.currentRoom.removeTag("m.favourite") : model.currentRoom.addTag("m.favourite", "1")
|
||||
}
|
||||
MenuItem {
|
||||
text: "Deprioritize"
|
||||
checkable: true
|
||||
checked: model && model.category === RoomType.Deprioritized
|
||||
|
||||
onTriggered: model.category === RoomType.Deprioritized ? model.currentRoom.removeTag("m.lowpriority") : model.currentRoom.addTag("m.lowpriority", "1")
|
||||
}
|
||||
MenuSeparator {}
|
||||
MenuItem {
|
||||
text: "Mark as Read"
|
||||
|
||||
onTriggered: model.currentRoom.markAllMessagesAsRead()
|
||||
}
|
||||
MenuItem {
|
||||
text: "Leave Room"
|
||||
|
||||
onTriggered: model.currentRoom.forget()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user