Merge pull request #216 from Nheko-Reborn/presence

Presence support
bw-emoji-fixes
Joseph Donofry 5 years ago committed by GitHub
commit 21dfb3c0b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      CMakeLists.txt
  2. 4
      io.github.NhekoReborn.Nheko.json
  3. 61
      resources/langs/nheko_de.ts
  4. 61
      resources/langs/nheko_el.ts
  5. 61
      resources/langs/nheko_en.ts
  6. 61
      resources/langs/nheko_fi.ts
  7. 61
      resources/langs/nheko_fr.ts
  8. 61
      resources/langs/nheko_it.ts
  9. 61
      resources/langs/nheko_ja.ts
  10. 61
      resources/langs/nheko_nl.ts
  11. 61
      resources/langs/nheko_pl.ts
  12. 61
      resources/langs/nheko_ru.ts
  13. 61
      resources/langs/nheko_zh_CN.ts
  14. 18
      resources/qml/Avatar.qml
  15. 14
      resources/qml/TimelineView.qml
  16. 72
      src/Cache.cpp
  17. 6
      src/Cache.h
  18. 13
      src/Cache_p.h
  19. 40
      src/ChatPage.cpp
  20. 6
      src/ChatPage.h
  21. 50
      src/UserInfoWidget.cpp
  22. 4
      src/UserInfoWidget.h
  23. 15
      src/UserSettingsPage.cpp
  24. 14
      src/UserSettingsPage.h
  25. 18
      src/main.cpp
  26. 12
      src/timeline/TimelineViewManager.cpp
  27. 3
      src/timeline/TimelineViewManager.h

@ -337,7 +337,7 @@ if(USE_BUNDLED_MTXCLIENT)
FetchContent_Declare(
MatrixClient
GIT_REPOSITORY https://github.com/Nheko-Reborn/mtxclient.git
GIT_TAG 795b6a82d4f10c629ce0eb99803cc677c413f940
GIT_TAG a897142a3fa6ece92daa1040551fb8ac09be1766
)
FetchContent_MakeAvailable(MatrixClient)
else()

@ -146,9 +146,9 @@
"name": "mtxclient",
"sources": [
{
"sha256": "7ba85bb477c9e17e2389faf2333034aa9ceae4b1c65d6bf5f7067f2799e9b770",
"sha256": "6a4368da5fda1db426c36c9a7b26c6e62ca99bd8c7fea421460156642e65a5cb",
"type": "archive",
"url": "https://github.com/Nheko-Reborn/mtxclient/archive/795b6a82d4f10c629ce0eb99803cc677c413f940.tar.gz"
"url": "https://github.com/Nheko-Reborn/mtxclient/archive/a897142a3fa6ece92daa1040551fb8ac09be1766.tar.gz"
}
]
},

@ -4,7 +4,7 @@
<context>
<name>Cache</name>
<message>
<location filename="../../src/Cache.cpp" line="+1342"/>
<location filename="../../src/Cache.cpp" line="+1359"/>
<source>You joined this room.</source>
<translation>Du bist dem Raum beigetreten.</translation>
</message>
@ -12,23 +12,23 @@
<context>
<name>ChatPage</name>
<message>
<location filename="../../src/ChatPage.cpp" line="+227"/>
<location filename="../../src/ChatPage.cpp" line="+229"/>
<source>Failed to invite user: %1</source>
<translation>Nutzer konnte nicht eingeladen werden: %1</translation>
</message>
<message>
<location line="+4"/>
<location line="+923"/>
<location line="+926"/>
<source>Invited user: %1</source>
<translation>Eingeladener Benutzer: %1</translation>
</message>
<message>
<location line="-471"/>
<location line="-474"/>
<source>Migrating the cache to the current version failed. This can have different reasons. Please open an issue and try to use an older version in the mean time. Alternatively you can try deleting the cache manually.</source>
<translation>Migrieren des Caches auf die aktuelle Version fehlgeschlagen. Das kann verschiedene Gründe als Ursache haben. Bitte lege einen Bugreport an und verwende in der Zwischenzeit eine ältere Version. Alternativ kannst du das Cache manuell entfernen.</translation>
</message>
<message>
<location line="+436"/>
<location line="+439"/>
<source>Room %1 created.</source>
<translation>Raum %1 erzeugt.</translation>
</message>
@ -68,7 +68,7 @@
<translation>Verbannung von %1 wurde aufgehoben.</translation>
</message>
<message>
<location line="-825"/>
<location line="-828"/>
<source>Failed to upload media. Please try again.</source>
<translation>Medienupload fehlgeschlagen. Bitte versuche es erneut.</translation>
</message>
@ -103,13 +103,13 @@
<translation>Fehler beim Setup der Verschlüsselungsschlüssel. Servermeldung: %1 %2. Bitte versuche es später erneut.</translation>
</message>
<message>
<location line="+51"/>
<location line="+219"/>
<location line="+54"/>
<location line="+252"/>
<source>Please try to login again: %1</source>
<translation>Bitte melde dich erneut an: %1</translation>
</message>
<message>
<location line="-154"/>
<location line="-187"/>
<source>Failed to join room: %1</source>
<translation>Konnte Raum nicht betreten: %1</translation>
</message>
@ -492,7 +492,7 @@ Beispiel: https://mein.server:8787</translation>
<context>
<name>RoomInfo</name>
<message>
<location filename="../../src/Cache.cpp" line="+940"/>
<location filename="../../src/Cache.cpp" line="+984"/>
<source>no version stored</source>
<translation>keine Version gespeichert</translation>
</message>
@ -921,7 +921,7 @@ Beispiel: https://mein.server:8787</translation>
<translation>Kein Raum geöffnet</translation>
</message>
<message>
<location line="+259"/>
<location line="+271"/>
<source>Close</source>
<translation>Schließen</translation>
</message>
@ -975,15 +975,50 @@ Beispiel: https://mein.server:8787</translation>
<context>
<name>UserInfoWidget</name>
<message>
<location filename="../../src/UserInfoWidget.cpp" line="+91"/>
<location filename="../../src/UserInfoWidget.cpp" line="+95"/>
<source>Logout</source>
<translation>Abmelden</translation>
</message>
<message>
<location line="+20"/>
<source>Set custom status message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+4"/>
<source>Custom status message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>Status:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+9"/>
<source>Set presence automatically</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>Online</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+5"/>
<source>Unavailable</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>Offline</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UserSettingsPage</name>
<message>
<location filename="../../src/UserSettingsPage.cpp" line="+520"/>
<location filename="../../src/UserSettingsPage.cpp" line="+535"/>
<source>Minimize to tray</source>
<translation>Ins Benachrichtigungsfeld minimieren</translation>
</message>

@ -4,7 +4,7 @@
<context>
<name>Cache</name>
<message>
<location filename="../../src/Cache.cpp" line="+1342"/>
<location filename="../../src/Cache.cpp" line="+1359"/>
<source>You joined this room.</source>
<translation type="unfinished"></translation>
</message>
@ -12,23 +12,23 @@
<context>
<name>ChatPage</name>
<message>
<location filename="../../src/ChatPage.cpp" line="+227"/>
<location filename="../../src/ChatPage.cpp" line="+229"/>
<source>Failed to invite user: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+4"/>
<location line="+923"/>
<location line="+926"/>
<source>Invited user: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="-471"/>
<location line="-474"/>
<source>Migrating the cache to the current version failed. This can have different reasons. Please open an issue and try to use an older version in the mean time. Alternatively you can try deleting the cache manually.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+436"/>
<location line="+439"/>
<source>Room %1 created.</source>
<translation type="unfinished"></translation>
</message>
@ -68,7 +68,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<location line="-825"/>
<location line="-828"/>
<source>Failed to upload media. Please try again.</source>
<translation type="unfinished"></translation>
</message>
@ -103,13 +103,13 @@
<translation type="unfinished"></translation>
</message>
<message>
<location line="+51"/>
<location line="+219"/>
<location line="+54"/>
<location line="+252"/>
<source>Please try to login again: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="-154"/>
<location line="-187"/>
<source>Failed to join room: %1</source>
<translation type="unfinished"></translation>
</message>
@ -488,7 +488,7 @@ Example: https://server.my:8787</source>
<context>
<name>RoomInfo</name>
<message>
<location filename="../../src/Cache.cpp" line="+940"/>
<location filename="../../src/Cache.cpp" line="+984"/>
<source>no version stored</source>
<translation type="unfinished"></translation>
</message>
@ -917,7 +917,7 @@ Example: https://server.my:8787</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+259"/>
<location line="+271"/>
<source>Close</source>
<translation type="unfinished"></translation>
</message>
@ -971,15 +971,50 @@ Example: https://server.my:8787</source>
<context>
<name>UserInfoWidget</name>
<message>
<location filename="../../src/UserInfoWidget.cpp" line="+91"/>
<location filename="../../src/UserInfoWidget.cpp" line="+95"/>
<source>Logout</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+20"/>
<source>Set custom status message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+4"/>
<source>Custom status message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>Status:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+9"/>
<source>Set presence automatically</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>Online</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+5"/>
<source>Unavailable</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>Offline</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UserSettingsPage</name>
<message>
<location filename="../../src/UserSettingsPage.cpp" line="+520"/>
<location filename="../../src/UserSettingsPage.cpp" line="+535"/>
<source>Minimize to tray</source>
<translation>Ελαχιστοποίηση</translation>
</message>

@ -4,7 +4,7 @@
<context>
<name>Cache</name>
<message>
<location filename="../../src/Cache.cpp" line="+1342"/>
<location filename="../../src/Cache.cpp" line="+1359"/>
<source>You joined this room.</source>
<translation>You joined this room.</translation>
</message>
@ -12,23 +12,23 @@
<context>
<name>ChatPage</name>
<message>
<location filename="../../src/ChatPage.cpp" line="+227"/>
<location filename="../../src/ChatPage.cpp" line="+229"/>
<source>Failed to invite user: %1</source>
<translation>Failed to invite user: %1</translation>
</message>
<message>
<location line="+4"/>
<location line="+923"/>
<location line="+926"/>
<source>Invited user: %1</source>
<translation>Invited user: %1</translation>
</message>
<message>
<location line="-471"/>
<location line="-474"/>
<source>Migrating the cache to the current version failed. This can have different reasons. Please open an issue and try to use an older version in the mean time. Alternatively you can try deleting the cache manually.</source>
<translation>Migrating the cache to the current version failed. This can have different reasons. Please open an issue and try to use an older version in the mean time. Alternatively you can try deleting the cache manually.</translation>
</message>
<message>
<location line="+436"/>
<location line="+439"/>
<source>Room %1 created.</source>
<translation>Room %1 created.</translation>
</message>
@ -68,7 +68,7 @@
<translation>Unbanned user: %1</translation>
</message>
<message>
<location line="-825"/>
<location line="-828"/>
<source>Failed to upload media. Please try again.</source>
<translation>Failed to upload media. Please try again.</translation>
</message>
@ -103,13 +103,13 @@
<translation>Failed to setup encryption keys. Server response: %1 %2. Please try again later.</translation>
</message>
<message>
<location line="+51"/>
<location line="+219"/>
<location line="+54"/>
<location line="+252"/>
<source>Please try to login again: %1</source>
<translation>Please try to login again: %1</translation>
</message>
<message>
<location line="-154"/>
<location line="-187"/>
<source>Failed to join room: %1</source>
<translation>Failed to join room: %1</translation>
</message>
@ -492,7 +492,7 @@ Example: https://server.my:8787</translation>
<context>
<name>RoomInfo</name>
<message>
<location filename="../../src/Cache.cpp" line="+940"/>
<location filename="../../src/Cache.cpp" line="+984"/>
<source>no version stored</source>
<translation>no version stored</translation>
</message>
@ -921,7 +921,7 @@ Example: https://server.my:8787</translation>
<translation>No room open</translation>
</message>
<message>
<location line="+259"/>
<location line="+271"/>
<source>Close</source>
<translation>Close</translation>
</message>
@ -975,15 +975,50 @@ Example: https://server.my:8787</translation>
<context>
<name>UserInfoWidget</name>
<message>
<location filename="../../src/UserInfoWidget.cpp" line="+91"/>
<location filename="../../src/UserInfoWidget.cpp" line="+95"/>
<source>Logout</source>
<translation>Logout</translation>
</message>
<message>
<location line="+20"/>
<source>Set custom status message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+4"/>
<source>Custom status message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>Status:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+9"/>
<source>Set presence automatically</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>Online</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+5"/>
<source>Unavailable</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>Offline</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UserSettingsPage</name>
<message>
<location filename="../../src/UserSettingsPage.cpp" line="+520"/>
<location filename="../../src/UserSettingsPage.cpp" line="+535"/>
<source>Minimize to tray</source>
<translation>Minimize to tray</translation>
</message>

@ -4,7 +4,7 @@
<context>
<name>Cache</name>
<message>
<location filename="../../src/Cache.cpp" line="+1342"/>
<location filename="../../src/Cache.cpp" line="+1359"/>
<source>You joined this room.</source>
<translation type="unfinished"></translation>
</message>
@ -12,23 +12,23 @@
<context>
<name>ChatPage</name>
<message>
<location filename="../../src/ChatPage.cpp" line="+227"/>
<location filename="../../src/ChatPage.cpp" line="+229"/>
<source>Failed to invite user: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+4"/>
<location line="+923"/>
<location line="+926"/>
<source>Invited user: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="-471"/>
<location line="-474"/>
<source>Migrating the cache to the current version failed. This can have different reasons. Please open an issue and try to use an older version in the mean time. Alternatively you can try deleting the cache manually.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+436"/>
<location line="+439"/>
<source>Room %1 created.</source>
<translation type="unfinished"></translation>
</message>
@ -68,7 +68,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<location line="-825"/>
<location line="-828"/>
<source>Failed to upload media. Please try again.</source>
<translation type="unfinished"></translation>
</message>
@ -103,13 +103,13 @@
<translation>Salausavainten lähetys epäonnistui. Palvelimen vastaus: %1 %2. Ole hyvä ja yritä uudelleen myöhemmin.</translation>
</message>
<message>
<location line="+51"/>
<location line="+219"/>
<location line="+54"/>
<location line="+252"/>
<source>Please try to login again: %1</source>
<translation>Ole hyvä ja yritä kirjautua sisään uudelleen: %1</translation>
</message>
<message>
<location line="-154"/>
<location line="-187"/>
<source>Failed to join room: %1</source>
<translation type="unfinished"></translation>
</message>
@ -488,7 +488,7 @@ Example: https://server.my:8787</source>
<context>
<name>RoomInfo</name>
<message>
<location filename="../../src/Cache.cpp" line="+940"/>
<location filename="../../src/Cache.cpp" line="+984"/>
<source>no version stored</source>
<translation>ei tallennettua versiota</translation>
</message>
@ -917,7 +917,7 @@ Example: https://server.my:8787</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+259"/>
<location line="+271"/>
<source>Close</source>
<translation type="unfinished">Sulje</translation>
</message>
@ -971,15 +971,50 @@ Example: https://server.my:8787</source>
<context>
<name>UserInfoWidget</name>
<message>
<location filename="../../src/UserInfoWidget.cpp" line="+91"/>
<location filename="../../src/UserInfoWidget.cpp" line="+95"/>
<source>Logout</source>
<translation>Kirjaudu ulos</translation>
</message>
<message>
<location line="+20"/>
<source>Set custom status message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+4"/>
<source>Custom status message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>Status:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+9"/>
<source>Set presence automatically</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>Online</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+5"/>
<source>Unavailable</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>Offline</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UserSettingsPage</name>
<message>
<location filename="../../src/UserSettingsPage.cpp" line="+520"/>
<location filename="../../src/UserSettingsPage.cpp" line="+535"/>
<source>Minimize to tray</source>
<translation>Pienennä ilmoitusalueelle</translation>
</message>

@ -4,7 +4,7 @@
<context>
<name>Cache</name>
<message>
<location filename="../../src/Cache.cpp" line="+1342"/>
<location filename="../../src/Cache.cpp" line="+1359"/>
<source>You joined this room.</source>
<translation type="unfinished"></translation>
</message>
@ -12,23 +12,23 @@
<context>
<name>ChatPage</name>
<message>
<location filename="../../src/ChatPage.cpp" line="+227"/>
<location filename="../../src/ChatPage.cpp" line="+229"/>
<source>Failed to invite user: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+4"/>
<location line="+923"/>
<location line="+926"/>
<source>Invited user: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="-471"/>
<location line="-474"/>
<source>Migrating the cache to the current version failed. This can have different reasons. Please open an issue and try to use an older version in the mean time. Alternatively you can try deleting the cache manually.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+436"/>
<location line="+439"/>
<source>Room %1 created.</source>
<translation type="unfinished"></translation>
</message>
@ -68,7 +68,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<location line="-825"/>
<location line="-828"/>
<source>Failed to upload media. Please try again.</source>
<translation type="unfinished"></translation>
</message>
@ -103,13 +103,13 @@
<translation type="unfinished"></translation>
</message>
<message>
<location line="+51"/>
<location line="+219"/>
<location line="+54"/>
<location line="+252"/>
<source>Please try to login again: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="-154"/>
<location line="-187"/>
<source>Failed to join room: %1</source>
<translation type="unfinished"></translation>
</message>
@ -488,7 +488,7 @@ Example: https://server.my:8787</source>
<context>
<name>RoomInfo</name>
<message>
<location filename="../../src/Cache.cpp" line="+940"/>
<location filename="../../src/Cache.cpp" line="+984"/>
<source>no version stored</source>
<translation type="unfinished"></translation>
</message>
@ -917,7 +917,7 @@ Example: https://server.my:8787</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+259"/>
<location line="+271"/>
<source>Close</source>
<translation type="unfinished"></translation>
</message>
@ -971,15 +971,50 @@ Example: https://server.my:8787</source>
<context>
<name>UserInfoWidget</name>
<message>
<location filename="../../src/UserInfoWidget.cpp" line="+91"/>
<location filename="../../src/UserInfoWidget.cpp" line="+95"/>
<source>Logout</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+20"/>
<source>Set custom status message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+4"/>
<source>Custom status message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>Status:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+9"/>
<source>Set presence automatically</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>Online</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+5"/>
<source>Unavailable</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>Offline</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UserSettingsPage</name>
<message>
<location filename="../../src/UserSettingsPage.cpp" line="+520"/>
<location filename="../../src/UserSettingsPage.cpp" line="+535"/>
<source>Minimize to tray</source>
<translation>Réduire à la barre des tâches</translation>
</message>

@ -4,7 +4,7 @@
<context>
<name>Cache</name>
<message>
<location filename="../../src/Cache.cpp" line="+1342"/>
<location filename="../../src/Cache.cpp" line="+1359"/>
<source>You joined this room.</source>
<translation>Sei entrato in questa stanza.</translation>
</message>
@ -12,23 +12,23 @@
<context>
<name>ChatPage</name>
<message>
<location filename="../../src/ChatPage.cpp" line="+227"/>
<location filename="../../src/ChatPage.cpp" line="+229"/>
<source>Failed to invite user: %1</source>
<translation>Impossibile invitare l&apos;utente: %1</translation>
</message>
<message>
<location line="+4"/>
<location line="+923"/>
<location line="+926"/>
<source>Invited user: %1</source>
<translation>Invitato utente: %1</translation>
</message>
<message>
<location line="-471"/>
<location line="-474"/>
<source>Migrating the cache to the current version failed. This can have different reasons. Please open an issue and try to use an older version in the mean time. Alternatively you can try deleting the cache manually.</source>
<translation>Migrazione della cache alla versione corrente fallita. Questo può avere diverse cause. Per favore apri una issue e nel frattempo prova ad usare una versione più vecchia. In alternativa puoi provare a cancellare la cache manualmente.</translation>
</message>
<message>
<location line="+436"/>
<location line="+439"/>
<source>Room %1 created.</source>
<translation>Stanza %1 creata.</translation>
</message>
@ -68,7 +68,7 @@
<translation>Rimosso il ban dall&apos;utente: %1</translation>
</message>
<message>
<location line="-825"/>
<location line="-828"/>
<source>Failed to upload media. Please try again.</source>
<translation>Impossibile inviare il file multimediale. Per favore riprova.</translation>
</message>
@ -103,13 +103,13 @@
<translation>Impossibile configurare le chiavi crittografiche. Risposta del server: %1 %2. Per favore riprova in seguito.</translation>
</message>
<message>
<location line="+51"/>
<location line="+219"/>
<location line="+54"/>
<location line="+252"/>
<source>Please try to login again: %1</source>
<translation>Per favore prova ad accedere nuovamente: %1</translation>
</message>
<message>
<location line="-154"/>
<location line="-187"/>
<source>Failed to join room: %1</source>
<translation>Impossibile accedere alla stanza: %1</translation>
</message>
@ -492,7 +492,7 @@ Esempio: https://server.mio:8787</translation>
<context>
<name>RoomInfo</name>
<message>
<location filename="../../src/Cache.cpp" line="+940"/>
<location filename="../../src/Cache.cpp" line="+984"/>
<source>no version stored</source>
<translation>nessuna versione memorizzata</translation>
</message>
@ -921,7 +921,7 @@ Esempio: https://server.mio:8787</translation>
<translation>Nessuna stanza aperta</translation>
</message>
<message>
<location line="+259"/>
<location line="+271"/>
<source>Close</source>
<translation>Chiudi</translation>
</message>
@ -975,15 +975,50 @@ Esempio: https://server.mio:8787</translation>
<context>
<name>UserInfoWidget</name>
<message>
<location filename="../../src/UserInfoWidget.cpp" line="+91"/>
<location filename="../../src/UserInfoWidget.cpp" line="+95"/>
<source>Logout</source>
<translation>Disconnettiti</translation>
</message>
<message>
<location line="+20"/>
<source>Set custom status message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+4"/>
<source>Custom status message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>Status:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+9"/>
<source>Set presence automatically</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>Online</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+5"/>
<source>Unavailable</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>Offline</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UserSettingsPage</name>
<message>
<location filename="../../src/UserSettingsPage.cpp" line="+520"/>
<location filename="../../src/UserSettingsPage.cpp" line="+535"/>
<source>Minimize to tray</source>
<translation>Minimizza nella tray</translation>
</message>

@ -4,7 +4,7 @@
<context>
<name>Cache</name>
<message>
<location filename="../../src/Cache.cpp" line="+1342"/>
<location filename="../../src/Cache.cpp" line="+1359"/>
<source>You joined this room.</source>
<translation type="unfinished"></translation>
</message>
@ -12,23 +12,23 @@
<context>
<name>ChatPage</name>
<message>
<location filename="../../src/ChatPage.cpp" line="+227"/>
<location filename="../../src/ChatPage.cpp" line="+229"/>
<source>Failed to invite user: %1</source>
<translation>: %1</translation>
</message>
<message>
<location line="+4"/>
<location line="+923"/>
<location line="+926"/>
<source>Invited user: %1</source>
<translation>: %1</translation>
</message>
<message>
<location line="-471"/>
<location line="-474"/>
<source>Migrating the cache to the current version failed. This can have different reasons. Please open an issue and try to use an older version in the mean time. Alternatively you can try deleting the cache manually.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+436"/>
<location line="+439"/>
<source>Room %1 created.</source>
<translation type="unfinished"></translation>
</message>
@ -68,7 +68,7 @@
<translation>: %1</translation>
</message>
<message>
<location line="-825"/>
<location line="-828"/>
<source>Failed to upload media. Please try again.</source>
<translation></translation>
</message>
@ -103,13 +103,13 @@
<translation>: %1 %2. </translation>
</message>
<message>
<location line="+51"/>
<location line="+219"/>
<location line="+54"/>
<location line="+252"/>
<source>Please try to login again: %1</source>
<translation>: %1</translation>
</message>
<message>
<location line="-154"/>
<location line="-187"/>
<source>Failed to join room: %1</source>
<translation>: %1</translation>
</message>
@ -488,7 +488,7 @@ Example: https://server.my:8787</source>
<context>
<name>RoomInfo</name>
<message>
<location filename="../../src/Cache.cpp" line="+940"/>
<location filename="../../src/Cache.cpp" line="+984"/>
<source>no version stored</source>
<translation></translation>
</message>
@ -916,7 +916,7 @@ Example: https://server.my:8787</source>
<translation></translation>
</message>
<message>
<location line="+259"/>
<location line="+271"/>
<source>Close</source>
<translation></translation>
</message>
@ -970,15 +970,50 @@ Example: https://server.my:8787</source>
<context>
<name>UserInfoWidget</name>
<message>
<location filename="../../src/UserInfoWidget.cpp" line="+91"/>
<location filename="../../src/UserInfoWidget.cpp" line="+95"/>
<source>Logout</source>
<translation></translation>
</message>
<message>
<location line="+20"/>
<source>Set custom status message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+4"/>
<source>Custom status message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>Status:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+9"/>
<source>Set presence automatically</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>Online</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+5"/>
<source>Unavailable</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>Offline</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UserSettingsPage</name>
<message>
<location filename="../../src/UserSettingsPage.cpp" line="+520"/>
<location filename="../../src/UserSettingsPage.cpp" line="+535"/>
<source>Minimize to tray</source>
<translation></translation>
</message>

@ -4,7 +4,7 @@
<context>
<name>Cache</name>
<message>
<location filename="../../src/Cache.cpp" line="+1342"/>
<location filename="../../src/Cache.cpp" line="+1359"/>
<source>You joined this room.</source>
<translation type="unfinished"></translation>
</message>
@ -12,23 +12,23 @@
<context>
<name>ChatPage</name>
<message>
<location filename="../../src/ChatPage.cpp" line="+227"/>
<location filename="../../src/ChatPage.cpp" line="+229"/>
<source>Failed to invite user: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+4"/>
<location line="+923"/>
<location line="+926"/>
<source>Invited user: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="-471"/>
<location line="-474"/>
<source>Migrating the cache to the current version failed. This can have different reasons. Please open an issue and try to use an older version in the mean time. Alternatively you can try deleting the cache manually.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+436"/>
<location line="+439"/>
<source>Room %1 created.</source>
<translation type="unfinished"></translation>
</message>
@ -68,7 +68,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<location line="-825"/>
<location line="-828"/>
<source>Failed to upload media. Please try again.</source>
<translation type="unfinished"></translation>
</message>
@ -103,13 +103,13 @@
<translation type="unfinished"></translation>
</message>
<message>
<location line="+51"/>
<location line="+219"/>
<location line="+54"/>
<location line="+252"/>
<source>Please try to login again: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="-154"/>
<location line="-187"/>
<source>Failed to join room: %1</source>
<translation type="unfinished"></translation>
</message>
@ -488,7 +488,7 @@ Example: https://server.my:8787</source>
<context>
<name>RoomInfo</name>
<message>
<location filename="../../src/Cache.cpp" line="+940"/>
<location filename="../../src/Cache.cpp" line="+984"/>
<source>no version stored</source>
<translation type="unfinished"></translation>
</message>
@ -917,7 +917,7 @@ Example: https://server.my:8787</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+259"/>
<location line="+271"/>
<source>Close</source>
<translation type="unfinished"></translation>
</message>
@ -971,15 +971,50 @@ Example: https://server.my:8787</source>
<context>
<name>UserInfoWidget</name>
<message>
<location filename="../../src/UserInfoWidget.cpp" line="+91"/>
<location filename="../../src/UserInfoWidget.cpp" line="+95"/>
<source>Logout</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+20"/>
<source>Set custom status message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+4"/>
<source>Custom status message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>Status:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+9"/>
<source>Set presence automatically</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>Online</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+5"/>
<source>Unavailable</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>Offline</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UserSettingsPage</name>
<message>
<location filename="../../src/UserSettingsPage.cpp" line="+520"/>
<location filename="../../src/UserSettingsPage.cpp" line="+535"/>
<source>Minimize to tray</source>
<translation>Minimaliseren naar systeemvak</translation>
</message>

@ -4,7 +4,7 @@
<context>
<name>Cache</name>
<message>
<location filename="../../src/Cache.cpp" line="+1342"/>
<location filename="../../src/Cache.cpp" line="+1359"/>
<source>You joined this room.</source>
<translation type="unfinished"></translation>
</message>
@ -12,23 +12,23 @@
<context>
<name>ChatPage</name>
<message>
<location filename="../../src/ChatPage.cpp" line="+227"/>
<location filename="../../src/ChatPage.cpp" line="+229"/>
<source>Failed to invite user: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+4"/>
<location line="+923"/>
<location line="+926"/>
<source>Invited user: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="-471"/>
<location line="-474"/>
<source>Migrating the cache to the current version failed. This can have different reasons. Please open an issue and try to use an older version in the mean time. Alternatively you can try deleting the cache manually.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+436"/>
<location line="+439"/>
<source>Room %1 created.</source>
<translation type="unfinished"></translation>
</message>
@ -68,7 +68,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<location line="-825"/>
<location line="-828"/>
<source>Failed to upload media. Please try again.</source>
<translation type="unfinished"></translation>
</message>
@ -103,13 +103,13 @@
<translation type="unfinished"></translation>
</message>
<message>
<location line="+51"/>
<location line="+219"/>
<location line="+54"/>
<location line="+252"/>
<source>Please try to login again: %1</source>
<translation>Spróbuj zalogować się ponownie: %1</translation>
</message>
<message>
<location line="-154"/>
<location line="-187"/>
<source>Failed to join room: %1</source>
<translation type="unfinished"></translation>
</message>
@ -488,7 +488,7 @@ Example: https://server.my:8787</source>
<context>
<name>RoomInfo</name>
<message>
<location filename="../../src/Cache.cpp" line="+940"/>
<location filename="../../src/Cache.cpp" line="+984"/>
<source>no version stored</source>
<translation type="unfinished"></translation>
</message>
@ -918,7 +918,7 @@ Example: https://server.my:8787</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+259"/>
<location line="+271"/>
<source>Close</source>
<translation type="unfinished"></translation>
</message>
@ -972,15 +972,50 @@ Example: https://server.my:8787</source>
<context>
<name>UserInfoWidget</name>
<message>
<location filename="../../src/UserInfoWidget.cpp" line="+91"/>
<location filename="../../src/UserInfoWidget.cpp" line="+95"/>
<source>Logout</source>
<translation>Wyloguj</translation>
</message>
<message>
<location line="+20"/>
<source>Set custom status message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+4"/>
<source>Custom status message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>Status:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+9"/>
<source>Set presence automatically</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>Online</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+5"/>
<source>Unavailable</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>Offline</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UserSettingsPage</name>
<message>
<location filename="../../src/UserSettingsPage.cpp" line="+520"/>
<location filename="../../src/UserSettingsPage.cpp" line="+535"/>
<source>Minimize to tray</source>
<translation>Zminimalizuj do paska zadań</translation>
</message>

@ -4,7 +4,7 @@
<context>
<name>Cache</name>
<message>
<location filename="../../src/Cache.cpp" line="+1342"/>
<location filename="../../src/Cache.cpp" line="+1359"/>
<source>You joined this room.</source>
<translation type="unfinished"></translation>
</message>
@ -12,23 +12,23 @@
<context>
<name>ChatPage</name>
<message>
<location filename="../../src/ChatPage.cpp" line="+227"/>
<location filename="../../src/ChatPage.cpp" line="+229"/>
<source>Failed to invite user: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+4"/>
<location line="+923"/>
<location line="+926"/>
<source>Invited user: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="-471"/>
<location line="-474"/>
<source>Migrating the cache to the current version failed. This can have different reasons. Please open an issue and try to use an older version in the mean time. Alternatively you can try deleting the cache manually.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+436"/>
<location line="+439"/>
<source>Room %1 created.</source>
<translation type="unfinished"></translation>
</message>
@ -68,7 +68,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<location line="-825"/>
<location line="-828"/>
<source>Failed to upload media. Please try again.</source>
<translation type="unfinished"></translation>
</message>
@ -103,13 +103,13 @@
<translation>Не удалось настроить ключи шифрования. Ответ сервера:%1 %2. Пожалуйста, попробуйте позже.</translation>
</message>
<message>
<location line="+51"/>
<location line="+219"/>
<location line="+54"/>
<location line="+252"/>
<source>Please try to login again: %1</source>
<translation>Повторите попытку входа: %1</translation>
</message>
<message>
<location line="-154"/>
<location line="-187"/>
<source>Failed to join room: %1</source>
<translation type="unfinished"></translation>
</message>
@ -488,7 +488,7 @@ Example: https://server.my:8787</source>
<context>
<name>RoomInfo</name>
<message>
<location filename="../../src/Cache.cpp" line="+940"/>
<location filename="../../src/Cache.cpp" line="+984"/>
<source>no version stored</source>
<translation type="unfinished"></translation>
</message>
@ -918,7 +918,7 @@ Example: https://server.my:8787</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+259"/>
<location line="+271"/>
<source>Close</source>
<translation type="unfinished">Закрыть</translation>
</message>
@ -972,15 +972,50 @@ Example: https://server.my:8787</source>
<context>
<name>UserInfoWidget</name>
<message>
<location filename="../../src/UserInfoWidget.cpp" line="+91"/>
<location filename="../../src/UserInfoWidget.cpp" line="+95"/>
<source>Logout</source>
<translation>Выйти</translation>
</message>
<message>
<location line="+20"/>
<source>Set custom status message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+4"/>
<source>Custom status message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>Status:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+9"/>
<source>Set presence automatically</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>Online</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+5"/>
<source>Unavailable</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>Offline</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UserSettingsPage</name>
<message>
<location filename="../../src/UserSettingsPage.cpp" line="+520"/>
<location filename="../../src/UserSettingsPage.cpp" line="+535"/>
<source>Minimize to tray</source>
<translation>Сворачивать в системную панель</translation>
</message>

@ -4,7 +4,7 @@
<context>
<name>Cache</name>
<message>
<location filename="../../src/Cache.cpp" line="+1342"/>
<location filename="../../src/Cache.cpp" line="+1359"/>
<source>You joined this room.</source>
<translation type="unfinished"></translation>
</message>
@ -12,23 +12,23 @@
<context>
<name>ChatPage</name>
<message>
<location filename="../../src/ChatPage.cpp" line="+227"/>
<location filename="../../src/ChatPage.cpp" line="+229"/>
<source>Failed to invite user: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+4"/>
<location line="+923"/>
<location line="+926"/>
<source>Invited user: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="-471"/>
<location line="-474"/>
<source>Migrating the cache to the current version failed. This can have different reasons. Please open an issue and try to use an older version in the mean time. Alternatively you can try deleting the cache manually.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+436"/>
<location line="+439"/>
<source>Room %1 created.</source>
<translation type="unfinished"></translation>
</message>
@ -68,7 +68,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<location line="-825"/>
<location line="-828"/>
<source>Failed to upload media. Please try again.</source>
<translation type="unfinished"></translation>
</message>
@ -103,13 +103,13 @@
<translation type="unfinished"></translation>
</message>
<message>
<location line="+51"/>
<location line="+219"/>
<location line="+54"/>
<location line="+252"/>
<source>Please try to login again: %1</source>
<translation>%1</translation>
</message>
<message>
<location line="-154"/>
<location line="-187"/>
<source>Failed to join room: %1</source>
<translation type="unfinished"></translation>
</message>
@ -488,7 +488,7 @@ Example: https://server.my:8787</source>
<context>
<name>RoomInfo</name>
<message>
<location filename="../../src/Cache.cpp" line="+940"/>
<location filename="../../src/Cache.cpp" line="+984"/>
<source>no version stored</source>
<translation type="unfinished"></translation>
</message>
@ -916,7 +916,7 @@ Example: https://server.my:8787</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+259"/>
<location line="+271"/>
<source>Close</source>
<translation type="unfinished"></translation>
</message>
@ -970,15 +970,50 @@ Example: https://server.my:8787</source>
<context>
<name>UserInfoWidget</name>
<message>
<location filename="../../src/UserInfoWidget.cpp" line="+91"/>
<location filename="../../src/UserInfoWidget.cpp" line="+95"/>
<source>Logout</source>
<translation></translation>
</message>
<message>
<location line="+20"/>
<source>Set custom status message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+4"/>
<source>Custom status message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>Status:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+9"/>
<source>Set presence automatically</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>Online</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+5"/>
<source>Unavailable</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>Offline</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UserSettingsPage</name>
<message>
<location filename="../../src/UserSettingsPage.cpp" line="+520"/>
<location filename="../../src/UserSettingsPage.cpp" line="+535"/>
<source>Minimize to tray</source>
<translation></translation>
</message>

@ -9,6 +9,7 @@ Rectangle {
radius: settings.avatarCircles ? height/2 : 3
property alias url: img.source
property string userid
property string displayName
Label {
@ -42,6 +43,23 @@ Rectangle {
radius: settings.avatarCircles ? height/2 : 3
}
}
}
Rectangle {
anchors.bottom: avatar.bottom
anchors.right: avatar.right
height: avatar.height / 6
width: height
radius: settings.avatarCircles ? height / 2 : height / 4
color: switch (timelineManager.userPresence(userid)) {
case "online": return "#00cc66"
case "unavailable": return "#ff9933"
case "offline": return "#a82353"
default: "transparent"
}
}
color: colors.base
}

@ -171,6 +171,8 @@ Page {
onCountChanged: if (atYEnd) model.currentIndex = 0 // Mark last event as read, since we are at the bottom
property int delegateMaxWidth: (settings.timelineMaxWidth > 100 && (parent.width - settings.timelineMaxWidth) > 32) ? settings.timelineMaxWidth : (parent.width - 32)
delegate: Rectangle {
// This would normally be previousSection, but our model's order is inverted.
property bool sectionBoundary: (ListView.nextSection != "" && ListView.nextSection !== ListView.section) || model.index === chat.count - 1
@ -178,7 +180,7 @@ Page {
id: wrapper
property Item section
anchors.horizontalCenter: parent.horizontalCenter
width: (settings.timelineMaxWidth > 100 && (parent.width - settings.timelineMaxWidth) > 32) ? settings.timelineMaxWidth : (parent.width - 32)
width: chat.delegateMaxWidth
height: section ? section.height + timelinerow.height : timelinerow.height
color: "transparent"
@ -255,6 +257,7 @@ Page {
height: avatarSize
url: chat.model.avatarUrl(modelData.userId).replace("mxc://", "image://MxcImage/")
displayName: modelData.userName
userid: modelData.userId
MouseArea {
anchors.fill: parent
@ -277,6 +280,15 @@ Page {
propagateComposedEvents: true
}
}
Label {
color: colors.buttonText
text: timelineManager.userStatus(modelData.userId)
textFormat: Text.PlainText
elide: Text.ElideRight
width: chat.delegateMaxWidth - parent.spacing*2 - userName.implicitWidth - avatarSize
font.italic: true
}
}
}
}

@ -952,6 +952,8 @@ Cache::saveState(const mtx::responses::Sync &res)
saveInvites(txn, res.rooms.invite);
savePresence(txn, res.presence);
removeLeftRooms(txn, res.rooms.leave);
txn.commit();
@ -1037,6 +1039,21 @@ Cache::saveInvite(lmdb::txn &txn,
}
}
void
Cache::savePresence(
lmdb::txn &txn,
const std::vector<mtx::events::Event<mtx::events::presence::Presence>> &presenceUpdates)
{
for (const auto &update : presenceUpdates) {
auto presenceDb = getPresenceDb(txn);
lmdb::dbi_put(txn,
presenceDb,
lmdb::val(update.sender),
lmdb::val(json(update.content).dump()));
}
}
std::vector<std::string>
Cache::roomsWithStateUpdates(const mtx::responses::Sync &res)
{
@ -2254,6 +2271,50 @@ Cache::removeAvatarUrl(const QString &room_id, const QString &user_id)
AvatarUrls.remove(fmt);
}
mtx::presence::PresenceState
Cache::presenceState(const std::string &user_id)
{
lmdb::val presenceVal;
auto txn = lmdb::txn::begin(env_);
auto db = getPresenceDb(txn);
auto res = lmdb::dbi_get(txn, db, lmdb::val(user_id), presenceVal);
mtx::presence::PresenceState state = mtx::presence::offline;
if (res) {
mtx::events::presence::Presence presence =
json::parse(std::string(presenceVal.data(), presenceVal.size()));
state = presence.presence;
}
txn.commit();
return state;
}
std::string
Cache::statusMessage(const std::string &user_id)
{
lmdb::val presenceVal;
auto txn = lmdb::txn::begin(env_);
auto db = getPresenceDb(txn);
auto res = lmdb::dbi_get(txn, db, lmdb::val(user_id), presenceVal);
std::string status_msg;
if (res) {
mtx::events::presence::Presence presence =
json::parse(std::string(presenceVal.data(), presenceVal.size()));
status_msg = presence.status_msg;
}
txn.commit();
return status_msg;
}
void
to_json(json &j, const RoomInfo &info)
{
@ -2425,6 +2486,17 @@ insertAvatarUrl(const QString &room_id, const QString &user_id, const QString &a
instance_->insertAvatarUrl(room_id, user_id, avatar_url);
}
mtx::presence::PresenceState
presenceState(const std::string &user_id)
{
return instance_->presenceState(user_id);
}
std::string
statusMessage(const std::string &user_id)
{
return instance_->statusMessage(user_id);
}
//! Load saved data for the display names & avatars.
void
populateMembers()

@ -54,6 +54,12 @@ insertDisplayName(const QString &room_id, const QString &user_id, const QString
void
insertAvatarUrl(const QString &room_id, const QString &user_id, const QString &avatar_url);
// presence
mtx::presence::PresenceState
presenceState(const std::string &user_id);
std::string
statusMessage(const std::string &user_id);
//! Load saved data for the display names & avatars.
void
populateMembers();

@ -52,6 +52,10 @@ public:
static QString displayName(const QString &room_id, const QString &user_id);
static QString avatarUrl(const QString &room_id, const QString &user_id);
// presence
mtx::presence::PresenceState presenceState(const std::string &user_id);
std::string statusMessage(const std::string &user_id);
static void removeDisplayName(const QString &room_id, const QString &user_id);
static void removeAvatarUrl(const QString &room_id, const QString &user_id);
@ -377,6 +381,10 @@ private:
void saveInvites(lmdb::txn &txn,
const std::map<std::string, mtx::responses::InvitedRoom> &rooms);
void savePresence(
lmdb::txn &txn,
const std::vector<mtx::events::Event<mtx::events::presence::Presence>> &presenceUpdates);
//! Sends signals for the rooms that are removed.
void removeLeftRooms(lmdb::txn &txn,
const std::map<std::string, mtx::responses::LeftRoom> &rooms)
@ -430,6 +438,11 @@ private:
return lmdb::dbi::open(txn, std::string(room_id + "/mentions").c_str(), MDB_CREATE);
}
lmdb::dbi getPresenceDb(lmdb::txn &txn)
{
return lmdb::dbi::open(txn, "presence", MDB_CREATE);
}
//! Retrieves or creates the database that stores the open OLM sessions between our device
//! and the given curve25519 key which represents another device.
//!

@ -61,6 +61,7 @@ constexpr size_t MAX_ONETIME_KEYS = 50;
Q_DECLARE_METATYPE(std::optional<mtx::crypto::EncryptedFile>)
Q_DECLARE_METATYPE(std::optional<RelatedInfo>)
Q_DECLARE_METATYPE(mtx::presence::PresenceState)
ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
: QWidget(parent)
@ -72,6 +73,7 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
qRegisterMetaType<std::optional<mtx::crypto::EncryptedFile>>();
qRegisterMetaType<std::optional<RelatedInfo>>();
qRegisterMetaType<mtx::presence::PresenceState>();
topLayout_ = new QHBoxLayout(this);
topLayout_->setSpacing(0);
@ -990,7 +992,9 @@ ChatPage::startInitialSync()
nhlog::net()->info("trying initial sync");
mtx::http::SyncOpts opts;
opts.timeout = 0;
opts.timeout = 0;
opts.set_presence = currentPresence();
http::client()->sync(
opts,
std::bind(
@ -1001,6 +1005,7 @@ void
ChatPage::trySync()
{
mtx::http::SyncOpts opts;
opts.set_presence = currentPresence();
if (!connectivityTimer_.isActive())
connectivityTimer_.start();
@ -1228,6 +1233,39 @@ ChatPage::sendTypingNotifications()
});
}
QString
ChatPage::status() const
{
return QString::fromStdString(cache::statusMessage(utils::localUser().toStdString()));
}
void
ChatPage::setStatus(const QString &status)
{
http::client()->put_presence_status(
currentPresence(), status.toStdString(), [](mtx::http::RequestErr err) {
if (err) {
nhlog::net()->warn("failed to set presence status_msg: {}",
err->matrix_error.error);
}
});
}
mtx::presence::PresenceState
ChatPage::currentPresence() const
{
switch (userSettings_->presence()) {
case UserSettings::Presence::Online:
return mtx::presence::online;
case UserSettings::Presence::Unavailable:
return mtx::presence::unavailable;
case UserSettings::Presence::Offline:
return mtx::presence::offline;
default:
return mtx::presence::online;
}
}
void
ChatPage::initialSyncHandler(const mtx::responses::Sync &res, mtx::http::RequestErr err)
{

@ -89,6 +89,11 @@ public:
void initiateLogout();
void focusMessageInput();
QString status() const;
void setStatus(const QString &status);
mtx::presence::PresenceState currentPresence() const;
public slots:
void leaveRoom(const QString &room_id);
void createRoom(const mtx::requests::CreateRoom &req);
@ -154,6 +159,7 @@ signals:
const QImage &icon);
void updateGroupsInfo(const mtx::responses::JoinedGroups &groups);
void retrievedPresence(const QString &statusMsg, mtx::presence::PresenceState state);
void themeChanged();
void decryptSidebarChanged();

@ -16,7 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QInputDialog>
#include <QLabel>
#include <QMenu>
#include <QPainter>
#include <QStyle>
#include <QStyleOption>
@ -24,10 +26,12 @@
#include <iostream>
#include "ChatPage.h"
#include "Config.h"
#include "MainWindow.h"
#include "Splitter.h"
#include "UserInfoWidget.h"
#include "UserSettingsPage.h"
#include "ui/Avatar.h"
#include "ui/FlatButton.h"
#include "ui/OverlayModal.h"
@ -105,6 +109,52 @@ UserInfoWidget::UserInfoWidget(QWidget *parent)
connect(logoutButton_, &QPushButton::clicked, this, []() {
MainWindow::instance()->openLogoutDialog();
});
menu = new QMenu(this);
auto setStatusAction = menu->addAction(tr("Set custom status message"));
connect(setStatusAction, &QAction::triggered, this, [this]() {
bool ok = false;
QString text = QInputDialog::getText(this,
tr("Custom status message"),
tr("Status:"),
QLineEdit::Normal,
ChatPage::instance()->status(),
&ok);
if (ok)
ChatPage::instance()->setStatus(text);
});
#if 0 // disable presence menu until issues in synapse are resolved
auto setAutoPresence = menu->addAction(tr("Set presence automatically"));
connect(setAutoPresence, &QAction::triggered, this, []() {
ChatPage::instance()->userSettings()->setPresence(
UserSettings::Presence::AutomaticPresence);
ChatPage::instance()->setStatus(ChatPage::instance()->status());
});
auto setOnline = menu->addAction(tr("Online"));
connect(setOnline, &QAction::triggered, this, []() {
ChatPage::instance()->userSettings()->setPresence(UserSettings::Presence::Online);
ChatPage::instance()->setStatus(ChatPage::instance()->status());
});
auto setUnavailable = menu->addAction(tr("Unavailable"));
connect(setUnavailable, &QAction::triggered, this, []() {
ChatPage::instance()->userSettings()->setPresence(
UserSettings::Presence::Unavailable);
ChatPage::instance()->setStatus(ChatPage::instance()->status());
});
auto setOffline = menu->addAction(tr("Offline"));
connect(setOffline, &QAction::triggered, this, []() {
ChatPage::instance()->userSettings()->setPresence(UserSettings::Presence::Offline);
ChatPage::instance()->setStatus(ChatPage::instance()->status());
});
#endif
}
void
UserInfoWidget::contextMenuEvent(QContextMenuEvent *event)
{
menu->popup(event->globalPos());
}
void

@ -26,6 +26,7 @@ class OverlayModal;
class QLabel;
class QHBoxLayout;
class QVBoxLayout;
class QMenu;
class UserInfoWidget : public QWidget
{
@ -48,6 +49,7 @@ public:
protected:
void resizeEvent(QResizeEvent *event) override;
void paintEvent(QPaintEvent *event) override;
void contextMenuEvent(QContextMenuEvent *) override;
private:
Avatar *userAvatar_;
@ -70,4 +72,6 @@ private:
int logoutButtonSize_;
QColor borderColor_;
QMenu *menu = nullptr;
};

@ -34,6 +34,7 @@
#include <QStandardPaths>
#include <QString>
#include <QTextStream>
#include <QtQml>
#include "Cache.h"
#include "Config.h"
@ -73,6 +74,9 @@ UserSettings::load()
decryptSidebar_ = settings.value("user/decrypt_sidebar", true).toBool();
emojiFont_ = settings.value("user/emoji_font_family", "default").toString();
baseFontSize_ = settings.value("user/font_size", QFont().pointSizeF()).toDouble();
presence_ =
settings.value("user/presence", QVariant::fromValue(Presence::AutomaticPresence))
.value<Presence>();
applyTheme();
}
@ -254,6 +258,16 @@ UserSettings::setEmojiFontFamily(QString family)
save();
}
void
UserSettings::setPresence(Presence state)
{
if (state == presence_)
return;
presence_ = state;
emit presenceChanged(state);
save();
}
void
UserSettings::setTheme(QString theme)
{
@ -349,6 +363,7 @@ UserSettings::save()
settings.setValue("theme", theme());
settings.setValue("font_family", font_);
settings.setValue("emoji_font_family", emojiFont_);
settings.setValue("presence", QVariant::fromValue(presence_));
settings.endGroup();

@ -70,10 +70,20 @@ class UserSettings : public QObject
Q_PROPERTY(QString font READ font WRITE setFontFamily NOTIFY fontChanged)
Q_PROPERTY(
QString emojiFont READ emojiFont WRITE setEmojiFontFamily NOTIFY emojiFontChanged)
Q_PROPERTY(Presence presence READ presence WRITE setPresence NOTIFY presenceChanged)
public:
UserSettings();
enum class Presence
{
AutomaticPresence,
Online,
Unavailable,
Offline,
};
Q_ENUM(Presence);
void save();
void load();
void applyTheme();
@ -96,6 +106,7 @@ public:
void setAlertOnNotification(bool state);
void setAvatarCircles(bool state);
void setDecryptSidebar(bool state);
void setPresence(Presence state);
QString theme() const { return !theme_.isEmpty() ? theme_ : defaultTheme_; }
bool messageHoverHighlight() const { return messageHoverHighlight_; }
@ -120,6 +131,7 @@ public:
double fontSize() const { return baseFontSize_; }
QString font() const { return font_; }
QString emojiFont() const { return emojiFont_; }
Presence presence() const { return presence_; }
signals:
void groupViewStateChanged(bool state);
@ -141,6 +153,7 @@ signals:
void fontSizeChanged(double state);
void fontChanged(QString state);
void emojiFontChanged(QString state);
void presenceChanged(Presence state);
private:
// Default to system theme if QT_QPA_PLATFORMTHEME var is set.
@ -167,6 +180,7 @@ private:
double baseFontSize_;
QString font_;
QString emojiFont_;
Presence presence_;
};
class HorizontalLine : public QFrame

@ -104,6 +104,18 @@ createCacheDirectory()
int
main(int argc, char *argv[])
{
// needed for settings so need to register before any settings are read to prevent warings
qRegisterMetaType<UserSettings::Presence>();
QCoreApplication::setApplicationName("nheko");
QCoreApplication::setApplicationVersion(nheko::version);
QCoreApplication::setOrganizationName("nheko");
QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
// this needs to be after setting the application name. Or how would we find our settings
// file then?
#if defined(Q_OS_LINUX) || defined(Q_OS_WIN) || defined(Q_OS_FREEBSD)
if (qgetenv("QT_SCALE_FACTOR").size() == 0) {
float factor = utils::scaleFactor();
@ -113,12 +125,6 @@ main(int argc, char *argv[])
}
#endif
QCoreApplication::setApplicationName("nheko");
QCoreApplication::setApplicationVersion(nheko::version);
QCoreApplication::setOrganizationName("nheko");
QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
SingleApplication app(argc,
argv,
false,

@ -59,6 +59,18 @@ TimelineViewManager::userColor(QString id, QColor background)
return userColors.value(id);
}
QString
TimelineViewManager::userPresence(QString id) const
{
return QString::fromStdString(
mtx::presence::to_string(cache::presenceState(id.toStdString())));
}
QString
TimelineViewManager::userStatus(QString id) const
{
return QString::fromStdString(cache::statusMessage(id.toStdString()));
}
TimelineViewManager::TimelineViewManager(QSharedPointer<UserSettings> userSettings, QWidget *parent)
: imgProvider(new MxcImageProvider())
, colorImgProvider(new ColorImageProvider())

@ -44,6 +44,9 @@ public:
Q_INVOKABLE void openImageOverlay(QString mxcUrl, QString eventId) const;
Q_INVOKABLE QColor userColor(QString id, QColor background);
Q_INVOKABLE QString userPresence(QString id) const;
Q_INVOKABLE QString userStatus(QString id) const;
signals:
void clearRoomMessageCount(QString roomid);
void updateRoomsLastMessage(QString roomid, const DescInfo &info);

Loading…
Cancel
Save