- training_area_telegrams.cpp: Fixed QJsonObject initializer syntax (Qt6 requires {{}} not ({}))
- training_area_telegrams.cpp: Fixed fromJson() methods to access m_* members directly
- training_area_telegrams.cpp: Fixed brace mismatches in multiple toJson() methods
- training_area_telegrams.h: Changed Header struct to public members for consistency
- tx_mixin.cpp: Fixed getEquipmentNumber() template for direct member access
- lts_coordinate.cpp: Added missing #include <iomanip>
- MIGRATION_STATUS.md: Added migration progress tracking document
C++17 constraint enforced due to RTI Connext DDS 7.7.0 incompatibility with C++20+
Build status: BUILD_RTI=OFF successful (0 errors, warnings only)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
200 lines
5.8 KiB
C++
200 lines
5.8 KiB
C++
#include "lts_screen_wide.h"
|
|
|
|
#include "lts_dummy_widget.h"
|
|
#include "lts_screen_container.h"
|
|
|
|
#include <LtsWidgets/lts_base_layout_widget.h>
|
|
#include <QtCore/QDebug>
|
|
#include <QtWidgets/QHBoxLayout>
|
|
#include <QtWidgets/QSplitter>
|
|
#include <QtCore/QTimer>
|
|
#ifdef Q_OS_WIN
|
|
#include <QtPlatformHeaders/qwindowswindowfunctions.h>
|
|
#endif
|
|
|
|
namespace LtsMultiMonitor
|
|
{
|
|
|
|
LtsScreenWide::LtsScreenWide(const QRect& screenGeo, int screenId, bool debugMargins, const QString& serial)
|
|
: LtsScreenBase(screenGeo, screenId, debugMargins, serial), m_childContainerMain(new LtsScreenContainer(screenGeo)),
|
|
m_childContainerLeft(new LtsScreenContainer(screenGeo)), m_childContainerRight(new LtsScreenContainer(screenGeo))
|
|
{
|
|
|
|
connect(m_childContainerMain, &LtsScreenContainer::check, this, &LtsScreenWide::check);
|
|
connect(m_childContainerLeft, &LtsScreenContainer::check, this, &LtsScreenWide::check);
|
|
connect(m_childContainerRight, &LtsScreenContainer::check, this, &LtsScreenWide::check);
|
|
|
|
auto* theLayout = new QHBoxLayout;
|
|
|
|
theLayout->setContentsMargins(0, 0, 0, 0);
|
|
theLayout->setSpacing(0);
|
|
theLayout->setStretch(0, 9999);
|
|
|
|
m_splitter = new QSplitter;
|
|
m_splitter->setContentsMargins(0, 0, 0, 0);
|
|
|
|
m_splitter->addWidget(m_childContainerLeft);
|
|
m_splitter->addWidget(m_childContainerRight);
|
|
|
|
theLayout->addWidget(m_splitter);
|
|
theLayout->addWidget(m_childContainerMain);
|
|
|
|
m_screenDialog->setLayout(theLayout);
|
|
|
|
m_splitter->hide();
|
|
}
|
|
|
|
void LtsScreenWide::putWidgetUnmanagedMain(QWidget* widget)
|
|
{
|
|
|
|
m_childContainerMain->setWidget(widget);
|
|
}
|
|
|
|
void LtsScreenWide::putWidgetUnmanagedRight(QWidget* widget)
|
|
{
|
|
|
|
m_childContainerRight->setWidget(widget);
|
|
}
|
|
|
|
void LtsScreenWide::putWidgetUnmanagedLeft(QWidget* widget)
|
|
{
|
|
|
|
m_childContainerLeft->setWidget(widget);
|
|
}
|
|
|
|
bool LtsScreenWide::hasWidget(QWidget* widget) const
|
|
{
|
|
return (m_childContainerMain->hasWidget(widget) || m_childContainerLeft->hasWidget(widget) ||
|
|
m_childContainerRight->hasWidget(widget));
|
|
}
|
|
|
|
bool LtsScreenWide::isIrreplaceable() const
|
|
{
|
|
return (childLeft()->isIrreplaceable() && childRight()->isIrreplaceable() && childMain()->isIrreplaceable());
|
|
}
|
|
|
|
bool LtsScreenWide::isEmpty() const
|
|
{
|
|
return (m_childContainerLeft->isEmpty() && m_childContainerRight->isEmpty() && m_childContainerMain->isEmpty());
|
|
}
|
|
|
|
int LtsScreenWide::containerIdOfWidget(QWidget* widget) const noexcept(false)
|
|
{
|
|
if (m_childContainerMain->hasWidget(widget))
|
|
return 0;
|
|
if (m_childContainerLeft->hasWidget(widget))
|
|
return 1;
|
|
if (m_childContainerRight->hasWidget(widget))
|
|
return 2;
|
|
throw "widget not on this screen";
|
|
}
|
|
|
|
LtsScreenContainer* LtsScreenWide::containerOfWidget(QWidget* widget) noexcept(false)
|
|
{
|
|
if (m_childContainerMain->hasWidget(widget))
|
|
return m_childContainerMain;
|
|
if (m_childContainerLeft->hasWidget(widget))
|
|
return m_childContainerLeft;
|
|
if (m_childContainerRight->hasWidget(widget))
|
|
return m_childContainerRight;
|
|
throw "widget is not present on this container";
|
|
}
|
|
|
|
LtsScreenContainer* LtsScreenWide::putWidget(QWidget* widget, int screenPart) noexcept(false)
|
|
{
|
|
if (screenPart == -1)
|
|
{
|
|
if (!isEmpty())
|
|
throw "cannot put widget as at least one container is occupied and screen part was not specified";
|
|
|
|
putWidgetUnmanagedMain(widget);
|
|
return m_childContainerMain;
|
|
}
|
|
|
|
switch (screenPart)
|
|
{
|
|
case 0: {
|
|
if (!m_childContainerMain->isEmpty())
|
|
throw "cannot put widget as main container is already occupied";
|
|
|
|
putWidgetUnmanagedMain(widget);
|
|
return m_childContainerMain;
|
|
}
|
|
|
|
case 1: {
|
|
if (!m_childContainerLeft->isEmpty())
|
|
throw "cannot put widget as left container is already occupied";
|
|
|
|
if (!m_childContainerMain->isEmpty())
|
|
putWidgetUnmanagedRight(m_childContainerMain->stealWidget());
|
|
|
|
putWidgetUnmanagedLeft(widget);
|
|
return m_childContainerLeft;
|
|
}
|
|
|
|
case 2: {
|
|
if (!m_childContainerRight->isEmpty())
|
|
throw "cannot put widget as right container is already occupied";
|
|
|
|
if (!m_childContainerMain->isEmpty())
|
|
putWidgetUnmanagedLeft(m_childContainerMain->stealWidget());
|
|
|
|
putWidgetUnmanagedRight(widget);
|
|
return m_childContainerRight;
|
|
}
|
|
|
|
default: {
|
|
throw "unknown screen part id";
|
|
}
|
|
}
|
|
}
|
|
|
|
void LtsScreenWide::check()
|
|
{
|
|
|
|
Q_ASSERT(
|
|
(!m_childContainerMain->isEmpty() && m_childContainerLeft->isEmpty() && m_childContainerRight->isEmpty()) ||
|
|
m_childContainerMain->isEmpty());
|
|
|
|
if (m_childContainerMain->isEmpty())
|
|
{
|
|
if (m_childContainerLeft->isEmpty() && !m_childContainerRight->isEmpty())
|
|
{
|
|
try
|
|
{
|
|
QWidget* widget = m_childContainerRight->stealWidget();
|
|
m_childContainerMain->setWidget(widget);
|
|
}
|
|
catch (...)
|
|
{
|
|
}
|
|
}
|
|
else if (!m_childContainerLeft->isEmpty() && m_childContainerRight->isEmpty())
|
|
{
|
|
try
|
|
{
|
|
QWidget* widget = m_childContainerLeft->stealWidget();
|
|
m_childContainerMain->setWidget(widget);
|
|
}
|
|
catch (...)
|
|
{
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!m_childContainerMain->isEmpty())
|
|
{
|
|
|
|
m_childContainerMain->show();
|
|
m_splitter->hide();
|
|
return;
|
|
}
|
|
|
|
m_childContainerMain->hide();
|
|
m_splitter->setVisible(!m_childContainerLeft->isEmpty() || !m_childContainerRight->isEmpty());
|
|
m_childContainerLeft->setVisible(!m_childContainerLeft->isEmpty());
|
|
m_childContainerRight->setVisible(!m_childContainerRight->isEmpty());
|
|
}
|
|
|
|
} // namespace LtsMultiMonitor
|