mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-24 05:21:58 +00:00
cfef7dc443
Fix BigInt compilation on linux Remove c++20 optimization for NamedType Add assert for failing getChats that was providing an easy to miss warning Enable linux CI build Don't run tests. They fail to run in docker with "malloc_consolidate(): invalid chunk size", probably due to status-go
45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
#include "Status/ChatSection/ChatSectionController.h"
|
|
|
|
using namespace Status::ChatSection;
|
|
|
|
ChatSectionController::ChatSectionController()
|
|
: QObject(nullptr)
|
|
, m_dataProvider(std::make_unique<ChatDataProvider>())
|
|
{
|
|
}
|
|
|
|
void ChatSectionController::init(const QString& sectionId)
|
|
{
|
|
auto chatSectionData = m_dataProvider->getSectionData(sectionId);
|
|
assert(chatSectionData.chats.size() > 0);
|
|
std::vector<ChatItemPtr> model;
|
|
for (auto c : chatSectionData.chats) {
|
|
model.push_back(std::make_shared<ChatItem>(std::move(c)));
|
|
}
|
|
m_chats = std::make_shared<ChatsModel>(std::move(model), "chat");
|
|
setCurrentChatIndex(0);
|
|
emit chatsModelChanged();
|
|
}
|
|
|
|
QAbstractListModel* ChatSectionController::chatsModel() const
|
|
{
|
|
return m_chats.get();
|
|
}
|
|
|
|
ChatItem* ChatSectionController::currentChat() const
|
|
{
|
|
return m_currentChat.get();
|
|
}
|
|
|
|
void ChatSectionController::setCurrentChatIndex(int index)
|
|
{
|
|
assert(index >= 0 && index < m_chats->size());
|
|
|
|
auto chat = m_chats->get(index);
|
|
if (m_currentChat == chat)
|
|
return;
|
|
|
|
m_currentChat = chat;
|
|
emit currentChatChanged();
|
|
}
|