Apply clang-format to Lts/Common and DTC/enum headers
- Formatted all CodeGen module files (9 files) - Formatted LtsAppDescriptor module files - Formatted LtsAppManager/AppChooser files - Applied clang-format to all DTC and enum headers across modules - Removed coordTransTests from CommonUnitTestsPlaceholder (moved to tests/) Cosmetic changes only, no functional modifications. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
848 files changed
+89305
-100020
No files matched your search
Executable → Regular
+87
-98
@@ -1,153 +1,142 @@
|
||||
|
||||
|
||||
|
||||
#include "requirement_widget.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)
|
||||
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();
|
||||
retranslate();
|
||||
}
|
||||
|
||||
|
||||
void UiRequirement::reset()
|
||||
{
|
||||
if (!isValid())
|
||||
return;
|
||||
m_descriptionLabel->setText(m_originalText);
|
||||
m_descriptionLabel->setToolTip(m_originalTooltip);
|
||||
if (!isValid())
|
||||
return;
|
||||
m_descriptionLabel->setText(m_originalText);
|
||||
m_descriptionLabel->setToolTip(m_originalTooltip);
|
||||
}
|
||||
|
||||
|
||||
void UiRequirement::setTexts()
|
||||
{
|
||||
if (!isValid())
|
||||
return;
|
||||
if (!m_lastResult)
|
||||
{
|
||||
m_descriptionLabel->setText(QStringLiteral("<span style=\"color:#aa0000;\">\u2022 %1</span>").arg(m_originalText));
|
||||
|
||||
if (!m_userWarningMessage.isEmpty())
|
||||
if (!isValid())
|
||||
return;
|
||||
if (!m_lastResult)
|
||||
{
|
||||
m_descriptionLabel->setCursor(Qt::WhatsThisCursor);
|
||||
m_descriptionLabel->setToolTip(m_userWarningMessage);
|
||||
m_descriptionLabel->setText(
|
||||
QStringLiteral("<span style=\"color:#aa0000;\">\u2022 %1</span>").arg(m_originalText));
|
||||
|
||||
if (!m_userWarningMessage.isEmpty())
|
||||
{
|
||||
m_descriptionLabel->setCursor(Qt::WhatsThisCursor);
|
||||
m_descriptionLabel->setToolTip(m_userWarningMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_originalText.startsWith(QStringLiteral("\u2022 ")))
|
||||
return;
|
||||
else
|
||||
{
|
||||
if (m_originalText.startsWith(QStringLiteral("\u2022 ")))
|
||||
return;
|
||||
|
||||
m_descriptionLabel->setText(QStringLiteral("\u2022 %1").arg(m_originalText));
|
||||
m_descriptionLabel->setCursor(Qt::ArrowCursor);
|
||||
m_descriptionLabel->setToolTip(m_originalTooltip);
|
||||
}
|
||||
m_descriptionLabel->setText(QStringLiteral("\u2022 %1").arg(m_originalText));
|
||||
m_descriptionLabel->setCursor(Qt::ArrowCursor);
|
||||
m_descriptionLabel->setToolTip(m_originalTooltip);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UiRequirement::retranslate()
|
||||
{
|
||||
if (!isValid())
|
||||
return;
|
||||
if (!isValid())
|
||||
return;
|
||||
|
||||
if (m_originalText.startsWith(QStringLiteral("\u2022 ")))
|
||||
return;
|
||||
if (m_originalText.startsWith(QStringLiteral("\u2022 ")))
|
||||
return;
|
||||
|
||||
auto x = m_descriptionLabel->text();
|
||||
if (x.startsWith(QStringLiteral("\u2022 ")))
|
||||
return;
|
||||
auto x = m_descriptionLabel->text();
|
||||
if (x.startsWith(QStringLiteral("\u2022 ")))
|
||||
return;
|
||||
|
||||
m_originalText = x;
|
||||
m_originalText = x;
|
||||
|
||||
m_originalTooltip = m_descriptionLabel->toolTip();
|
||||
setTexts();
|
||||
m_originalTooltip = m_descriptionLabel->toolTip();
|
||||
setTexts();
|
||||
}
|
||||
|
||||
|
||||
bool UiRequirement::checkRequirement()
|
||||
{
|
||||
if (!isValid())
|
||||
return m_lastResult;
|
||||
if (!isValid())
|
||||
return m_lastResult;
|
||||
|
||||
m_lastResult = m_requirementCheck();
|
||||
m_lastResult = m_requirementCheck();
|
||||
|
||||
if (!m_descriptionLabel->isVisible() && !m_descriptionLabel->property("checkMe").toBool())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
setTexts();
|
||||
|
||||
return m_lastResult;
|
||||
}
|
||||
|
||||
|
||||
bool UiRequirementList::checkRequirements(QWidget *messageOnThisParent)
|
||||
{
|
||||
bool result = true;
|
||||
for (auto i = m_requirementList.begin(); i != m_requirementList.end(); ++i)
|
||||
{
|
||||
UiRequirement &r = (*i);
|
||||
|
||||
|
||||
if (!r.isValid())
|
||||
continue;
|
||||
|
||||
if (!r.checkRequirement())
|
||||
if (!m_descriptionLabel->isVisible() && !m_descriptionLabel->property("checkMe").toBool())
|
||||
{
|
||||
result = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!result && messageOnThisParent)
|
||||
{
|
||||
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"));
|
||||
}
|
||||
setTexts();
|
||||
|
||||
return result;
|
||||
return m_lastResult;
|
||||
}
|
||||
|
||||
|
||||
void UiRequirementList::addRequirement(const UiRequirement &uiRequirement)
|
||||
bool UiRequirementList::checkRequirements(QWidget* messageOnThisParent)
|
||||
{
|
||||
m_requirementList.append(uiRequirement);
|
||||
bool result = true;
|
||||
for (auto i = m_requirementList.begin(); i != m_requirementList.end(); ++i)
|
||||
{
|
||||
UiRequirement& r = (*i);
|
||||
|
||||
if (!r.isValid())
|
||||
continue;
|
||||
|
||||
if (!r.checkRequirement())
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!result && messageOnThisParent)
|
||||
{
|
||||
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();
|
||||
}
|
||||
for (auto i = m_requirementList.begin(); i != m_requirementList.end(); ++i)
|
||||
{
|
||||
UiRequirement& uir = *i;
|
||||
uir.reset();
|
||||
}
|
||||
|
||||
m_requirementList.clear();
|
||||
m_requirementList.clear();
|
||||
}
|
||||
|
||||
|
||||
void UiRequirementList::retranslate()
|
||||
{
|
||||
for (auto i = m_requirementList.begin(); i != m_requirementList.end(); ++i)
|
||||
{
|
||||
UiRequirement &r = (*i);
|
||||
for (auto i = m_requirementList.begin(); i != m_requirementList.end(); ++i)
|
||||
{
|
||||
UiRequirement& r = (*i);
|
||||
|
||||
r.retranslate();
|
||||
}
|
||||
r.retranslate();
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace LtsWidgets
|
||||
Reference in new issue
Block a user