Major Changes:
- Merged latest Qt5 devel content from dlbo (292 files changed, 7 new dirs)
- Consolidated forward-declarations and include folders
- Removed unneeded modules per Niklas' repo check list
Build System Fixes:
- Fixed CMake VERSION_GREATER syntax in ParticipantManagement/CMakeLists.txt
- Added VLC packages (libvlc-dev, vlc-plugin-base) to docker_build.sh
- Added PostgreSQL dev packages (libpq-dev, postgresql-server-dev-all) to Dockerfile
- Fixed locale warnings (ANSI_X3.4-1968 → C.UTF-8)
- Fixed ArcGIS SDK path warnings when BUILD_ARCGIS=OFF
Code Generation Fixes:
- Fixed IDL enum collisions (PortType→CorePortType/DdsutPortType, PdmEventType)
- Fixed Grantlee template svc_translation.cpp.grantlee:
- Changed {{ idl_enum.name }}_def:: to {{ idl_enum.name }}::
- Fixed .underlying() calls for C++11 scoped enums (enum class)
- Removed generated files from repo (moc_*, *_dtc.h, *_ftc.h)
Validation:
- BUILD_RTI=ON: SUCCESS
- BUILD_RTI=OFF: SUCCESS
- C++17 standard maintained for RTI 7.7 compatibility
- Ubuntu 26.04 Docker environment verified
Remaining Warnings (expected):
- BgViewer, KDChart, KDReports, Poppler-Qt6 not found (optional features)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
131 lines
3.8 KiB
C++
131 lines
3.8 KiB
C++
/**
|
|
* @RDE_HEADER@
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Hannes Fritsche, SLSE, 2017-09-06
|
|
*/
|
|
|
|
#include "mainwindow.h"
|
|
#include "ui_mainwindow.h"
|
|
#include "message_model.h"
|
|
#include <nglsettings/nglsettings_settings.h>
|
|
|
|
#include <QJsonDocument>
|
|
#include <QtWebSockets/QWebSocket>
|
|
|
|
MainWindow::MainWindow(QWidget *parent)
|
|
: NGLMainWindow(parent)
|
|
, m_ui(new Ui::MainWindow)
|
|
, m_socket(new QWebSocket(QString(), QWebSocketProtocol::Version13, this))
|
|
, m_messageModel(new MessageModel(this))
|
|
{
|
|
m_ui->setupUi(this);
|
|
|
|
setWindowTitle(QLatin1String("CNR Tester"));
|
|
|
|
connect(m_ui->pbConnect, &QPushButton::clicked,
|
|
this, &MainWindow::onConnectClicked);
|
|
connect(m_ui->pbDisconnect, &QPushButton::clicked,
|
|
this, &MainWindow::onDisconnectClicked);
|
|
connect(m_ui->pbGetPositionsCnr, &QPushButton::clicked,
|
|
this, &MainWindow::onSendGetPositionsCnrClicked);
|
|
connect(m_ui->pbSendError, &QPushButton::clicked,
|
|
this, &MainWindow::onSendErrorClicked);
|
|
connect(m_ui->pbSendGetConfigCnr, &QPushButton::clicked,
|
|
this, &MainWindow::onSendGetConfigCnrClicked);
|
|
connect(m_ui->pbSendGetEssentials, &QPushButton::clicked,
|
|
this, &MainWindow::onSendGetEssentialsClicked);
|
|
connect(m_socket, &QWebSocket::stateChanged,
|
|
this, &MainWindow::onNewSocketState);
|
|
connect(m_socket, &QWebSocket::textMessageReceived,
|
|
this, &MainWindow::onNewTextMessageFromSocket);
|
|
connect(m_ui->pbClearMessages, &QPushButton::clicked,
|
|
m_messageModel, &MessageModel::clear);
|
|
|
|
m_ui->dvMessages->setModel(m_messageModel);
|
|
}
|
|
|
|
MainWindow::~MainWindow()
|
|
{
|
|
delete m_ui;
|
|
}
|
|
|
|
void MainWindow::onSendGetEssentialsClicked()
|
|
{
|
|
newMessageToServer(QLatin1String("getEssentials"));
|
|
}
|
|
|
|
void MainWindow::onSendGetConfigCnrClicked()
|
|
{
|
|
newMessageToServer(QLatin1String("getConfigCNR"));
|
|
}
|
|
|
|
void MainWindow::onSendGetPositionsCnrClicked()
|
|
{
|
|
int32_t repeat = m_ui->leCnrPosRepeat->text().toInt();
|
|
|
|
QJsonObject obj;
|
|
|
|
obj.insert(QLatin1String("repeat"), repeat);
|
|
|
|
newMessageToServer(QLatin1String("getPositionsCNR"), QUuid::createUuid().toString(), obj);
|
|
}
|
|
|
|
void MainWindow::onSendErrorClicked()
|
|
{
|
|
QJsonObject obj;
|
|
|
|
obj.insert(QLatin1String("errorClass"), m_ui->leErrorClass->text().toInt());
|
|
obj.insert(QLatin1String("errorMessage"), m_ui->leErrorMessage->text());
|
|
obj.insert(QLatin1String("uuid"), m_ui->leErrorUuid->text());
|
|
|
|
newMessageToServer(QLatin1String("error"), QString(), obj);
|
|
}
|
|
|
|
void MainWindow::onConnectClicked()
|
|
{
|
|
m_socket->open(QUrl(QStringLiteral("ws://%1:%2").arg(m_ui->leHost->text(), m_ui->lePort->text())));
|
|
}
|
|
|
|
void MainWindow::onDisconnectClicked()
|
|
{
|
|
m_socket->close();
|
|
}
|
|
|
|
void MainWindow::onNewSocketState(QAbstractSocket::SocketState state)
|
|
{
|
|
m_ui->lbState->setText(QVariant::fromValue(state).toString());
|
|
|
|
m_ui->pbConnect->setEnabled(state != QAbstractSocket::ConnectedState);
|
|
m_ui->pbDisconnect->setEnabled(state == QAbstractSocket::ConnectedState);
|
|
}
|
|
|
|
void MainWindow::onNewTextMessageFromSocket(const QString &message)
|
|
{
|
|
m_messageModel->addMessage(MessageModel::FROM_PROXY, message);
|
|
}
|
|
|
|
void MainWindow::newMessageToServer(const QString &type, const QString &uuid, const QJsonObject &data)
|
|
{
|
|
if (!m_socket || m_socket->state() != QAbstractSocket::ConnectedState)
|
|
return;
|
|
|
|
QJsonObject obj;
|
|
|
|
obj.insert(QLatin1String("type"), type);
|
|
obj.insert(QLatin1String("data"), data);
|
|
if (!uuid.isNull())
|
|
obj.insert(QLatin1String("uuid"), uuid);
|
|
|
|
m_socket->sendTextMessage(QString::fromUtf8(QJsonDocument(obj).toJson()));
|
|
m_messageModel->addMessage(MessageModel::TO_PROXY, type, uuid, obj.value(QLatin1String("data")).toString());
|
|
}
|
|
|
|
void MainWindow::setVersionView()
|
|
{
|
|
return;
|
|
// m_versionView = new VersionView(NGLSettings::instance(), tr("CNR Proxy Tester"), this);
|
|
// connect(m_versionView, SIGNAL(destroyed()), this, SLOT(onVersionViewDeleted()), Qt::DirectConnection);
|
|
}
|