2019-04-12 18:33:09 +10:00
|
|
|
# Copyright 2019 miruka
|
|
|
|
# This file is part of harmonyqml, licensed under GPLv3.
|
|
|
|
|
2019-04-18 07:07:20 +10:00
|
|
|
from typing import Deque
|
|
|
|
|
2019-04-23 01:37:41 +10:00
|
|
|
from PyQt5.QtCore import QObject, pyqtProperty
|
2019-04-12 18:33:09 +10:00
|
|
|
|
2019-04-13 03:18:46 +10:00
|
|
|
from .list_model import ListModel
|
|
|
|
from .list_model_map import ListModelMap
|
2019-04-12 18:33:09 +10:00
|
|
|
|
|
|
|
|
|
|
|
class QMLModels(QObject):
|
2019-04-23 04:24:45 +10:00
|
|
|
def __init__(self, parent: QObject) -> None:
|
|
|
|
super().__init__(parent)
|
|
|
|
self._accounts: ListModel = ListModel(parent)
|
|
|
|
self._rooms: ListModelMap = ListModelMap(parent)
|
|
|
|
self._room_events: ListModelMap = ListModelMap(parent,
|
|
|
|
models_container=Deque)
|
2019-04-12 18:33:09 +10:00
|
|
|
|
|
|
|
|
2019-04-13 03:18:46 +10:00
|
|
|
@pyqtProperty(ListModel, constant=True)
|
|
|
|
def accounts(self):
|
|
|
|
return self._accounts
|
2019-04-12 18:33:09 +10:00
|
|
|
|
|
|
|
|
2019-04-23 01:37:41 +10:00
|
|
|
@pyqtProperty("QVariant", constant=True)
|
2019-04-13 03:18:46 +10:00
|
|
|
def rooms(self):
|
|
|
|
return self._rooms
|
2019-04-12 18:33:09 +10:00
|
|
|
|
|
|
|
|
2019-04-13 03:18:46 +10:00
|
|
|
@pyqtProperty("QVariant", constant=True)
|
2019-04-15 02:56:30 +10:00
|
|
|
def roomEvents(self):
|
|
|
|
return self._room_events
|