MessageComponent

It feels weird to have anything that needs MessageComponent have to depend on all of MessageContentModel and pull in it's dependencies. This moves MessageComponent into its own header.
This commit is contained in:
James Graham
2024-10-05 15:51:19 +00:00
parent 4bd4bd6f22
commit a4e9794b13
6 changed files with 25 additions and 20 deletions

View File

@@ -12,9 +12,7 @@
#include "enums/messagecomponenttype.h"
#include "models/customemojimodel.h"
#include "models/messagecontentmodel.h"
#include "neochatconnection.h"
#include "utils.h"
#include "testutils.h"

View File

@@ -195,6 +195,7 @@ add_library(neochat STATIC
models/threadmodel.cpp
models/threadmodel.h
enums/messagetype.h
messagecomponent.h
)
set_source_files_properties(qml/OsmLocationPlugin.qml PROPERTIES

22
src/messagecomponent.h Normal file
View File

@@ -0,0 +1,22 @@
// SPDX-FileCopyrightText: 2024 James Graham <james.h.graham@protonmail.com>
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
#pragma once
#include "enums/messagecomponenttype.h"
struct MessageComponent {
MessageComponentType::Type type = MessageComponentType::Other;
QString content;
QVariantMap attributes;
int operator==(const MessageComponent &right) const
{
return type == right.type && content == right.content && attributes == right.attributes;
}
bool isEmpty() const
{
return type == MessageComponentType::Other;
}
};

View File

@@ -11,24 +11,9 @@
#include "enums/messagecomponenttype.h"
#include "itinerarymodel.h"
#include "messagecomponent.h"
#include "neochatroommember.h"
struct MessageComponent {
MessageComponentType::Type type = MessageComponentType::Other;
QString content;
QVariantMap attributes;
int operator==(const MessageComponent &right) const
{
return type == right.type && content == right.content && attributes == right.attributes;
}
bool isEmpty() const
{
return type == MessageComponentType::Other;
}
};
/**
* @class MessageContentModel
*

View File

@@ -17,7 +17,6 @@
#include <Kirigami/Platform/PlatformTheme>
#include "messagecomponenttype.h"
#include "messagecontentmodel.h"
#include "models/customemojimodel.h"
#include "utils.h"

View File

@@ -6,7 +6,7 @@
#include <QObject>
#include <QString>
#include "models/messagecontentmodel.h"
#include "messagecomponent.h"
#include "neochatroom.h"
namespace Quotient