Merge pull request #146 from Alch-Emi/priority-sort

Place unread rooms higher in the room list
This commit is contained in:
DeepBlueV7.X 2020-03-15 21:13:55 +00:00 committed by GitHub
commit b41e2e6f18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 321 additions and 177 deletions

View file

@ -371,12 +371,12 @@
<context> <context>
<name>RoomInfoListItem</name> <name>RoomInfoListItem</name>
<message> <message>
<location filename="../../src/RoomInfoListItem.cpp" line="+97"/> <location filename="../../src/RoomInfoListItem.cpp" line="+98"/>
<source>Leave room</source> <source>Leave room</source>
<translation>Raum verlassen</translation> <translation>Raum verlassen</translation>
</message> </message>
<message> <message>
<location line="+154"/> <location line="+158"/>
<source>Accept</source> <source>Accept</source>
<translation>Akzeptieren</translation> <translation>Akzeptieren</translation>
</message> </message>
@ -491,7 +491,13 @@
<translation>-- Entschlüsselungsfehler (Fehler bei Suche nach megolm Schlüsseln in Datenbank) --</translation> <translation>-- Entschlüsselungsfehler (Fehler bei Suche nach megolm Schlüsseln in Datenbank) --</translation>
</message> </message>
<message> <message>
<location line="+88"/> <location line="+12"/>
<source>-- Decryption Error (%1) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1.</comment>
<translation type="unfinished">-- Entschlüsselungsfehler (%1) --</translation>
</message>
<message>
<location line="+76"/>
<source>Message redaction failed: %1</source> <source>Message redaction failed: %1</source>
<translation>Nachricht zurückziehen fehlgeschlagen: %1</translation> <translation>Nachricht zurückziehen fehlgeschlagen: %1</translation>
</message> </message>
@ -522,13 +528,7 @@
<translation type="unfinished">-- Verschlüsseltes Event (keine Schlüssel zur Entschlüsselung gefunden) --</translation> <translation type="unfinished">-- Verschlüsseltes Event (keine Schlüssel zur Entschlüsselung gefunden) --</translation>
</message> </message>
<message> <message>
<location line="+46"/> <location line="+75"/>
<source>-- Decryption Error (%1) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted. In this case, the Olm decrytion returned an error, which is passed as %1.</comment>
<translation type="unfinished">-- Entschlüsselungsfehler (%1) --</translation>
</message>
<message>
<location line="+29"/>
<source>-- Encrypted Event (Unknown event type) --</source> <source>-- Encrypted Event (Unknown event type) --</source>
<comment>Placeholder, when the message was decrypted, but we couldn&apos;t parse it, because Nheko/mtxclient don&apos;t support that event type yet.</comment> <comment>Placeholder, when the message was decrypted, but we couldn&apos;t parse it, because Nheko/mtxclient don&apos;t support that event type yet.</comment>
<translation type="unfinished">-- Verschlüsseltes Event (Unbekannter Eventtyp) --</translation> <translation type="unfinished">-- Verschlüsseltes Event (Unbekannter Eventtyp) --</translation>
@ -782,7 +782,7 @@
<context> <context>
<name>UserSettingsPage</name> <name>UserSettingsPage</name>
<message> <message>
<location filename="../../src/UserSettingsPage.cpp" line="+296"/> <location filename="../../src/UserSettingsPage.cpp" line="+299"/>
<source>Minimize to tray</source> <source>Minimize to tray</source>
<translation>Ins Benachrichtigungsfeld minimieren</translation> <translation>Ins Benachrichtigungsfeld minimieren</translation>
</message> </message>
@ -811,6 +811,11 @@
<source>Typing notifications</source> <source>Typing notifications</source>
<translation>Schreibbenachrichtigungen</translation> <translation>Schreibbenachrichtigungen</translation>
</message> </message>
<message>
<location line="+1"/>
<source>Sort rooms by unreads</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<location line="+2"/> <location line="+2"/>
<source>Read receipts</source> <source>Read receipts</source>
@ -857,7 +862,7 @@
<translation>Gerätefingerabdruck</translation> <translation>Gerätefingerabdruck</translation>
</message> </message>
<message> <message>
<location line="-57"/> <location line="-58"/>
<source>Session Keys</source> <source>Session Keys</source>
<translation>Sitzungsschlüssel</translation> <translation>Sitzungsschlüssel</translation>
</message> </message>
@ -877,22 +882,22 @@
<translation>VERSCHLÜSSELUNG</translation> <translation>VERSCHLÜSSELUNG</translation>
</message> </message>
<message> <message>
<location line="-61"/> <location line="-62"/>
<source>GENERAL</source> <source>GENERAL</source>
<translation>ALLGEMEINES</translation> <translation>ALLGEMEINES</translation>
</message> </message>
<message> <message>
<location line="+23"/> <location line="+24"/>
<source>INTERFACE</source> <source>INTERFACE</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+106"/> <location line="+107"/>
<source>Emoji Font Family</source> <source>Emoji Font Family</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+147"/> <location line="+152"/>
<source>Open Sessions File</source> <source>Open Sessions File</source>
<translation>Öffne Sessions Datei</translation> <translation>Öffne Sessions Datei</translation>
</message> </message>

View file

@ -371,12 +371,12 @@
<context> <context>
<name>RoomInfoListItem</name> <name>RoomInfoListItem</name>
<message> <message>
<location filename="../../src/RoomInfoListItem.cpp" line="+97"/> <location filename="../../src/RoomInfoListItem.cpp" line="+98"/>
<source>Leave room</source> <source>Leave room</source>
<translation>Βγές</translation> <translation>Βγές</translation>
</message> </message>
<message> <message>
<location line="+154"/> <location line="+158"/>
<source>Accept</source> <source>Accept</source>
<translation>Αποδοχή</translation> <translation>Αποδοχή</translation>
</message> </message>
@ -491,7 +491,13 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+88"/> <location line="+12"/>
<source>-- Decryption Error (%1) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1.</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+76"/>
<source>Message redaction failed: %1</source> <source>Message redaction failed: %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -522,13 +528,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+46"/> <location line="+75"/>
<source>-- Decryption Error (%1) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted. In this case, the Olm decrytion returned an error, which is passed as %1.</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+29"/>
<source>-- Encrypted Event (Unknown event type) --</source> <source>-- Encrypted Event (Unknown event type) --</source>
<comment>Placeholder, when the message was decrypted, but we couldn&apos;t parse it, because Nheko/mtxclient don&apos;t support that event type yet.</comment> <comment>Placeholder, when the message was decrypted, but we couldn&apos;t parse it, because Nheko/mtxclient don&apos;t support that event type yet.</comment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -782,7 +782,7 @@
<context> <context>
<name>UserSettingsPage</name> <name>UserSettingsPage</name>
<message> <message>
<location filename="../../src/UserSettingsPage.cpp" line="+296"/> <location filename="../../src/UserSettingsPage.cpp" line="+299"/>
<source>Minimize to tray</source> <source>Minimize to tray</source>
<translation>Ελαχιστοποίηση</translation> <translation>Ελαχιστοποίηση</translation>
</message> </message>
@ -811,6 +811,11 @@
<source>Typing notifications</source> <source>Typing notifications</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<location line="+1"/>
<source>Sort rooms by unreads</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<location line="+2"/> <location line="+2"/>
<source>Read receipts</source> <source>Read receipts</source>
@ -857,7 +862,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="-57"/> <location line="-58"/>
<source>Session Keys</source> <source>Session Keys</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -877,22 +882,22 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="-61"/> <location line="-62"/>
<source>GENERAL</source> <source>GENERAL</source>
<translation>ΓΕΝΙΚΑ</translation> <translation>ΓΕΝΙΚΑ</translation>
</message> </message>
<message> <message>
<location line="+23"/> <location line="+24"/>
<source>INTERFACE</source> <source>INTERFACE</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+106"/> <location line="+107"/>
<source>Emoji Font Family</source> <source>Emoji Font Family</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+147"/> <location line="+152"/>
<source>Open Sessions File</source> <source>Open Sessions File</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View file

@ -371,12 +371,12 @@
<context> <context>
<name>RoomInfoListItem</name> <name>RoomInfoListItem</name>
<message> <message>
<location filename="../../src/RoomInfoListItem.cpp" line="+97"/> <location filename="../../src/RoomInfoListItem.cpp" line="+98"/>
<source>Leave room</source> <source>Leave room</source>
<translation>Leave room</translation> <translation>Leave room</translation>
</message> </message>
<message> <message>
<location line="+154"/> <location line="+158"/>
<source>Accept</source> <source>Accept</source>
<translation>Accept</translation> <translation>Accept</translation>
</message> </message>
@ -491,7 +491,13 @@
<translation>-- Decryption Error (failed to retrieve megolm keys from db) --</translation> <translation>-- Decryption Error (failed to retrieve megolm keys from db) --</translation>
</message> </message>
<message> <message>
<location line="+88"/> <location line="+12"/>
<source>-- Decryption Error (%1) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1.</comment>
<translation type="unfinished">-- Decryption Error (%1) --</translation>
</message>
<message>
<location line="+76"/>
<source>Message redaction failed: %1</source> <source>Message redaction failed: %1</source>
<translation>Message redaction failed: %1</translation> <translation>Message redaction failed: %1</translation>
</message> </message>
@ -522,13 +528,7 @@
<translation type="unfinished">-- Encrypted Event (No keys found for decryption) --</translation> <translation type="unfinished">-- Encrypted Event (No keys found for decryption) --</translation>
</message> </message>
<message> <message>
<location line="+46"/> <location line="+75"/>
<source>-- Decryption Error (%1) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted. In this case, the Olm decrytion returned an error, which is passed as %1.</comment>
<translation type="unfinished">-- Decryption Error (%1) --</translation>
</message>
<message>
<location line="+29"/>
<source>-- Encrypted Event (Unknown event type) --</source> <source>-- Encrypted Event (Unknown event type) --</source>
<comment>Placeholder, when the message was decrypted, but we couldn&apos;t parse it, because Nheko/mtxclient don&apos;t support that event type yet.</comment> <comment>Placeholder, when the message was decrypted, but we couldn&apos;t parse it, because Nheko/mtxclient don&apos;t support that event type yet.</comment>
<translation type="unfinished">-- Encrypted Event (Unknown event type) --</translation> <translation type="unfinished">-- Encrypted Event (Unknown event type) --</translation>
@ -782,7 +782,7 @@
<context> <context>
<name>UserSettingsPage</name> <name>UserSettingsPage</name>
<message> <message>
<location filename="../../src/UserSettingsPage.cpp" line="+296"/> <location filename="../../src/UserSettingsPage.cpp" line="+299"/>
<source>Minimize to tray</source> <source>Minimize to tray</source>
<translation>Minimize to tray</translation> <translation>Minimize to tray</translation>
</message> </message>
@ -811,6 +811,11 @@
<source>Typing notifications</source> <source>Typing notifications</source>
<translation>Typing notifications</translation> <translation>Typing notifications</translation>
</message> </message>
<message>
<location line="+1"/>
<source>Sort rooms by unreads</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<location line="+2"/> <location line="+2"/>
<source>Read receipts</source> <source>Read receipts</source>
@ -857,7 +862,7 @@
<translation>Device Fingerprint</translation> <translation>Device Fingerprint</translation>
</message> </message>
<message> <message>
<location line="-57"/> <location line="-58"/>
<source>Session Keys</source> <source>Session Keys</source>
<translation>Session Keys</translation> <translation>Session Keys</translation>
</message> </message>
@ -877,22 +882,22 @@
<translation>ENCRYPTION</translation> <translation>ENCRYPTION</translation>
</message> </message>
<message> <message>
<location line="-61"/> <location line="-62"/>
<source>GENERAL</source> <source>GENERAL</source>
<translation>GENERAL</translation> <translation>GENERAL</translation>
</message> </message>
<message> <message>
<location line="+23"/> <location line="+24"/>
<source>INTERFACE</source> <source>INTERFACE</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+106"/> <location line="+107"/>
<source>Emoji Font Family</source> <source>Emoji Font Family</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+147"/> <location line="+152"/>
<source>Open Sessions File</source> <source>Open Sessions File</source>
<translation>Open Sessions File</translation> <translation>Open Sessions File</translation>
</message> </message>

View file

@ -371,12 +371,12 @@
<context> <context>
<name>RoomInfoListItem</name> <name>RoomInfoListItem</name>
<message> <message>
<location filename="../../src/RoomInfoListItem.cpp" line="+97"/> <location filename="../../src/RoomInfoListItem.cpp" line="+98"/>
<source>Leave room</source> <source>Leave room</source>
<translation>Poistu huoneesta</translation> <translation>Poistu huoneesta</translation>
</message> </message>
<message> <message>
<location line="+154"/> <location line="+158"/>
<source>Accept</source> <source>Accept</source>
<translation>Hyväksy</translation> <translation>Hyväksy</translation>
</message> </message>
@ -491,7 +491,13 @@
<translation type="unfinished">-- Virhe purkaessa salausta (megolm-avaimien hakeminen tietokannasta epäonnistui) --</translation> <translation type="unfinished">-- Virhe purkaessa salausta (megolm-avaimien hakeminen tietokannasta epäonnistui) --</translation>
</message> </message>
<message> <message>
<location line="+88"/> <location line="+12"/>
<source>-- Decryption Error (%1) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1.</comment>
<translation type="unfinished">-- Virhe purkaessa salausta (%1) --</translation>
</message>
<message>
<location line="+76"/>
<source>Message redaction failed: %1</source> <source>Message redaction failed: %1</source>
<translation type="unfinished">Viestin poisto epäonnistui: %1</translation> <translation type="unfinished">Viestin poisto epäonnistui: %1</translation>
</message> </message>
@ -522,13 +528,7 @@
<translation type="unfinished">-- Salattu viesti (salauksen purkuavaimia ei löydetty) --</translation> <translation type="unfinished">-- Salattu viesti (salauksen purkuavaimia ei löydetty) --</translation>
</message> </message>
<message> <message>
<location line="+46"/> <location line="+75"/>
<source>-- Decryption Error (%1) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted. In this case, the Olm decrytion returned an error, which is passed as %1.</comment>
<translation type="unfinished">-- Virhe purkaessa salausta (%1) --</translation>
</message>
<message>
<location line="+29"/>
<source>-- Encrypted Event (Unknown event type) --</source> <source>-- Encrypted Event (Unknown event type) --</source>
<comment>Placeholder, when the message was decrypted, but we couldn&apos;t parse it, because Nheko/mtxclient don&apos;t support that event type yet.</comment> <comment>Placeholder, when the message was decrypted, but we couldn&apos;t parse it, because Nheko/mtxclient don&apos;t support that event type yet.</comment>
<translation type="unfinished">-- Salattu viesti (tuntematon viestityyppi) --</translation> <translation type="unfinished">-- Salattu viesti (tuntematon viestityyppi) --</translation>
@ -782,7 +782,7 @@
<context> <context>
<name>UserSettingsPage</name> <name>UserSettingsPage</name>
<message> <message>
<location filename="../../src/UserSettingsPage.cpp" line="+296"/> <location filename="../../src/UserSettingsPage.cpp" line="+299"/>
<source>Minimize to tray</source> <source>Minimize to tray</source>
<translation>Pienennä ilmoitusalueelle</translation> <translation>Pienennä ilmoitusalueelle</translation>
</message> </message>
@ -811,6 +811,11 @@
<source>Typing notifications</source> <source>Typing notifications</source>
<translation>Kirjoitusilmoitukset</translation> <translation>Kirjoitusilmoitukset</translation>
</message> </message>
<message>
<location line="+1"/>
<source>Sort rooms by unreads</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<location line="+2"/> <location line="+2"/>
<source>Read receipts</source> <source>Read receipts</source>
@ -857,7 +862,7 @@
<translation>Laitteen sormenjälki</translation> <translation>Laitteen sormenjälki</translation>
</message> </message>
<message> <message>
<location line="-57"/> <location line="-58"/>
<source>Session Keys</source> <source>Session Keys</source>
<translation>Istunnon avaimet</translation> <translation>Istunnon avaimet</translation>
</message> </message>
@ -877,22 +882,22 @@
<translation>SALAUS</translation> <translation>SALAUS</translation>
</message> </message>
<message> <message>
<location line="-61"/> <location line="-62"/>
<source>GENERAL</source> <source>GENERAL</source>
<translation>YLEISET ASETUKSET</translation> <translation>YLEISET ASETUKSET</translation>
</message> </message>
<message> <message>
<location line="+23"/> <location line="+24"/>
<source>INTERFACE</source> <source>INTERFACE</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+106"/> <location line="+107"/>
<source>Emoji Font Family</source> <source>Emoji Font Family</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+147"/> <location line="+152"/>
<source>Open Sessions File</source> <source>Open Sessions File</source>
<translation>Avaa Istuntoavaintiedosto</translation> <translation>Avaa Istuntoavaintiedosto</translation>
</message> </message>

View file

@ -372,12 +372,12 @@
<context> <context>
<name>RoomInfoListItem</name> <name>RoomInfoListItem</name>
<message> <message>
<location filename="../../src/RoomInfoListItem.cpp" line="+97"/> <location filename="../../src/RoomInfoListItem.cpp" line="+98"/>
<source>Leave room</source> <source>Leave room</source>
<translation>Quitter le salon</translation> <translation>Quitter le salon</translation>
</message> </message>
<message> <message>
<location line="+154"/> <location line="+158"/>
<source>Accept</source> <source>Accept</source>
<translation>Accepter</translation> <translation>Accepter</translation>
</message> </message>
@ -492,7 +492,13 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+88"/> <location line="+12"/>
<source>-- Decryption Error (%1) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1.</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+76"/>
<source>Message redaction failed: %1</source> <source>Message redaction failed: %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -523,13 +529,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+46"/> <location line="+75"/>
<source>-- Decryption Error (%1) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted. In this case, the Olm decrytion returned an error, which is passed as %1.</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+29"/>
<source>-- Encrypted Event (Unknown event type) --</source> <source>-- Encrypted Event (Unknown event type) --</source>
<comment>Placeholder, when the message was decrypted, but we couldn&apos;t parse it, because Nheko/mtxclient don&apos;t support that event type yet.</comment> <comment>Placeholder, when the message was decrypted, but we couldn&apos;t parse it, because Nheko/mtxclient don&apos;t support that event type yet.</comment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -783,7 +783,7 @@
<context> <context>
<name>UserSettingsPage</name> <name>UserSettingsPage</name>
<message> <message>
<location filename="../../src/UserSettingsPage.cpp" line="+296"/> <location filename="../../src/UserSettingsPage.cpp" line="+299"/>
<source>Minimize to tray</source> <source>Minimize to tray</source>
<translation>Réduire à la barre des tâches</translation> <translation>Réduire à la barre des tâches</translation>
</message> </message>
@ -812,6 +812,11 @@
<source>Typing notifications</source> <source>Typing notifications</source>
<translation>Notifications d&apos;écriture</translation> <translation>Notifications d&apos;écriture</translation>
</message> </message>
<message>
<location line="+1"/>
<source>Sort rooms by unreads</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<location line="+2"/> <location line="+2"/>
<source>Read receipts</source> <source>Read receipts</source>
@ -858,7 +863,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="-57"/> <location line="-58"/>
<source>Session Keys</source> <source>Session Keys</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -878,22 +883,22 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="-61"/> <location line="-62"/>
<source>GENERAL</source> <source>GENERAL</source>
<translation>GÉNÉRAL</translation> <translation>GÉNÉRAL</translation>
</message> </message>
<message> <message>
<location line="+23"/> <location line="+24"/>
<source>INTERFACE</source> <source>INTERFACE</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+106"/> <location line="+107"/>
<source>Emoji Font Family</source> <source>Emoji Font Family</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+147"/> <location line="+152"/>
<source>Open Sessions File</source> <source>Open Sessions File</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View file

@ -371,12 +371,12 @@
<context> <context>
<name>RoomInfoListItem</name> <name>RoomInfoListItem</name>
<message> <message>
<location filename="../../src/RoomInfoListItem.cpp" line="+97"/> <location filename="../../src/RoomInfoListItem.cpp" line="+98"/>
<source>Leave room</source> <source>Leave room</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location line="+154"/> <location line="+158"/>
<source>Accept</source> <source>Accept</source>
<translation></translation> <translation></translation>
</message> </message>
@ -491,7 +491,13 @@
<translation>-- (megolm鍵を取得できませんでした) --</translation> <translation>-- (megolm鍵を取得できませんでした) --</translation>
</message> </message>
<message> <message>
<location line="+88"/> <location line="+12"/>
<source>-- Decryption Error (%1) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1.</comment>
<translation type="unfinished">-- (%1) --</translation>
</message>
<message>
<location line="+76"/>
<source>Message redaction failed: %1</source> <source>Message redaction failed: %1</source>
<translation>: %1</translation> <translation>: %1</translation>
</message> </message>
@ -522,13 +528,7 @@
<translation type="unfinished">-- () --</translation> <translation type="unfinished">-- () --</translation>
</message> </message>
<message> <message>
<location line="+46"/> <location line="+75"/>
<source>-- Decryption Error (%1) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted. In this case, the Olm decrytion returned an error, which is passed as %1.</comment>
<translation type="unfinished">-- (%1) --</translation>
</message>
<message>
<location line="+29"/>
<source>-- Encrypted Event (Unknown event type) --</source> <source>-- Encrypted Event (Unknown event type) --</source>
<comment>Placeholder, when the message was decrypted, but we couldn&apos;t parse it, because Nheko/mtxclient don&apos;t support that event type yet.</comment> <comment>Placeholder, when the message was decrypted, but we couldn&apos;t parse it, because Nheko/mtxclient don&apos;t support that event type yet.</comment>
<translation type="unfinished">-- () --</translation> <translation type="unfinished">-- () --</translation>
@ -781,7 +781,7 @@
<context> <context>
<name>UserSettingsPage</name> <name>UserSettingsPage</name>
<message> <message>
<location filename="../../src/UserSettingsPage.cpp" line="+296"/> <location filename="../../src/UserSettingsPage.cpp" line="+299"/>
<source>Minimize to tray</source> <source>Minimize to tray</source>
<translation></translation> <translation></translation>
</message> </message>
@ -810,6 +810,11 @@
<source>Typing notifications</source> <source>Typing notifications</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<location line="+1"/>
<source>Sort rooms by unreads</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<location line="+2"/> <location line="+2"/>
<source>Read receipts</source> <source>Read receipts</source>
@ -856,7 +861,7 @@
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location line="-57"/> <location line="-58"/>
<source>Session Keys</source> <source>Session Keys</source>
<translation></translation> <translation></translation>
</message> </message>
@ -876,22 +881,22 @@
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location line="-61"/> <location line="-62"/>
<source>GENERAL</source> <source>GENERAL</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location line="+23"/> <location line="+24"/>
<source>INTERFACE</source> <source>INTERFACE</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+106"/> <location line="+107"/>
<source>Emoji Font Family</source> <source>Emoji Font Family</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+147"/> <location line="+152"/>
<source>Open Sessions File</source> <source>Open Sessions File</source>
<translation></translation> <translation></translation>
</message> </message>

View file

@ -371,12 +371,12 @@
<context> <context>
<name>RoomInfoListItem</name> <name>RoomInfoListItem</name>
<message> <message>
<location filename="../../src/RoomInfoListItem.cpp" line="+97"/> <location filename="../../src/RoomInfoListItem.cpp" line="+98"/>
<source>Leave room</source> <source>Leave room</source>
<translation>Kamer verlaten</translation> <translation>Kamer verlaten</translation>
</message> </message>
<message> <message>
<location line="+154"/> <location line="+158"/>
<source>Accept</source> <source>Accept</source>
<translation>Accepteren</translation> <translation>Accepteren</translation>
</message> </message>
@ -491,7 +491,13 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+88"/> <location line="+12"/>
<source>-- Decryption Error (%1) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1.</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+76"/>
<source>Message redaction failed: %1</source> <source>Message redaction failed: %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -522,13 +528,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+46"/> <location line="+75"/>
<source>-- Decryption Error (%1) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted. In this case, the Olm decrytion returned an error, which is passed as %1.</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+29"/>
<source>-- Encrypted Event (Unknown event type) --</source> <source>-- Encrypted Event (Unknown event type) --</source>
<comment>Placeholder, when the message was decrypted, but we couldn&apos;t parse it, because Nheko/mtxclient don&apos;t support that event type yet.</comment> <comment>Placeholder, when the message was decrypted, but we couldn&apos;t parse it, because Nheko/mtxclient don&apos;t support that event type yet.</comment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -782,7 +782,7 @@
<context> <context>
<name>UserSettingsPage</name> <name>UserSettingsPage</name>
<message> <message>
<location filename="../../src/UserSettingsPage.cpp" line="+296"/> <location filename="../../src/UserSettingsPage.cpp" line="+299"/>
<source>Minimize to tray</source> <source>Minimize to tray</source>
<translation>Minimaliseren naar systeemvak</translation> <translation>Minimaliseren naar systeemvak</translation>
</message> </message>
@ -811,6 +811,11 @@
<source>Typing notifications</source> <source>Typing notifications</source>
<translation>Meldingen bij typen van berichten</translation> <translation>Meldingen bij typen van berichten</translation>
</message> </message>
<message>
<location line="+1"/>
<source>Sort rooms by unreads</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<location line="+2"/> <location line="+2"/>
<source>Read receipts</source> <source>Read receipts</source>
@ -857,7 +862,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="-57"/> <location line="-58"/>
<source>Session Keys</source> <source>Session Keys</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -877,22 +882,22 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="-61"/> <location line="-62"/>
<source>GENERAL</source> <source>GENERAL</source>
<translation>ALGEMEEN</translation> <translation>ALGEMEEN</translation>
</message> </message>
<message> <message>
<location line="+23"/> <location line="+24"/>
<source>INTERFACE</source> <source>INTERFACE</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+106"/> <location line="+107"/>
<source>Emoji Font Family</source> <source>Emoji Font Family</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+147"/> <location line="+152"/>
<source>Open Sessions File</source> <source>Open Sessions File</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View file

@ -371,12 +371,12 @@
<context> <context>
<name>RoomInfoListItem</name> <name>RoomInfoListItem</name>
<message> <message>
<location filename="../../src/RoomInfoListItem.cpp" line="+97"/> <location filename="../../src/RoomInfoListItem.cpp" line="+98"/>
<source>Leave room</source> <source>Leave room</source>
<translation>Opuść pokój</translation> <translation>Opuść pokój</translation>
</message> </message>
<message> <message>
<location line="+154"/> <location line="+158"/>
<source>Accept</source> <source>Accept</source>
<translation>Akceptuj</translation> <translation>Akceptuj</translation>
</message> </message>
@ -491,7 +491,13 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+88"/> <location line="+12"/>
<source>-- Decryption Error (%1) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1.</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+76"/>
<source>Message redaction failed: %1</source> <source>Message redaction failed: %1</source>
<translation type="unfinished">Redagowanie wiadomości nie powiodło się: %1</translation> <translation type="unfinished">Redagowanie wiadomości nie powiodło się: %1</translation>
</message> </message>
@ -522,13 +528,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+46"/> <location line="+75"/>
<source>-- Decryption Error (%1) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted. In this case, the Olm decrytion returned an error, which is passed as %1.</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+29"/>
<source>-- Encrypted Event (Unknown event type) --</source> <source>-- Encrypted Event (Unknown event type) --</source>
<comment>Placeholder, when the message was decrypted, but we couldn&apos;t parse it, because Nheko/mtxclient don&apos;t support that event type yet.</comment> <comment>Placeholder, when the message was decrypted, but we couldn&apos;t parse it, because Nheko/mtxclient don&apos;t support that event type yet.</comment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -783,7 +783,7 @@
<context> <context>
<name>UserSettingsPage</name> <name>UserSettingsPage</name>
<message> <message>
<location filename="../../src/UserSettingsPage.cpp" line="+296"/> <location filename="../../src/UserSettingsPage.cpp" line="+299"/>
<source>Minimize to tray</source> <source>Minimize to tray</source>
<translation>Zminimalizuj do paska zadań</translation> <translation>Zminimalizuj do paska zadań</translation>
</message> </message>
@ -812,6 +812,11 @@
<source>Typing notifications</source> <source>Typing notifications</source>
<translation>Powiadomienia o pisaniu</translation> <translation>Powiadomienia o pisaniu</translation>
</message> </message>
<message>
<location line="+1"/>
<source>Sort rooms by unreads</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<location line="+2"/> <location line="+2"/>
<source>Read receipts</source> <source>Read receipts</source>
@ -858,7 +863,7 @@
<translation>Odcisk palca urządzenia</translation> <translation>Odcisk palca urządzenia</translation>
</message> </message>
<message> <message>
<location line="-57"/> <location line="-58"/>
<source>Session Keys</source> <source>Session Keys</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -878,22 +883,22 @@
<translation>SZYFROWANIE</translation> <translation>SZYFROWANIE</translation>
</message> </message>
<message> <message>
<location line="-61"/> <location line="-62"/>
<source>GENERAL</source> <source>GENERAL</source>
<translation>OGÓLNE</translation> <translation>OGÓLNE</translation>
</message> </message>
<message> <message>
<location line="+23"/> <location line="+24"/>
<source>INTERFACE</source> <source>INTERFACE</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+106"/> <location line="+107"/>
<source>Emoji Font Family</source> <source>Emoji Font Family</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+147"/> <location line="+152"/>
<source>Open Sessions File</source> <source>Open Sessions File</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View file

@ -371,12 +371,12 @@
<context> <context>
<name>RoomInfoListItem</name> <name>RoomInfoListItem</name>
<message> <message>
<location filename="../../src/RoomInfoListItem.cpp" line="+97"/> <location filename="../../src/RoomInfoListItem.cpp" line="+98"/>
<source>Leave room</source> <source>Leave room</source>
<translation>Покинуть комнату</translation> <translation>Покинуть комнату</translation>
</message> </message>
<message> <message>
<location line="+154"/> <location line="+158"/>
<source>Accept</source> <source>Accept</source>
<translation>Принять</translation> <translation>Принять</translation>
</message> </message>
@ -491,7 +491,13 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+88"/> <location line="+12"/>
<source>-- Decryption Error (%1) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1.</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+76"/>
<source>Message redaction failed: %1</source> <source>Message redaction failed: %1</source>
<translation type="unfinished">Ошибка редактирования сообщения: %1</translation> <translation type="unfinished">Ошибка редактирования сообщения: %1</translation>
</message> </message>
@ -522,13 +528,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+46"/> <location line="+75"/>
<source>-- Decryption Error (%1) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted. In this case, the Olm decrytion returned an error, which is passed as %1.</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+29"/>
<source>-- Encrypted Event (Unknown event type) --</source> <source>-- Encrypted Event (Unknown event type) --</source>
<comment>Placeholder, when the message was decrypted, but we couldn&apos;t parse it, because Nheko/mtxclient don&apos;t support that event type yet.</comment> <comment>Placeholder, when the message was decrypted, but we couldn&apos;t parse it, because Nheko/mtxclient don&apos;t support that event type yet.</comment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -783,7 +783,7 @@
<context> <context>
<name>UserSettingsPage</name> <name>UserSettingsPage</name>
<message> <message>
<location filename="../../src/UserSettingsPage.cpp" line="+296"/> <location filename="../../src/UserSettingsPage.cpp" line="+299"/>
<source>Minimize to tray</source> <source>Minimize to tray</source>
<translation>Сворачивать в системную панель</translation> <translation>Сворачивать в системную панель</translation>
</message> </message>
@ -812,6 +812,11 @@
<source>Typing notifications</source> <source>Typing notifications</source>
<translation>Сообщать о наборе сообщения</translation> <translation>Сообщать о наборе сообщения</translation>
</message> </message>
<message>
<location line="+1"/>
<source>Sort rooms by unreads</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<location line="+2"/> <location line="+2"/>
<source>Read receipts</source> <source>Read receipts</source>
@ -858,7 +863,7 @@
<translation>Отпечаток устройства</translation> <translation>Отпечаток устройства</translation>
</message> </message>
<message> <message>
<location line="-57"/> <location line="-58"/>
<source>Session Keys</source> <source>Session Keys</source>
<translation>Ключи сеанса</translation> <translation>Ключи сеанса</translation>
</message> </message>
@ -878,22 +883,22 @@
<translation>ШИФРОВАНИЕ</translation> <translation>ШИФРОВАНИЕ</translation>
</message> </message>
<message> <message>
<location line="-61"/> <location line="-62"/>
<source>GENERAL</source> <source>GENERAL</source>
<translation>ГЛАВНОЕ</translation> <translation>ГЛАВНОЕ</translation>
</message> </message>
<message> <message>
<location line="+23"/> <location line="+24"/>
<source>INTERFACE</source> <source>INTERFACE</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+106"/> <location line="+107"/>
<source>Emoji Font Family</source> <source>Emoji Font Family</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+147"/> <location line="+152"/>
<source>Open Sessions File</source> <source>Open Sessions File</source>
<translation>Открыть файл сеансов</translation> <translation>Открыть файл сеансов</translation>
</message> </message>

View file

@ -371,12 +371,12 @@
<context> <context>
<name>RoomInfoListItem</name> <name>RoomInfoListItem</name>
<message> <message>
<location filename="../../src/RoomInfoListItem.cpp" line="+97"/> <location filename="../../src/RoomInfoListItem.cpp" line="+98"/>
<source>Leave room</source> <source>Leave room</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location line="+154"/> <location line="+158"/>
<source>Accept</source> <source>Accept</source>
<translation></translation> <translation></translation>
</message> </message>
@ -491,7 +491,13 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+88"/> <location line="+12"/>
<source>-- Decryption Error (%1) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1.</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+76"/>
<source>Message redaction failed: %1</source> <source>Message redaction failed: %1</source>
<translation type="unfinished">%1</translation> <translation type="unfinished">%1</translation>
</message> </message>
@ -522,13 +528,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+46"/> <location line="+75"/>
<source>-- Decryption Error (%1) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted. In this case, the Olm decrytion returned an error, which is passed as %1.</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+29"/>
<source>-- Encrypted Event (Unknown event type) --</source> <source>-- Encrypted Event (Unknown event type) --</source>
<comment>Placeholder, when the message was decrypted, but we couldn&apos;t parse it, because Nheko/mtxclient don&apos;t support that event type yet.</comment> <comment>Placeholder, when the message was decrypted, but we couldn&apos;t parse it, because Nheko/mtxclient don&apos;t support that event type yet.</comment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -781,7 +781,7 @@
<context> <context>
<name>UserSettingsPage</name> <name>UserSettingsPage</name>
<message> <message>
<location filename="../../src/UserSettingsPage.cpp" line="+296"/> <location filename="../../src/UserSettingsPage.cpp" line="+299"/>
<source>Minimize to tray</source> <source>Minimize to tray</source>
<translation></translation> <translation></translation>
</message> </message>
@ -810,6 +810,11 @@
<source>Typing notifications</source> <source>Typing notifications</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<location line="+1"/>
<source>Sort rooms by unreads</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<location line="+2"/> <location line="+2"/>
<source>Read receipts</source> <source>Read receipts</source>
@ -856,7 +861,7 @@
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location line="-57"/> <location line="-58"/>
<source>Session Keys</source> <source>Session Keys</source>
<translation></translation> <translation></translation>
</message> </message>
@ -876,22 +881,22 @@
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location line="-61"/> <location line="-62"/>
<source>GENERAL</source> <source>GENERAL</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location line="+23"/> <location line="+24"/>
<source>INTERFACE</source> <source>INTERFACE</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+106"/> <location line="+107"/>
<source>Emoji Font Family</source> <source>Emoji Font Family</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+147"/> <location line="+152"/>
<source>Open Sessions File</source> <source>Open Sessions File</source>
<translation></translation> <translation></translation>
</message> </message>

View file

@ -100,7 +100,7 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
user_info_widget_ = new UserInfoWidget(sideBar_); user_info_widget_ = new UserInfoWidget(sideBar_);
user_mentions_popup_ = new popups::UserMentions(); user_mentions_popup_ = new popups::UserMentions();
room_list_ = new RoomList(sideBar_); room_list_ = new RoomList(userSettings, sideBar_);
connect(room_list_, &RoomList::joinRoom, this, &ChatPage::joinRoom); connect(room_list_, &RoomList::joinRoom, this, &ChatPage::joinRoom);
sideBarLayout_->addWidget(user_info_widget_); sideBarLayout_->addWidget(user_info_widget_);

View file

@ -26,6 +26,7 @@
#include "Config.h" #include "Config.h"
#include "RoomInfoListItem.h" #include "RoomInfoListItem.h"
#include "Splitter.h" #include "Splitter.h"
#include "UserSettingsPage.h"
#include "Utils.h" #include "Utils.h"
#include "ui/Menu.h" #include "ui/Menu.h"
#include "ui/Ripple.h" #include "ui/Ripple.h"
@ -99,7 +100,10 @@ RoomInfoListItem::init(QWidget *parent)
menu_->addAction(leaveRoom_); menu_->addAction(leaveRoom_);
} }
RoomInfoListItem::RoomInfoListItem(QString room_id, const RoomInfo &info, QWidget *parent) RoomInfoListItem::RoomInfoListItem(QString room_id,
const RoomInfo &info,
QSharedPointer<UserSettings> userSettings,
QWidget *parent)
: QWidget(parent) : QWidget(parent)
, roomType_{info.is_invite ? RoomType::Invited : RoomType::Joined} , roomType_{info.is_invite ? RoomType::Invited : RoomType::Joined}
, roomId_(std::move(room_id)) , roomId_(std::move(room_id))
@ -107,6 +111,7 @@ RoomInfoListItem::RoomInfoListItem(QString room_id, const RoomInfo &info, QWidge
, isPressed_(false) , isPressed_(false)
, unreadMsgCount_(0) , unreadMsgCount_(0)
, unreadHighlightedMsgCount_(0) , unreadHighlightedMsgCount_(0)
, settings(userSettings)
{ {
init(parent); init(parent);
} }
@ -324,6 +329,34 @@ RoomInfoListItem::updateUnreadMessageCount(int count, int highlightedCount)
update(); update();
} }
enum NotificationImportance : short
{
ImportanceDisabled = -1,
AllEventsRead = 0,
NewMessage = 1,
NewMentions = 2,
Invite = 3
};
short int
RoomInfoListItem::calculateImportance() const
{
// Returns the degree of importance of the unread messages in the room.
// If sorting by importance is disabled in settings, this only ever
// returns ImportanceDisabled or Invite
if (isInvite()) {
return Invite;
} else if (!settings->isSortByImportanceEnabled()) {
return ImportanceDisabled;
} else if (unreadHighlightedMsgCount_) {
return NewMentions;
} else if (unreadMsgCount_) {
return NewMessage;
} else {
return AllEventsRead;
}
}
void void
RoomInfoListItem::setPressedState(bool state) RoomInfoListItem::setPressedState(bool state)
{ {

View file

@ -25,6 +25,7 @@
#include <mtx/responses.hpp> #include <mtx/responses.hpp>
#include "CacheStructs.h" #include "CacheStructs.h"
#include "UserSettingsPage.h"
#include "ui/Avatar.h" #include "ui/Avatar.h"
class Menu; class Menu;
@ -63,11 +64,16 @@ class RoomInfoListItem : public QWidget
Q_PROPERTY(QColor btnTextColor READ btnTextColor WRITE setBtnTextColor) Q_PROPERTY(QColor btnTextColor READ btnTextColor WRITE setBtnTextColor)
public: public:
RoomInfoListItem(QString room_id, const RoomInfo &info, QWidget *parent = nullptr); RoomInfoListItem(QString room_id,
const RoomInfo &info,
QSharedPointer<UserSettings> userSettings,
QWidget *parent = nullptr);
void updateUnreadMessageCount(int count, int highlightedCount); void updateUnreadMessageCount(int count, int highlightedCount);
void clearUnreadMessageCount() { updateUnreadMessageCount(0, 0); }; void clearUnreadMessageCount() { updateUnreadMessageCount(0, 0); };
short int calculateImportance() const;
QString roomId() { return roomId_; } QString roomId() { return roomId_; }
bool isPressed() const { return isPressed_; } bool isPressed() const { return isPressed_; }
int unreadMessageCount() const { return unreadMsgCount_; } int unreadMessageCount() const { return unreadMsgCount_; }
@ -128,7 +134,7 @@ public:
roomType_ = RoomType::Joined; roomType_ = RoomType::Joined;
} }
bool isInvite() { return roomType_ == RoomType::Invited; } bool isInvite() const { return roomType_ == RoomType::Invited; }
void setReadState(bool hasUnreadMessages) void setReadState(bool hasUnreadMessages)
{ {
if (hasUnreadMessages_ != hasUnreadMessages) { if (hasUnreadMessages_ != hasUnreadMessages) {
@ -214,4 +220,6 @@ private:
QColor bubbleBgColor_; QColor bubbleBgColor_;
QColor bubbleFgColor_; QColor bubbleFgColor_;
QSharedPointer<UserSettings> settings;
}; };

View file

@ -16,6 +16,7 @@
*/ */
#include <limits> #include <limits>
#include <set>
#include <QObject> #include <QObject>
#include <QPainter> #include <QPainter>
@ -26,11 +27,13 @@
#include "MainWindow.h" #include "MainWindow.h"
#include "RoomInfoListItem.h" #include "RoomInfoListItem.h"
#include "RoomList.h" #include "RoomList.h"
#include "UserSettingsPage.h"
#include "Utils.h" #include "Utils.h"
#include "ui/OverlayModal.h" #include "ui/OverlayModal.h"
RoomList::RoomList(QWidget *parent) RoomList::RoomList(QSharedPointer<UserSettings> userSettings, QWidget *parent)
: QWidget(parent) : QWidget(parent)
, settings(userSettings)
{ {
topLayout_ = new QVBoxLayout(this); topLayout_ = new QVBoxLayout(this);
topLayout_->setSpacing(0); topLayout_->setSpacing(0);
@ -62,12 +65,16 @@ RoomList::RoomList(QWidget *parent)
topLayout_->addWidget(scrollArea_); topLayout_->addWidget(scrollArea_);
connect(this, &RoomList::updateRoomAvatarCb, this, &RoomList::updateRoomAvatar); connect(this, &RoomList::updateRoomAvatarCb, this, &RoomList::updateRoomAvatar);
connect(userSettings.data(),
&UserSettings::roomSortingChanged,
this,
&RoomList::sortRoomsByLastMessage);
} }
void void
RoomList::addRoom(const QString &room_id, const RoomInfo &info) RoomList::addRoom(const QString &room_id, const RoomInfo &info)
{ {
auto room_item = new RoomInfoListItem(room_id, info, scrollArea_); auto room_item = new RoomInfoListItem(room_id, info, settings, scrollArea_);
room_item->setRoomName(QString::fromStdString(std::move(info.name))); room_item->setRoomName(QString::fromStdString(std::move(info.name)));
connect(room_item, &RoomInfoListItem::clicked, this, &RoomList::highlightSelectedRoom); connect(room_item, &RoomInfoListItem::clicked, this, &RoomList::highlightSelectedRoom);
@ -122,6 +129,8 @@ RoomList::updateUnreadMessageCount(const QString &roomid, int count, int highlig
rooms_[roomid]->updateUnreadMessageCount(count, highlightedCount); rooms_[roomid]->updateUnreadMessageCount(count, highlightedCount);
calculateUnreadMessageCount(); calculateUnreadMessageCount();
sortRoomsByLastMessage();
} }
void void
@ -328,30 +337,51 @@ RoomList::updateRoomDescription(const QString &roomid, const DescInfo &info)
emit sortRoomsByLastMessage(); emit sortRoomsByLastMessage();
} }
struct room_sort
{
bool operator()(const RoomInfoListItem *a, const RoomInfoListItem *b) const
{
// Sort by "importance" (i.e. invites before mentions before
// notifs before new events before old events), then secondly
// by recency.
// Checking importance first
const auto a_importance = a->calculateImportance();
const auto b_importance = b->calculateImportance();
if (a_importance != b_importance) {
return a_importance > b_importance;
}
// Now sort by recency
// Zero if empty, otherwise the time that the event occured
const uint64_t a_recency = a->lastMessageInfo().userid.isEmpty()
? 0
: a->lastMessageInfo().datetime.toMSecsSinceEpoch();
const uint64_t b_recency = b->lastMessageInfo().userid.isEmpty()
? 0
: b->lastMessageInfo().datetime.toMSecsSinceEpoch();
return a_recency > b_recency;
}
};
void void
RoomList::sortRoomsByLastMessage() RoomList::sortRoomsByLastMessage()
{ {
isSortPending_ = false; isSortPending_ = false;
std::multimap<uint64_t, RoomInfoListItem *, std::greater<uint64_t>> times; std::multiset<RoomInfoListItem *, room_sort> times;
for (int ii = 0; ii < contentsLayout_->count(); ++ii) { for (int ii = 0; ii < contentsLayout_->count(); ++ii) {
auto room = qobject_cast<RoomInfoListItem *>(contentsLayout_->itemAt(ii)->widget()); auto room = qobject_cast<RoomInfoListItem *>(contentsLayout_->itemAt(ii)->widget());
if (!room) if (!room)
continue; continue;
// Not a room message.
if (room->isInvite())
times.emplace(std::numeric_limits<uint64_t>::max(), room);
else if (room->lastMessageInfo().userid.isEmpty())
times.emplace(0, room);
else else
times.emplace(room->lastMessageInfo().datetime.toMSecsSinceEpoch(), room); times.insert(room);
} }
for (auto it = times.cbegin(); it != times.cend(); ++it) { for (auto it = times.cbegin(); it != times.cend(); ++it) {
const auto roomWidget = it->second; const auto roomWidget = *it;
const auto currentIndex = contentsLayout_->indexOf(roomWidget); const auto currentIndex = contentsLayout_->indexOf(roomWidget);
const auto newIndex = std::distance(times.cbegin(), it); const auto newIndex = std::distance(times.cbegin(), it);
@ -468,7 +498,7 @@ RoomList::updateRoom(const QString &room_id, const RoomInfo &info)
void void
RoomList::addInvitedRoom(const QString &room_id, const RoomInfo &info) RoomList::addInvitedRoom(const QString &room_id, const RoomInfo &info)
{ {
auto room_item = new RoomInfoListItem(room_id, info, scrollArea_); auto room_item = new RoomInfoListItem(room_id, info, settings, scrollArea_);
connect(room_item, &RoomInfoListItem::acceptInvite, this, &RoomList::acceptInvite); connect(room_item, &RoomInfoListItem::acceptInvite, this, &RoomList::acceptInvite);
connect(room_item, &RoomInfoListItem::declineInvite, this, &RoomList::declineInvite); connect(room_item, &RoomInfoListItem::declineInvite, this, &RoomList::declineInvite);

View file

@ -23,6 +23,9 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QWidget> #include <QWidget>
#include "CacheStructs.h"
#include "UserSettingsPage.h"
class LeaveRoomDialog; class LeaveRoomDialog;
class OverlayModal; class OverlayModal;
class RoomInfoListItem; class RoomInfoListItem;
@ -35,7 +38,7 @@ class RoomList : public QWidget
Q_OBJECT Q_OBJECT
public: public:
explicit RoomList(QWidget *parent = nullptr); explicit RoomList(QSharedPointer<UserSettings> userSettings, QWidget *parent = nullptr);
void initialize(const QMap<QString, RoomInfo> &info); void initialize(const QMap<QString, RoomInfo> &info);
void sync(const std::map<QString, RoomInfo> &info); void sync(const std::map<QString, RoomInfo> &info);
@ -100,4 +103,5 @@ private:
QString selectedRoom_; QString selectedRoom_;
bool isSortPending_ = false; bool isSortPending_ = false;
QSharedPointer<UserSettings> settings;
}; };

View file

@ -58,6 +58,7 @@ UserSettings::load()
isButtonsInTimelineEnabled_ = settings.value("user/timeline/buttons", true).toBool(); isButtonsInTimelineEnabled_ = settings.value("user/timeline/buttons", true).toBool();
isMarkdownEnabled_ = settings.value("user/markdown_enabled", true).toBool(); isMarkdownEnabled_ = settings.value("user/markdown_enabled", true).toBool();
isTypingNotificationsEnabled_ = settings.value("user/typing_notifications", true).toBool(); isTypingNotificationsEnabled_ = settings.value("user/typing_notifications", true).toBool();
sortByImportance_ = settings.value("user/sort_by_unread", true).toBool();
isReadReceiptsEnabled_ = settings.value("user/read_receipts", true).toBool(); isReadReceiptsEnabled_ = settings.value("user/read_receipts", true).toBool();
theme_ = settings.value("user/theme", defaultTheme_).toString(); theme_ = settings.value("user/theme", defaultTheme_).toString();
font_ = settings.value("user/font_family", "default").toString(); font_ = settings.value("user/font_family", "default").toString();
@ -135,6 +136,7 @@ UserSettings::save()
settings.setValue("font_size", baseFontSize_); settings.setValue("font_size", baseFontSize_);
settings.setValue("typing_notifications", isTypingNotificationsEnabled_); settings.setValue("typing_notifications", isTypingNotificationsEnabled_);
settings.setValue("minor_events", sortByImportance_);
settings.setValue("read_receipts", isReadReceiptsEnabled_); settings.setValue("read_receipts", isReadReceiptsEnabled_);
settings.setValue("group_view", isGroupViewEnabled_); settings.setValue("group_view", isGroupViewEnabled_);
settings.setValue("markdown_enabled", isMarkdownEnabled_); settings.setValue("markdown_enabled", isMarkdownEnabled_);
@ -197,6 +199,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
groupViewToggle_ = new Toggle{this}; groupViewToggle_ = new Toggle{this};
timelineButtonsToggle_ = new Toggle{this}; timelineButtonsToggle_ = new Toggle{this};
typingNotifications_ = new Toggle{this}; typingNotifications_ = new Toggle{this};
sortByImportance_ = new Toggle{this};
readReceipts_ = new Toggle{this}; readReceipts_ = new Toggle{this};
markdownEnabled_ = new Toggle{this}; markdownEnabled_ = new Toggle{this};
desktopNotifications_ = new Toggle{this}; desktopNotifications_ = new Toggle{this};
@ -300,6 +303,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
boxWrap(tr("Group's sidebar"), groupViewToggle_); boxWrap(tr("Group's sidebar"), groupViewToggle_);
boxWrap(tr("Show buttons in timeline"), timelineButtonsToggle_); boxWrap(tr("Show buttons in timeline"), timelineButtonsToggle_);
boxWrap(tr("Typing notifications"), typingNotifications_); boxWrap(tr("Typing notifications"), typingNotifications_);
boxWrap(tr("Sort rooms by unreads"), sortByImportance_);
formLayout_->addRow(new HorizontalLine{this}); formLayout_->addRow(new HorizontalLine{this});
boxWrap(tr("Read receipts"), readReceipts_); boxWrap(tr("Read receipts"), readReceipts_);
boxWrap(tr("Send messages as Markdown"), markdownEnabled_); boxWrap(tr("Send messages as Markdown"), markdownEnabled_);
@ -401,6 +405,10 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
settings_->setTypingNotifications(!isDisabled); settings_->setTypingNotifications(!isDisabled);
}); });
connect(sortByImportance_, &Toggle::toggled, this, [this](bool isDisabled) {
settings_->setSortByImportance(!isDisabled);
});
connect(timelineButtonsToggle_, &Toggle::toggled, this, [this](bool isDisabled) { connect(timelineButtonsToggle_, &Toggle::toggled, this, [this](bool isDisabled) {
settings_->setButtonsInTimeline(!isDisabled); settings_->setButtonsInTimeline(!isDisabled);
}); });
@ -439,6 +447,7 @@ UserSettingsPage::showEvent(QShowEvent *)
groupViewToggle_->setState(!settings_->isGroupViewEnabled()); groupViewToggle_->setState(!settings_->isGroupViewEnabled());
avatarCircles_->setState(!settings_->isAvatarCirclesEnabled()); avatarCircles_->setState(!settings_->isAvatarCirclesEnabled());
typingNotifications_->setState(!settings_->isTypingNotificationsEnabled()); typingNotifications_->setState(!settings_->isTypingNotificationsEnabled());
sortByImportance_->setState(!settings_->isSortByImportanceEnabled());
timelineButtonsToggle_->setState(!settings_->isButtonsInTimelineEnabled()); timelineButtonsToggle_->setState(!settings_->isButtonsInTimelineEnabled());
readReceipts_->setState(!settings_->isReadReceiptsEnabled()); readReceipts_->setState(!settings_->isReadReceiptsEnabled());
markdownEnabled_->setState(!settings_->isMarkdownEnabled()); markdownEnabled_->setState(!settings_->isMarkdownEnabled());

View file

@ -87,6 +87,12 @@ public:
save(); save();
} }
void setSortByImportance(bool state)
{
sortByImportance_ = state;
emit roomSortingChanged();
}
void setButtonsInTimeline(bool state) void setButtonsInTimeline(bool state)
{ {
isButtonsInTimelineEnabled_ = state; isButtonsInTimelineEnabled_ = state;
@ -112,6 +118,7 @@ public:
bool isAvatarCirclesEnabled() const { return avatarCircles_; } bool isAvatarCirclesEnabled() const { return avatarCircles_; }
bool isMarkdownEnabled() const { return isMarkdownEnabled_; } bool isMarkdownEnabled() const { return isMarkdownEnabled_; }
bool isTypingNotificationsEnabled() const { return isTypingNotificationsEnabled_; } bool isTypingNotificationsEnabled() const { return isTypingNotificationsEnabled_; }
bool isSortByImportanceEnabled() const { return sortByImportance_; }
bool isButtonsInTimelineEnabled() const { return isButtonsInTimelineEnabled_; } bool isButtonsInTimelineEnabled() const { return isButtonsInTimelineEnabled_; }
bool isReadReceiptsEnabled() const { return isReadReceiptsEnabled_; } bool isReadReceiptsEnabled() const { return isReadReceiptsEnabled_; }
bool hasDesktopNotifications() const { return hasDesktopNotifications_; } bool hasDesktopNotifications() const { return hasDesktopNotifications_; }
@ -121,6 +128,7 @@ public:
signals: signals:
void groupViewStateChanged(bool state); void groupViewStateChanged(bool state);
void roomSortingChanged();
private: private:
// Default to system theme if QT_QPA_PLATFORMTHEME var is set. // Default to system theme if QT_QPA_PLATFORMTHEME var is set.
@ -134,6 +142,7 @@ private:
bool isGroupViewEnabled_; bool isGroupViewEnabled_;
bool isMarkdownEnabled_; bool isMarkdownEnabled_;
bool isTypingNotificationsEnabled_; bool isTypingNotificationsEnabled_;
bool sortByImportance_;
bool isButtonsInTimelineEnabled_; bool isButtonsInTimelineEnabled_;
bool isReadReceiptsEnabled_; bool isReadReceiptsEnabled_;
bool hasDesktopNotifications_; bool hasDesktopNotifications_;
@ -185,6 +194,7 @@ private:
Toggle *groupViewToggle_; Toggle *groupViewToggle_;
Toggle *timelineButtonsToggle_; Toggle *timelineButtonsToggle_;
Toggle *typingNotifications_; Toggle *typingNotifications_;
Toggle *sortByImportance_;
Toggle *readReceipts_; Toggle *readReceipts_;
Toggle *markdownEnabled_; Toggle *markdownEnabled_;
Toggle *desktopNotifications_; Toggle *desktopNotifications_;