Files
neochat/imports/NeoChat/RoomManager.qml
2020-11-10 17:08:13 +00:00

41 lines
777 B
QML

/**
* SPDX-FileCopyrightText: 2020 Carl Schwan <carl@carlschwan.eu>
*
* SPDX-LicenseIdentifier: GPL-2.0-or-later
*/
pragma Singleton
import QtQuick 2.14
import NeoChat.Page 2.0
/**
* Manage opening and close rooms
*/
Item {
id: openRoomAction
property var currentRoom: null
property var pageStack: null
readonly property bool hasOpenRoom: currentRoom != null
signal leaveRoom(string room);
signal openRoom(string room);
function enterRoom(room) {
if (currentRoom != null) {
currentRoom = null;
pageStack.removePage(pageStack.lastItem);
}
pageStack.push(roomPage, {"currentRoom": room});
currentRoom = room;
}
Component {
id: roomPage
RoomPage {}
}
}