Move the remaining functionality of ChatDocumentHandler to ChatTextItemHelper or split into own objects

This commit is contained in:
James Graham
2025-12-31 18:49:19 +00:00
parent 22d7d90cf4
commit 9ea76ca5d0
32 changed files with 1389 additions and 1494 deletions

View File

@@ -10,7 +10,7 @@
class QQuickItem;
class QTextDocument;
class QmlTextItemWrapper;
class ChatTextItemHelper;
class ChatMarkdownHelper : public QObject
{
@@ -19,13 +19,20 @@ class ChatMarkdownHelper : public QObject
public:
explicit ChatMarkdownHelper(QObject *parent = nullptr);
QmlTextItemWrapper *textItem() const;
void setTextItem(QmlTextItemWrapper *textItem);
ChatTextItemHelper *textItem() const;
void setTextItem(ChatTextItemHelper *textItem);
void handleExternalFormatChange();
Q_SIGNALS:
void textItemChanged();
/**
* @brief There is an unhandled block format request.
*
* i.e. the markdown for as new block (e.g. code or quote) has been typed which
* ChatMarkdownHelper cannot resolve.
*/
void unhandledBlockFormat(RichFormat::Format format);
private:
@@ -35,7 +42,7 @@ private:
Started,
};
QPointer<QmlTextItemWrapper> m_textItem;
QPointer<ChatTextItemHelper> m_textItem;
State m_currentState = None;
int m_startPos = 0;