Merge PR #342: Fix log viewers string/uuid conversion
This commit is contained in:
commit
1b7ac0dcab
@ -111,12 +111,12 @@ void LogsModelNg::setLive(bool live)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString LogsModelNg::deviceId() const
|
QUuid LogsModelNg::deviceId() const
|
||||||
{
|
{
|
||||||
return m_deviceId;
|
return m_deviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogsModelNg::setDeviceId(const QString &deviceId)
|
void LogsModelNg::setDeviceId(const QUuid &deviceId)
|
||||||
{
|
{
|
||||||
if (m_deviceId != deviceId) {
|
if (m_deviceId != deviceId) {
|
||||||
m_deviceId = deviceId;
|
m_deviceId = deviceId;
|
||||||
@ -126,13 +126,21 @@ void LogsModelNg::setDeviceId(const QString &deviceId)
|
|||||||
|
|
||||||
QStringList LogsModelNg::typeIds() const
|
QStringList LogsModelNg::typeIds() const
|
||||||
{
|
{
|
||||||
return m_typeIds;
|
QStringList strings;
|
||||||
|
foreach (const QUuid &id, m_typeIds) {
|
||||||
|
strings.append(id.toString());
|
||||||
|
}
|
||||||
|
return strings;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogsModelNg::setTypeIds(const QStringList &typeIds)
|
void LogsModelNg::setTypeIds(const QStringList &typeIds)
|
||||||
{
|
{
|
||||||
if (m_typeIds != typeIds) {
|
QList<QUuid> fixedTypeIds;
|
||||||
m_typeIds = typeIds;
|
foreach (const QString &id, typeIds) {
|
||||||
|
fixedTypeIds.append(QUuid(id));
|
||||||
|
}
|
||||||
|
if (m_typeIds != fixedTypeIds) {
|
||||||
|
m_typeIds = fixedTypeIds;
|
||||||
emit typeIdsChanged();
|
emit typeIdsChanged();
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
qDeleteAll(m_list);
|
qDeleteAll(m_list);
|
||||||
@ -361,14 +369,14 @@ void LogsModelNg::fetchMore(const QModelIndex &parent)
|
|||||||
emit busyChanged();
|
emit busyChanged();
|
||||||
|
|
||||||
QVariantMap params;
|
QVariantMap params;
|
||||||
if (!m_deviceId.isEmpty()) {
|
if (!m_deviceId.isNull()) {
|
||||||
QVariantList deviceIds;
|
QVariantList deviceIds;
|
||||||
deviceIds.append(m_deviceId);
|
deviceIds.append(m_deviceId);
|
||||||
params.insert("deviceIds", deviceIds);
|
params.insert("deviceIds", deviceIds);
|
||||||
}
|
}
|
||||||
if (!m_typeIds.isEmpty()) {
|
if (!m_typeIds.isEmpty()) {
|
||||||
QVariantList typeIds;
|
QVariantList typeIds;
|
||||||
foreach (const QString &typeId, m_typeIds) {
|
foreach (const QUuid &typeId, m_typeIds) {
|
||||||
typeIds.append(typeId);
|
typeIds.append(typeId);
|
||||||
}
|
}
|
||||||
params.insert("typeIds", typeIds);
|
params.insert("typeIds", typeIds);
|
||||||
@ -403,12 +411,12 @@ void LogsModelNg::newLogEntryReceived(const QVariantMap &data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap entryMap = data;
|
QVariantMap entryMap = data;
|
||||||
QString deviceId = entryMap.value("deviceId").toString();
|
QUuid deviceId = entryMap.value("deviceId").toUuid();
|
||||||
if (!m_deviceId.isNull() && deviceId != m_deviceId) {
|
if (!m_deviceId.isNull() && deviceId != m_deviceId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString typeId = entryMap.value("typeId").toString();
|
QUuid typeId = entryMap.value("typeId").toUuid();
|
||||||
if (!m_typeIds.isEmpty() && !m_typeIds.contains(typeId)) {
|
if (!m_typeIds.isEmpty() && !m_typeIds.contains(typeId)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,6 +35,7 @@
|
|||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QLineSeries>
|
#include <QLineSeries>
|
||||||
|
#include <QUuid>
|
||||||
|
|
||||||
class LogEntry;
|
class LogEntry;
|
||||||
class Engine;
|
class Engine;
|
||||||
@ -46,7 +47,7 @@ class LogsModelNg : public QAbstractListModel
|
|||||||
Q_PROPERTY(bool busy READ busy NOTIFY busyChanged)
|
Q_PROPERTY(bool busy READ busy NOTIFY busyChanged)
|
||||||
Q_PROPERTY(bool live READ live WRITE setLive NOTIFY liveChanged)
|
Q_PROPERTY(bool live READ live WRITE setLive NOTIFY liveChanged)
|
||||||
Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
|
Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
|
||||||
Q_PROPERTY(QString deviceId READ deviceId WRITE setDeviceId NOTIFY deviceIdChanged)
|
Q_PROPERTY(QUuid deviceId READ deviceId WRITE setDeviceId NOTIFY deviceIdChanged)
|
||||||
Q_PROPERTY(QStringList typeIds READ typeIds WRITE setTypeIds NOTIFY typeIdsChanged)
|
Q_PROPERTY(QStringList typeIds READ typeIds WRITE setTypeIds NOTIFY typeIdsChanged)
|
||||||
Q_PROPERTY(QDateTime startTime READ startTime WRITE setStartTime NOTIFY startTimeChanged)
|
Q_PROPERTY(QDateTime startTime READ startTime WRITE setStartTime NOTIFY startTimeChanged)
|
||||||
Q_PROPERTY(QDateTime endTime READ endTime WRITE setEndTime NOTIFY endTimeChanged)
|
Q_PROPERTY(QDateTime endTime READ endTime WRITE setEndTime NOTIFY endTimeChanged)
|
||||||
@ -80,8 +81,8 @@ public:
|
|||||||
bool live() const;
|
bool live() const;
|
||||||
void setLive(bool live);
|
void setLive(bool live);
|
||||||
|
|
||||||
QString deviceId() const;
|
QUuid deviceId() const;
|
||||||
void setDeviceId(const QString &deviceId);
|
void setDeviceId(const QUuid &deviceId);
|
||||||
|
|
||||||
QStringList typeIds() const;
|
QStringList typeIds() const;
|
||||||
void setTypeIds(const QStringList &typeId);
|
void setTypeIds(const QStringList &typeId);
|
||||||
@ -131,8 +132,8 @@ private:
|
|||||||
Engine *m_engine = nullptr;
|
Engine *m_engine = nullptr;
|
||||||
bool m_busy = false;
|
bool m_busy = false;
|
||||||
bool m_live = false;
|
bool m_live = false;
|
||||||
QString m_deviceId;
|
QUuid m_deviceId;
|
||||||
QStringList m_typeIds;
|
QList<QUuid> m_typeIds;
|
||||||
QDateTime m_startTime;
|
QDateTime m_startTime;
|
||||||
QDateTime m_endTime;
|
QDateTime m_endTime;
|
||||||
int m_blockSize = 100;
|
int m_blockSize = 100;
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
|
||||||
LogEntry::LogEntry(const QDateTime ×tamp, const QVariant &value, const QString &deviceId, const QString &typeId, LoggingSource source, LoggingEventType loggingEventType, QObject *parent):
|
LogEntry::LogEntry(const QDateTime ×tamp, const QVariant &value, const QUuid &deviceId, const QUuid &typeId, LoggingSource source, LoggingEventType loggingEventType, QObject *parent):
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_value(value),
|
m_value(value),
|
||||||
m_timeStamp(timestamp),
|
m_timeStamp(timestamp),
|
||||||
@ -54,12 +54,12 @@ QDateTime LogEntry::timestamp() const
|
|||||||
return m_timeStamp;
|
return m_timeStamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString LogEntry::deviceId() const
|
QUuid LogEntry::deviceId() const
|
||||||
{
|
{
|
||||||
return m_deviceId;
|
return m_deviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString LogEntry::typeId() const
|
QUuid LogEntry::typeId() const
|
||||||
{
|
{
|
||||||
return m_typeId;
|
return m_typeId;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,13 +34,14 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include <QUuid>
|
||||||
|
|
||||||
class LogEntry : public QObject
|
class LogEntry : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QVariant value READ value CONSTANT)
|
Q_PROPERTY(QVariant value READ value CONSTANT)
|
||||||
Q_PROPERTY(QString deviceId READ deviceId CONSTANT)
|
Q_PROPERTY(QUuid deviceId READ deviceId CONSTANT)
|
||||||
Q_PROPERTY(QString typeId READ typeId CONSTANT)
|
Q_PROPERTY(QUuid typeId READ typeId CONSTANT)
|
||||||
Q_PROPERTY(LoggingSource source READ source CONSTANT)
|
Q_PROPERTY(LoggingSource source READ source CONSTANT)
|
||||||
Q_PROPERTY(LoggingEventType loggingEventType READ loggingEventType CONSTANT)
|
Q_PROPERTY(LoggingEventType loggingEventType READ loggingEventType CONSTANT)
|
||||||
|
|
||||||
@ -69,12 +70,12 @@ public:
|
|||||||
};
|
};
|
||||||
Q_ENUM(LoggingEventType)
|
Q_ENUM(LoggingEventType)
|
||||||
|
|
||||||
explicit LogEntry(const QDateTime ×tamp, const QVariant &value, const QString &deviceId = QString(), const QString &typeId = QString(), LoggingSource source = LoggingSourceSystem, LoggingEventType loggingEventType = LoggingEventTypeTrigger, QObject *parent = nullptr);
|
explicit LogEntry(const QDateTime ×tamp, const QVariant &value, const QUuid &deviceId = QUuid(), const QUuid &typeId = QUuid(), LoggingSource source = LoggingSourceSystem, LoggingEventType loggingEventType = LoggingEventTypeTrigger, QObject *parent = nullptr);
|
||||||
|
|
||||||
QVariant value() const;
|
QVariant value() const;
|
||||||
QDateTime timestamp() const;
|
QDateTime timestamp() const;
|
||||||
QString deviceId() const;
|
QUuid deviceId() const;
|
||||||
QString typeId() const;
|
QUuid typeId() const;
|
||||||
LoggingSource source() const;
|
LoggingSource source() const;
|
||||||
LoggingEventType loggingEventType() const;
|
LoggingEventType loggingEventType() const;
|
||||||
|
|
||||||
@ -85,8 +86,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
QVariant m_value;
|
QVariant m_value;
|
||||||
QDateTime m_timeStamp;
|
QDateTime m_timeStamp;
|
||||||
QString m_deviceId;
|
QUuid m_deviceId;
|
||||||
QString m_typeId;
|
QUuid m_typeId;
|
||||||
LoggingSource m_source;
|
LoggingSource m_source;
|
||||||
LoggingEventType m_loggingEventType;
|
LoggingEventType m_loggingEventType;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user