aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-03-13 18:07:03 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-03-13 18:07:03 +0900
commitb6b4b5e82c8984c0c7e29c4ccf5c2d25cda563f9 (patch)
tree6d3d542acc03bdc82d6e8bfb6a575c4aec46d791
parentced57b074d0dc4e6e582a4bddca7a07e41d2063f (diff)
downloadlibquotient-b6b4b5e82c8984c0c7e29c4ccf5c2d25cda563f9.tar.gz
libquotient-b6b4b5e82c8984c0c7e29c4ccf5c2d25cda563f9.zip
Room: make notificationCount, highlightCount Q_PROPERTYs
Closes #299. Due to restrictions for the NOTIFY signal notificationCountChanged and highlightCountChanged no more carry Room* as a parameter, breaking back-compatibility.
-rw-r--r--lib/room.cpp8
-rw-r--r--lib/room.h6
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/room.cpp b/lib/room.cpp
index f2e03e94..a4946b65 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -815,7 +815,7 @@ void Room::resetNotificationCount()
if( d->notificationCount == 0 )
return;
d->notificationCount = 0;
- emit notificationCountChanged(this);
+ emit notificationCountChanged();
}
int Room::highlightCount() const
@@ -828,7 +828,7 @@ void Room::resetHighlightCount()
if( d->highlightCount == 0 )
return;
d->highlightCount = 0;
- emit highlightCountChanged(this);
+ emit highlightCountChanged();
}
void Room::switchVersion(QString newVersion)
@@ -1343,12 +1343,12 @@ void Room::updateData(SyncRoomData&& data, bool fromCache)
if( data.highlightCount != d->highlightCount )
{
d->highlightCount = data.highlightCount;
- emit highlightCountChanged(this);
+ emit highlightCountChanged();
}
if( data.notificationCount != d->notificationCount )
{
d->notificationCount = data.notificationCount;
- emit notificationCountChanged(this);
+ emit notificationCountChanged();
}
if (roomChanges != Change::NoChange)
{
diff --git a/lib/room.h b/lib/room.h
index f7add412..352c098b 100644
--- a/lib/room.h
+++ b/lib/room.h
@@ -108,6 +108,8 @@ namespace QMatrixClient
Q_PROPERTY(QString readMarkerEventId READ readMarkerEventId WRITE markMessagesAsRead NOTIFY readMarkerMoved)
Q_PROPERTY(bool hasUnreadMessages READ hasUnreadMessages NOTIFY unreadMessagesChanged)
Q_PROPERTY(int unreadCount READ unreadCount NOTIFY unreadMessagesChanged)
+ Q_PROPERTY(int highlightCount READ highlightCount NOTIFY highlightCountChanged RESET resetHighlightCount)
+ Q_PROPERTY(int notificationCount READ notificationCount NOTIFY notificationCountChanged RESET resetNotificationCount)
Q_PROPERTY(QStringList tagNames READ tagNames NOTIFY tagsChanged)
Q_PROPERTY(bool isFavourite READ isFavourite NOTIFY tagsChanged)
Q_PROPERTY(bool isLowPriority READ isLowPriority NOTIFY tagsChanged)
@@ -517,8 +519,8 @@ namespace QMatrixClient
void joinStateChanged(JoinState oldState, JoinState newState);
void typingChanged();
- void highlightCountChanged(Room* room);
- void notificationCountChanged(Room* room);
+ void highlightCountChanged();
+ void notificationCountChanged();
void displayedChanged(bool displayed);
void firstDisplayedEventChanged();