Code cleanup && speed up initial sync.
This commit is contained in:
parent
bca88c17b5
commit
5e3f18e320
|
@ -15,7 +15,7 @@ Page {
|
||||||
|
|
||||||
connection: page.connection
|
connection: page.connection
|
||||||
|
|
||||||
onNewMessage: trayIcon.showMessage("New message", "New message for room " + room.displayName)
|
// onNewMessage: trayIcon.showMessage("New message", "New message for room " + room.displayName)
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
|
|
@ -26,17 +26,6 @@ AvatarContainer {
|
||||||
z: -4
|
z: -4
|
||||||
sourceSize.width: 128
|
sourceSize.width: 128
|
||||||
source: "image://mxc/" + (content.thumbnail_url ? content.thumbnail_url : content.url)
|
source: "image://mxc/" + (content.thumbnail_url ? content.thumbnail_url : content.url)
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
hoverEnabled: true
|
|
||||||
propagateComposedEvents: true
|
|
||||||
ToolTip.visible: containsMouse
|
|
||||||
ToolTip.text: content.body
|
|
||||||
|
|
||||||
onClicked: downloadable.downloadAndOpen()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
import QtQuick 2.9
|
||||||
|
import QtQuick.Controls 2.2
|
||||||
|
|
||||||
|
Menu {
|
||||||
|
MenuItem {
|
||||||
|
text: "Copy"
|
||||||
|
onTriggered: matriqueController.copyToClipboard(plainText)
|
||||||
|
}
|
||||||
|
MenuItem {
|
||||||
|
text: "Copy Source"
|
||||||
|
onTriggered: matriqueController.copyToClipboard(toolTip)
|
||||||
|
}
|
||||||
|
MenuItem {
|
||||||
|
visible: isFile
|
||||||
|
height: visible ? undefined : 0
|
||||||
|
text: "Open Externally"
|
||||||
|
onTriggered: delegateLoader.item.downloadAndOpen()
|
||||||
|
}
|
||||||
|
MenuItem {
|
||||||
|
visible: isFile
|
||||||
|
height: visible ? undefined : 0
|
||||||
|
text: "Save As"
|
||||||
|
onTriggered: delegateLoader.item.saveFileAs()
|
||||||
|
}
|
||||||
|
MenuItem {
|
||||||
|
visible: sentByMe
|
||||||
|
height: visible ? undefined : 0
|
||||||
|
text: "Redact"
|
||||||
|
onTriggered: currentRoom.redactEvent(eventId)
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: popup()
|
||||||
|
}
|
|
@ -25,43 +25,7 @@ Item {
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onPressAndHold: menuComponent.createObject(this)
|
onPressAndHold: Qt.createComponent("MessageContextMenu.qml").createObject(this)
|
||||||
|
|
||||||
Component {
|
|
||||||
id: menuComponent
|
|
||||||
Menu {
|
|
||||||
id: messageContextMenu
|
|
||||||
|
|
||||||
MenuItem {
|
|
||||||
text: "Copy"
|
|
||||||
onTriggered: matriqueController.copyToClipboard(plainText)
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
text: "Copy Source"
|
|
||||||
onTriggered: matriqueController.copyToClipboard(toolTip)
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
visible: isFile
|
|
||||||
height: visible ? undefined : 0
|
|
||||||
text: "Open Externally"
|
|
||||||
onTriggered: delegateLoader.item.downloadAndOpen()
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
visible: isFile
|
|
||||||
height: visible ? undefined : 0
|
|
||||||
text: "Save As"
|
|
||||||
onTriggered: delegateLoader.item.saveFileAs()
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
visible: sentByMe
|
|
||||||
height: visible ? undefined : 0
|
|
||||||
text: "Redact"
|
|
||||||
onTriggered: currentRoom.redactEvent(eventId)
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: popup()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
|
|
|
@ -139,7 +139,7 @@ Item {
|
||||||
height: 80
|
height: 80
|
||||||
onPressed: listView.currentIndex = index
|
onPressed: listView.currentIndex = index
|
||||||
onClicked: enterRoom()
|
onClicked: enterRoom()
|
||||||
onPressAndHold: menuComponent.createObject(this)
|
onPressAndHold: roomListMenu.popup()
|
||||||
|
|
||||||
ToolTip.visible: mini && hovered
|
ToolTip.visible: mini && hovered
|
||||||
ToolTip.text: name
|
ToolTip.text: name
|
||||||
|
@ -191,37 +191,6 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
|
||||||
id: menuComponent
|
|
||||||
Menu {
|
|
||||||
id: roomListMenu
|
|
||||||
|
|
||||||
MenuItem {
|
|
||||||
text: "Favourite"
|
|
||||||
checkable: true
|
|
||||||
checked: currentRoom.isFavourite
|
|
||||||
onTriggered: currentRoom.isFavourite ? currentRoom.removeTag("m.favourite") : currentRoom.addTag("m.favourite", "1")
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
text: "Deprioritize"
|
|
||||||
checkable: true
|
|
||||||
checked: 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: matriqueController.forgetRoom(currentRoom.id)
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: popup()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
section.property: "category"
|
section.property: "category"
|
||||||
|
@ -240,7 +209,35 @@ Item {
|
||||||
color: Material.theme == Material.Light ? "#dbdbdb" : "#363636"
|
color: Material.theme == Material.Light ? "#dbdbdb" : "#363636"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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: matriqueController.forgetRoom(currentRoom.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onCurrentRoomChanged: if (currentRoom && !currentRoom.timelineSize) currentRoom.getPreviousContent(50)
|
||||||
|
}
|
||||||
|
|
21
qml/main.qml
21
qml/main.qml
|
@ -42,18 +42,6 @@ ApplicationWindow {
|
||||||
visible: true
|
visible: true
|
||||||
iconSource: "qrc:/asset/img/icon.png"
|
iconSource: "qrc:/asset/img/icon.png"
|
||||||
|
|
||||||
menu: Platform.Menu {
|
|
||||||
MenuItem {
|
|
||||||
text: "Hide/Show"
|
|
||||||
onTriggered: window.active ? window.hide() : raiseWindow()
|
|
||||||
}
|
|
||||||
|
|
||||||
MenuItem {
|
|
||||||
text: "Quit"
|
|
||||||
onTriggered: Qt.quit()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onActivated: window.active ? window.hide() : raiseWindow()
|
onActivated: window.active ? window.hide() : raiseWindow()
|
||||||
|
|
||||||
function raiseWindow() {
|
function raiseWindow() {
|
||||||
|
@ -65,10 +53,6 @@ ApplicationWindow {
|
||||||
|
|
||||||
Controller {
|
Controller {
|
||||||
id: matriqueController
|
id: matriqueController
|
||||||
onErrorOccured: {
|
|
||||||
errorDialog.text = err;
|
|
||||||
errorDialog.open();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Popup {
|
Popup {
|
||||||
|
@ -85,10 +69,7 @@ ApplicationWindow {
|
||||||
|
|
||||||
BusyIndicator { running: true }
|
BusyIndicator { running: true }
|
||||||
|
|
||||||
onBusyChanged: {
|
onBusyChanged: busyPopup.busy ? busyPopup.open() : busyPopup.close()
|
||||||
if(busyPopup.busy) { busyPopup.open(); }
|
|
||||||
else { busyPopup.close(); }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
|
|
1
res.qrc
1
res.qrc
|
@ -30,5 +30,6 @@
|
||||||
<file>qml/form/SettingAccountForm.qml</file>
|
<file>qml/form/SettingAccountForm.qml</file>
|
||||||
<file>qml/form/SettingAppearanceForm.qml</file>
|
<file>qml/form/SettingAppearanceForm.qml</file>
|
||||||
<file>qml/component/TextDelegate.qml</file>
|
<file>qml/component/TextDelegate.qml</file>
|
||||||
|
<file>qml/component/MessageContextMenu.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -42,7 +42,6 @@ void RoomListModel::doAddRoom(Room* r) {
|
||||||
if (auto* room = r) {
|
if (auto* room = r) {
|
||||||
m_rooms.append(room);
|
m_rooms.append(room);
|
||||||
connectRoomSignals(room);
|
connectRoomSignals(room);
|
||||||
if (room->timelineSize() == 0) room->getPreviousContent(50);
|
|
||||||
} else {
|
} else {
|
||||||
qCritical() << "Attempt to add nullptr to the room list";
|
qCritical() << "Attempt to add nullptr to the room list";
|
||||||
Q_ASSERT(false);
|
Q_ASSERT(false);
|
||||||
|
|
Loading…
Reference in New Issue