Fix code component regression.

Tweak when member objects are deleted on changeover to stop cli spam
This commit is contained in:
James Graham
2024-07-23 20:19:03 +01:00
parent 8e4b20341d
commit c2f2bb26dc
4 changed files with 9 additions and 6 deletions

View File

@@ -88,11 +88,14 @@ void MessageEventModel::setRoom(NeoChatRoom *room)
// HACK: Reset the model to a null room first to make sure QML dismantles
// last room's objects before the room is actually changed
beginResetModel();
m_memberObjects.clear();
m_readMarkerModels.clear();
m_currentRoom->disconnect(this);
m_currentRoom = nullptr;
endResetModel();
// Don't clear the member objects until the model has been fully reset and all
// refs cleared.
m_memberObjects.clear();
}
beginResetModel();

View File

@@ -185,7 +185,7 @@ void RoomManager::maximizeMedia(int index)
Q_EMIT showMaximizedMedia(index);
}
void RoomManager::maximizeCode(const RoomMember &author, const QDateTime &time, const QString &codeText, const QString &language)
void RoomManager::maximizeCode(NeochatRoomMember *author, const QDateTime &time, const QString &codeText, const QString &language)
{
if (codeText.isEmpty()) {
return;

View File

@@ -217,7 +217,7 @@ public:
*/
Q_INVOKABLE void maximizeMedia(int index);
Q_INVOKABLE void maximizeCode(const RoomMember &author, const QDateTime &time, const QString &codeText, const QString &language);
Q_INVOKABLE void maximizeCode(NeochatRoomMember *author, const QDateTime &time, const QString &codeText, const QString &language);
/**
* @brief Request that any full screen overlay currently open closes.
@@ -288,7 +288,7 @@ Q_SIGNALS:
/**
* @brief Request a block of code is shown maximized.
*/
void showMaximizedCode(const RoomMember &author, const QDateTime &time, const QString &codeText, const QString &language);
void showMaximizedCode(NeochatRoomMember *author, const QDateTime &time, const QString &codeText, const QString &language);
/**
* @brief Request that any full screen overlay closes.

View File

@@ -54,7 +54,7 @@ RowLayout {
anchors.fill: parent
enabled: root.author
cursorShape: Qt.PointingHandCursor
onClicked: RoomManager.resolveResource("https://matrix.to/#/" + root.author.id)
onClicked: RoomManager.resolveResource("https://matrix.to/#/" + root.author?.id ?? "")
}
}
@@ -62,7 +62,7 @@ RowLayout {
id: label
Layout.alignment: Qt.AlignVCenter
Layout.fillWidth: true
text: `<style>a {text-decoration: none; color: ${Kirigami.Theme.textColor};}</style><a href="https://matrix.to/#/${root.author.id}">${root.authorDisplayName}</a> ${root.text}`
text: `<style>a {text-decoration: none; color: ${Kirigami.Theme.textColor};}</style><a href="https://matrix.to/#/${root.author?.id ?? ""}">${root.authorDisplayName}</a> ${root.text}`
wrapMode: Text.WordWrap
textFormat: Text.RichText
onLinkActivated: link => RoomManager.resolveResource(link)