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>
134 lines
5.1 KiB
C++
134 lines
5.1 KiB
C++
#include "lts_message_dialog.h"
|
|
#include "lts_message_dialog_helper.h"
|
|
|
|
#include <QCoreApplication>
|
|
#include <QVBoxLayout>
|
|
#include <QLabel>
|
|
#include <QPushButton>
|
|
#include <QDebug>
|
|
|
|
|
|
namespace LtsWidgets
|
|
{
|
|
namespace LtsMessageDialog
|
|
{
|
|
Button showMessage(QWidget* parent,
|
|
const QString& message,
|
|
const QString &title,
|
|
const Behaviour behaviour,
|
|
const Buttons buttons,
|
|
const QHash<Button, QString> &buttonTexts)
|
|
{
|
|
static QAtomicInt s_used = 0;
|
|
|
|
if (s_used)
|
|
qDebug() << "LtsMessageDialog: showMessage called while showMessage is in its Event Loop - do not open more than one Dialog at once !!";
|
|
|
|
s_used = 1;
|
|
|
|
LtsMessageDialogHelper *dialog = new LtsMessageDialogHelper(); // NOT 'parent' !
|
|
Button result = dialog->showMessage(parent, message, title, behaviour, buttons, buttonTexts);
|
|
dialog->deleteLater();
|
|
|
|
s_used = 0;
|
|
|
|
return result;
|
|
}
|
|
|
|
Button askApplyDiscardCancel(QWidget *parent)
|
|
{
|
|
const QString question = QCoreApplication::translate("LtsDialog",
|
|
"<br>"
|
|
"Apply - apply changes and close.<br>"
|
|
"Discard - discard changes and close.<br>"
|
|
"Cancel - do not close.");
|
|
const QString title = QCoreApplication::translate("LtsDialog", "Unapplied changes made. Apply the changes?");
|
|
return LtsMessageDialog::showMessage(parent,
|
|
question,
|
|
title,
|
|
Behaviour::Modal,
|
|
Button::Apply | Button::Discard | Button::Cancel);
|
|
}
|
|
|
|
|
|
} // namespace LtsMessageDialog
|
|
|
|
|
|
|
|
// LtsWidgets
|
|
LtsMessageDialogNew::LtsMessageDialogNew(QWidget *parent, const QString &message, const QString &title, const Behaviour behaviour, const Buttons buttons, const QHash<Button, QString> &buttonTexts, bool deleteOnClose)
|
|
{
|
|
m_dialog = new LtsFramelessDialog(parent, behaviour);
|
|
|
|
if (deleteOnClose)
|
|
m_dialog->setAttribute(Qt::WA_DeleteOnClose); // Message Dialogs are loose instances that must delete theirselves, because noone keeps a pointer to the message dialog
|
|
|
|
connect(m_dialog, &LtsFramelessDialog::destroyed,
|
|
this, &LtsMessageDialogNew::deleteLater);
|
|
|
|
QVBoxLayout *mainLayout = new QVBoxLayout(m_dialog);
|
|
|
|
QString text;
|
|
if (!title.isEmpty()) // title given?
|
|
{
|
|
text = QStringLiteral("<b>%1</b><br><br>").arg(title);
|
|
}
|
|
|
|
text += message;
|
|
|
|
QLabel *messageLabel = new QLabel(text, m_dialog);
|
|
messageLabel->setTextInteractionFlags(Qt::TextSelectableByMouse); // make text selectable by mouse
|
|
mainLayout->addWidget(messageLabel);
|
|
|
|
QHBoxLayout *buttonLayout = new QHBoxLayout;
|
|
buttonLayout->setMargin(0);
|
|
|
|
// TODO: FIXME: can this be called after the selection was made and the shadow just dies ?
|
|
//connect(m_dialog, &LtsFramelessDialog::rejected, this, &LtsMessageDialogHelper::slotCancel); // respect that non-modal dialogs can be closed by clicking outside of it
|
|
|
|
if (buttons.testFlag(Button::Ok))
|
|
connect(addButton(buttonTexts.value(Button::Ok, tr("Ok")), buttonLayout, m_dialog, Button::Ok, parent), &QPushButton::clicked, this, &LtsMessageDialogNew::ok);
|
|
|
|
if (buttons.testFlag(Button::Yes))
|
|
connect(addButton(buttonTexts.value(Button::Yes, tr("Yes")), buttonLayout, m_dialog, Button::Yes, parent), &QPushButton::clicked, this, &LtsMessageDialogNew::yes);
|
|
|
|
if (buttons.testFlag(Button::No))
|
|
connect(addButton(buttonTexts.value(Button::No, tr("No")), buttonLayout, m_dialog, Button::No, parent), &QPushButton::clicked, this, &LtsMessageDialogNew::no);
|
|
|
|
if (buttons.testFlag(Button::Apply))
|
|
connect(addButton(buttonTexts.value(Button::Apply, tr("Apply")), buttonLayout, m_dialog, Button::Apply, parent), &QPushButton::clicked, this, &LtsMessageDialogNew::apply); // same as yes
|
|
|
|
if (buttons.testFlag(Button::Discard))
|
|
connect(addButton(buttonTexts.value(Button::Discard, tr("Discard")), buttonLayout, m_dialog, Button::Discard, parent), &QPushButton::clicked, this, &LtsMessageDialogNew::discard); // same as no
|
|
|
|
if (buttons.testFlag(Button::Cancel))
|
|
connect(addButton(buttonTexts.value(Button::Cancel, tr("Cancel")), buttonLayout, m_dialog, Button::Cancel, parent), &QPushButton::clicked, this, &LtsMessageDialogNew::cancel);
|
|
|
|
QWidget *buttonLayoutWidget = new QWidget;
|
|
buttonLayoutWidget->setLayout(buttonLayout);
|
|
|
|
mainLayout->addWidget(buttonLayoutWidget);
|
|
|
|
m_dialog->show();
|
|
m_dialog->raise();
|
|
}
|
|
|
|
|
|
QPushButton* LtsMessageDialogNew::addButton(const QString &text, QHBoxLayout *thatLayout, LtsFramelessDialog *dialog, const Button &button, QWidget *parent)
|
|
{
|
|
QPushButton* btn = new QPushButton(text, parent);
|
|
connect(btn, &QPushButton::clicked, dialog, &LtsFramelessDialog::accept);
|
|
thatLayout->addWidget(btn);
|
|
|
|
if (button == Button::Ok ||
|
|
button == Button::Cancel) // ok and cancel should not be used together, so there is no check needed (as only one button can be the default button)
|
|
{
|
|
btn->setDefault(true);
|
|
}
|
|
|
|
return btn;
|
|
}
|
|
|
|
|
|
} // namespace LtsWidgets
|