Session 022: Migrate Lts/Tools (72 submodules) to Qt6
- Copied complete Lts/Tools directory from qt5-before to qt6-after - Updated 32 CMakeLists.txt files (Qt5:: → Qt6::) - Tools subdirectory already included in parent Lts/CMakeLists.txt - All 72 tool submodules now present in qt6-migrated-legatus - Includes: Adler, ArAssets, ConfigX, DBAdministration, DBUpdate, DdsView, InfrastructureManagement, and 67 more tools - C++17 standard (RTI 7.7.0 compatibility maintained) - Tests deferred until final validation phase Migration progress: ✅ Lts/Application (68 files) ✅ Lts/DDS (verified Qt6-ready) ✅ Lts/Plugins (60 submodules, verified) ✅ Lts/Projects (5 submodules, verified) ✅ Lts/Proxies (13 submodules, verified) ✅ Lts/Services (47 submodules, verified) ✅ Lts/Tools (72 submodules, copied + CMake updated) ✅ Lts/Viewer (LtsFileDialog, LtsReportDisplay, SituationMap) 🟡 TetraIF (partial) 🟡 Z (partial: nglwidgets, QtSingleApplication, qsql_informix, WMS_Interface)
This commit is contained in:
1 parent
01dce5fe52
commit
d5c13033e2
1792 files changed
+982018
No files matched your search
@@ -0,0 +1,112 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* The MessageModel class handles message related data
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Fritsche, SLSE, 2017-09-06
|
||||
*/
|
||||
|
||||
#include "message_model.h"
|
||||
#include <QtCore/QJsonDocument>
|
||||
#include <QtCore/QJsonObject>
|
||||
#include <QtCore/QJsonArray>
|
||||
|
||||
MessageModel::MessageModel(QObject *parent)
|
||||
: LtsAbstractTableModel<MessageInfo>( { tr("Time"), tr("Direction"), tr("Type"), tr("UUID"), tr("Data") }, parent)
|
||||
{
|
||||
setData(QVector<MessageInfo>());
|
||||
}
|
||||
|
||||
void MessageModel::addMessage(MessageModel::MessageDirection direction, const QString &message)
|
||||
{
|
||||
QJsonParseError parseError;
|
||||
|
||||
QString uuid = QLatin1String("-");
|
||||
QString data = uuid;
|
||||
|
||||
QJsonDocument doc = QJsonDocument::fromJson(message.toLatin1(), &parseError);
|
||||
|
||||
QString type;
|
||||
|
||||
if (parseError.error != QJsonParseError::NoError)
|
||||
type = parseError.errorString();
|
||||
else if (!doc.isObject())
|
||||
type = QLatin1String("invalid");
|
||||
else
|
||||
{
|
||||
QJsonObject obj = doc.object();
|
||||
|
||||
type = obj.value(QLatin1String("type")).toString(QLatin1String("not present"));
|
||||
uuid = obj.value(QLatin1String("uuid")).toString(QLatin1String("not present"));
|
||||
|
||||
QJsonObject dataObj = obj.value(QLatin1String("data")).toObject();
|
||||
|
||||
if (dataObj.isEmpty())
|
||||
data = QLatin1String("not present");
|
||||
else
|
||||
data = QString::fromUtf8(QJsonDocument(dataObj).toJson());
|
||||
}
|
||||
|
||||
addMessage(direction, type, uuid, data);
|
||||
}
|
||||
|
||||
void MessageModel::addMessage(MessageModel::MessageDirection direction, const QString &type, const QString &uuid, const QString &data)
|
||||
{
|
||||
int32_t rows = rowCount();
|
||||
|
||||
onDataChanged({rows, toString(direction), type, uuid, data}, DataModification::eAdded);
|
||||
}
|
||||
|
||||
QVariant MessageModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (role != Qt::DisplayRole || !indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
const MessageInfo &infoData = m_vecData.at(index.row());
|
||||
|
||||
switch (index.column())
|
||||
{
|
||||
case TIME:
|
||||
return infoData.time.toString();
|
||||
case DIRECTION:
|
||||
return infoData.direction;
|
||||
case TYPE:
|
||||
return infoData.type;
|
||||
case UUID:
|
||||
return infoData.uuid;
|
||||
case DATA:
|
||||
{
|
||||
if (!infoData.data.size())
|
||||
return infoData.data;
|
||||
|
||||
QJsonObject obj = QJsonDocument::fromJson(infoData.data.toLatin1()).object();
|
||||
QString result = infoData.data;
|
||||
const QStringList keys = obj.keys();
|
||||
|
||||
for (const QString ¤tKey : keys)
|
||||
{
|
||||
const QJsonValue subObj = obj.value(currentKey);
|
||||
if (subObj.isArray())
|
||||
result.prepend(QStringLiteral("%1 size: %2\n").arg(currentKey).arg(subObj.toArray().size()));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QString MessageModel::toString(MessageModel::MessageDirection direction) const
|
||||
{
|
||||
switch (direction)
|
||||
{
|
||||
case TO_PROXY:
|
||||
return tr(" > to Proxy");
|
||||
case FROM_PROXY:
|
||||
return tr(" < from Proxy");
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user