diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2022-05-06 00:36:38 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2022-05-06 00:36:53 +0200 |
commit | b75ef07896b83dc50a11a7af525bff381d50b565 (patch) | |
tree | 5573ff6b667c3648454266e5716cf33288b68491 /resources | |
parent | Translated using Weblate (Finnish) (diff) | |
download | nheko-b75ef07896b83dc50a11a7af525bff381d50b565.tar.xz |
Add basic support for multiple windows
Diffstat (limited to 'resources')
-rw-r--r-- | resources/qml/MessageView.qml | 8 | ||||
-rw-r--r-- | resources/qml/RoomList.qml | 49 | ||||
-rw-r--r-- | resources/qml/Root.qml | 2 |
3 files changed, 51 insertions, 8 deletions
diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml index b20a1d88..541d20db 100644 --- a/resources/qml/MessageView.qml +++ b/resources/qml/MessageView.qml @@ -232,13 +232,7 @@ Item { } } - Connections { - function onFocusChanged() { - readTimer.running = TimelineManager.isWindowFocused; - } - - target: TimelineManager - } + Window.onActiveChanged: readTimer.running = Window.active Timer { id: readTimer diff --git a/resources/qml/RoomList.qml b/resources/qml/RoomList.qml index 078baede..d33c562e 100644 --- a/resources/qml/RoomList.qml +++ b/resources/qml/RoomList.qml @@ -64,6 +64,41 @@ Page { target: Rooms } + Component { + id: roomWindowComponent + + ApplicationWindow { + id: roomWindowW + + property var room: null + property var roomPreview: null + + onActiveChanged: if (active) {MainWindow.activeRoom = (room.roomId || roomPreview.roomid)} + + height: 650 + width: 420 + minimumWidth: 150 + minimumHeight: 150 + palette: Nheko.colors + color: Nheko.colors.window + title: room.roomName + modality: Qt.NonModal + flags: Qt.Window | Qt.WindowCloseButtonHint | Qt.WindowTitleHint + + Shortcut { + sequence: StandardKey.Cancel + onActivated: roomWindowW.close() + } + + TimelineView { + anchors.fill: parent + room: roomWindowW.room + roomPreview: roomWindowW.roomPreview.roomid ? roomWindowW.roomPreview : null + } + } + + } + Platform.Menu { id: roomContextMenu @@ -87,6 +122,18 @@ Page { } Platform.MenuItem { + text: qsTr("Open separately") + onTriggered: { + var roomWindow = roomWindowComponent.createObject(null, { + "room": Rooms.getRoomById(roomContextMenu.roomid), + "roomPreview": Rooms.getRoomPreviewById(roomContextMenu.roomid) + }); + roomWindow.showNormal(); + destroyOnClose(roomWindow); + } + } + + Platform.MenuItem { text: qsTr("Leave room") onTriggered: TimelineManager.openLeaveRoomDialog(roomContextMenu.roomid) } @@ -97,7 +144,7 @@ Page { Instantiator { model: Communities.tagsWithDefault - onObjectAdded: roomContextMenu.insertItem(index + 2, object) + onObjectAdded: roomContextMenu.insertItem(index + 3, object) onObjectRemoved: roomContextMenu.removeItem(object) delegate: Platform.MenuItem { diff --git a/resources/qml/Root.qml b/resources/qml/Root.qml index 72f30b7a..92bff0e0 100644 --- a/resources/qml/Root.qml +++ b/resources/qml/Root.qml @@ -25,6 +25,8 @@ Pane { background: null padding: 0 + Window.onActiveChanged: if (Window.active) {MainWindow.activeRoom = Qt.binding(function() { return Rooms.currentRoom.roomId || Rooms.currentRoomPreview.roomid })} + FontMetrics { id: fontMetrics } |