Comment updates
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
#include "chatbarmessagecontentmodel.h"
|
||||
|
||||
#include <QTextDocumentFragment>
|
||||
#include <qlogging.h>
|
||||
|
||||
#include "chatbarcache.h"
|
||||
#include "chatkeyhelper.h"
|
||||
@@ -332,7 +331,7 @@ QModelIndex ChatBarMessageContentModel::indexForTextItem(ChatTextItemHelper *tex
|
||||
|
||||
bool ChatBarMessageContentModel::hasRichFormatting() const
|
||||
{
|
||||
for (const auto &component : m_components) {
|
||||
return std::ranges::any_of(m_components, [this](const auto &component) {
|
||||
if (component.type != MessageComponentType::Text) {
|
||||
return true;
|
||||
}
|
||||
@@ -341,8 +340,8 @@ bool ChatBarMessageContentModel::hasRichFormatting() const
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
bool ChatBarMessageContentModel::hasAttachment() const
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
/**
|
||||
* @class ChatBarMessageContentModel
|
||||
*
|
||||
* Inherited from MessageContentModel this visulaises the content of a Quotient::RoomMessageEvent.
|
||||
* Inherited from MessageContentModel this visualises the content of a Quotient::RoomMessageEvent.
|
||||
*/
|
||||
class ChatBarMessageContentModel : public MessageContentModel
|
||||
{
|
||||
|
||||
@@ -201,7 +201,7 @@ QVariant MessageContentModel::data(const QModelIndex &index, int role) const
|
||||
}
|
||||
return QVariant::fromValue<ChatBarCache *>(m_room->editCache());
|
||||
}
|
||||
if (role == Editable) {
|
||||
if (role == EditableRole) {
|
||||
return m_editableActive;
|
||||
}
|
||||
if (role == CurrentFocusRole) {
|
||||
@@ -239,7 +239,7 @@ QHash<int, QByteArray> MessageContentModel::roleNamesStatic()
|
||||
roles[MessageContentModel::ThreadRootRole] = "threadRoot";
|
||||
roles[MessageContentModel::LinkPreviewerRole] = "linkPreviewer";
|
||||
roles[MessageContentModel::ChatBarCacheRole] = "chatBarCache";
|
||||
roles[MessageContentModel::Editable] = "editable";
|
||||
roles[MessageContentModel::EditableRole] = "editable";
|
||||
roles[MessageContentModel::CurrentFocusRole] = "currentFocus";
|
||||
return roles;
|
||||
}
|
||||
@@ -254,14 +254,11 @@ bool MessageContentModel::hasComponentType(MessageComponentType::Type type) cons
|
||||
!= m_components.cend();
|
||||
}
|
||||
|
||||
bool MessageContentModel::hasComponentType(QList<MessageComponentType::Type> types) const
|
||||
bool MessageContentModel::hasComponentType(const QList<MessageComponentType::Type> &types) const
|
||||
{
|
||||
for (const auto &type : types) {
|
||||
if (hasComponentType(type)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return std::ranges::any_of(types, [this](const MessageComponentType::Type &type) {
|
||||
return hasComponentType(type);
|
||||
});
|
||||
}
|
||||
|
||||
void MessageContentModel::forEachComponentOfType(MessageComponentType::Type type,
|
||||
@@ -316,8 +313,7 @@ void MessageContentModel::updateReplyModel()
|
||||
|
||||
m_replyModel = new EventMessageContentModel(m_room, *eventId, true, false, this);
|
||||
|
||||
bool hasModel = hasComponentType(MessageComponentType::Reply);
|
||||
if (!hasModel) {
|
||||
if (!hasComponentType(MessageComponentType::Reply)) {
|
||||
int insertRow = 0;
|
||||
if (m_components.first().type == MessageComponentType::Author) {
|
||||
insertRow = 1;
|
||||
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
ThreadRootRole, /**< The thread root event ID for the event. */
|
||||
LinkPreviewerRole, /**< The link preview details. */
|
||||
ChatBarCacheRole, /**< The ChatBarCache to use. */
|
||||
Editable, /**< Whether the component can be edited. */
|
||||
EditableRole, /**< Whether the component can be edited. */
|
||||
CurrentFocusRole, /**< Whteher the delegate should have focus. */
|
||||
};
|
||||
Q_ENUM(Roles)
|
||||
@@ -138,7 +138,7 @@ Q_SIGNALS:
|
||||
|
||||
protected:
|
||||
QPointer<NeoChatRoom> m_room;
|
||||
QString m_eventId = {};
|
||||
QString m_eventId;
|
||||
|
||||
/**
|
||||
* @brief NeoChatDateTime for the message.
|
||||
@@ -165,7 +165,7 @@ protected:
|
||||
|
||||
QList<MessageComponent> m_components;
|
||||
bool hasComponentType(MessageComponentType::Type type) const;
|
||||
bool hasComponentType(QList<MessageComponentType::Type> types) const;
|
||||
bool hasComponentType(const QList<MessageComponentType::Type> &types) const;
|
||||
void forEachComponentOfType(MessageComponentType::Type type, std::function<ComponentIt(ComponentIt)> function);
|
||||
void forEachComponentOfType(QList<MessageComponentType::Type> types, std::function<ComponentIt(ComponentIt)> function);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user