Continue the Qt5->Qt6 migration so the LTS Projects (Group 10) and LTS
Application (Group 11) compile, link, and ctest runs.
Qt5->Qt6 API migration (resolves removed/deprecated Qt6 APIs) across Lts
Tools and Apps, e.g. QAction->QActionGroup, QAbstractSocket::errorOccurred,
Qt::SkipEmptyParts, QRandomGenerator, QInputDevice::DeviceType,
QRegularExpression, QLatin1Literal->QStringLiteral, and the SampleModel
m_description->description rename.
CMake build fixes:
- CMakeLists.txt: add Lts/Common to CMAKE_AUTOMOC_INCLUDE_DIRECTORIES so moc
resolves Q_INTERFACES(ProjectPlugin::Plugin) for the migrated Projects.
- cmake/NGLMacros.cmake: NGL_COMPILE_RESOURCES - replace return() (which aborts
the calling CMakeLists.txt) with an if/else/endif.
- OpApp/THP: guard the ArcGISQt5Hack link with $<IF:$<TARGET_EXISTS:...>> (the
target is absent when the SituationMap viewer is stubbed); matches
CentralEffectSimulation.
- LtsSession: prefer the in-tree svcCoreClient target over a FIND_LIBRARY in
/usr/local/lib.
- CnrProxyTester/DotMatrixDisplay: set AUTOUIC_SEARCH_PATHS for the ui/ subdir.
- TopicDiscover: link NGLLogger.
Export-header visibility stubs (expand the empty *_EXPORT macro to
__attribute__((visibility("default"))); the build sets -fvisibility=hidden and
these stubs shadow the CMake-generated header):
- include/LtsProjectionWorkstation/ltsprojectionworkstation_export.h (fixes
undefined reference to LtsProjectionWorkstation::getInstance /
setProjectionOperatorPreset)
- include/LtsSession/ltssession_export.h, include/LtsUtilsGuiDds/ltsutilsguidds_export.h (same pattern)
New plugin modules (copied from legacy) so LtsAppDescriptorChecker finds the
gui:3 IIDs referenced by the Projects' apps.json:
- TakeHomePackageManager/OldTHP gui:3:tpm.man, gui:3:tpm.usb
- PresentationManagement/.../ScriptEditor gui:3:pre.script.edit
- Timeline/Gui/EventTimelineClassic gui:3:tln.view
new_docker_build.sh: correct group targets to the actual CMake target names,
guard LtsReportDisplay on BUILD_CODIFICATION, and skip modules unavailable in
the prebuilt image (AsmWorkstationCertifier/botan2, TrajectoryWidget,
VideoImport, thp_viewer/VLC).
223 lines
4.4 KiB
C++
Executable File
223 lines
4.4 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Implements n QLedChars to display a line of Text/Image
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Florian Schult, SLSE, 2016-03-18
|
|
*/
|
|
#include "qledline.h"
|
|
|
|
#include <QString>
|
|
#include <QLayout>
|
|
#include <QTimer>
|
|
#include <QImage>
|
|
|
|
#include "qledchar.h"
|
|
|
|
QLedLine::QLedLine(QWidget *parent)
|
|
: QWidget(parent)
|
|
, m_charCount(0)
|
|
, m_height(0)
|
|
, m_visible(true)
|
|
, m_text()
|
|
, m_layout(new QHBoxLayout(this))
|
|
, m_chars()
|
|
, m_flashTimer(new QTimer(this))
|
|
, m_color(Qt::red) // Standard color
|
|
, m_image()
|
|
{
|
|
m_layout->setSpacing(0);
|
|
m_layout->setContentsMargins(0,0,0,0);
|
|
|
|
QSpacerItem *sp1 = new QSpacerItem(0,0, QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
QSpacerItem *sp2 = new QSpacerItem(0,0, QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
|
|
m_layout->addSpacerItem(sp1);
|
|
m_layout->addSpacerItem(sp2);
|
|
m_layout->setAlignment(m_layout, Qt::AlignHCenter);
|
|
}
|
|
|
|
QLedLine::~QLedLine()
|
|
{
|
|
qDeleteAll(m_chars);
|
|
// optional. They have "this" as parent and are QT.
|
|
delete m_layout;
|
|
delete m_flashTimer;
|
|
}
|
|
|
|
QString QLedLine::shownText() const
|
|
{
|
|
return m_text.leftJustified(m_chars.size(), QLatin1Char(' '), true);
|
|
}
|
|
|
|
bool QLedLine::isTextVisible() const
|
|
{
|
|
return m_visible;
|
|
}
|
|
|
|
int QLedLine::flashTime() const
|
|
{
|
|
return m_flashTimer->interval();
|
|
}
|
|
|
|
QColor QLedLine::color() const
|
|
{
|
|
return m_color;
|
|
}
|
|
|
|
void QLedLine::setText(const QString &text)
|
|
{
|
|
m_text = text;
|
|
|
|
// Todo: Arabic: RightJustified? Automatic?
|
|
QString shown = shownText();
|
|
for (int i=0; i<m_chars.size(); ++i)
|
|
m_chars[i]->setLetter(shown[i]);
|
|
}
|
|
|
|
// Expects a properly sized QImage, corresponding to the count and Pixelsizes of QLedLine and QLedChar
|
|
void QLedLine::setImage(const QImage &image)
|
|
{
|
|
m_image = image;
|
|
QImage charImage;
|
|
QSize charSize = m_chars[0]->charSize();
|
|
|
|
for (int i=0; i<m_chars.size(); ++i)
|
|
{
|
|
charImage = m_image.copy((charSize.width() * i), 0, charSize.width(), charSize.height());
|
|
m_chars[i]->setImage(charImage);
|
|
}
|
|
}
|
|
|
|
QSize QLedLine::charSize() const
|
|
{
|
|
return m_chars[0]->charSize();
|
|
}
|
|
|
|
QString QLedLine::text() const
|
|
{
|
|
return m_text;
|
|
}
|
|
|
|
void QLedLine::addChar()
|
|
{
|
|
QLedChar *ledChar = new QLedChar(m_height, this, m_text[m_chars.size()]);
|
|
ledChar->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
|
if (!m_chars.isEmpty())
|
|
ledChar->setLetterVisible(m_chars[0]->letterVisible());
|
|
connect(m_flashTimer, &QTimer::timeout, ledChar, &QLedChar::onFlashTimerTimeout);
|
|
ledChar->setColor(m_color);
|
|
|
|
// Takes the last stretch-item and puts it behind the new added ledChar
|
|
QLayoutItem *spacer = m_layout->takeAt(m_layout->count()-1);
|
|
m_layout->addWidget(ledChar);
|
|
m_layout->addItem(spacer);
|
|
|
|
m_chars.append(ledChar);
|
|
ledChar->setLetter(shownText().at(m_chars.size()-1));
|
|
}
|
|
|
|
void QLedLine::deleteChar()
|
|
{
|
|
if (m_chars.isEmpty())
|
|
return;
|
|
|
|
delete m_chars.last();
|
|
m_chars.remove(m_chars.size()-1);
|
|
}
|
|
|
|
void QLedLine::setCharCount(int charCount)
|
|
{
|
|
m_charCount = charCount;
|
|
while(m_chars.size() != m_charCount)
|
|
{
|
|
if(m_chars.size() > m_charCount)
|
|
deleteChar();
|
|
else if(m_chars.size() < m_charCount)
|
|
addChar();
|
|
}
|
|
}
|
|
|
|
int QLedLine::charCount() const
|
|
{
|
|
return m_charCount;
|
|
}
|
|
|
|
void QLedLine::setHeight(int height)
|
|
{
|
|
m_height = height;
|
|
|
|
for(int i=0; i<m_chars.size(); ++i)
|
|
{
|
|
m_chars[i]->setCharHeight(m_height);
|
|
}
|
|
setText(m_text);
|
|
}
|
|
|
|
int QLedLine::height() const
|
|
{
|
|
return m_height;
|
|
}
|
|
|
|
void QLedLine::setCharCountAndHeight(int charCount, int height)
|
|
{
|
|
setHeight(height);
|
|
setCharCount(charCount);
|
|
}
|
|
|
|
void QLedLine::setColor(const QColor &color)
|
|
{
|
|
m_color = color;
|
|
for (int i=0; i<m_charCount; ++i)
|
|
m_chars[i]->setColor(color);
|
|
}
|
|
|
|
void QLedLine::clear()
|
|
{
|
|
for (int i=0; i<m_charCount; ++i)
|
|
{
|
|
m_chars[i]->setLetterVisible(false);
|
|
m_chars[i]->setLetterVisible(true);
|
|
}
|
|
}
|
|
|
|
void QLedLine::setFlashing(int msecs)
|
|
{
|
|
m_flashTimer->setInterval(msecs);
|
|
if (msecs == 0)
|
|
{
|
|
if (m_visible)
|
|
{
|
|
for (int i = 0; i < m_chars.size(); ++i)
|
|
m_chars[i]->setLetterVisible();
|
|
}
|
|
m_flashTimer->stop();
|
|
}
|
|
else
|
|
{
|
|
if(m_visible)
|
|
m_flashTimer->start();
|
|
else
|
|
m_flashTimer->stop();
|
|
}
|
|
}
|
|
|
|
void QLedLine::setTextVisible(bool visible)
|
|
{
|
|
m_visible = visible;
|
|
for (int i=0; i<m_chars.size(); ++i)
|
|
m_chars[i]->setLetterVisible(m_visible);
|
|
|
|
if(m_visible)
|
|
{
|
|
if(m_flashTimer->interval() > 0)
|
|
m_flashTimer->start();
|
|
}
|
|
else
|
|
{
|
|
m_flashTimer->stop();
|
|
}
|
|
}
|
|
|