Qt6 Migration: Merge latest Qt5 devel content and apply migration fixes
- Merged 292 changed files from dlbo snapshot - Fixed IDL enum collisions (PortType, PdmEventType) - Fixed Grantlee template for C++11 scoped enums - Fixed CMake VERSION_GREATER syntax - Added missing directories (THP, LtsRestClient, etc.) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
310 files changed
+2823
-740
No files matched your search
@@ -21,6 +21,11 @@
|
||||
#include <QTime>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
|
||||
#include <AdlerJson/generatetelegrams.h>
|
||||
#include <AdlerJson/telegrams.h>
|
||||
|
||||
@@ -41,6 +46,7 @@ ICDTest::ICDTest(QWidget *parent)
|
||||
generatePositionReportsPage();
|
||||
generateTextMessagePage();
|
||||
generateErkundungsergebnissePage();
|
||||
generateFilePage();
|
||||
connect(m_ui->tbTrash, &QToolButton::clicked, m_ui->textEdit, &QTextEdit::clear);
|
||||
connect(m_ui->tbRestart, &QToolButton::clicked, this, &ICDTest::doRestart);
|
||||
connect(&m_heartbeatTimer, &QTimer::timeout, this, &ICDTest::generateConnectionTestMessage);
|
||||
@@ -1170,6 +1176,57 @@ void ICDTest::generateErkundungsergebnissePage()
|
||||
m_ui->toolBox->addItem(widget, tr("Erkundungsergebnisse"));
|
||||
}
|
||||
|
||||
void ICDTest::selectAndSendJson() {
|
||||
// 1. QSettings initialisieren
|
||||
QSettings settings(QStringLiteral("Legatus"), QStringLiteral("JsonWebsocketSender"));
|
||||
|
||||
// 2. Letzten Pfad auslesen (Standard: leerer String)
|
||||
QString lastDir = settings.value(QStringLiteral("lastDirectory"), QStringLiteral("")).toString();
|
||||
|
||||
// 3. Dialog mit dem letzten Pfad öffnen
|
||||
QString filePath = QFileDialog::getOpenFileName(this,
|
||||
tr("Select JSON file"),
|
||||
lastDir, // Hier wird der gemerkte Pfad übergeben
|
||||
tr("JSON Files (.json);;Text Files (.txt)"));
|
||||
|
||||
if (filePath.isEmpty()) return;
|
||||
|
||||
// 4. Neuen Pfad für das nächste Mal speichern
|
||||
QFileInfo fileInfo(filePath);
|
||||
settings.setValue(QStringLiteral("lastDirectory"), fileInfo.absolutePath());
|
||||
|
||||
// 5. Datei einlesen
|
||||
QFile file(filePath);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Couldn't open file"));
|
||||
return;
|
||||
}
|
||||
|
||||
m_pendingData = file.readAll();
|
||||
file.close();
|
||||
|
||||
QString message = QString::fromUtf8(m_pendingData);
|
||||
m_ui->textEdit->append(message);
|
||||
emit messsageToProxy(message);
|
||||
|
||||
}
|
||||
|
||||
void ICDTest::generateFilePage()
|
||||
{
|
||||
QVBoxLayout *lay = new QVBoxLayout(this);
|
||||
QSpacerItem *item = new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
|
||||
QWidget *widget = new QWidget(this);
|
||||
|
||||
QPushButton *btnEXAQ = new QPushButton(tr("JSON Files"));
|
||||
connect(btnEXAQ, &QPushButton::clicked, this, &ICDTest::selectAndSendJson);
|
||||
lay->addWidget(btnEXAQ);
|
||||
|
||||
lay->addItem(item);
|
||||
widget->setLayout(lay);
|
||||
m_ui->toolBox->addItem(widget, tr("Load JSON File"));
|
||||
}
|
||||
|
||||
|
||||
void ICDTest::generateStatusPage()
|
||||
{
|
||||
QVBoxLayout *lay = new QVBoxLayout(this);
|
||||
|
||||
@@ -82,6 +82,7 @@ class ICDTest : public QWidget
|
||||
void generateEXFlugbahnberechnung(); // Flugbahnberechnung
|
||||
void generateEXFlugbahndaten(); // Flugbahndaten
|
||||
void onSendHeartbeatChanged();
|
||||
void selectAndSendJson();
|
||||
|
||||
private:
|
||||
void generateConnectionPage();
|
||||
@@ -91,6 +92,7 @@ class ICDTest : public QWidget
|
||||
void generateTrajectoryGenerationPage();
|
||||
void generateTextMessagePage();
|
||||
void generateErkundungsergebnissePage();
|
||||
void generateFilePage();
|
||||
void generateStatusPage();
|
||||
void generateEXSQWS_1WS(const QString &verein, const QString &kenner);
|
||||
|
||||
@@ -101,6 +103,7 @@ class ICDTest : public QWidget
|
||||
QTimer m_heartbeatTimer;
|
||||
QString m_lastFeuerkampfReferenz;
|
||||
QString m_fixedReference;
|
||||
QByteArray m_pendingData;
|
||||
};
|
||||
|
||||
} // namespace AdlerWebSocketSimulator
|
||||
@@ -23,6 +23,7 @@ ADD_SUBDIRECTORY(ParticipantDataGenerator)
|
||||
ADD_SUBDIRECTORY(ProjectSettingsEditor)
|
||||
ADD_SUBDIRECTORY(QLedLine)
|
||||
ADD_SUBDIRECTORY(QLedMatrix)
|
||||
ADD_SUBDIRECTORY(RestClientUi)
|
||||
ADD_SUBDIRECTORY(ScreenIdShow)
|
||||
ADD_SUBDIRECTORY(SerialToTcpConverter)
|
||||
ADD_SUBDIRECTORY(Splash)
|
||||
@@ -34,6 +35,8 @@ ADD_SUBDIRECTORY(VapixConfig)
|
||||
ADD_SUBDIRECTORY(Automount)
|
||||
ADD_SUBDIRECTORY(EgcuSimulator)
|
||||
ADD_SUBDIRECTORY(TextEditorTest)
|
||||
#ADD_SUBDIRECTORY(Examples/Plugins)
|
||||
ADD_SUBDIRECTORY(Examples/TestGuiElement)
|
||||
|
||||
#ADD_SUBDIRECTORY(VideoImport)
|
||||
ADD_SUBDIRECTORY(VulnerabilityStateGenerator)
|
||||
|
||||
@@ -278,6 +278,7 @@ SET(UPDATES_GUEZ
|
||||
updates/guez/2.178_guez_pdm_target_type_target_subtype.upd
|
||||
updates/guez/2.179_guez_ppm_uas_update.upd
|
||||
updates/guez/2.180_guez_ex_rec_uas.upd
|
||||
updates/guez/2.183_guez_pdm_charge_type.upd
|
||||
)
|
||||
|
||||
SET(UPDATES_QATAR
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
-- GLOBAL: PDM;
|
||||
BEGIN;
|
||||
|
||||
UPDATE pdm_charge_type SET properties = '{"adlerChargeTypeName": "Mine DM72", "impactRadius":25, "impactEdgeLength":25, "hazardDistance": 250, "fuseTypes": [{"fuseType": 1, "chargeLegacyId": 395}], "mineLaying":{"appearanceTimeOffset" : 19.2, "appearanceJitter": 3.4, "armingTimeOffset": 29.6, "armingJitter" : 2.3, "mineChargeTypeId": 216, "pattern": [ {"id": 1, "positions": [{"easting": -28, "northing": -30}, {"easting": -34, "northing": -36}, {"easting": -46, "northing": -48}, {"easting": -43, "northing": -44}, {"easting": -61, "northing": -43}, {"easting": -34, "northing": -35}, {"easting": 78, "northing": -77}, {"easting": 78, "northing": -77}, {"easting": 82, "northing": -81}, {"easting": 113, "northing": -112}, {"easting": 105, "northing": -105}, {"easting": 104, "northing": -102}, {"easting": 55, "northing": -53}, {"easting": 61, "northing": -60}, {"easting": 61, "northing": -59}, {"easting": 65, "northing": -64}, {"easting": 71, "northing": -76}, {"easting": 88, "northing": -93}, {"easting": -12, "northing": -13}, {"easting": -4, "northing": -3}, {"easting": 2, "northing": -16}, {"easting": -16, "northing": -3}, {"easting": -11, "northing": -11}, {"easting": -12, "northing": 5}, {"easting": 7, "northing": -40}, {"easting": 8, "northing": -13}, {"easting": 5, "northing": -21}, {"easting": -33, "northing": 44}]}, {"id": 2, "positions": [{"easting": 34, "northing": -238}, {"easting": 16, "northing": -132}, {"easting": -108, "northing": -57}, {"easting": 64, "northing": -262}, {"easting": -12, "northing": -122}, {"easting": 2, "northing": -143}, {"easting": 125, "northing": -235}, {"easting": 39, "northing": -108}, {"easting": 32, "northing": -261}, {"easting": 69, "northing": -248}, {"easting": 56, "northing": -253}, {"easting": 121, "northing": -170}, {"easting": 53, "northing": -268}, {"easting": 116, "northing": -115}, {"easting": 46, "northing": -258}, {"easting": -117, "northing": -53}, {"easting": 49, "northing": -229}, {"easting": 131, "northing": -155}, {"easting": 143, "northing": -236}, {"easting": 137, "northing": -236}, {"easting": 131, "northing": -248}, {"easting": 39, "northing": -100}, {"easting": 22, "northing": -238}, {"easting": 51, "northing": -251}, {"easting": 139, "northing": -139}, {"easting": 73, "northing": -274}, {"easting": 28, "northing": -224}, {"easting": 53, "northing": -234}]}, {"id": 3, "positions": [{"easting": -61, "northing": -520}, {"easting": -58, "northing": -409}, {"easting": -74, "northing": -474}, {"easting": -69, "northing": -393}, {"easting": -5, "northing": -448}, {"easting": -37, "northing": -504}, {"easting": -37, "northing": -397}, {"easting": -55, "northing": -378}, {"easting": -5, "northing": -467}, {"easting": 19, "northing": -342}, {"easting": -26, "northing": -496}, {"easting": -26, "northing": -487}, {"easting": -43, "northing": -445}, {"easting": -69, "northing": -400}, {"easting": -43, "northing": -389}, {"easting": -13, "northing": -463}, {"easting": -52, "northing": -500}, {"easting": -40, "northing": -520}, {"easting": -19, "northing": -444}, {"easting": -38, "northing": -464}, {"easting": 38, "northing": -356}, {"easting": 27, "northing": -354}, {"easting": 47, "northing": -359}, {"easting": -91, "northing": -362}, {"easting": -36, "northing": -540}, {"easting": 27, "northing": -365}, {"easting": 100, "northing": -391}, {"easting": 97, "northing": -365}]}, {"id": 4, "positions": [{"easting": 16, "northing": 221}, {"easting": -125, "northing": 164}, {"easting": 13, "northing": 224}, {"easting": 23, "northing": 214}, {"easting": -91, "northing": 350}, {"easting": 15, "northing": 233}, {"easting": -83, "northing": 365}, {"easting": -63, "northing": 358}, {"easting": 32, "northing": 216}, {"easting": -1, "northing": 236}, {"easting": -26, "northing": 244}, {"easting": -31, "northing": 241}, {"easting": -77, "northing": 184}, {"easting": -79, "northing": 323}, {"easting": -128, "northing": 167}, {"easting": -130, "northing": 158}, {"easting": -97, "northing": 360}, {"easting": 42, "northing": 210}, {"easting": -111, "northing": 329}, {"easting": -32, "northing": 233}, {"easting": -102, "northing": 342}, {"easting": -25, "northing": 231}, {"easting": -81, "northing": 202}, {"easting": -113, "northing": 340}, {"easting": 31, "northing": 202}, {"easting": -67, "northing": 219}, {"easting": -50, "northing": 213}, {"easting": -45, "northing": 210}]}, {"id": 5, "positions": [{"easting": -69, "northing": 5}, {"easting": -53, "northing": 22}, {"easting": -25, "northing": -1}, {"easting": -48, "northing": 48}, {"easting": -103, "northing": 83}, {"easting": -43, "northing": 69}, {"easting": -30, "northing": 43}, {"easting": -137, "northing": 19}, {"easting": -89, "northing": 89}, {"easting": -128, "northing": 41}, {"easting": -81, "northing": 79}, {"easting": -130, "northing": 9}, {"easting": -6, "northing": -7}, {"easting": -121, "northing": 63}, {"easting": -59, "northing": 73}, {"easting": -90, "northing": 35}, {"easting": -20, "northing": 20}, {"eastingLine truncated
|
||||
|
||||
UPDATE pdm_charge_type SET properties = '{"impactRadius": 25, "hazardDistance": 250, "impactEdgeLength": 25, "fuseTypes": [{"fuseType": 1, "chargeLegacyId": 395}], "mineLaying": {"pattern": [ { "id": 1, "positions": [ {"easting": 111, "northing": -30}, {"easting": 111, "northing": -36}, {"easting": 120, "northing": -48}, {"easting": 101, "northing": -45}, {"easting": 61, "northing": -44}, {"easting": 87, "northing": -35}, {"easting": -78, "northing": -36}, {"easting": -78, "northing": -35}, {"easting": -82, "northing": -39}, {"easting": -113, "northing": -27}, {"easting": -105, "northing": -15}, {"easting": -104, "northing": -1}, {"easting": -93, "northing": -54}, {"easting": -91, "northing": -60}, {"easting": -89, "northing": -59}, {"easting": -81, "northing": -64}, {"easting": -78, "northing": -69}, {"easting": -95, "northing": -86}, {"easting": 11, "northing": -70}, {"easting": -4, "northing": -90}, {"easting": 2, "northing": -16}, {"easting": -3, "northing": 16}, {"easting": -11, "northing": 11}, {"easting": -12, "northing": 5}, {"easting": 7, "northing": -40}, {"easting": 8, "northing": -13}, {"easting": -21, "northing": 6}, {"easting": 44, "northing": -34} ] }, { "id": 2, "positions": [ {"easting": -239, "northing": -31}, {"easting": -132, "northing": 17}, {"easting": -108, "northing": -57}, {"easting": -261, "northing": 67}, {"easting": -123, "northing": 14}, {"easting": -143, "northing": 5}, {"easting": -233, "northing": 125}, {"easting": -109, "northing": -37}, {"easting": -261, "northing": 37}, {"easting": -247, "northing": 73}, {"easting": -253, "northing": 60}, {"easting": -168, "northing": 124}, {"easting": -267, "northing": 57}, {"easting": -115, "northing": 3}, {"easting": -258, "northing": 49}, {"easting": -117, "northing": -53}, {"easting": -230, "northing": -45}, {"easting": -153, "northing": 131}, {"easting": -234, "northing": 146}, {"easting": -234, "northing": 138}, {"easting": -246, "northing": 132}, {"easting": -100, "northing": -38}, {"easting": -239, "northing": -18}, {"easting": -251, "northing": 53}, {"easting": -137, "northing": 160}, {"easting": -274, "northing": 75}, {"easting": -225, "northing": -23}, {"easting": -234, "northing": 58} ] }, { "id": 3, "positions": [ {"easting": -521, "northing": -54}, {"easting": -409, "northing": -50}, {"easting": -473, "northing": 44}, {"easting": -392, "northing": 76}, {"easting": -447, "northing": 1}, {"easting": -503, "northing": -27}, {"easting": -399, "northing": -31}, {"easting": -377, "northing": 61}, {"easting": -466, "northing": 10}, {"easting": -342, "northing": -15}, {"easting": -497, "northing": -17}, {"easting": -487, "northing": -18}, {"easting": -445, "northing": -38}, {"easting": -398, "northing": 72}, {"easting": -392, "northing": -38}, {"easting": -464, "northing": 19}, {"easting": -502, "northing": -45}, {"easting": -522, "northing": -31}, {"easting": -444, "northing": 23}, {"easting": -467, "northing": -33}, {"easting": -355, "northing": 40}, {"easting": -353, "northing": 30}, {"easting": -358, "northing": 49}, {"easting": -360, "northing": 94}, {"easting": -538, "northing": -30}, {"easting": -364, "northing": 31}, {"easting": -391, "northing": -95}, {"easting": -366, "northing": -90} ] }, { "id": 4, "positions": [ {"easting": 221, "northing": -20}, {"easting": 163, "northing": -127}, {"easting": 224, "northing": -17}, {"easting": 214, "northing": -26}, {"easting": 349, "northing": -97}, {"easting": 232, "northing": -18}, {"easting": 364, "northing": -89}, {"easting": 358, "northing": -70}, {"easting": 215, "northing": -37}, {"easting": 236, "northing": -3}, {"easting": 243, "northing": 21}, {"easting": 241, "northing": -35}, {"easting": 183, "northing": -80}, {"easting": 322, "northing": -84}, {"easting": 166, "northing": -130}, {"easting": 157, "northing": -133}, {"easting": 358, "northing": -104}, {"easting": 209, "northing": -45}, {"easting": 329, "northing": -118}, {"easting": 227, "northing": -37}, {"easting": 342, "northing": -108}, {"easting": 230, "northing": -29}, {"easting": 201, "northing": -83}, {"easting": 339, "northing": -116}, {"easting": 201, "northing": -35}, {"easting": 208, "northing": -70}, {"easting": 212, "northing": -55}, {"easting": 205, "northing": -48} ] }, { "id": 5, "positions": [ {"easting": -69, "northing": 6}, {"easting": -53, "northing": 22}, {"easting": -25, "northing": -1}, {"easting": 43, "northing": 48}, {"easting": -82, "northing": 103}, {"easting": 70, "northing": 42}, {"easting": 43, "northing": 29}, {"easting": -136, "northing": 20}, {"easting": -61, "northing": 90}, {"easting": -128, "northing": 41}, {"easting": 71, "northing": 79}, {"easting": -130, "northing": 10}, {"easting": -6, "northing": -7}, {"easting": -63, "northing": 121}, {"easting": 73, "northing": 58}, {"easting": 35, "northing": 90}, {"easting": -14, "northing": 20}, {"easting": -111, "northing": 38}, {"easting": 58, "northing": 82}, {"easting": -135, "northing": 8}, {"easting": -110, "northing": 12}, {"easting": -Line truncated
|
||||
UPDATE pdm_charge_type SET properties = '{"impactRadius": 25, "hazardDistance": 250, "impactEdgeLength": 25, "adlerChargeTypeName": "Mine DM72", "fuseTypes": [{"fuseType": 1, "chargeLegacyId": 395}], "mineLaying": {"pattern": [ { "id": 1, "positions": [ {"easting": 111, "northing": -30}, {"easting": 111, "northing": -36}, {"easting": 120, "northing": -48}, {"easting": 101, "northing": -45}, {"easting": 61, "northing": -44}, {"easting": 87, "northing": -35}, {"easting": -78, "northing": -36}, {"easting": -78, "northing": -35}, {"easting": -82, "northing": -39}, {"easting": -113, "northing": -27}, {"easting": -105, "northing": -15}, {"easting": -104, "northing": -1}, {"easting": -93, "northing": -54}, {"easting": -91, "northing": -60}, {"easting": -89, "northing": -59}, {"easting": -81, "northing": -64}, {"easting": -78, "northing": -69}, {"easting": -95, "northing": -86}, {"easting": 11, "northing": -70}, {"easting": -4, "northing": -90}, {"easting": 2, "northing": -16}, {"easting": -3, "northing": 16}, {"easting": -11, "northing": 11}, {"easting": -12, "northing": 5}, {"easting": 7, "northing": -40}, {"easting": 8, "northing": -13}, {"easting": -21, "northing": 6}, {"easting": 44, "northing": -34} ] }, { "id": 2, "positions": [ {"easting": -239, "northing": -31}, {"easting": -132, "northing": 17}, {"easting": -108, "northing": -57}, {"easting": -261, "northing": 67}, {"easting": -123, "northing": 14}, {"easting": -143, "northing": 5}, {"easting": -233, "northing": 125}, {"easting": -109, "northing": -37}, {"easting": -261, "northing": 37}, {"easting": -247, "northing": 73}, {"easting": -253, "northing": 60}, {"easting": -168, "northing": 124}, {"easting": -267, "northing": 57}, {"easting": -115, "northing": 3}, {"easting": -258, "northing": 49}, {"easting": -117, "northing": -53}, {"easting": -230, "northing": -45}, {"easting": -153, "northing": 131}, {"easting": -234, "northing": 146}, {"easting": -234, "northing": 138}, {"easting": -246, "northing": 132}, {"easting": -100, "northing": -38}, {"easting": -239, "northing": -18}, {"easting": -251, "northing": 53}, {"easting": -137, "northing": 160}, {"easting": -274, "northing": 75}, {"easting": -225, "northing": -23}, {"easting": -234, "northing": 58} ] }, { "id": 3, "positions": [ {"easting": -521, "northing": -54}, {"easting": -409, "northing": -50}, {"easting": -473, "northing": 44}, {"easting": -392, "northing": 76}, {"easting": -447, "northing": 1}, {"easting": -503, "northing": -27}, {"easting": -399, "northing": -31}, {"easting": -377, "northing": 61}, {"easting": -466, "northing": 10}, {"easting": -342, "northing": -15}, {"easting": -497, "northing": -17}, {"easting": -487, "northing": -18}, {"easting": -445, "northing": -38}, {"easting": -398, "northing": 72}, {"easting": -392, "northing": -38}, {"easting": -464, "northing": 19}, {"easting": -502, "northing": -45}, {"easting": -522, "northing": -31}, {"easting": -444, "northing": 23}, {"easting": -467, "northing": -33}, {"easting": -355, "northing": 40}, {"easting": -353, "northing": 30}, {"easting": -358, "northing": 49}, {"easting": -360, "northing": 94}, {"easting": -538, "northing": -30}, {"easting": -364, "northing": 31}, {"easting": -391, "northing": -95}, {"easting": -366, "northing": -90} ] }, { "id": 4, "positions": [ {"easting": 221, "northing": -20}, {"easting": 163, "northing": -127}, {"easting": 224, "northing": -17}, {"easting": 214, "northing": -26}, {"easting": 349, "northing": -97}, {"easting": 232, "northing": -18}, {"easting": 364, "northing": -89}, {"easting": 358, "northing": -70}, {"easting": 215, "northing": -37}, {"easting": 236, "northing": -3}, {"easting": 243, "northing": 21}, {"easting": 241, "northing": -35}, {"easting": 183, "northing": -80}, {"easting": 322, "northing": -84}, {"easting": 166, "northing": -130}, {"easting": 157, "northing": -133}, {"easting": 358, "northing": -104}, {"easting": 209, "northing": -45}, {"easting": 329, "northing": -118}, {"easting": 227, "northing": -37}, {"easting": 342, "northing": -108}, {"easting": 230, "northing": -29}, {"easting": 201, "northing": -83}, {"easting": 339, "northing": -116}, {"easting": 201, "northing": -35}, {"easting": 208, "northing": -70}, {"easting": 212, "northing": -55}, {"easting": 205, "northing": -48} ] }, { "id": 5, "positions": [ {"easting": -69, "northing": 6}, {"easting": -53, "northing": 22}, {"easting": -25, "northing": -1}, {"easting": 43, "northing": 48}, {"easting": -82, "northing": 103}, {"easting": 70, "northing": 42}, {"easting": 43, "northing": 29}, {"easting": -136, "northing": 20}, {"easting": -61, "northing": 90}, {"easting": -128, "northing": 41}, {"easting": 71, "northing": 79}, {"easting": -130, "northing": 10}, {"easting": -6, "northing": -7}, {"easting": -63, "northing": 121}, {"easting": 73, "northing": 58}, {"easting": 35, "northing": 90}, {"easting": -14, "northing": 20}, {"easting": -111, "northing": 38}, {"easting": 58, "northing": 82}, {"easting": -135, "northing": 8}, {"easting": Line truncated
|
||||
COMMIT;
|
||||
|
||||
-- EXERCISE: NONE;
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
-- $Id: 2.89_guez_pdm_charge_type.upd 62864 2024-05-24 08:23:59Z rathje $
|
||||
-- $HeadURL$
|
||||
-- $Author: rathje $
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
-- INFO: Add table pdm_load_type / pdm_charge_type_load_type
|
||||
-- PROJECT: Guez
|
||||
-- DATE: 2026-06-26
|
||||
-- VERSION: 2.183
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
-- GLOBAL: PDM;
|
||||
BEGIN;
|
||||
|
||||
-- delete
|
||||
DELETE FROM pdm_charge_type_igniter_type_igniter_function WHERE charge_type_id IN (368,369,373,394,395);
|
||||
|
||||
-- updates
|
||||
UPDATE pdm_charge_type SET predefined_name = NULL, name = 'GMLRS Unitary M31', short_name = 'GMLRS', properties = '{"impactRadius":25, "impactEdgeLength":25, "hazardDistance": 250, "fuseTypes" : [ { "fuseType" : 1, "chargeLegacyId" : 394}]}', dis_entity = '2.255.201.3.0.0.0', charge_legacy_id = NULL WHERE ID = 394;
|
||||
UPDATE pdm_charge_type SET predefined_name = NULL, name = 'Mine DM72', short_name = 'DM72', properties = '{"impactRadius":25, "impactEdgeLength":25, "hazardDistance": 250, "fuseTypes": [{"fuseType": 1, "chargeLegacyId": 395}], "mineLaying":{"appearanceTimeOffset" : 19.2, "appearanceJitter": 3.4, "armingTimeOffset": 29.6, "armingJitter" : 2.3, "mineChargeTypeId": 216, "pattern": [ {"id": 1, "positions": [{"easting": -28, "northing": -30}, {"easting": -34, "northing": -36}, {"easting": -46, "northing": -48}, {"easting": -43, "northing": -44}, {"easting": -61, "northing": -43}, {"easting": -34, "northing": -35}, {"easting": 78, "northing": -77}, {"easting": 78, "northing": -77}, {"easting": 82, "northing": -81}, {"easting": 113, "northing": -112}, {"easting": 105, "northing": -105}, {"easting": 104, "northing": -102}, {"easting": 55, "northing": -53}, {"easting": 61, "northing": -60}, {"easting": 61, "northing": -59}, {"easting": 65, "northing": -64}, {"easting": 71, "northing": -76}, {"easting": 88, "northing": -93}, {"easting": -12, "northing": -13}, {"easting": -4, "northing": -3}, {"easting": 2, "northing": -16}, {"easting": -16, "northing": -3}, {"easting": -11, "northing": -11}, {"easting": -12, "northing": 5}, {"easting": 7, "northing": -40}, {"easting": 8, "northing": -13}, {"easting": 5, "northing": -21}, {"easting": -33, "northing": 44}]}, {"id": 2, "positions": [{"easting": 34, "northing": -238}, {"easting": 16, "northing": -132}, {"easting": -108, "northing": -57}, {"easting": 64, "northing": -262}, {"easting": -12, "northing": -122}, {"easting": 2, "northing": -143}, {"easting": 125, "northing": -235}, {"easting": 39, "northing": -108}, {"easting": 32, "northing": -261}, {"easting": 69, "northing": -248}, {"easting": 56, "northing": -253}, {"easting": 121, "northing": -170}, {"easting": 53, "northing": -268}, {"easting": 116, "northing": -115}, {"easting": 46, "northing": -258}, {"easting": -117, "northing": -53}, {"easting": 49, "northing": -229}, {"easting": 131, "northing": -155}, {"easting": 143, "northing": -236}, {"easting": 137, "northing": -236}, {"easting": 131, "northing": -248}, {"easting": 39, "northing": -100}, {"easting": 22, "northing": -238}, {"easting": 51, "northing": -251}, {"easting": 139, "northing": -139}, {"easting": 73, "northing": -274}, {"easting": 28, "northing": -224}, {"easting": 53, "northing": -234}]}, {"id": 3, "positions": [{"easting": -61, "northing": -520}, {"easting": -58, "northing": -409}, {"easting": -74, "northing": -474}, {"easting": -69, "northing": -393}, {"easting": -5, "northing": -448}, {"easting": -37, "northing": -504}, {"easting": -37, "northing": -397}, {"easting": -55, "northing": -378}, {"easting": -5, "northing": -467}, {"easting": 19, "northing": -342}, {"easting": -26, "northing": -496}, {"easting": -26, "northing": -487}, {"easting": -43, "northing": -445}, {"easting": -69, "northing": -400}, {"easting": -43, "northing": -389}, {"easting": -13, "northing": -463}, {"easting": -52, "northing": -500}, {"easting": -40, "northing": -520}, {"easting": -19, "northing": -444}, {"easting": -38, "northing": -464}, {"easting": 38, "northing": -356}, {"easting": 27, "northing": -354}, {"easting": 47, "northing": -359}, {"easting": -91, "northing": -362}, {"easting": -36, "northing": -540}, {"easting": 27, "northing": -365}, {"easting": 100, "northing": -391}, {"easting": 97, "northing": -365}]}, {"id": 4, "positions": [{"easting": 16, "northing": 221}, {"easting": -125, "northing": 164}, {"easting": 13, "northing": 224}, {"easting": 23, "northing": 214}, {"easting": -91, "northing": 350}, {"easting": 15, "northing": 233}, {"easting": -83, "northing": 365}, {"easting": -63, "northing": 358}, {"easting": 32, "northing": 216}, {"easting": -1, "northing": 236}, {"easting": -26, "northing": 244}, {"easting": -31, "northing": 241}, {"easting": -77, "northing": 184}, {"easting": -79, "northing": 323}, {"easting": -128, "northing": 167}, {"easting": -130, "northing": 158}, {"easting": -97, "northing": 360}, {"easting": 42, "northing": 210}, {"easting": -111, "northing": 329}, {"easting": -32, "northing": 233}, {"easting": -102, "northing": 342}, {"easting": -25, "northing": 231}, {"easting": -81, "northing": 202}, {"easting": -113, "northing": 340}, {"easting": 31, "northing": 202}, {"easting": -67, "northing": 219}, {"easting": -50, "northing": 213}, {"easting": -45, "northing": 210}]}, {"id": 5, "positions": [{"easting": -69, "northing": 5}, {"easting": -53, "northing": 22}, {"easting": -25, "northing": -1}, {"easting": -48, "northing": 48}, {"easting": -103, "northing": 83}, {"easting": -43, "northing": 69}, {"easting": -30, "northing": 43}, {"easting": -137, "northing": 19}, {"easting": -89, "northing": 89}, {"easting": -128, "northing": 41}, {"easting": -81, "northing": 79}, {"easting": -130, "northing": 9}, {"easting": -6, "northing": -7}, {"easting": -121, "northing": 63}, {"easting": -59, "northing": 73}, {"easting": -90, "northing": 35}, {"easting": -2Line truncated
|
||||
|
||||
|
||||
|
||||
INSERT INTO pdm_charge_type (id, predefined_name, name, short_name, properties, dis_entity, charge_legacy_id) VALUES (368, NULL, 'GMLRS Unitary M31', 'GMLRS', '{"adlerChargeTypeName": "Unitary M31", "isAdlerChargeType": true, "impactRadius":25, "impactEdgeLength":25, "hazardDistance": 250, "fuseTypes" : [ { "fuseType" : 1, "chargeLegacyId" : 394}]}', '2.255.201.3.0.0.0', 394);
|
||||
INSERT INTO pdm_charge_type (id, predefined_name, name, short_name, properties, dis_entity, charge_legacy_id) VALUES (369, NULL, 'Mine DM72', 'DM72', '{"adlerChargeTypeName": "Mine DM72","isAdlerChargeType": true, "impactRadius":25, "impactEdgeLength":25, "hazardDistance": 250, "fuseTypes": [{"fuseType": 1, "chargeLegacyId": 395}], "mineLaying":{"appearanceTimeOffset" : 19.2, "appearanceJitter": 3.4, "armingTimeOffset": 29.6, "armingJitter" : 2.3, "mineChargeTypeId": 216, "pattern": [{"id": 1, "positions": [{"easting": -28, "northing": -30}, {"easting": -34, "northing": -36}, {"easting": -46, "northing": -48}, {"easting": -43, "northing": -44}, {"easting": -61, "northing": -43}, {"easting": -34, "northing": -35}, {"easting": 78, "northing": -77}, {"easting": 78, "northing": -77}, {"easting": 82, "northing": -81}, {"easting": 113, "northing": -112}, {"easting": 105, "northing": -105}, {"easting": 104, "northing": -102}, {"easting": 55, "northing": -53}, {"easting": 61, "northing": -60}, {"easting": 61, "northing": -59}, {"easting": 65, "northing": -64}, {"easting": 71, "northing": -76}, {"easting": 88, "northing": -93}, {"easting": -12, "northing": -13}, {"easting": -4, "northing": -3}, {"easting": 2, "northing": -16}, {"easting": -16, "northing": -3}, {"easting": -11, "northing": -11}, {"easting": -12, "northing": 5}, {"easting": 7, "northing": -40}, {"easting": 8, "northing": -13}, {"easting": 5, "northing": -21}, {"easting": -33, "northing": 44}]}, {"id": 2, "positions": [{"easting": 34, "northing": -238}, {"easting": 16, "northing": -132}, {"easting": -108, "northing": -57}, {"easting": 64, "northing": -262}, {"easting": -12, "northing": -122}, {"easting": 2, "northing": -143}, {"easting": 125, "northing": -235}, {"easting": 39, "northing": -108}, {"easting": 32, "northing": -261}, {"easting": 69, "northing": -248}, {"easting": 56, "northing": -253}, {"easting": 121, "northing": -170}, {"easting": 53, "northing": -268}, {"easting": 116, "northing": -115}, {"easting": 46, "northing": -258}, {"easting": -117, "northing": -53}, {"easting": 49, "northing": -229}, {"easting": 131, "northing": -155}, {"easting": 143, "northing": -236}, {"easting": 137, "northing": -236}, {"easting": 131, "northing": -248}, {"easting": 39, "northing": -100}, {"easting": 22, "northing": -238}, {"easting": 51, "northing": -251}, {"easting": 139, "northing": -139}, {"easting": 73, "northing": -274}, {"easting": 28, "northing": -224}, {"easting": 53, "northing": -234}]}, {"id": 3, "positions": [{"easting": -61, "northing": -520}, {"easting": -58, "northing": -409}, {"easting": -74, "northing": -474}, {"easting": -69, "northing": -393}, {"easting": -5, "northing": -448}, {"easting": -37, "northing": -504}, {"easting": -37, "northing": -397}, {"easting": -55, "northing": -378}, {"easting": -5, "northing": -467}, {"easting": 19, "northing": -342}, {"easting": -26, "northing": -496}, {"easting": -26, "northing": -487}, {"easting": -43, "northing": -445}, {"easting": -69, "northing": -400}, {"easting": -43, "northing": -389}, {"easting": -13, "northing": -463}, {"easting": -52, "northing": -500}, {"easting": -40, "northing": -520}, {"easting": -19, "northing": -444}, {"easting": -38, "northing": -464}, {"easting": 38, "northing": -356}, {"easting": 27, "northing": -354}, {"easting": 47, "northing": -359}, {"easting": -91, "northing": -362}, {"easting": -36, "northing": -540}, {"easting": 27, "northing": -365}, {"easting": 100, "northing": -391}, {"easting": 97, "northing": -365}]}, {"id": 4, "positions": [{"easting": 16, "northing": 221}, {"easting": -125, "northing": 164}, {"easting": 13, "northing": 224}, {"easting": 23, "northing": 214}, {"easting": -91, "northing": 350}, {"easting": 15, "northing": 233}, {"easting": -83, "northing": 365}, {"easting": -63, "northing": 358}, {"easting": 32, "northing": 216}, {"easting": -1, "northing": 236}, {"easting": -26, "northing": 244}, {"easting": -31, "northing": 241}, {"easting": -77, "northing": 184}, {"easting": -79, "northing": 323}, {"easting": -128, "northing": 167}, {"easting": -130, "northing": 158}, {"easting": -97, "northing": 360}, {"easting": 42, "northing": 210}, {"easting": -111, "northing": 329}, {"easting": -32, "northing": 233}, {"easting": -102, "northing": 342}, {"easting": -25, "northing": 231}, {"easting": -81, "northing": 202}, {"easting": -113, "northing": 340}, {"easting": 31, "northing": 202}, {"easting": -67, "northing": 219}, {"easting": -50, "northing": 213}, {"easting": -45, "northing": 210}]}, {"id": 5, "positions": [{"easting": -69, "northing": 5}, {"easting": -53, "northing": 22}, {"easting": -25, "northing": -1}, {"easting": -48, "northing": 48}, {"easting": -103, "northing": 83}, {"easting": -43, "northing": 69}, {"easting": -30, "northing": 43}, {"easting": -137, "northing": 19}, {"easting": -89, "northing": 89}, {"easting": -128, "northing": 41}, {"easting": -81, "northing": 79}, {"easting": -130, "northing": 9}, {"easting": -6, "northing": -7}, {"easting":Line truncated
|
||||
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (901, 368, 25190);
|
||||
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (901, 369, 25190);
|
||||
|
||||
|
||||
-- inserts pdm_charge_type_igniter_type_igniter_function
|
||||
INSERT INTO pdm_charge_type_igniter_type_igniter_function (charge_type_id, igniter_type_id, igniter_function_id, impact_area, impact_radius, hazard_distance, charge_legacy_id, igniter_function_base_id, properties) VALUES (368, 0, 2, NULL, 25, 250, 394, 2, NULL);
|
||||
INSERT INTO pdm_charge_type_igniter_type_igniter_function (charge_type_id, igniter_type_id, igniter_function_id, impact_area, impact_radius, hazard_distance, charge_legacy_id, igniter_function_base_id, properties) VALUES (368, 0, 5, NULL, 25, 250, 394, 0, NULL);
|
||||
INSERT INTO pdm_charge_type_igniter_type_igniter_function (charge_type_id, igniter_type_id, igniter_function_id, impact_area, impact_radius, hazard_distance, charge_legacy_id, igniter_function_base_id, properties) VALUES (368, 0, 6, NULL, 25, 250, 394, 0, NULL);
|
||||
INSERT INTO pdm_charge_type_igniter_type_igniter_function (charge_type_id, igniter_type_id, igniter_function_id, impact_area, impact_radius, hazard_distance, charge_legacy_id, igniter_function_base_id, properties) VALUES (368, 0, 7, NULL, 25, 250, 394, 0, NULL);
|
||||
INSERT INTO pdm_charge_type_igniter_type_igniter_function (charge_type_id, igniter_type_id, igniter_function_id, impact_area, impact_radius, hazard_distance, charge_legacy_id, igniter_function_base_id, properties) VALUES (368, 0, 8, NULL, 25, 250, 394, 0, NULL);
|
||||
INSERT INTO pdm_charge_type_igniter_type_igniter_function (charge_type_id, igniter_type_id, igniter_function_id, impact_area, impact_radius, hazard_distance, charge_legacy_id, igniter_function_base_id, properties) VALUES (369, 0, 0, NULL, 25, 250, 395, 0, NULL);
|
||||
INSERT INTO pdm_charge_type_igniter_type_igniter_function (charge_type_id, igniter_type_id, igniter_function_id, impact_area, impact_radius, hazard_distance, charge_legacy_id, igniter_function_base_id, properties) VALUES (394, 102, 0, NULL, 25, 250, 394, 0, NULL);
|
||||
INSERT INTO pdm_charge_type_igniter_type_igniter_function (charge_type_id, igniter_type_id, igniter_function_id, impact_area, impact_radius, hazard_distance, charge_legacy_id, igniter_function_base_id, properties) VALUES (395, 102, 0, NULL, 25, 250, 395, 0, NULL);
|
||||
INSERT INTO pdm_charge_type_igniter_type_igniter_function (charge_type_id, igniter_type_id, igniter_function_id, impact_area, impact_radius, hazard_distance, charge_legacy_id, igniter_function_base_id, properties) VALUES (373, 101, 0, NULL, 25, 0, 3, 4, NULL);
|
||||
INSERT INTO pdm_charge_type_igniter_type_igniter_function (charge_type_id, igniter_type_id, igniter_function_id, impact_area, impact_radius, hazard_distance, charge_legacy_id, igniter_function_base_id, properties) VALUES (373, 102, 0, NULL, 25, 0, 3, 2, NULL);
|
||||
INSERT INTO pdm_charge_type_igniter_type_igniter_function (charge_type_id, igniter_type_id, igniter_function_id, impact_area, impact_radius, hazard_distance, charge_legacy_id, igniter_function_base_id, properties) VALUES (373, 103, 0, NULL, 25, 0, 3, 3, NULL);
|
||||
INSERT INTO pdm_charge_type_igniter_type_igniter_function (charge_type_id, igniter_type_id, igniter_function_id, impact_area, impact_radius, hazard_distance, charge_legacy_id, igniter_function_base_id, properties) VALUES (373, 104, 0, NULL, 25, 0, 3, 1, NULL);
|
||||
|
||||
COMMIT;
|
||||
|
||||
-- EXERCISE: NONE;
|
||||
BEGIN;
|
||||
COMMIT;
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
-- $Id: 2.184_guez_charge.upd$
|
||||
-- $HeadURL$
|
||||
-- $Author: rudolphus $
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
-- INFO: update pdm_charge_type_igniter_type_igniter_function and pdm_charge_type
|
||||
-- PROJECT: Guez
|
||||
-- DATE: 2026-07-15
|
||||
-- VERSION: 2.184
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
-- GLOBAL: PDM;
|
||||
BEGIN;
|
||||
|
||||
UPDATE pdm_charge_type_igniter_type_igniter_function set impact_radius = 10 where charge_type_id = 2050;
|
||||
UPDATE pdm_charge_type_igniter_type_igniter_function set charge_legacy_id = 1 where charge_legacy_id = 394;
|
||||
UPDATE pdm_charge_type_igniter_type_igniter_function set charge_legacy_id = 1 where charge_legacy_id = 395;
|
||||
|
||||
UPDATE pdm_charge_type set charge_legacy_id = 1 where id = 368;
|
||||
UPDATE pdm_charge_type set charge_legacy_id = 1 where id = 369;
|
||||
|
||||
|
||||
COMMIT;
|
||||
|
||||
-- EXERCISE: NONE;
|
||||
BEGIN;
|
||||
COMMIT;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(QtPluginSystemDemo CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
find_package(Qt5 REQUIRED COMPONENTS Core Widgets)
|
||||
|
||||
# Ausgabepfad für Plugins definieren
|
||||
set(PLUGIN_OUTPUT_DIR "${CMAKE_BINARY_DIR}/plugins")
|
||||
|
||||
add_subdirectory(plugins)
|
||||
add_subdirectory(app)
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
add_executable(DlboTestPluginApp main.cpp)
|
||||
target_link_libraries(DlboTestPluginApp PRIVATE Qt5::Widgets)
|
||||
|
||||
# Kopiert die Interfaces virtuell via Include-Pfad (keine statische Link-Abhängigkeit zu .cpp Dateien)
|
||||
target_include_directories(DlboTestPluginApp PRIVATE ${CMAKE_SOURCE_DIR}/interfaces)
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QMainWindow>
|
||||
#include <QMap>
|
||||
#include <QPluginLoader>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "../interfaces/child_interface.h"
|
||||
#include "../interfaces/parent_interface.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
QMainWindow mainWindow;
|
||||
QWidget *centralWidget = new QWidget(&mainWindow);
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(centralWidget);
|
||||
mainWindow.setCentralWidget(centralWidget);
|
||||
|
||||
// Ordnerstruktur auflösen (.../build-.../plugins/)
|
||||
QDir baseDir(QCoreApplication::applicationDirPath());
|
||||
baseDir.cdUp();
|
||||
QDir pluginsDir = baseDir;
|
||||
if (!pluginsDir.cd(QStringLiteral("plugins")))
|
||||
{
|
||||
qCritical() << "Plugins-Ordner nicht gefunden!";
|
||||
return -1;
|
||||
}
|
||||
|
||||
QMap<QString, ParentInterface *> parentPlugins;
|
||||
QList<ChildInterface *> childPlugins;
|
||||
|
||||
// Nur .so-Dateien auflisten (verhindert das Einlesen von cmake_install.cmake)
|
||||
QStringList filters;
|
||||
filters << QStringLiteral("*.so");
|
||||
#ifdef Q_OS_WIN
|
||||
filters << QStringLiteral("*.dll");
|
||||
#else
|
||||
filters << QStringLiteral("*.so");
|
||||
#endif
|
||||
|
||||
// 1. Durchlauf: Plugins laden und katalogisieren
|
||||
for (const QString &fileName : pluginsDir.entryList(filters, QDir::Files))
|
||||
{
|
||||
QPluginLoader loader(pluginsDir.absoluteFilePath(fileName));
|
||||
QObject *pluginInstance = loader.instance();
|
||||
|
||||
if (!pluginInstance)
|
||||
{
|
||||
qDebug() << "Überspringe Datei:" << fileName << loader.errorString();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ist es ein Parent?
|
||||
auto *parent = qobject_cast<ParentInterface *>(pluginInstance);
|
||||
if (parent)
|
||||
{
|
||||
parentPlugins[parent->pluginName()] = parent;
|
||||
mainLayout->addWidget(parent->widget());
|
||||
qDebug() << "Eltern-Plugin registriert:" << parent->pluginName();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ist es ein Child?
|
||||
auto *child = qobject_cast<ChildInterface *>(pluginInstance);
|
||||
if (child)
|
||||
{
|
||||
childPlugins.append(child);
|
||||
qDebug() << "Kind-Plugin zwischengespeichert:" << child->childName();
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Durchlauf: Zuordnen, Daten übergeben und Signale verbinden
|
||||
for (ChildInterface *child : childPlugins)
|
||||
{
|
||||
QString target = child->targetParentName();
|
||||
|
||||
if (parentPlugins.contains(target))
|
||||
{
|
||||
ParentInterface *parent = parentPlugins[target];
|
||||
|
||||
// A. Widget zuweisen
|
||||
parent->addChildWidget(child->widget());
|
||||
qDebug() << "Kind" << child->childName() << "wurde" << target << "zugeordnet.";
|
||||
|
||||
// B. Initiale Parameterübergabe
|
||||
child->setParentData(QStringLiteral("Konfig-Paket via %1").arg(parent->pluginName()));
|
||||
|
||||
// C. Dynamische Signal-Slot Live-Verbindung (Absturzsicher via Pointer-Check)
|
||||
QObject *parentObj = parent->qobjectInstance();
|
||||
QObject *childObj = dynamic_cast<QObject *>(child);
|
||||
|
||||
if (parentObj && childObj)
|
||||
{
|
||||
bool connected = QObject::connect(parentObj, SIGNAL(dataChangedLive(QString)), childObj, SLOT(updateLiveData(QString)));
|
||||
if (connected)
|
||||
qDebug() << "Live-Signal verbunden für:" << child->childName();
|
||||
else
|
||||
qWarning() << "Verbindung fehlgeschlagen für:" << child->childName();
|
||||
}
|
||||
else
|
||||
qWarning() << "Fehler beim Casten des Plugins" << child->childName() << "zu QObject!";
|
||||
}
|
||||
else
|
||||
qDebug() << "Warnung: Kein Parent gefunden für" << child->childName();
|
||||
}
|
||||
|
||||
mainWindow.resize(500, 450);
|
||||
mainWindow.show();
|
||||
return app.exec();
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include <QtPlugin>
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
|
||||
class ChildInterface
|
||||
{
|
||||
public:
|
||||
virtual ~ChildInterface() = default;
|
||||
virtual QString childName() const = 0;
|
||||
virtual QString targetParentName() const = 0;
|
||||
virtual QWidget* widget() = 0;
|
||||
|
||||
// Für die einmalige Übergabe direkt nach dem Laden
|
||||
virtual void setParentData(const QString& data) = 0;
|
||||
|
||||
// Für die dynamischen Live-Updates zur Laufzeit
|
||||
virtual void updateLiveData(const QString& text) = 0;
|
||||
};
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
Q_DECLARE_INTERFACE(ChildInterface, "gui:3:ChildInterface")
|
||||
QT_END_NAMESPACE
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
#include <QtPlugin>
|
||||
|
||||
class ParentInterface
|
||||
{
|
||||
public:
|
||||
virtual ~ParentInterface() = default;
|
||||
virtual QString pluginName() const = 0;
|
||||
virtual QWidget *widget() = 0;
|
||||
virtual void addChildWidget(QWidget *childWidget) = 0;
|
||||
|
||||
// Ermöglicht der App den Zugriff auf das QObject für connect()
|
||||
virtual QObject *qobjectInstance() = 0;
|
||||
};
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
Q_DECLARE_INTERFACE(ParentInterface, "gui:3:ParentInterface")
|
||||
QT_END_NAMESPACE
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
add_subdirectory(parent_alpha)
|
||||
add_subdirectory(child_beta)
|
||||
add_subdirectory(child_gamma)
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
add_library(childBetaGui MODULE child_beta.cpp child_beta.h)
|
||||
target_link_libraries(childBetaGui PRIVATE Qt5::Widgets)
|
||||
target_include_directories(childBetaGui PRIVATE ${CMAKE_SOURCE_DIR}/interfaces)
|
||||
|
||||
# Plugin in den Laufzeit-Ordner verschieben
|
||||
set_target_properties(childBetaGui PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY "${PLUGIN_OUTPUT_DIR}"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${PLUGIN_OUTPUT_DIR}"
|
||||
)
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
#include "child_beta.h"
|
||||
#include <QVBoxLayout>
|
||||
|
||||
namespace DLBO
|
||||
{
|
||||
ChildBeta::ChildBeta()
|
||||
{
|
||||
m_widget = new QWidget();
|
||||
QVBoxLayout *layout = new QVBoxLayout(m_widget);
|
||||
m_widget->setStyleSheet(QStringLiteral("border: 1px solid green; background-color: #f0fff0; margin: 5px;"));
|
||||
|
||||
QLabel *title = new QLabel(QStringLiteral("Kind-Widget 1"));
|
||||
title->setStyleSheet(QStringLiteral("font-weight: bold; color: green;"));
|
||||
|
||||
m_staticLabel = new QLabel(QStringLiteral("Warte auf Init-Daten..."));
|
||||
m_liveLabel = new QLabel(QStringLiteral("Warte auf Live-Text..."));
|
||||
|
||||
layout->addWidget(title);
|
||||
layout->addWidget(m_staticLabel);
|
||||
layout->addWidget(m_liveLabel);
|
||||
}
|
||||
|
||||
void ChildBeta::setParentData(const QString &data)
|
||||
{
|
||||
if (m_staticLabel)
|
||||
m_staticLabel->setText(QStringLiteral("Init-Wert: %1").arg(data));
|
||||
}
|
||||
|
||||
void ChildBeta::updateLiveData(const QString &text)
|
||||
{
|
||||
if (m_liveLabel)
|
||||
{
|
||||
m_liveLabel->setText(text.isEmpty() ? QStringLiteral("Warte auf Live-Text...") : QStringLiteral("Beta Live: ") + text);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../interfaces/child_interface.h"
|
||||
#include <QLabel>
|
||||
#include <QObject>
|
||||
|
||||
namespace DLBO
|
||||
{
|
||||
class ChildBeta
|
||||
: public QObject
|
||||
, public ChildInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "gui:3:ChildInterface")
|
||||
Q_INTERFACES(ChildInterface)
|
||||
|
||||
public:
|
||||
ChildBeta();
|
||||
QString childName() const override { return QStringLiteral("BetaChild"); }
|
||||
QString targetParentName() const override { return QStringLiteral("AlphaParent"); }
|
||||
QWidget *widget() override { return m_widget; }
|
||||
|
||||
void setParentData(const QString &data) override;
|
||||
|
||||
public slots:
|
||||
void updateLiveData(const QString &text) override;
|
||||
|
||||
private:
|
||||
QWidget *m_widget;
|
||||
QLabel *m_staticLabel;
|
||||
QLabel *m_liveLabel;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"Keys": ["child_beta"]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
add_library(childGammaGui MODULE child_gamma.cpp child_gamma.h)
|
||||
target_link_libraries(childGammaGui PRIVATE Qt5::Widgets)
|
||||
target_include_directories(childGammaGui PRIVATE ${CMAKE_SOURCE_DIR}/interfaces)
|
||||
|
||||
# Plugin in den Laufzeit-Ordner verschieben
|
||||
set_target_properties(childGammaGui PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY "${PLUGIN_OUTPUT_DIR}"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${PLUGIN_OUTPUT_DIR}"
|
||||
)
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
#include "child_gamma.h"
|
||||
#include <QVBoxLayout>
|
||||
|
||||
namespace DLBO
|
||||
{
|
||||
ChildGamma::ChildGamma()
|
||||
{
|
||||
m_widget = new QWidget();
|
||||
QVBoxLayout *layout = new QVBoxLayout(m_widget);
|
||||
m_widget->setStyleSheet(QStringLiteral("border: 1px solid purple; background-color: #faf0ff; margin: 5px;"));
|
||||
|
||||
QLabel *title = new QLabel(QStringLiteral("Kind-Widget 2"));
|
||||
title->setStyleSheet(QStringLiteral("font-weight: bold; color: purple;"));
|
||||
|
||||
m_staticLabel = new QLabel(QStringLiteral("Warte auf Init-Daten..."));
|
||||
m_liveLabel = new QLabel(QStringLiteral("Warte auf Live-Text..."));
|
||||
|
||||
layout->addWidget(title);
|
||||
layout->addWidget(m_staticLabel);
|
||||
layout->addWidget(m_liveLabel);
|
||||
}
|
||||
|
||||
void ChildGamma::setParentData(const QString &data)
|
||||
{
|
||||
if (m_staticLabel)
|
||||
m_staticLabel->setText(QStringLiteral("Init-Wert: %1").arg(data));
|
||||
}
|
||||
|
||||
void ChildGamma::updateLiveData(const QString &text)
|
||||
{
|
||||
if (m_liveLabel)
|
||||
{
|
||||
m_liveLabel->setText(text.isEmpty() ? QStringLiteral("Warte auf Live-Text...") : QStringLiteral("Gamma Live: ") + text);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../interfaces/child_interface.h"
|
||||
#include <QLabel>
|
||||
#include <QObject>
|
||||
|
||||
namespace DLBO
|
||||
{
|
||||
class ChildGamma
|
||||
: public QObject
|
||||
, public ChildInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "gui:3:ChildInterface")
|
||||
Q_INTERFACES(ChildInterface)
|
||||
|
||||
public:
|
||||
ChildGamma();
|
||||
QString childName() const override { return QStringLiteral("GammaChild"); }
|
||||
QString targetParentName() const override { return QStringLiteral("AlphaParent"); }
|
||||
QWidget *widget() override { return m_widget; }
|
||||
|
||||
void setParentData(const QString &data) override;
|
||||
|
||||
public slots:
|
||||
void updateLiveData(const QString &text) override;
|
||||
|
||||
private:
|
||||
QWidget *m_widget;
|
||||
QLabel *m_staticLabel;
|
||||
QLabel *m_liveLabel;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"Keys": ["child_gamma"]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
add_library(parentAlphaGui MODULE parent_alpha.cpp parent_alpha.h)
|
||||
target_link_libraries(parentAlphaGui PRIVATE Qt5::Widgets)
|
||||
target_include_directories(parentAlphaGui PRIVATE ${CMAKE_SOURCE_DIR}/interfaces)
|
||||
|
||||
# Plugin in den Laufzeit-Ordner verschieben
|
||||
set_target_properties(parentAlphaGui PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY "${PLUGIN_OUTPUT_DIR}"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${PLUGIN_OUTPUT_DIR}"
|
||||
)
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
#include "parent_alpha.h"
|
||||
#include <QLabel>
|
||||
|
||||
namespace DLBO
|
||||
{
|
||||
ParentAlpha::ParentAlpha()
|
||||
{
|
||||
m_widget = new QWidget();
|
||||
m_layout = new QVBoxLayout(m_widget);
|
||||
m_widget->setStyleSheet(QStringLiteral("border: 2px solid blue; padding: 10px; margin: 5px;"));
|
||||
|
||||
QLabel *label = new QLabel(QStringLiteral("Eltern-Widget (AlphaParent)\nBsp.: Tln-Info-Fenster"));
|
||||
label->setStyleSheet(QStringLiteral("font-weight: bold; color: blue; font-size: 14px;"));
|
||||
m_layout->addWidget(label);
|
||||
|
||||
m_inputField = new QLineEdit();
|
||||
m_inputField->setPlaceholderText(QStringLiteral("Live-Eingabe für alle Kinder..."));
|
||||
m_layout->addWidget(m_inputField);
|
||||
|
||||
connect(m_inputField, &QLineEdit::textChanged, this, &ParentAlpha::dataChangedLive);
|
||||
}
|
||||
|
||||
void ParentAlpha::addChildWidget(QWidget *childWidget)
|
||||
{
|
||||
if (childWidget)
|
||||
{
|
||||
m_layout->addWidget(childWidget);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../interfaces/parent_interface.h"
|
||||
#include <QLineEdit>
|
||||
#include <QObject>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
namespace DLBO
|
||||
{
|
||||
class ParentAlpha
|
||||
: public QObject
|
||||
, public ParentInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "gui:3:ParentInterface")
|
||||
Q_INTERFACES(ParentInterface)
|
||||
|
||||
public:
|
||||
ParentAlpha();
|
||||
QString pluginName() const override { return QStringLiteral("AlphaParent"); }
|
||||
QWidget *widget() override { return m_widget; }
|
||||
void addChildWidget(QWidget *childWidget) override;
|
||||
QObject *qobjectInstance() override { return this; }
|
||||
|
||||
signals:
|
||||
void dataChangedLive(const QString &text);
|
||||
|
||||
private:
|
||||
QWidget *m_widget;
|
||||
QVBoxLayout *m_layout;
|
||||
QLineEdit *m_inputField;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"Keys": ["parent_alpha"]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
Confluence: https://confluence-classified.rh-int.de/spaces/GUEZDLBO/pages/186346247/Plugin+Konzept
|
||||
|
||||
Jira: https://devhub.defence-elec.de/jira/browse/LS-671
|
||||
@@ -0,0 +1,31 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(GuiElementPlugin CXX)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
|
||||
SET(gui_element_SRCS
|
||||
custom_widget.cpp
|
||||
custom_widget.h
|
||||
gui_element_plugin.cpp
|
||||
gui_element_plugin.h
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(gui_element_SRCS
|
||||
custom_widget.ui
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(WS GuiElementPlugin MODULE ${gui_element_SRCS})
|
||||
# Pfad zum Interface-Ordner bekannt machen
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(GuiElementPlugin PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
|
||||
NGL_TARGET_LINK_LIBRARIES(GuiElementPlugin
|
||||
Qt5::Widgets
|
||||
LtsWidgets
|
||||
LtsSession
|
||||
LtsSessionData
|
||||
GuiElementInterface
|
||||
PpmDataPluginInterface
|
||||
PpmCommon
|
||||
LtsCoordTrans
|
||||
)
|
||||
@@ -0,0 +1,33 @@
|
||||
#include "custom_widget.h"
|
||||
#include "LtsCoordTrans/lts_coord_trans.h"
|
||||
#include "ui_custom_widget.h"
|
||||
#include <QDebug>
|
||||
|
||||
CustomWidget::CustomWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_ui(new Ui::CustomWidget)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
connect(m_ui->pbFindOnMap, &QToolButton::clicked, this, &CustomWidget::finOnMapClicked);
|
||||
}
|
||||
|
||||
CustomWidget::~CustomWidget()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void CustomWidget::onPositionChanged(const Core::GeoPosition &position, int participantId)
|
||||
{
|
||||
if (participantId == 0 || std::isnan(position.lon()) || std::isnan(position.lat()))
|
||||
m_ui->lblPos->setText(tr("Invalid Position"));
|
||||
else
|
||||
{
|
||||
QString mgrs = LtsCoordTrans::mgrsFromGeographic(position.lon(), position.lat());
|
||||
|
||||
if (!qFuzzyIsNull(position.z()))
|
||||
mgrs += QStringLiteral(" | ") + QString::number(position.z(), 'f', 2);
|
||||
|
||||
m_ui->lblPos->setText(mgrs);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include "Core/core.hpp"
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class CustomWidget;
|
||||
}
|
||||
|
||||
class CustomWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CustomWidget(QWidget *parent = nullptr);
|
||||
~CustomWidget();
|
||||
void onPositionChanged(const Core::GeoPosition &position, int participantId);
|
||||
|
||||
signals:
|
||||
void finOnMapClicked();
|
||||
private:
|
||||
Ui::CustomWidget *m_ui;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CustomWidget</class>
|
||||
<widget class="QWidget" name="CustomWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>268</width>
|
||||
<height>88</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Plugin-Test-DEBUG ONLY</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelPos">
|
||||
<property name="text">
|
||||
<string>Position:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="lblPos">
|
||||
<property name="text">
|
||||
<string><Position></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="pbFindOnMap">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Find on map</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"><TIME OVER TARGET></string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/style/center_to_object.svg</normaloff>:/style/center_to_object.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,60 @@
|
||||
#include <Plugins/ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
#include "gui_element_plugin.h"
|
||||
#include "custom_widget.h"
|
||||
|
||||
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
GuiElementPlugin::GuiElementPlugin()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QWidget *GuiElementPlugin::createGuiElement(QWidget *parent)
|
||||
{
|
||||
m_customWidget = new CustomWidget(parent);
|
||||
if (!m_ppmDtc)
|
||||
{
|
||||
qCritical()<<" ppmDtc not yet init!!!";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
connect(m_customWidget, &CustomWidget::finOnMapClicked, this, &GuiElementPlugin::onFindOnMap);
|
||||
connect(m_ppmDtc.get(), &ParticipantManagement::Interface::Dtc::participantPositionChanged,
|
||||
m_customWidget, [=](const ParticipantManagement::ParticipantPosition &ppPos){
|
||||
m_customWidget->onPositionChanged(ppPos.pos(), m_participantId);
|
||||
}, Qt::UniqueConnection);
|
||||
m_customWidget->onPositionChanged(m_ppmDtc->participantPosition(m_participantId).pos(), m_participantId);
|
||||
return m_customWidget;
|
||||
}
|
||||
|
||||
|
||||
bool GuiElementPlugin::init(LtsSession::LtsSession *session, int participantId)
|
||||
{
|
||||
m_session = session;
|
||||
|
||||
if (!m_session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc))
|
||||
{
|
||||
qCritical()<<"couln't init ppmDtc for gui element ";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!session->getForeignGuiInterface<SituationMap::ForeignGuiInterface>(m_sitMapGuiIfc))
|
||||
{
|
||||
qCritical()<<"couln't init sitMapGuiIfc for gui element ";
|
||||
return false;
|
||||
}
|
||||
|
||||
m_participantId = participantId;
|
||||
return true;
|
||||
}
|
||||
|
||||
void GuiElementPlugin::onFindOnMap()
|
||||
{
|
||||
if (m_sitMapGuiIfc)
|
||||
m_sitMapGuiIfc->centerMapToParticipant(m_participantId);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
#include <Core/core.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <Plugins/ParticipantManagement/participant_info_gui_element_interface.h>
|
||||
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
||||
#include <QObject>
|
||||
|
||||
|
||||
|
||||
class CustomWidget;
|
||||
|
||||
class GuiElementPlugin : public QObject, public GuiElementInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID IGuiElementPlugin)
|
||||
Q_INTERFACES(GuiElementInterface)
|
||||
|
||||
public:
|
||||
GuiElementPlugin();
|
||||
|
||||
QString pluginName() {return QStringLiteral("KeyValueGuiElement_XY");}
|
||||
QWidget* createGuiElement(QWidget *parent = nullptr);
|
||||
|
||||
bool init(LtsSession::LtsSession *session, int participantId = 0);
|
||||
void onFindOnMap();
|
||||
|
||||
|
||||
private:
|
||||
LtsSession::LtsSession *m_session;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
std::shared_ptr<SituationMap::ForeignGuiInterface> m_sitMapGuiIfc;
|
||||
CustomWidget *m_customWidget;
|
||||
int m_participantId = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
#
|
||||
# Tool for sending http-requests to a REST API
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Hannes Fritsche, ESZS, 2026-08-25
|
||||
#
|
||||
|
||||
SET(SRCS
|
||||
main_window.cpp
|
||||
main_window.h
|
||||
main.cpp
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(SRCS main_window.ui)
|
||||
|
||||
NGL_ADD_EXECUTABLE(TOOLSWS RestClientUi ${SRCS})
|
||||
|
||||
NGL_INSTALL(WS DIRECTORY rest_templates/ DESTINATION bin/updates/)
|
||||
|
||||
NGL_TARGET_LINK_LIBRARIES(RestClientUi
|
||||
Qt5::Widgets
|
||||
Qt5::Gui
|
||||
LtsRestClient
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(RestClientUi)
|
||||
|
||||
IF (BUILD_TOOLSWS)
|
||||
SET(TEMPLATES_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/rest_templates")
|
||||
SET(TEMPLATES_DESTINATION "${CMAKE_BINARY_DIR}/bin/rest_templates")
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET RestClientUi POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory "${TEMPLATES_SOURCE}" "${TEMPLATES_DESTINATION}"
|
||||
COMMENT "Copy ${TEMPLATES_SOURCE} to ${TEMPLATES_DESTINATION}"
|
||||
)
|
||||
ENDIF()
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* main for RestClientUi
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Fritsche, ESZS, 2026-08-25
|
||||
*/
|
||||
|
||||
#include <QApplication>
|
||||
#include "main_window.h"
|
||||
|
||||
// Documentation on how to use it can be found at https://confluence-classified.rh-int.de/spaces/LEG/pages/207919552/HOWTO+RestClientUi+Tool
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
MainWindow window;
|
||||
window.show();
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
@@ -0,0 +1,301 @@
|
||||
#include "main_window.h"
|
||||
#include "LtsRestClient/lts_rest_client.h"
|
||||
#include "ui_main_window.h"
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QFileDialog>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonParseError>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
|
||||
// Documentation on how to use it can be found at https://confluence-classified.rh-int.de/spaces/LEG/pages/207919552/HOWTO+RestClientUi+Tool
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// Connect core HTTP actions
|
||||
connect(ui->m_getBtn, &QPushButton::clicked, this, &MainWindow::onGetClicked);
|
||||
connect(ui->m_postBtn, &QPushButton::clicked, this, &MainWindow::onPostClicked);
|
||||
connect(ui->m_putBtn, &QPushButton::clicked, this, &MainWindow::onPutClicked);
|
||||
connect(ui->m_deleteBtn, &QPushButton::clicked, this, &MainWindow::onDeleteClicked);
|
||||
|
||||
// Connect logging output actions
|
||||
connect(ui->m_clearResponseBtn, &QPushButton::clicked, this, &MainWindow::onClearResponseClicked);
|
||||
connect(ui->m_exportResponseBtn, &QPushButton::clicked, this, &MainWindow::onExportResponseClicked);
|
||||
|
||||
loadRequestTemplates();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindow::onClearResponseClicked()
|
||||
{
|
||||
ui->m_responseOutput->clear();
|
||||
}
|
||||
|
||||
void MainWindow::onExportResponseClicked()
|
||||
{
|
||||
const QString content = ui->m_responseOutput->toPlainText().trimmed();
|
||||
|
||||
if (content.isEmpty())
|
||||
{
|
||||
QMessageBox::warning(this, QStringLiteral("Export Failed"), QStringLiteral("There is no response data available to export."));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const QString fileName = QFileDialog::getSaveFileName(this,
|
||||
QStringLiteral("Save Response as JSON"),
|
||||
QDir::homePath() + QStringLiteral("/response.json"),
|
||||
QStringLiteral("JSON Files (*.json);;All Files (*)"));
|
||||
|
||||
if (fileName.isEmpty())
|
||||
return;
|
||||
|
||||
QJsonParseError parseError;
|
||||
const QJsonDocument jsonDoc = QJsonDocument::fromJson(content.toUtf8(), &parseError);
|
||||
QByteArray dataToWrite;
|
||||
|
||||
if (parseError.error == QJsonParseError::NoError)
|
||||
dataToWrite = jsonDoc.toJson(QJsonDocument::Indented);
|
||||
else
|
||||
dataToWrite = content.toUtf8();
|
||||
|
||||
QFile file(fileName);
|
||||
|
||||
if (file.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
{
|
||||
file.write(dataToWrite);
|
||||
file.close();
|
||||
|
||||
QMessageBox::information(this, QStringLiteral("Success"), QStringLiteral("File saved successfully."));
|
||||
}
|
||||
else
|
||||
QMessageBox::critical(this, QStringLiteral("Error"), QStringLiteral("Could not write to file:\n") + file.errorString());
|
||||
}
|
||||
|
||||
void MainWindow::highlightMethodButton(const QString &method)
|
||||
{
|
||||
// Reset stylesheets for all HTTP method buttons back to default
|
||||
ui->m_getBtn->setStyleSheet(QString());
|
||||
ui->m_postBtn->setStyleSheet(QString());
|
||||
ui->m_putBtn->setStyleSheet(QString());
|
||||
ui->m_deleteBtn->setStyleSheet(QString());
|
||||
|
||||
// Modern green border highlight style string
|
||||
const QString highlightStyle = QStringLiteral("border: 2px solid #2ecc71; font-weight: bold; background-color: #e8f8f5;");
|
||||
|
||||
// Apply style based on the uppercase method string
|
||||
const QString upperMethod = method.toUpper().trimmed();
|
||||
if (upperMethod == QStringLiteral("GET"))
|
||||
ui->m_getBtn->setStyleSheet(highlightStyle);
|
||||
else if (upperMethod == QStringLiteral("POST"))
|
||||
ui->m_postBtn->setStyleSheet(highlightStyle);
|
||||
else if (upperMethod == QStringLiteral("PUT"))
|
||||
ui->m_putBtn->setStyleSheet(highlightStyle);
|
||||
else if (upperMethod == QStringLiteral("DELETE")
|
||||
|| upperMethod == QStringLiteral("DEL"))
|
||||
ui->m_deleteBtn->setStyleSheet(highlightStyle);
|
||||
}
|
||||
|
||||
void MainWindow::loadRequestTemplates()
|
||||
{
|
||||
const QString templatePath = QCoreApplication::applicationDirPath() + QStringLiteral("/templates");
|
||||
QDir directory(templatePath);
|
||||
|
||||
if (!directory.exists())
|
||||
directory.mkpath(QStringLiteral("."));
|
||||
|
||||
QStringList filters;
|
||||
filters << QStringLiteral("*.json");
|
||||
directory.setNameFilters(filters);
|
||||
|
||||
const QFileInfoList fileList = directory.entryInfoList(QDir::Files);
|
||||
|
||||
int insertIndex = 0;
|
||||
for (const QFileInfo &fileInfo : fileList)
|
||||
{
|
||||
const QString absolutePath = fileInfo.absoluteFilePath();
|
||||
|
||||
QFile file(absolutePath);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const QByteArray fileContent = file.readAll();
|
||||
file.close();
|
||||
|
||||
QJsonParseError parseError;
|
||||
const QJsonDocument metaDoc = QJsonDocument::fromJson(fileContent, &parseError);
|
||||
|
||||
if (parseError.error != QJsonParseError::NoError
|
||||
|| !metaDoc.isObject())
|
||||
continue;
|
||||
|
||||
const QJsonObject metaObj = metaDoc.object();
|
||||
|
||||
QString displayName = metaObj.value(QStringLiteral("name")).toString();
|
||||
if (displayName.isEmpty())
|
||||
displayName = fileInfo.fileName();
|
||||
|
||||
const QString targetEndpoint = metaObj.value(QStringLiteral("endpoint")).toString();
|
||||
const QString targetMethod = metaObj.value(QStringLiteral("method")).toString().toUpper().trimmed();
|
||||
|
||||
QPushButton *templateBtn = new QPushButton(displayName, this);
|
||||
|
||||
connect(templateBtn, &QPushButton::clicked, this, [this, metaObj, targetEndpoint, targetMethod]()
|
||||
{
|
||||
// 1. Fill values into fields
|
||||
ui->m_endpointInput->setText(targetEndpoint);
|
||||
ui->m_jsonInput->clear();
|
||||
|
||||
if (metaObj.contains(QStringLiteral("payload")))
|
||||
{
|
||||
const QJsonValue payloadValue = metaObj.value(QStringLiteral("payload"));
|
||||
|
||||
if (payloadValue.isObject())
|
||||
{
|
||||
const QJsonDocument doc(payloadValue.toObject());
|
||||
ui->m_jsonInput->setPlainText(QString::fromUtf8(doc.toJson(QJsonDocument::Indented)));
|
||||
}
|
||||
else if (payloadValue.isArray())
|
||||
{
|
||||
const QJsonDocument doc(payloadValue.toArray());
|
||||
ui->m_jsonInput->setPlainText(QString::fromUtf8(doc.toJson(QJsonDocument::Indented)));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->m_jsonInput->setPlainText(payloadValue.toVariant().toString());
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Visually focus the matching HTTP button
|
||||
highlightMethodButton(targetMethod);
|
||||
|
||||
// 3. NEW: Optional Auto-Submit trigger chain execution
|
||||
if (ui->m_autoSubmitCheck->isChecked())
|
||||
{
|
||||
if (targetMethod == QStringLiteral("GET"))
|
||||
ui->m_getBtn->animateClick(); // animateClick provides nice visual feedback
|
||||
else if (targetMethod == QStringLiteral("POST"))
|
||||
ui->m_postBtn->animateClick();
|
||||
else if (targetMethod == QStringLiteral("PUT"))
|
||||
ui->m_putBtn->animateClick();
|
||||
else if (targetMethod == QStringLiteral("DELETE")
|
||||
|| targetMethod == QStringLiteral("DEL"))
|
||||
ui->m_deleteBtn->animateClick();
|
||||
}
|
||||
});
|
||||
|
||||
ui->templateButtonContainer->insertWidget(insertIndex++, templateBtn);
|
||||
}
|
||||
}
|
||||
|
||||
LtsCommon::LtsRestClient *MainWindow::createClient()
|
||||
{
|
||||
return new LtsCommon::LtsRestClient(ui->m_urlInput->text(), this);
|
||||
}
|
||||
|
||||
void MainWindow::showSuccess(const QJsonDocument &json)
|
||||
{
|
||||
ui->m_responseOutput->setTextColor(QColor(Qt::darkGreen));
|
||||
ui->m_responseOutput->setText(QString::fromLatin1(json.toJson(QJsonDocument::Indented)));
|
||||
}
|
||||
|
||||
void MainWindow::showError(const QString &error)
|
||||
{
|
||||
ui->m_responseOutput->setTextColor(QColor(Qt::red));
|
||||
ui->m_responseOutput->setText(QStringLiteral("Error: ") + error);
|
||||
}
|
||||
|
||||
void MainWindow::onGetClicked()
|
||||
{
|
||||
ui->m_responseOutput->clear();
|
||||
LtsCommon::LtsRestClient *client = createClient();
|
||||
client->get(
|
||||
ui->m_endpointInput->text(),
|
||||
[this](const QJsonDocument &json)
|
||||
{
|
||||
showSuccess(json);
|
||||
},
|
||||
[this](const QString &err)
|
||||
{
|
||||
showError(err);
|
||||
});
|
||||
}
|
||||
|
||||
void MainWindow::onPostClicked()
|
||||
{
|
||||
ui->m_responseOutput->clear();
|
||||
QJsonParseError parseError;
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(ui->m_jsonInput->toPlainText().toUtf8(), &parseError);
|
||||
|
||||
if (parseError.error != QJsonParseError::NoError)
|
||||
{
|
||||
showError(QStringLiteral("Invalid JSON input syntax: ") + parseError.errorString());
|
||||
return;
|
||||
}
|
||||
|
||||
LtsCommon::LtsRestClient *client = createClient();
|
||||
client->post(
|
||||
ui->m_endpointInput->text(), jsonDoc,
|
||||
[this](const QJsonDocument &json)
|
||||
{
|
||||
showSuccess(json);
|
||||
},
|
||||
[this](const QString &err)
|
||||
{
|
||||
showError(err);
|
||||
});
|
||||
}
|
||||
|
||||
void MainWindow::onPutClicked()
|
||||
{
|
||||
ui->m_responseOutput->clear();
|
||||
QJsonParseError parseError;
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(ui->m_jsonInput->toPlainText().toUtf8(), &parseError);
|
||||
|
||||
if (parseError.error != QJsonParseError::NoError)
|
||||
{
|
||||
showError(QStringLiteral("Invalid JSON input syntax: ") + parseError.errorString());
|
||||
return;
|
||||
}
|
||||
|
||||
LtsCommon::LtsRestClient *client = createClient();
|
||||
client->put(
|
||||
ui->m_endpointInput->text(), jsonDoc,
|
||||
[this](const QJsonDocument &json)
|
||||
{
|
||||
showSuccess(json);
|
||||
},
|
||||
[this](const QString &err)
|
||||
{
|
||||
showError(err);
|
||||
});
|
||||
}
|
||||
|
||||
void MainWindow::onDeleteClicked()
|
||||
{
|
||||
ui->m_responseOutput->clear();
|
||||
LtsCommon::LtsRestClient *client = createClient();
|
||||
client->del(
|
||||
ui->m_endpointInput->text(),
|
||||
[this](const QJsonDocument &json)
|
||||
{
|
||||
showSuccess(json);
|
||||
},
|
||||
[this](const QString &err)
|
||||
{
|
||||
showError(err);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#include "LtsRestClient/lts_rest_client.h"
|
||||
#include <QJsonDocument>
|
||||
#include <QMainWindow>
|
||||
|
||||
// Documentation on how to use it can be found at https://confluence-classified.rh-int.de/spaces/LEG/pages/207919552/HOWTO+RestClientUi+Tool
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
private slots:
|
||||
void onGetClicked();
|
||||
void onPostClicked();
|
||||
void onPutClicked();
|
||||
void onDeleteClicked();
|
||||
void onClearResponseClicked();
|
||||
void onExportResponseClicked();
|
||||
|
||||
private:
|
||||
void loadRequestTemplates();
|
||||
LtsCommon::LtsRestClient *createClient();
|
||||
void showSuccess(const QJsonDocument &json);
|
||||
void showError(const QString &error);
|
||||
void highlightMethodButton(const QString &method);
|
||||
|
||||
Ui::MainWindow *ui;
|
||||
}; // class MainWindow
|
||||
@@ -0,0 +1,215 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>750</width>
|
||||
<height>580</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Qt REST Client GUI</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QFrame" name="leftFrame">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>180</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>220</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="leftLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelTemplates">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>JSON Templates:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>200</width>
|
||||
<height>520</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="templateButtonContainer">
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="mainVerticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelUrl">
|
||||
<property name="text">
|
||||
<string>Basis URL:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="m_urlInput">
|
||||
<property name="text">
|
||||
<string>http://localhost:8080</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelEndpoint">
|
||||
<property name="text">
|
||||
<string>Endpunkt:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="m_endpointInput">
|
||||
<property name="text">
|
||||
<string>/posts</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelJson">
|
||||
<property name="text">
|
||||
<string>JSON Input (for POST / PUT):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="m_jsonInput"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="m_autoSubmitCheck">
|
||||
<property name="text">
|
||||
<string>Submit automatically on template click</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="buttonLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_getBtn">
|
||||
<property name="text">
|
||||
<string>GET</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_postBtn">
|
||||
<property name="text">
|
||||
<string>POST</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_putBtn">
|
||||
<property name="text">
|
||||
<string>PUT</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_deleteBtn">
|
||||
<property name="text">
|
||||
<string>DELETE</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelResponse">
|
||||
<property name="text">
|
||||
<string>Server Response / Error Log:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="m_responseOutput">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="responseActionLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_clearResponseBtn">
|
||||
<property name="text">
|
||||
<string>Clear Log</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_exportResponseBtn">
|
||||
<property name="text">
|
||||
<string>Export as JSON...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "itemsKeys",
|
||||
"method": "GET",
|
||||
"endpoint": "/uncat/itemsKeys"
|
||||
}
|
||||
Reference in new issue
Block a user