Terminology: room mention count → highlight count
This commit is contained in:
parent
dce3328037
commit
3791a08eea
|
@ -278,12 +278,12 @@ class Backend:
|
||||||
room = self.models[user_id, "rooms"].get(room_id)
|
room = self.models[user_id, "rooms"].get(room_id)
|
||||||
|
|
||||||
if room:
|
if room:
|
||||||
account = self.models["accounts"][user_id]
|
account = self.models["accounts"][user_id]
|
||||||
account.total_unread -= room.unreads
|
account.total_unread -= room.unreads
|
||||||
account.total_mentions -= room.mentions
|
account.total_highlights -= room.highlights
|
||||||
|
|
||||||
room.mentions = 0
|
room.highlights = 0
|
||||||
room.unreads = 0
|
room.unreads = 0
|
||||||
|
|
||||||
|
|
||||||
# General functions
|
# General functions
|
||||||
|
|
|
@ -1298,8 +1298,8 @@ class MatrixClient(nio.AsyncClient):
|
||||||
|
|
||||||
last_event_date = last_event_date,
|
last_event_date = last_event_date,
|
||||||
|
|
||||||
mentions = room.unread_highlights,
|
unreads = room.unread_notifications,
|
||||||
unreads = room.unread_notifications,
|
highlights = room.unread_highlights,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.models[self.user_id, "rooms"][room.room_id] = room_item
|
self.models[self.user_id, "rooms"][room.room_id] = room_item
|
||||||
|
|
|
@ -32,15 +32,15 @@ class TypeSpecifier(AutoStrEnum):
|
||||||
class Account(ModelItem):
|
class Account(ModelItem):
|
||||||
"""A logged in matrix account."""
|
"""A logged in matrix account."""
|
||||||
|
|
||||||
id: str = field()
|
id: str = field()
|
||||||
order: int = -1
|
order: int = -1
|
||||||
display_name: str = ""
|
display_name: str = ""
|
||||||
avatar_url: str = ""
|
avatar_url: str = ""
|
||||||
max_upload_size: int = 0
|
max_upload_size: int = 0
|
||||||
profile_updated: datetime = ZeroDate
|
profile_updated: datetime = ZeroDate
|
||||||
first_sync_done: bool = False
|
first_sync_done: bool = False
|
||||||
total_unread: int = 0
|
total_unread: int = 0
|
||||||
total_mentions: int = 0
|
total_highlights: int = 0
|
||||||
|
|
||||||
def __lt__(self, other: "Account") -> bool:
|
def __lt__(self, other: "Account") -> bool:
|
||||||
"""Sort by order, then by user ID."""
|
"""Sort by order, then by user ID."""
|
||||||
|
@ -84,16 +84,17 @@ class Room(ModelItem):
|
||||||
|
|
||||||
last_event_date: datetime = ZeroDate
|
last_event_date: datetime = ZeroDate
|
||||||
|
|
||||||
mentions: int = 0
|
unreads: int = 0
|
||||||
unreads: int = 0
|
highlights: int = 0
|
||||||
|
|
||||||
def __lt__(self, other: "Room") -> bool:
|
def __lt__(self, other: "Room") -> bool:
|
||||||
"""Sort by membership, mentions/unread events, last event date, name.
|
"""Sort by membership, highlights/unread events, last event date, name.
|
||||||
|
|
||||||
Invited rooms are first, then joined rooms, then left rooms.
|
Invited rooms are first, then joined rooms, then left rooms.
|
||||||
Within these categories, sort by last event date (room with recent
|
Within these categories, sort by last event date (room with recent
|
||||||
messages are first), then by display names, then account, but
|
messages are first), then by display names, then account, but
|
||||||
keep rooms with mentions on top, followed by rooms with unread events.
|
keep rooms with highlights on top,
|
||||||
|
followed by rooms with unread events.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Left rooms may still have an inviter_id, so check left first.
|
# Left rooms may still have an inviter_id, so check left first.
|
||||||
|
@ -101,7 +102,7 @@ class Room(ModelItem):
|
||||||
self.for_account,
|
self.for_account,
|
||||||
self.left,
|
self.left,
|
||||||
other.inviter_id,
|
other.inviter_id,
|
||||||
bool(other.mentions),
|
bool(other.highlights),
|
||||||
bool(other.unreads),
|
bool(other.unreads),
|
||||||
other.last_event_date,
|
other.last_event_date,
|
||||||
(self.display_name or self.id).lower(),
|
(self.display_name or self.id).lower(),
|
||||||
|
@ -110,7 +111,7 @@ class Room(ModelItem):
|
||||||
other.for_account,
|
other.for_account,
|
||||||
other.left,
|
other.left,
|
||||||
self.inviter_id,
|
self.inviter_id,
|
||||||
bool(self.mentions),
|
bool(self.highlights),
|
||||||
bool(self.unreads),
|
bool(self.unreads),
|
||||||
self.last_event_date,
|
self.last_event_date,
|
||||||
(other.display_name or other.id).lower(),
|
(other.display_name or other.id).lower(),
|
||||||
|
@ -129,7 +130,7 @@ class AccountOrRoom(Account, Room):
|
||||||
other.type is Account,
|
other.type is Account,
|
||||||
self.left,
|
self.left,
|
||||||
other.inviter_id,
|
other.inviter_id,
|
||||||
bool(other.mentions),
|
bool(other.highlights),
|
||||||
bool(other.unreads),
|
bool(other.unreads),
|
||||||
other.last_event_date,
|
other.last_event_date,
|
||||||
(self.display_name or self.id).lower(),
|
(self.display_name or self.id).lower(),
|
||||||
|
@ -140,7 +141,7 @@ class AccountOrRoom(Account, Room):
|
||||||
self.type is Account,
|
self.type is Account,
|
||||||
other.left,
|
other.left,
|
||||||
self.inviter_id,
|
self.inviter_id,
|
||||||
bool(self.mentions),
|
bool(self.highlights),
|
||||||
bool(self.unreads),
|
bool(self.unreads),
|
||||||
self.last_event_date,
|
self.last_event_date,
|
||||||
(other.display_name or other.id).lower(),
|
(other.display_name or other.id).lower(),
|
||||||
|
|
|
@ -56,7 +56,7 @@ HTile {
|
||||||
indicatorTheme:
|
indicatorTheme:
|
||||||
theme.mainPane.accountBar.account.unreadIndicator
|
theme.mainPane.accountBar.account.unreadIndicator
|
||||||
unreads: model.total_unread
|
unreads: model.total_unread
|
||||||
mentions: model.total_mentions
|
highlights: model.total_highlights
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ HLabel {
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color:
|
color:
|
||||||
mentions ?
|
highlights ?
|
||||||
indicatorTheme.mentionBackground :
|
indicatorTheme.mentionBackground :
|
||||||
indicatorTheme.background
|
indicatorTheme.background
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ HLabel {
|
||||||
|
|
||||||
property QtObject indicatorTheme
|
property QtObject indicatorTheme
|
||||||
property int unreads: 0
|
property int unreads: 0
|
||||||
property int mentions: 0
|
property int highlights: 0
|
||||||
|
|
||||||
|
|
||||||
Behavior on scale { HNumberAnimation {} }
|
Behavior on scale { HNumberAnimation {} }
|
||||||
|
|
|
@ -43,7 +43,7 @@ HTile {
|
||||||
indicatorTheme:
|
indicatorTheme:
|
||||||
theme.mainPane.listView.room.unreadIndicator
|
theme.mainPane.listView.room.unreadIndicator
|
||||||
unreads: model.unreads
|
unreads: model.unreads
|
||||||
mentions: model.mentions
|
highlights: model.highlights
|
||||||
}
|
}
|
||||||
|
|
||||||
HIcon {
|
HIcon {
|
||||||
|
|
|
@ -140,8 +140,8 @@ HListView {
|
||||||
showItemAtIndex(accountIndice[currentUserId] + 1 + index)
|
showItemAtIndex(accountIndice[currentUserId] + 1 + index)
|
||||||
}
|
}
|
||||||
|
|
||||||
function cycleUnreadRooms(forward=true, mentions=false) {
|
function cycleUnreadRooms(forward=true, highlights=false) {
|
||||||
const prop = mentions ? "mentions" : "unreads"
|
const prop = highlights ? "highlights" : "unreads"
|
||||||
const start = currentIndex === -1 ? 0 : currentIndex
|
const start = currentIndex === -1 ? 0 : currentIndex
|
||||||
let index = start
|
let index = start
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ HListView {
|
||||||
if (index < 0) index = model.count - 1
|
if (index < 0) index = model.count - 1
|
||||||
if (index > model.count - 1) index = 0
|
if (index > model.count - 1) index = 0
|
||||||
|
|
||||||
if (index === start && mentions)
|
if (index === start && highlights)
|
||||||
return cycleUnreadRooms(forward, false)
|
return cycleUnreadRooms(forward, false)
|
||||||
else if (index === start)
|
else if (index === start)
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in New Issue
Block a user