Cleanup logging in MessageContentModel
This commit is contained in:
@@ -88,12 +88,10 @@ ecm_add_qml_module(MessageContent GENERATE_PLUGIN_SOURCE
|
|||||||
configure_file(config-neochat.h.in ${CMAKE_CURRENT_BINARY_DIR}/config-neochat.h)
|
configure_file(config-neochat.h.in ${CMAKE_CURRENT_BINARY_DIR}/config-neochat.h)
|
||||||
|
|
||||||
ecm_qt_declare_logging_category(MessageContent
|
ecm_qt_declare_logging_category(MessageContent
|
||||||
HEADER "messagemodel_logging.h"
|
HEADER "messagecontentlogging.h"
|
||||||
IDENTIFIER "Message"
|
IDENTIFIER "MessageContent"
|
||||||
CATEGORY_NAME "org.kde.neochat.messagemodel"
|
CATEGORY_NAME "org.kde.neochat.messagecontent"
|
||||||
DESCRIPTION "Neochat: messagemodel"
|
|
||||||
DEFAULT_SEVERITY Info
|
DEFAULT_SEVERITY Info
|
||||||
EXPORT NEOCHAT
|
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(MessageContent PRIVATE ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/models)
|
target_include_directories(MessageContent PRIVATE ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/models)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include "chatbarcache.h"
|
#include "chatbarcache.h"
|
||||||
#include "contentprovider.h"
|
#include "contentprovider.h"
|
||||||
|
#include "messagecontentlogging.h"
|
||||||
#include "neochatconnection.h"
|
#include "neochatconnection.h"
|
||||||
#include "neochatdatetime.h"
|
#include "neochatdatetime.h"
|
||||||
#include "texthandler.h"
|
#include "texthandler.h"
|
||||||
@@ -139,13 +140,13 @@ QVariant MessageContentModel::data(const QModelIndex &index, int role) const
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index.row() >= rowCount()) {
|
if (index.row() < 0 || index.row() >= rowCount()) {
|
||||||
qDebug() << "MessageContentModel, something's wrong: index.row() >= rowCount()";
|
qCWarning(MessageContent) << __FUNCTION__ << "called with invalid index" << index << rowCount();
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_room) {
|
if (!m_room) {
|
||||||
qWarning() << "MessageContentModel::data called without room";
|
qCWarning(MessageContent) << __FUNCTION__ << "called without room";
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,7 +358,7 @@ MessageComponent MessageContentModel::linkPreviewComponent(const QUrl &link)
|
|||||||
void MessageContentModel::closeLinkPreview(int row)
|
void MessageContentModel::closeLinkPreview(int row)
|
||||||
{
|
{
|
||||||
if (row < 0 || row >= m_components.size()) {
|
if (row < 0 || row >= m_components.size()) {
|
||||||
qWarning() << "closeLinkPreview() called with row" << row << "which does not exist. m_components.size() =" << m_components.size();
|
qCWarning(MessageContent) << __FUNCTION__ << "called with invalid row" << row << m_components.size();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -381,7 +382,7 @@ void MessageContentModel::updateSpoiler(const QModelIndex &index)
|
|||||||
{
|
{
|
||||||
const auto row = index.row();
|
const auto row = index.row();
|
||||||
if (row < 0 || row >= rowCount()) {
|
if (row < 0 || row >= rowCount()) {
|
||||||
qWarning() << __FUNCTION__ << "called with row" << row << "which does not exist. m_components.size() =" << m_components.size();
|
qCWarning(MessageContent) << __FUNCTION__ << "called with invalid index" << index << rowCount();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,7 +395,7 @@ void MessageContentModel::toggleSpoiler(QModelIndex index)
|
|||||||
{
|
{
|
||||||
const auto row = index.row();
|
const auto row = index.row();
|
||||||
if (row < 0 || row >= rowCount()) {
|
if (row < 0 || row >= rowCount()) {
|
||||||
qWarning() << __FUNCTION__ << "called with row" << row << "which does not exist. m_components.size() =" << m_components.size();
|
qCWarning(MessageContent) << __FUNCTION__ << "called with invalid row" << row << m_components.size();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_components[row].type != MessageComponentType::Text) {
|
if (m_components[row].type != MessageComponentType::Text) {
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ class MessageContentModel : public QAbstractListModel
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
QML_ELEMENT
|
QML_ELEMENT
|
||||||
|
QML_UNCREATABLE("")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The room the chat bar is for.
|
* @brief The room the chat bar is for.
|
||||||
|
|||||||
Reference in New Issue
Block a user