A lot of improvements.
Fix laggish RoomListView when dragging. Remove per-room timer and add timer in RoomForm. Remove singleton module and use file as singleton. Minor UI tweak in RoomListView. Pass room to RoomListView via "currentRoom" delegate property and remove RoomListForm-wide currentRoom. Put menu files in a separate folder. Show initial image in ImageStatus when avatar is not loaded. Add about page. Merge all setting pages into Setting.qml. Add option to rearrange rooms by activity. Add option to use RichText parser. Add document url.
This commit is contained in:
@@ -5,13 +5,16 @@ import QtQuick.Layouts 1.3
|
||||
import QtQuick.Controls.Material 2.2
|
||||
import QtGraphicalEffects 1.0
|
||||
import Matrique 0.1
|
||||
import Matrique.Settings 0.1
|
||||
|
||||
import "qrc:/qml/component"
|
||||
import "qrc:/js/md.js" as Markdown
|
||||
|
||||
Item {
|
||||
id: item
|
||||
property var currentRoom: null
|
||||
|
||||
id: item
|
||||
|
||||
Drawer {
|
||||
id: roomDrawer
|
||||
|
||||
@@ -114,7 +117,7 @@ Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 80
|
||||
|
||||
color: Material.theme == Material.Light ? "#eaeaea" : "#242424"
|
||||
color: MSettings.darkTheme ? "#242424" : "#eaeaea"
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
@@ -185,7 +188,7 @@ Item {
|
||||
|
||||
boundsBehavior: Flickable.DragOverBounds
|
||||
|
||||
model: MessageEventModel{
|
||||
model: MessageEventModel {
|
||||
id: messageEventModel
|
||||
room: currentRoom
|
||||
}
|
||||
@@ -293,6 +296,26 @@ Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 80
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
spacing: 0
|
||||
@@ -320,7 +343,8 @@ Item {
|
||||
|
||||
text: currentRoom ? currentRoom.cachedInput : ""
|
||||
onTextChanged: {
|
||||
currentRoom.isTyping = true
|
||||
timeoutTimer.restart()
|
||||
repeatTimer.start()
|
||||
currentRoom.cachedInput = text
|
||||
}
|
||||
|
||||
@@ -332,7 +356,7 @@ Item {
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
color: Material.theme == Material.Light ? "#eaeaea" : "#242424"
|
||||
color: MSettings.darkTheme ? "#242424" : "#eaeaea"
|
||||
}
|
||||
|
||||
ToolTip.visible: currentRoom && currentRoom.hasUsersTyping
|
||||
@@ -395,7 +419,7 @@ Item {
|
||||
|
||||
contentItem: MaterialIcon { icon: "\ue24e" }
|
||||
|
||||
background: Rectangle { color: Material.theme == Material.Light ? "#eaeaea" : "#242424" }
|
||||
background: Rectangle { color: MSettings.darkTheme ? "#242424" : "#eaeaea" }
|
||||
|
||||
onClicked: emojiPicker.visible ? emojiPicker.close() : emojiPicker.open()
|
||||
|
||||
@@ -417,4 +441,6 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onCurrentRoomChanged: if (currentRoom && currentRoom.timelineSize === 0) currentRoom.getPreviousContent(20)
|
||||
}
|
||||
|
||||
@@ -6,17 +6,13 @@ import QtQuick.Controls.Material 2.2
|
||||
import QtQml.Models 2.3
|
||||
import Matrique 0.1
|
||||
import SortFilterProxyModel 0.2
|
||||
import MatriqueSettings 0.1
|
||||
import Matrique.Settings 0.1
|
||||
|
||||
import "qrc:/qml/component"
|
||||
|
||||
Item {
|
||||
property alias listModel: roomListProxyModel.sourceModel
|
||||
property alias rawCurrentIndex: listView.currentIndex
|
||||
readonly property int currentIndex: roomListProxyModel.mapToSource(listView.currentIndex)
|
||||
readonly property var currentRoom: currentIndex != -1 ? listModel.roomAt(currentIndex) : null
|
||||
readonly property bool mini: MatriqueSettings.miniMode // Used as an indicator of whether the listform should be displayed as "Mini mode".
|
||||
signal enterRoom()
|
||||
property var enteredRoom: null
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
@@ -33,7 +29,7 @@ Item {
|
||||
width: parent.width - 18
|
||||
height: 36
|
||||
color: "white"
|
||||
leftPadding: mini ? 4 : 32
|
||||
leftPadding: MSettings.miniMode ? 4 : 32
|
||||
topPadding: 0
|
||||
bottomPadding: 0
|
||||
anchors.centerIn: parent
|
||||
@@ -45,13 +41,13 @@ Item {
|
||||
icon: "\ue8b6"
|
||||
color: "white"
|
||||
|
||||
width: mini ? parent.width : parent.height
|
||||
width: MSettings.miniMode ? parent.width : parent.height
|
||||
height: parent.height
|
||||
}
|
||||
|
||||
Label {
|
||||
height: parent.height
|
||||
visible: !mini
|
||||
visible: !MSettings.miniMode
|
||||
text: "Search"
|
||||
color: "white"
|
||||
font.pointSize: 12
|
||||
@@ -66,11 +62,11 @@ Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
color: Material.theme == Material.Light ? "#eaeaea" : "#242424"
|
||||
color: MSettings.darkTheme ? "#242424" : "#eaeaea"
|
||||
|
||||
Label {
|
||||
z: 10
|
||||
text: mini ? "Empty" : "Here? No, not here."
|
||||
text: MSettings.miniMode ? "Empty" : "Here? No, not here."
|
||||
anchors.centerIn: parent
|
||||
visible: listView.count === 0
|
||||
}
|
||||
@@ -98,6 +94,7 @@ Item {
|
||||
sorters: [
|
||||
RoleSorter { roleName: "category" },
|
||||
RoleSorter {
|
||||
enabled: MSettings.rearrangeByActivity
|
||||
roleName: "unreadCount"
|
||||
sortOrder: Qt.DescendingOrder
|
||||
},
|
||||
@@ -111,34 +108,26 @@ Item {
|
||||
|
||||
model: roomListProxyModel
|
||||
|
||||
highlight: Rectangle {
|
||||
color: Material.accent
|
||||
opacity: 0.2
|
||||
}
|
||||
highlightMoveDuration: 250
|
||||
highlightResizeDuration: 0
|
||||
|
||||
currentIndex: -1
|
||||
|
||||
boundsBehavior: Flickable.DragOverBounds
|
||||
|
||||
ScrollBar.vertical: ScrollBar { id: scrollBar }
|
||||
|
||||
delegate: Item {
|
||||
delegate: Rectangle {
|
||||
id: swipeDelegate
|
||||
width: parent.width
|
||||
height: 80
|
||||
|
||||
color: currentRoom === enteredRoom ? Material.background : "transparent"
|
||||
|
||||
AutoMouseArea {
|
||||
anchors.fill: parent
|
||||
|
||||
onPressed: listView.currentIndex = index
|
||||
onSecondaryClicked: roomListMenu.popup()
|
||||
onPrimaryClicked: category === RoomType.Invited ? inviteDialog.open() : enterRoom()
|
||||
onSecondaryClicked: Qt.createComponent("qrc:/qml/menu/RoomContextMenu.qml").createObject(this)
|
||||
onPrimaryClicked: category === RoomType.Invited ? inviteDialog.open() : enteredRoom = currentRoom
|
||||
}
|
||||
|
||||
ToolTip.visible: mini && hovered
|
||||
ToolTip.text: name
|
||||
|
||||
Rectangle {
|
||||
width: 4
|
||||
height: parent.height
|
||||
@@ -186,6 +175,9 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ToolTip.visible: MSettings.miniMode && hovered
|
||||
ToolTip.text: name
|
||||
}
|
||||
|
||||
section.property: "display"
|
||||
@@ -195,13 +187,13 @@ Item {
|
||||
height: 24
|
||||
text: section
|
||||
color: "grey"
|
||||
leftPadding: mini ? undefined : 16
|
||||
leftPadding: MSettings.miniMode ? undefined : 16
|
||||
elide: Text.ElideRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: mini ? Text.AlignHCenter : undefined
|
||||
horizontalAlignment: MSettings.miniMode ? Text.AlignHCenter : undefined
|
||||
background: Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Material.theme == Material.Light ? "#dbdbdb" : "#363636"
|
||||
color: MSettings.darkTheme ? "#363636" : "#dbdbdb"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,32 +214,6 @@ Item {
|
||||
onAccepted: currentRoom.acceptInvitation()
|
||||
onRejected: currentRoom.forget()
|
||||
}
|
||||
|
||||
Menu {
|
||||
id: roomListMenu
|
||||
|
||||
MenuItem {
|
||||
text: "Favourite"
|
||||
checkable: true
|
||||
checked: currentRoom && currentRoom.isFavourite
|
||||
onTriggered: currentRoom.isFavourite ? currentRoom.removeTag("m.favourite") : currentRoom.addTag("m.favourite", "1")
|
||||
}
|
||||
MenuItem {
|
||||
text: "Deprioritize"
|
||||
checkable: true
|
||||
checked: currentRoom && currentRoom.isLowPriority
|
||||
onTriggered: currentRoom.isLowPriority ? currentRoom.removeTag("m.lowpriority") : currentRoom.addTag("m.lowpriority", "1")
|
||||
}
|
||||
MenuSeparator {}
|
||||
MenuItem {
|
||||
text: "Mark as Read"
|
||||
onTriggered: currentRoom.markAllMessagesAsRead()
|
||||
}
|
||||
MenuItem {
|
||||
text: "Leave Room"
|
||||
onTriggered: currentRoom.forget()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
import "qrc:/qml/component"
|
||||
|
||||
Page {
|
||||
padding: 64
|
||||
|
||||
ColumnLayout {
|
||||
RowLayout {
|
||||
Layout.preferredHeight: 60
|
||||
|
||||
ImageStatus {
|
||||
Layout.preferredWidth: height
|
||||
Layout.fillHeight: true
|
||||
|
||||
source: matriqueController.isLogin ? connection.localUser && connection.localUser.avatarUrl ? "image://mxc/" + connection.localUser.avatarUrl : "" : "qrc:/asset/img/avatar.png"
|
||||
displayText: matriqueController.isLogin && connection.localUser.displayName ? connection.localUser.displayName : "N"
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
Label {
|
||||
font.pointSize: 18
|
||||
text: matriqueController.isLogin ? connection.localUser.displayName : ""
|
||||
}
|
||||
|
||||
Label {
|
||||
font.pointSize: 12
|
||||
text: matriqueController.isLogin ? connection.localUser.id : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
text: "Logout"
|
||||
highlighted: true
|
||||
|
||||
onClicked: {
|
||||
matriqueController.logout()
|
||||
Qt.quit()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import MatriqueSettings 0.1
|
||||
|
||||
Page {
|
||||
Column {
|
||||
Switch {
|
||||
id: themeSwitch
|
||||
text: "Dark theme"
|
||||
checked: MatriqueSettings.darkTheme
|
||||
onCheckedChanged: MatriqueSettings.darkTheme = checked
|
||||
}
|
||||
|
||||
Switch {
|
||||
id: miniModeSwitch
|
||||
text: "Mini Room List"
|
||||
checked: MatriqueSettings.miniMode
|
||||
onCheckedChanged: MatriqueSettings.miniMode = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import MatriqueSettings 0.1
|
||||
|
||||
Page {
|
||||
Column {
|
||||
Switch {
|
||||
id: lazyLoadSwitch
|
||||
text: "Lazy load at initial sync"
|
||||
checked: MatriqueSettings.lazyLoad
|
||||
onCheckedChanged: MatriqueSettings.lazyLoad = checked
|
||||
}
|
||||
Switch {
|
||||
id: asyncMessageDelegateSwitch
|
||||
text: "Force loading message delegates asynchronously"
|
||||
checked: MatriqueSettings.asyncMessageDelegate
|
||||
onCheckedChanged: MatriqueSettings.asyncMessageDelegate = checked
|
||||
}
|
||||
Switch {
|
||||
id: richTextSwitch
|
||||
text: "Use RichText instead of StyledText"
|
||||
checked: MatriqueSettings.richText
|
||||
onCheckedChanged: MatriqueSettings.richText = checked
|
||||
}
|
||||
Switch {
|
||||
id: pressAndHoldSwitch
|
||||
text: "Use press and hold instead of right click"
|
||||
checked: MatriqueSettings.pressAndHold
|
||||
onCheckedChanged: MatriqueSettings.pressAndHold = checked
|
||||
}
|
||||
|
||||
Button {
|
||||
text: "Invoke GC"
|
||||
highlighted: true
|
||||
onClicked: gc()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user