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>
161 lines
4.4 KiB
C++
161 lines
4.4 KiB
C++
/**
|
|
* @RDE_HEADER@
|
|
* Helper Classes to manage requirements for end-users to ui elements
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*
|
|
* Created by Mike Wille, SLSE, 2016-08-19
|
|
*/
|
|
|
|
#include "ui_requirement.h"
|
|
|
|
#include <LtsWidgets/lts_message_dialog.h>
|
|
|
|
#include <QApplication>
|
|
#include <QLabel>
|
|
|
|
|
|
namespace LtsWidgets
|
|
{
|
|
UiRequirement::UiRequirement(QLabel *descriptionLabel, const std::function<bool()> &requirementCheck, const QString &userWarningMessage)
|
|
: m_descriptionLabel(descriptionLabel)
|
|
, m_requirementCheck(requirementCheck)
|
|
, m_lastResult(true)
|
|
, m_userWarningMessage(userWarningMessage)
|
|
{
|
|
retranslate();
|
|
}
|
|
|
|
|
|
void UiRequirement::reset()
|
|
{
|
|
if (!isValid())
|
|
return;
|
|
m_descriptionLabel->setText(m_originalText);
|
|
m_descriptionLabel->setToolTip(m_originalTooltip);
|
|
}
|
|
|
|
|
|
void UiRequirement::setTexts()
|
|
{
|
|
if (!isValid())
|
|
return;
|
|
if (!m_lastResult) // requirement not met? change text color but only if this is NOT a simulation!
|
|
{
|
|
m_descriptionLabel->setText(QStringLiteral("<span style=\"color:#aa0000;\">\u2022 %1</span>").arg(m_originalText)); // add requirement-indicator unicode 'bullet'
|
|
|
|
if (!m_userWarningMessage.isEmpty())
|
|
{
|
|
m_descriptionLabel->setCursor(Qt::WhatsThisCursor);
|
|
m_descriptionLabel->setToolTip(m_userWarningMessage);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (m_originalText.startsWith(QStringLiteral("\u2022 ")))
|
|
return;
|
|
|
|
m_descriptionLabel->setText(QStringLiteral("\u2022 %1").arg(m_originalText)); // set back to original text, as the requirement is now met and add requirement-indicator unicode 'bullet'
|
|
m_descriptionLabel->setCursor(Qt::ArrowCursor);
|
|
m_descriptionLabel->setToolTip(m_originalTooltip);
|
|
}
|
|
}
|
|
|
|
|
|
void UiRequirement::retranslate()
|
|
{
|
|
if (!isValid())
|
|
return;
|
|
|
|
if (m_originalText.startsWith(QStringLiteral("\u2022 ")))
|
|
return;
|
|
|
|
auto x = m_descriptionLabel->text();
|
|
if (x.startsWith(QStringLiteral("\u2022 ")))
|
|
return;
|
|
|
|
m_originalText = x;
|
|
|
|
m_originalTooltip = m_descriptionLabel->toolTip();
|
|
setTexts();
|
|
}
|
|
|
|
|
|
bool UiRequirement::checkRequirement()
|
|
{
|
|
if (!isValid())
|
|
return m_lastResult;
|
|
|
|
m_lastResult = m_requirementCheck();
|
|
|
|
if (!m_descriptionLabel->isVisible() && !m_descriptionLabel->property("checkMe").toBool()) // do not check when label is not visible (on some cases there are elemts which must not be used, so they are hidden and therefor not a requirement, and therefor "a met requirement")
|
|
{
|
|
return true;
|
|
}
|
|
|
|
setTexts();
|
|
|
|
return m_lastResult;
|
|
}
|
|
|
|
|
|
bool UiRequirementList::checkRequirements(QWidget *messageOnThisParent)
|
|
{
|
|
bool result = true; // as long no requirement failed (even if there are none), the result is positive
|
|
for (auto i = m_requirementList.begin(); i != m_requirementList.end(); ++i)
|
|
{
|
|
UiRequirement &r = (*i);
|
|
|
|
// Todo: Delete from Vector!
|
|
if (!r.isValid())
|
|
continue;
|
|
|
|
if (!r.checkRequirement()) // requirement failed, so all requirements failed, but keep on checking the requirements (to show the user what exactly is wrong)
|
|
{
|
|
result = false; // to NOT break here, checkRequirement() marks all important errors, so it must be called, even if result was already set to false
|
|
}
|
|
}
|
|
|
|
if (!result && messageOnThisParent) // show a message that one or more requirements are not met, but only when a pointer has been given to put the LtsMessageDialog on
|
|
{
|
|
LtsWidgets::LtsMessageDialog::showMessage(messageOnThisParent,
|
|
QApplication::translate("LtsWidgets::LtsDialog",
|
|
"There are elements that have invalid or no value.<br>"
|
|
"Please change values in the elements which are marked with red text."),
|
|
QApplication::translate("LtsWidgets::LtsDialog", "Operation not complete"));
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
|
|
void UiRequirementList::addRequirement(const UiRequirement &uiRequirement)
|
|
{
|
|
m_requirementList.append(uiRequirement);
|
|
}
|
|
|
|
|
|
void UiRequirementList::clear()
|
|
{
|
|
for (auto i = m_requirementList.begin(); i != m_requirementList.end(); ++i)
|
|
{
|
|
UiRequirement &uir = *i;
|
|
uir.reset();
|
|
}
|
|
|
|
m_requirementList.clear();
|
|
}
|
|
|
|
|
|
void UiRequirementList::retranslate()
|
|
{
|
|
for (auto i = m_requirementList.begin(); i != m_requirementList.end(); ++i)
|
|
{
|
|
UiRequirement &r = (*i);
|
|
|
|
r.retranslate();
|
|
}
|
|
}
|
|
} // namespace LtsWidgets
|