Move NeoChatConnection and NeoChatRoom to LibNeoChat

Move `NeoChatConnection` and `NeoChatRoom` to `LibNeoChat` along with any required dependencies.
This commit is contained in:
James Graham
2025-04-07 18:52:15 +00:00
parent 8327b4369e
commit aef4f75c33
54 changed files with 57 additions and 72 deletions

View File

@@ -12,14 +12,6 @@ add_subdirectory(libneochat)
add_library(neochat STATIC
controller.cpp
controller.h
models/emojimodel.cpp
models/emojimodel.h
emojitones.cpp
emojitones.h
models/customemojimodel.cpp
models/customemojimodel.h
clipboard.cpp
clipboard.h
models/timelinemessagemodel.cpp
models/timelinemessagemodel.h
models/messagefiltermodel.cpp
@@ -30,12 +22,8 @@ add_library(neochat STATIC
models/sortfilterspacelistmodel.h
models/accountemoticonmodel.cpp
models/accountemoticonmodel.h
spacehierarchycache.cpp
spacehierarchycache.h
roommanager.cpp
roommanager.h
neochatroom.cpp
neochatroom.h
models/userlistmodel.cpp
models/userlistmodel.h
models/userfiltermodel.cpp
@@ -77,38 +65,26 @@ add_library(neochat STATIC
blurhashimageprovider.h
models/mediamessagefiltermodel.cpp
models/mediamessagefiltermodel.h
urlhelper.cpp
urlhelper.h
windowcontroller.cpp
windowcontroller.h
linkpreviewer.cpp
linkpreviewer.h
models/completionmodel.cpp
models/completionmodel.h
models/completionproxymodel.cpp
models/completionproxymodel.h
models/actionsmodel.cpp
models/actionsmodel.h
models/serverlistmodel.cpp
models/serverlistmodel.h
models/statemodel.cpp
models/statemodel.h
models/statefiltermodel.cpp
models/statefiltermodel.h
filetransferpseudojob.cpp
filetransferpseudojob.h
models/searchmodel.cpp
models/searchmodel.h
texthandler.cpp
texthandler.h
logger.cpp
logger.h
models/stickermodel.cpp
models/stickermodel.h
models/imagepacksmodel.cpp
models/imagepacksmodel.h
events/imagepackevent.cpp
events/imagepackevent.h
models/reactionmodel.cpp
models/reactionmodel.h
models/livelocationsmodel.cpp
@@ -117,39 +93,25 @@ add_library(neochat STATIC
models/locationsmodel.h
locationhelper.cpp
locationhelper.h
events/pollevent.cpp
pollhandler.cpp
utils.h
utils.cpp
registration.cpp
neochatconnection.cpp
neochatconnection.h
jobs/neochatgetcommonroomsjob.cpp
jobs/neochatgetcommonroomsjob.h
mediasizehelper.cpp
mediasizehelper.h
eventhandler.cpp
enums/delegatetype.h
roomlastmessageprovider.cpp
roomlastmessageprovider.h
chatbarcache.cpp
chatbarcache.h
colorschemer.cpp
colorschemer.h
models/notificationsmodel.cpp
models/notificationsmodel.h
models/timelinemodel.cpp
models/timelinemodel.h
enums/pushrule.h
models/itinerarymodel.cpp
models/itinerarymodel.h
proxycontroller.cpp
proxycontroller.h
models/linemodel.cpp
models/linemodel.h
events/locationbeaconevent.h
events/widgetevent.h
enums/messagecomponenttype.h
models/messagecontentmodel.cpp
models/messagecontentmodel.h
enums/neochatroomtype.h
@@ -170,20 +132,14 @@ add_library(neochat STATIC
threepidaddhelper.h
identityserverhelper.cpp
identityserverhelper.h
enums/powerlevel.cpp
enums/powerlevel.h
models/permissionsmodel.cpp
models/permissionsmodel.h
threepidbindhelper.cpp
threepidbindhelper.h
models/readmarkermodel.cpp
models/readmarkermodel.h
neochatroommember.cpp
neochatroommember.h
models/threadmodel.cpp
models/threadmodel.h
enums/messagetype.h
messagecomponent.h
enums/roomsortparameter.cpp
enums/roomsortparameter.h
models/roomsortparametermodel.cpp
@@ -313,6 +269,7 @@ ecm_add_qml_module(neochat URI org.kde.neochat GENERATE_PLUGIN_SOURCE
QtCore
QtQuick
IMPORTS
org.kde.neochat.libneochat
org.kde.neochat.timeline
org.kde.neochat.settings
org.kde.neochat.devtools
@@ -360,13 +317,6 @@ ecm_qt_declare_logging_category(neochat
EXPORT NEOCHAT
)
ecm_qt_declare_logging_category(neochat
HEADER "eventhandler_logging.h"
IDENTIFIER "EventHandling"
CATEGORY_NAME "org.kde.neochat.eventhandler"
DEFAULT_SEVERITY Info
)
ecm_qt_declare_logging_category(neochat
HEADER "chatdocumenthandler_logging.h"
IDENTIFIER "ChatDocumentHandling"
@@ -400,9 +350,8 @@ if(NOT ANDROID)
else()
target_sources(neochat PRIVATE trayicon.cpp trayicon.h)
endif()
target_link_libraries(neochat PUBLIC KF6::WindowSystem ICU::uc)
target_link_libraries(neochat PUBLIC KF6::WindowSystem)
target_compile_definitions(neochat PUBLIC -DHAVE_WINDOWSYSTEM)
target_compile_definitions(neochat PUBLIC -DHAVE_ICU)
endif()
if (NOT ANDROID AND NOT WIN32 AND NOT APPLE AND NOT HAIKU)
@@ -439,9 +388,6 @@ target_link_libraries(neochat PUBLIC
KF6::ColorScheme
KF6::ItemModels
QuotientQt6
cmark::cmark
QCoro::Core
QCoro::Network
)
if (TARGET KF6::Crash)

View File

@@ -4,7 +4,30 @@
add_library(LibNeoChat STATIC)
target_sources(LibNeoChat PRIVATE
neochatconnection.cpp
neochatroom.cpp
neochatroommember.cpp
chatbarcache.cpp
clipboard.cpp
delegatesizehelper.cpp
emojitones.cpp
eventhandler.cpp
filetransferpseudojob.cpp
linkpreviewer.cpp
roomlastmessageprovider.cpp
spacehierarchycache.cpp
texthandler.cpp
urlhelper.cpp
utils.cpp
enums/messagecomponenttype.h
enums/messagetype.h
enums/powerlevel.cpp
enums/pushrule.h
events/imagepackevent.cpp
events/pollevent.cpp
models/actionsmodel.cpp
models/customemojimodel.cpp
models/emojimodel.cpp
)
ecm_add_qml_module(LibNeoChat GENERATE_PLUGIN_SOURCE
@@ -12,8 +35,33 @@ ecm_add_qml_module(LibNeoChat GENERATE_PLUGIN_SOURCE
OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/src/org/kde/neochat/libneochat
)
ecm_qt_declare_logging_category(LibNeoChat
HEADER "eventhandler_logging.h"
IDENTIFIER "EventHandling"
CATEGORY_NAME "org.kde.neochat.eventhandler"
DEFAULT_SEVERITY Info
)
generate_export_header(LibNeoChat BASE_NAME LibNeoChat)
target_include_directories(LibNeoChat PRIVATE ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/enums ${CMAKE_CURRENT_SOURCE_DIR}/events ${CMAKE_CURRENT_SOURCE_DIR}/models)
target_link_libraries(LibNeoChat PUBLIC
Qt::Core
Qt::Multimedia
Qt::Quick
KF6::ConfigCore
KF6::CoreAddons
KF6::I18n
KF6::Kirigami
QuotientQt6
cmark::cmark
QCoro::Core
QCoro::Network
)
if(NOT ANDROID)
target_link_libraries(LibNeoChat PUBLIC
KF6::KIOWidgets
ICU::uc
)
target_compile_definitions(LibNeoChat PUBLIC -DHAVE_ICU)
endif()

View File

@@ -5,7 +5,6 @@
#include <Quotient/roommember.h>
#include "contentprovider.h"
#include "eventhandler.h"
#include "models/actionsmodel.h"
#include "neochatroom.h"
@@ -88,7 +87,6 @@ void ChatBarCache::setReplyId(const QString &replyId)
m_relationType = Reply;
}
m_attachmentPath = QString();
delete m_relationContentModel;
Q_EMIT relationIdChanged(oldEventId, m_relationId);
Q_EMIT attachmentPathChanged();
}
@@ -118,7 +116,6 @@ void ChatBarCache::setEditId(const QString &editId)
m_relationType = Edit;
}
m_attachmentPath = QString();
delete m_relationContentModel;
Q_EMIT relationIdChanged(oldEventId, m_relationId);
Q_EMIT attachmentPathChanged();
}
@@ -196,7 +193,6 @@ void ChatBarCache::setAttachmentPath(const QString &attachmentPath)
#if (Quotient_VERSION_MINOR < 10 && Quotient_VERSION_PATCH < 3) || Quotient_VERSION_MINOR < 9
m_relationType = None;
const auto oldEventId = std::exchange(m_relationId, QString());
delete m_relationContentModel;
Q_EMIT relationIdChanged(oldEventId, m_relationId);
#endif
}
@@ -206,7 +202,6 @@ void ChatBarCache::clearRelations()
const auto oldEventId = std::exchange(m_relationId, QString());
const auto oldThreadId = std::exchange(m_threadId, QString());
m_attachmentPath = QString();
delete m_relationContentModel;
Q_EMIT relationIdChanged(oldEventId, m_relationId);
Q_EMIT threadIdChanged(oldThreadId, m_threadId);
Q_EMIT attachmentPathChanged();

View File

@@ -8,14 +8,11 @@
#include <QQuickTextDocument>
#include <QTextCursor>
#include "models/messagecontentmodel.h"
namespace Quotient
{
class RoomMember;
}
/**
* @brief Defines a user mention in the current chat or edit text.
*/
@@ -210,7 +207,5 @@ private:
QList<Mention> m_mentions;
QString m_savedText;
QPointer<MessageContentModel> m_relationContentModel;
void clearCache();
};

View File

@@ -12,6 +12,7 @@
#include <Quotient/events/eventcontent.h>
#include <Quotient/events/eventrelation.h>
#include <Quotient/events/roommessageevent.h>
#include <Quotient/events/stickerevent.h>
#include <Quotient/jobs/basejob.h>
#include <Quotient/quotient_common.h>
#include <qcoro/qcorosignal.h>

View File

@@ -4,10 +4,10 @@
#include "completionmodel.h"
#include <QDebug>
#include "actionsmodel.h"
#include "completionproxymodel.h"
#include "customemojimodel.h"
#include "emojimodel.h"
#include "models/actionsmodel.h"
#include "models/customemojimodel.h"
#include "models/emojimodel.h"
#include "neochatroom.h"
#include "roommanager.h"
#include "userlistmodel.h"

View File

@@ -3,8 +3,8 @@
#include "messagecontentmodel.h"
#include "contentprovider.h"
#include "enums/messagecomponenttype.h"
#include "eventhandler.h"
#include "messagecomponenttype.h"
#include "neochatconfig.h"
#include <QImageReader>

View File

@@ -7,7 +7,7 @@
#include <KLazyLocalizedString>
#include "powerlevel.h"
#include "enums/powerlevel.h"
using namespace Qt::Literals::StringLiterals;

View File

@@ -10,8 +10,8 @@
#include "chatbarcache.h"
#include "contentprovider.h"
#include "enums/messagecomponenttype.h"
#include "eventhandler.h"
#include "messagecomponenttype.h"
#include "messagecontentmodel.h"
#include "neochatroom.h"