Commit Graph

176 Commits

Author SHA1 Message Date
miruka
9023d28c43 Add Backend.getDir(), Backend.getFile()
Replaces Backend.getPath()
2019-05-06 21:57:44 -04:00
miruka
a9964ab0f9 Fix roomCategoryDelegate height stuck to 0 2019-05-06 21:37:34 -04:00
miruka
a3d0f32dc5 ClientManager._get_standard_path → Backend.getPath 2019-05-06 21:28:54 -04:00
miruka
eab5ae0afe Fix sendbox enter not working 2019-05-06 21:07:59 -04:00
miruka
55e701c24d Improve sidePane expand toggle buttons
Animate them, use an icon that makes more sense, have a componant file
2019-05-06 20:37:41 -04:00
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
0e5c5619cf Support directly defined pyqtProperty in ListItem 2019-05-02 18:09:01 -04:00
miruka
e124dcbff7 Bring back room movements on new events 2019-05-02 16:10:41 -04:00
miruka
6bc6998fde Bring back clipping for RoomEventsList 2019-05-02 15:09:17 -04:00
miruka
51386821bc Make clientManager easier to use
- Backend.clientManager renamed to Backend.clients
- clientManager is now a Mapping subclass

Before/After from Python:
backend.clientManager.clients[thing] → backend.clients[thing]

From QML:
Backend.clientManager.clients[thing] → Backend.clients.get(thing)
2019-05-02 14:58:42 -04:00
miruka
52d538e995 Merge Backend and QMLModels
Backend.models.accounts → Backend.accounts
Backend.models.roomEvents → Backend.roomEvents
2019-05-02 14:31:47 -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
92b3baa012 Set background image sourceSize to screen size
Saves memory for most displays
2019-05-01 03:25:58 -04:00
miruka
3299aefaf1 Fix Engine.app_dir and leftover Backend.pdb()
Use __file__ instead of sys.argv[0] to determine the current script's
path, which works correctly when importing the package from another dir
2019-05-01 01:32:06 -04:00
miruka
12ce4cdb30 Rework startup and Application-Engine relation
- Application and Engine will be started by __init__.run() independently
- Exiting app will disconnect clients
- Signals like SIGINT (Ctrl-C) are now handled for proper exit
2019-05-01 01:23:38 -04:00
miruka
5ad13aed7d Same avatar-content spacing for events and msgs 2019-04-29 23:58:17 -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
216ae312c5 Remove html-sanitizer custom attrs workaround
Fix merged upstream (1.7.2).
2019-04-28 20:39:45 -04:00
miruka
67c3ef5906 Disable QML cache, responsible of multiple bugs 2019-04-28 20:37:11 -04:00
miruka
c4fb0c1150 Fix SidePane indent at minimum size 2019-04-28 15:52:26 -04:00
miruka
4433e48611 Fix QtQuick.Layout version, MessageContent wrap 2019-04-28 15:45:42 -04:00
miruka
70ca608961 Lower opacity for boxes in HStyle 2019-04-28 15:38:08 -04:00
miruka
ef60a1129f Clean up QML imports 2019-04-28 15:36:43 -04:00
miruka
f714c85d75 HSpacer component for layouts 2019-04-28 15:22:53 -04:00
miruka
d0089df051 Use Base components without namespace prefix 2019-04-28 15:18:36 -04:00
miruka
89fcfbea82 Colors for controls and PaneToolBar 2019-04-28 15:13:18 -04:00
miruka
b8901dfc5b Use H*Layout totalSpacing wherever possible 2019-04-28 14:54:01 -04:00
miruka
455490b5af Use Loaders for RoomEventDelegate 2019-04-28 14:48:59 -04:00
miruka
7004b4ea3f Reorganize Chat component files
- MessageList renamed to RoomEventList
- MessageDelegate renamed to RoomEventDelegate
- Banner and RoomEventList get their own folders
2019-04-28 14:34:29 -04:00
miruka
99ab6a817a Update/refactor Chat components and banner 2019-04-28 14:20:30 -04:00
miruka
bf9eb7dbc9 Use HColumnLayout in HInterfaceBox 2019-04-28 12:47:51 -04:00
miruka
c5794424ed Capitalize all component folders 2019-04-28 12:45:12 -04:00
miruka
e64b233427 Better default SidePane size 2019-04-28 12:40:42 -04:00
miruka
87c72e32db Update SidePane componants, add Base.HColumnLayout 2019-04-28 12:40:18 -04:00
miruka
2e8e042808 Replace HToolButton usages with HButton
Also change sidePane toolbar: option button and filter rooms field
2019-04-28 12:10:34 -04:00
miruka
80067b5060 Add HScrollableTextArea and make SendBox use it 2019-04-28 11:53:47 -04:00
miruka
25badb693d Use HImage for HStatusAvatar 2019-04-28 11:34:05 -04:00
miruka
83272b9580 Update and improve HAvatar code 2019-04-28 11:32:02 -04:00
miruka
be4b15e484 Add missing H prefix to some base componants 2019-04-28 11:21:19 -04:00
miruka
f49b3e4b62 Fix sendbox freeze when typing more than one line 2019-04-28 11:08:09 -04:00
miruka
5650234e3b Restyle the chat UI 2019-04-28 11:03:08 -04:00
miruka
f65ea9dd0d Just import nio
Instead of nio.events, nio.responses, etc.
All the classes are already available at nio.
2019-04-28 01:17:12 -04:00
miruka
d3749af4bc Boxes blur, more styling 2019-04-28 00:46:40 -04:00
miruka
8a714fb7a0 Add Default and RememberAccount? pages 2019-04-27 21:07:20 -04:00
miruka
0db5a3233d Change pages organization
- UI (previously MainUI) is back to being the only component loaded
  as Window's child

- UI has the background image previously only for the SignInPage

- If there are no accounts, the UI Loader's initialItem is the
  SignInPage

- The SidePane becomes visible when there's >=1 account connected
2019-04-27 18:54:33 -04:00
miruka
e09efaecda Refactor LoginPage into separate components 2019-04-27 18:00:28 -04:00
miruka
102baccbe5 Login loading icon
Add standard mechanism in HButton for loading icon display;
have HImage and HIcon base components.
2019-04-26 21:16:57 -04:00
miruka
dc2f779d4b Make login button work for login page 2019-04-26 18:47:25 -04:00
miruka
c7dd602687 Fix room forget and buttons bugs 2019-04-26 16:52:26 -04:00
miruka
5988eccdbb Add login page and forget room system 2019-04-26 16:02:20 -04:00
miruka
34d2bd233d Set parents for all QObjects 2019-04-22 14:24:45 -04:00
miruka
6664fc29e3 Better default size for ApplicationWindow 2019-04-22 14:02:55 -04:00
miruka
33743baa12 Use same color as avatars for message user names 2019-04-22 11:45:08 -04:00
miruka
0df46a0415 Add property notify signals where needed 2019-04-22 11:37:41 -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
98969b75c7 Remove unused getcryptdbpath leftover function. 2019-04-22 10:05:08 -04:00
miruka
03dc9be523 Improve hueFromString()
More diversed output, without using hashing function.
2019-04-22 10:04:16 -04:00
miruka
f6ae315fb2 Improve Makefile test, add additional checkers 2019-04-22 09:37:49 -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
677117983a Set hourglass icon when clicking accept/decline
PyQtFuture's gotResult signal can now be used from QML/JS.
2019-04-21 16:31:48 -04:00
miruka
99d5fb551c Make the banner buttons work
For invitation accept/decline.
Forget remains to be implemented in nio.
2019-04-21 16:12:53 -04:00
miruka
ac70634256 Remove uneeded "Rejoin" button 2019-04-21 15:40:05 -04:00
miruka
4dced63b63 Fix banners not live-updating 2019-04-21 15:34:08 -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
909e1c3363 Fix and improve room members event texts 2019-04-21 12:25:55 -04:00
miruka
94d6bc0e52 Fix roomList height with sections 2019-04-21 11:39:29 -04:00
miruka
9602608b87 Add inviter account informations to room invites 2019-04-21 11:15:03 -04:00
miruka
bbf29e29b1 Add InviteOffer component 2019-04-21 10:44:04 -04:00
miruka
e2d7f18bb8 Fix net.talk() not raising errors for nio bad resp 2019-04-21 07:04:42 -04:00
miruka
2c5dc7bd4f Handle room invites
Add them to the roomList, and have separate sections:
Invites and Rooms.
2019-04-21 06:56:59 -04:00
miruka
21ca38117d Fix Backend.pdb() leftover stuff 2019-04-21 05:15:45 -04:00
miruka
c866ac87a9 Remove quotes from id: properties
As suggested in the Qt Quick coding style
2019-04-20 17:45:51 -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
b33f5f1d34 Fix date and top padding when loading previous msg 2019-04-20 03:29:24 -04:00
miruka
99c06e4034 Fix local echoes not sent if all threads occupied 2019-04-19 18:37:56 -04:00
miruka
aa55ffbc6a Prevent queuing lots of setTypingState
@futurize() is now called with parentheses and can take a max_instances
int argument. This is used for setTypingState to not have more than one
queued calls per room and True/False state and avoids bombing the server
with old ephemeral events after a network loss and reconnection.
2019-04-19 18:21:19 -04:00
miruka
188dc6be98 Socket timeouts, always HTTP reconnect on errors 2019-04-19 17:17:37 -04:00
miruka
08368bbf36 Add retry time logic (exponential backoff) 2019-04-19 16:52:12 -04:00
miruka
0d7728665f Handle network errors
- Move HTTP connect/disconnect logic to networkManager
- If a talk fails due to socket error, HTTP transport error or
  nio bad response that might change, retry every 2s until success
- Clean up some leftover debug prints
2019-04-19 16:15:21 -04:00
miruka
1f04fa07cb Remove workaround for sanitizer autolink
Fix merged upstream
2019-04-19 13:42:00 -04:00
miruka
9a1b91caa5 Set user typing state when using the SendBox 2019-04-19 03:11:56 -04:00
miruka
1d0cce402e Proper display name retrieval implementation
For any name not found in rooms data, rely on new
nio.HttpClient.get_displayname() function to get and cache it,
e.g. for our own name if no room is joined and past events from users
who left the room.

@futurize now returns PyQtFuture objects, wrapper for the
concurrent.futures.Future objects that can be used from QML,
to ensure name retrieval does not block the GUI.
2019-04-19 02:26:29 -04:00
miruka
11d900965a Add local echoing of messages
As per
https://matrix.org/docs/spec/client_server/latest.html#local-echo
2019-04-18 13:46:39 -04:00
miruka
e9b3628fcc html_filter: Don't wrap result in <html><body> 2019-04-18 11:32:32 -04:00
miruka
98b494fcc2 Convert markdown to HTML for sendbox
Also pass to clientManager the Backend, and to Client the clientManager,
and set Qt parents for them.
2019-04-17 23:28:25 -04:00
miruka
a7649d1a7a Make the SendBox work, send plaintext messages 2019-04-17 23:01:26 -04:00
miruka
6ab4acdc84 Improve room past events loading
- Trigger when room is shown if there's not enough messages to fill the
  list height

- Trigger whenever user is scrolling before a certain point, instead of
  when dragging is released/scrolling stopped and the top edge is hit

- Prevent multiple load requests at same time

- Keep a set of fully loaded rooms, don't request anymore history
  if a room is fully loaded
2019-04-17 22:34:22 -04:00
miruka
a0f9acddaa Load past events when scrolling up
Also keep two nio clients internally: one for loop-syncing, one for the
rest; since they can't handle more than one talk at a time.
2019-04-17 21:08:32 -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
f0dab1801a Order the roomEvents models from newest to oldest
Qt somehow handles scrolling on new messages on its own when the
ListView direction is bottom to top.
In normal top to bottom, manual scrolling is completly buggy.
2019-04-17 16:43:18 -04:00
miruka
7e62da8733 Fix image position and filter() return 2019-04-17 14:27:22 -04:00
miruka
c4f46f42b6 Add image previews in HTML messages 2019-04-17 13:44:04 -04:00
miruka
a59c0d1572 Improve HTML autolinking
Allow example.com and 127.0.0.1, handle tel: and magnet:
2019-04-17 12:06:09 -04:00
miruka
aa105e0c2c Make links in messages clickable 2019-04-17 10:54:55 -04:00
miruka
a7bf1fca44 Sanitize HTML displayed as message content 2019-04-17 10:49:54 -04:00