Commit 28d64620 authored by Ronan Abhamon's avatar Ronan Abhamon

fix(MessagesCountNotifier): avoid pure virtual call

parent 97c57547
...@@ -62,7 +62,10 @@ CoreManager::CoreManager (QObject *parent, const QString &configPath) : ...@@ -62,7 +62,10 @@ CoreManager::CoreManager (QObject *parent, const QString &configPath) :
CoreHandlers *coreHandlers = mHandlers.get(); CoreHandlers *coreHandlers = mHandlers.get();
QObject::connect(coreHandlers, &CoreHandlers::coreStarted, this, [] { QObject::connect(coreHandlers, &CoreHandlers::coreStarted, this, [] {
new MessagesCountNotifier(mInstance); {
MessagesCountNotifier *messagesCountNotifier = new MessagesCountNotifier(mInstance);
messagesCountNotifier->updateUnreadMessagesCount();
}
mInstance->mCallsListModel = new CallsListModel(mInstance); mInstance->mCallsListModel = new CallsListModel(mInstance);
mInstance->mContactsListModel = new ContactsListModel(mInstance); mInstance->mContactsListModel = new ContactsListModel(mInstance);
......
...@@ -38,14 +38,10 @@ AbstractMessagesCountNotifier::AbstractMessagesCountNotifier (QObject *parent) : ...@@ -38,14 +38,10 @@ AbstractMessagesCountNotifier::AbstractMessagesCountNotifier (QObject *parent) :
coreManager->getHandlers().get(), &CoreHandlers::messageReceived, coreManager->getHandlers().get(), &CoreHandlers::messageReceived,
this, &AbstractMessagesCountNotifier::handleMessageReceived this, &AbstractMessagesCountNotifier::handleMessageReceived
); );
updateUnreadMessagesCount();
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void AbstractMessagesCountNotifier::notifyUnreadMessagesCount (int) {}
void AbstractMessagesCountNotifier::updateUnreadMessagesCount () { void AbstractMessagesCountNotifier::updateUnreadMessagesCount () {
mUnreadMessagesCount = 0; mUnreadMessagesCount = 0;
for (const auto &chatRoom : CoreManager::getInstance()->getCore()->getChatRooms()) for (const auto &chatRoom : CoreManager::getInstance()->getCore()->getChatRooms())
......
...@@ -39,11 +39,12 @@ public: ...@@ -39,11 +39,12 @@ public:
AbstractMessagesCountNotifier (QObject *parent = Q_NULLPTR); AbstractMessagesCountNotifier (QObject *parent = Q_NULLPTR);
virtual ~AbstractMessagesCountNotifier () = default; virtual ~AbstractMessagesCountNotifier () = default;
void updateUnreadMessagesCount ();
protected: protected:
virtual void notifyUnreadMessagesCount (int n) = 0; virtual void notifyUnreadMessagesCount (int n) = 0;
private: private:
void updateUnreadMessagesCount ();
void internalNotifyUnreadMessagesCount (); void internalNotifyUnreadMessagesCount ();
void handleChatModelCreated (const std::shared_ptr<ChatModel> &chatModel); void handleChatModelCreated (const std::shared_ptr<ChatModel> &chatModel);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment