Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Tools/LogViewer/logviewtableview.cpp
T
Berrux Kana 3f7beb3c7e Qt6 migration: build fixes for Groups 10/11 + missing plugin modules
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).
2026-10-05 10:49:34 +02:00

140 lines
5.2 KiB
C++
Executable File

/*
* @RDE_HEADER@
* <short description>
* $Id$
* $HeadURL$
* $Author$
* Created by Malte Schröder, SLSE, 2016-07-14
*/
#include "logviewtableview.h"
#include "logviewtablemodel.h"
#include <QtGui/QAction> // Qt6: QAction moved from QtWidgets to QtGui
#include <QtGui/QColor>
#include <QColorDialog>
#include <QtGui/QIcon>
#include <QtWidgets/QMenu>
#include <QMouseEvent>
LogViewTableView::LogViewTableView(QWidget *parent)
: QTableView(parent)
, m_contextMenu(new QMenu(this))
, m_colorMenu(new QMenu(tr("Select Color"), m_contextMenu))
, m_actionSetCellColor(new QAction(m_colorMenu))
, m_actionSetFontColor(new QAction(m_colorMenu))
, m_filterMenu(new QMenu(tr("Select Filter"), m_contextMenu))
, m_actionFilterDate(nullptr)
, m_actionFilterLevel(nullptr)
, m_actionFilterLogger(nullptr)
, m_actionFilterData(nullptr)
, m_actionFilterLocation(nullptr)
, m_actionResetFilter(nullptr)
, m_coords()
, m_contentAvailable(false)
{
this->setMouseTracking(true);
// ---------- COLOR ---------
m_actionSetCellColor = m_colorMenu->addAction(tr("Cell-Color"));
m_actionSetFontColor = m_colorMenu->addAction(tr("Font-Color"));
m_contextMenu->addMenu(m_colorMenu);
// ---------- FILTER ---------
m_actionFilterDate = m_filterMenu->addAction(tr("Date"));
m_actionFilterLevel = m_filterMenu->addAction(tr("Level"));
m_actionFilterLogger = m_filterMenu->addAction(tr("Logger"));
m_actionFilterData = m_filterMenu->addAction(tr("Data"));
m_actionFilterLocation = m_filterMenu->addAction(tr("Location"));
m_filterMenu->addSeparator();
m_actionResetFilter = m_filterMenu->addAction(tr("Reset all filter"));
m_contextMenu->addMenu(m_filterMenu);
// ICONS
m_actionFilterDate->setIcon(QIcon(QLatin1String("://icons/16x16/dialog-ok-apply.png")));
m_actionFilterLevel->setIcon(QIcon(QLatin1String("://icons/16x16/dialog-ok-apply.png")));
m_actionFilterLogger->setIcon(QIcon(QLatin1String("://icons/16x16/dialog-ok-apply.png")));
m_actionFilterData->setIcon(QIcon(QLatin1String("://icons/16x16/dialog-ok-apply.png")));
m_actionFilterLocation->setIcon(QIcon(QLatin1String("://icons/16x16/dialog-ok-apply.png")));
m_actionResetFilter->setIcon(QIcon(QLatin1String("://icons/16x16/edit-undo.png")));
m_actionFilterDate->setIconVisibleInMenu(false);
m_actionFilterLevel->setIconVisibleInMenu(false);
m_actionFilterLogger->setIconVisibleInMenu(false);
m_actionFilterData->setIconVisibleInMenu(false);
m_actionFilterLocation->setIconVisibleInMenu(false);
m_actionResetFilter->setIconVisibleInMenu(true);
connect(m_actionSetCellColor, &QAction::triggered, this, &LogViewTableView::setCellColor);
connect(m_actionSetFontColor, &QAction::triggered, this, &LogViewTableView::setFontColor);
connect(m_actionFilterDate, &QAction::triggered, this, &LogViewTableView::dateFilterIsAboutToChange);
connect(m_actionFilterLevel, &QAction::triggered, this, &LogViewTableView::levelFilterIsAboutToChange);
connect(m_actionFilterLogger, &QAction::triggered, this, &LogViewTableView::loggerFilterIsAboutToChange);
connect(m_actionFilterData, &QAction::triggered, this, &LogViewTableView::dataFilterIsAboutToChange);
connect(m_actionResetFilter, &QAction::triggered, this, &LogViewTableView::resetAllFilter);
connect(m_actionFilterLocation, &QAction::triggered, this, &LogViewTableView::locationFilterIsAboutToChange);
}
LogViewTableView::~LogViewTableView()
{
delete m_contextMenu;
// all other menus and actions are children of m_contextMenu
}
void LogViewTableView::setCellColor()
{
QColor color = QColorDialog::getColor(Qt::white, this, tr("Select cell color"), QColorDialog::DontUseNativeDialog);
QModelIndex index = indexAt(m_coords);
QString level = index.data().toString();
emit cellColorIsAboutToChange(color, level);
}
void LogViewTableView::setFontColor()
{
QColor color = QColorDialog::getColor(Qt::white, this, tr("Select font color"), QColorDialog::DontUseNativeDialog);
QModelIndex index = indexAt(m_coords);
QString level = index.data().toString();
emit fontColorIsAboutToChange(color, level);
}
void LogViewTableView::showActivatedFilter(QVector<bool> &filter)
{
m_actionFilterDate->setIconVisibleInMenu(filter.at(LogViewTableModel::colDate));
m_actionFilterLevel->setIconVisibleInMenu(filter.at(LogViewTableModel::colLevel));
m_actionFilterLogger->setIconVisibleInMenu(filter.at(LogViewTableModel::colLogger));
m_actionFilterData->setIconVisibleInMenu(filter.at(LogViewTableModel::colData));
m_actionFilterLocation->setIconVisibleInMenu(filter.at(LogViewTableModel::colLocation));
}
void LogViewTableView::mouseReleaseEvent(QMouseEvent *event)
{
if (QTableView::indexAt(m_coords).column() == LogViewTableModel::colLevel)
enableColorSubMenuActions(true);
else
enableColorSubMenuActions(false);
if (event->button() == Qt::RightButton
&& m_contentAvailable)
{
emit whichFilterAreActivated();
m_contextMenu->exec(mapToGlobal(m_coords));
}
}
void LogViewTableView::mouseMoveEvent(QMouseEvent *event)
{
m_coords.setX(event->x());
m_coords.setY(event->y());
emit mouseMoved(m_coords);
}
void LogViewTableView::enableColorSubMenuActions(bool checkState)
{
m_actionSetCellColor->setEnabled(checkState);
m_actionSetFontColor->setEnabled(checkState);
}