Commit Graph

21 Commits

Author SHA1 Message Date
miruka
25bb082f5a Fix invisible room categories still taking space 2019-05-06 14:20:43 -04:00
miruka
d6714141e0 Update chatPage properly when roomCategory changes 2019-05-06 14:06:28 -04:00
miruka
cdf6190cba Fix room sorting for good
Do it the right way with a QSortFilterProxyModel.
2019-05-06 13:07:00 -04:00
miruka
e124dcbff7 Bring back room movements on new events 2019-05-02 16:10:41 -04:00
miruka
047225fded Rework models hierarchy, room categories models 2019-05-02 14:20:21 -04:00
miruka
ada44cf6f7 Various ListModel and ListItem improvements
Type hints, pyqt types, comments,
better __repr__ for ListItem, repr() for ListModel
2019-05-01 17:31:02 -04:00
miruka
012e89f6cb Improved ListModel and ListItem
- New ListItem implemented using a metaclass, which makes defining new
  ListItem subclasses much cleaner and shorter

- ListModel functions taking an index now accept either an int
  (list index) or str (value of a main key)

- getWhere() gone, simply use get(a_main_key_value) now

- updateOrAppendWhere replaced by update()/upsert()
2019-04-29 23:51:37 -04:00
miruka
34d2bd233d Set parents for all QObjects 2019-04-22 14:24:45 -04:00
miruka
4607f53b7a Show special text when room has no events yet
e.g. if invited to a room but there's no history provided by
another account.

Also add a signal for the ListModel.count property.
2019-04-22 11:31:06 -04:00
miruka
d47bf34522 Replace assert statements by normal if/raise 2019-04-22 10:08:42 -04:00
miruka
237d750d47 Overhaul room list sorting 2019-04-21 20:55:24 -04:00
miruka
424405e3e8 Set invited and left rooms position in model
Invited rooms at the start, left rooms at the end, with the bonus effect
of fixing the roomList height problem.
2019-04-21 16:53:16 -04:00
miruka
ea8f75c729 Organize banners, add LeftBanner
Previously there was InviteOffer, now there's a base Banner component,
InviteBanner and LeftBanner.
2019-04-21 15:20:20 -04:00
miruka
8f35e60801 Capitalization, list model and room header work
- Standardized capitalization for variables and file names everywhere in
  QML and JS, get rid of mixed camelCase/snakeCase,
  use camelCase like everywhere in Qt

- ListModel items are now stored and returned as real QObjects with
  PyQt properties and signals.
  This makes dynamic property binding a lot easier and eliminates the need
  for many hacks.

- New update(), updateOrAppendWhere() methods and roles property
  for ListModel

- RoomHeader now properly updates when the room title or topic changes

- Add Backend.pdb(), to make it easier to start the debugger from QML
2019-04-20 17:43:57 -04:00
miruka
9e5e2c6718 Use a Deque for roomEvents's ListModel
- Take a custom container callable for ListModel __init__ (defaults to
  list, must be a MutableSequence)

- Use a Deque for roomEvents, which is much faster for inserting
  new items at the beginning.
2019-04-17 17:24:36 -04:00
miruka
8a3189df15 Add users currently typing in room bar 2019-04-14 16:12:07 -04:00
miruka
3ec51b9253 Fix room subtitle reloading
Replace the "reloadThis" ListModel hack by an actual signal,
works when the subtitle is displayed in more than one place
(e.g. two accounts in the same room connected).
2019-04-14 14:33:57 -04:00
miruka
5c8fd4500d Fix garbage collection of ListModelMap items
Prevent ListModel items from being deleted on the C++ side (specially
when using .get() from QML and a new ListModel is created)
by setting their parent to the ListModelMap.
2019-04-13 09:59:34 -04:00
miruka
13fca98838 Rooms and threads fixes
- Fix roomList height again, now based on model.count().
  All delegates are assumed to be the same height

- Properly update room list when a room is joined or left

- Catch exceptions happening in threads (futures), which previously
  passed silently

- Show "Empty room?" as "<i>Empty Room</i>" + gray [?] avatar
2019-04-13 08:59:10 -04:00
miruka
30514fb7db Show joined rooms, delete left rooms
To make the models update correctly in QML:
- ListModel and _QtModel merged
- Return a ListModelMap QObject from properties instead of
  a DefaultDict → QVariantMap
2019-04-12 13:18:46 -04:00
miruka
5d4c7b8520 Reorganize backend files, show accounts in UI 2019-04-12 04:33:09 -04:00