Fix crash on shutdown and simplify code
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include "messagecontentmodel.h"
|
#include "messagecontentmodel.h"
|
||||||
|
|
||||||
|
#include <QStyleHints>
|
||||||
|
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
|
|
||||||
#include "chatbarcache.h"
|
#include "chatbarcache.h"
|
||||||
@@ -18,10 +20,7 @@ MessageContentModel::MessageContentModel(NeoChatRoom *room, MessageContentModel
|
|||||||
, m_room(room)
|
, m_room(room)
|
||||||
, m_eventId(eventId)
|
, m_eventId(eventId)
|
||||||
{
|
{
|
||||||
m_theme = static_cast<Kirigami::Platform::PlatformTheme *>(qmlAttachedPropertiesObject<Kirigami::Platform::PlatformTheme>(this, true));
|
connect(qGuiApp->styleHints(), &QStyleHints::colorSchemeChanged, this, &MessageContentModel::updateSpoilers);
|
||||||
if (m_theme) {
|
|
||||||
connect(m_theme, &Kirigami::Platform::PlatformTheme::colorsChanged, this, &MessageContentModel::updateSpoilers);
|
|
||||||
}
|
|
||||||
|
|
||||||
initializeModel();
|
initializeModel();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
#include <QImageReader>
|
#include <QImageReader>
|
||||||
|
|
||||||
#include <Kirigami/Platform/PlatformTheme>
|
|
||||||
#ifndef Q_OS_ANDROID
|
#ifndef Q_OS_ANDROID
|
||||||
#include <KSyntaxHighlighting/Definition>
|
#include <KSyntaxHighlighting/Definition>
|
||||||
#include <KSyntaxHighlighting/Repository>
|
#include <KSyntaxHighlighting/Repository>
|
||||||
@@ -240,7 +239,6 @@ private:
|
|||||||
QList<QUrl> m_removedLinkPreviews;
|
QList<QUrl> m_removedLinkPreviews;
|
||||||
MessageComponent linkPreviewComponent(const QUrl &link);
|
MessageComponent linkPreviewComponent(const QUrl &link);
|
||||||
|
|
||||||
Kirigami::Platform::PlatformTheme *m_theme = nullptr;
|
|
||||||
void updateSpoilers();
|
void updateSpoilers();
|
||||||
void updateSpoiler(const QModelIndex &index);
|
void updateSpoiler(const QModelIndex &index);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user