Move pollhandler to ContentProvider

Move `PollHandler` to `ContentProvider`, this also breaks the dependency on `PollHandler` for `NeoChatRoom`
This commit is contained in:
James Graham
2025-04-05 10:08:44 +00:00
parent d9b8b1c8ef
commit c56054a05a
6 changed files with 36 additions and 33 deletions

View File

@@ -10,6 +10,7 @@
#include "models/messagecontentmodel.h"
#include "models/threadmodel.h"
#include "neochatroom.h"
#include "pollhandler.h"
/**
* @class ContentProvider
@@ -70,9 +71,20 @@ public:
*/
ThreadModel *modelForThread(NeoChatRoom *room, const QString &threadRootId);
/**
* @brief Get a PollHandler object for the given event Id.
*
* Will return an existing PollHandler if one already exists for the event ID.
* A new PollHandler will be created if one doesn't exist.
*
* @sa PollHandler
*/
PollHandler *handlerForPoll(NeoChatRoom *room, const QString &eventId);
private:
explicit ContentProvider(QObject *parent = nullptr);
QCache<QString, MessageContentModel> m_eventContentModels;
QCache<QString, ThreadModel> m_threadModels;
QCache<QString, PollHandler> m_pollHandlers;
};