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>
140 lines
3.3 KiB
C++
Executable File
140 lines
3.3 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Handle HTML output for thp
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
#include "thp_html_widget.h"
|
|
#include "ui_thp_html_widget.h"
|
|
|
|
#include <QUrl>
|
|
#include <QWebEnginePage>
|
|
#include <NGLLogger/NGLLoggerBootstrap.h>
|
|
|
|
|
|
namespace THP
|
|
{
|
|
|
|
class MyQWebEnginePage : public QWebEnginePage
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit MyQWebEnginePage(NGL::INGLLogger &logger, QObject *parent = nullptr)
|
|
: QWebEnginePage(parent)
|
|
, m_logger(logger)
|
|
{}
|
|
MyQWebEnginePage(NGL::INGLLogger &logger, QWebEngineProfile *profile, QObject *parent = nullptr)
|
|
: QWebEnginePage(profile, parent)
|
|
, m_logger(logger)
|
|
{}
|
|
|
|
bool needsToBeOpenedExternally(const QUrl &url)
|
|
{
|
|
const QString lpath = url.toString();
|
|
const QStringRef ext = lpath.splitRef(QLatin1Char('.')).last();
|
|
const QStringRef ext2Chars = ext.left(2);
|
|
if (ext == QLatin1String("html") &&
|
|
lpath.midRef(lpath.lastIndexOf(QLatin1Char('/')) + 1).startsWith(QLatin1String("combined_")))
|
|
return true;
|
|
// PDF
|
|
if (ext == QLatin1String("pdf"))
|
|
return true;
|
|
// A/V playlist
|
|
if (ext == QLatin1String("pls"))
|
|
return true;
|
|
// Situation
|
|
if (ext == QLatin1String("json"))
|
|
return true;
|
|
// Word/Excel/PowerPoint
|
|
if (ext2Chars == QLatin1String("do") ||
|
|
ext2Chars == QLatin1String("xl") ||
|
|
ext2Chars == QLatin1String("pp"))
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
bool acceptNavigationRequest(const QUrl &url,
|
|
QWebEnginePage::NavigationType type,
|
|
bool isMainFrame) override
|
|
{
|
|
Q_UNUSED(isMainFrame)
|
|
if (type == QWebEnginePage::NavigationTypeLinkClicked)
|
|
{
|
|
if (needsToBeOpenedExternally(url))
|
|
{
|
|
emit linkClicked(url);
|
|
DEBUG_LOG(m_logger) << "acceptNavigationRequest denied for " << url.toString();
|
|
return false;
|
|
}
|
|
}
|
|
DEBUG_LOG(m_logger) << "acceptNavigationRequest allowed for " << url.toString();
|
|
return true;
|
|
}
|
|
|
|
Q_SIGNALS:
|
|
void linkClicked(const QUrl &url);
|
|
private:
|
|
NGL::INGLLogger &m_logger;
|
|
|
|
};
|
|
|
|
HtmlWidget::HtmlWidget(QWidget *parent)
|
|
: QWidget(parent)
|
|
, ui(new Ui::HtmlWidget)
|
|
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("THP.HtmlWidget"))
|
|
{
|
|
ui->setupUi(this);
|
|
auto webEnginePage = new MyQWebEnginePage(m_logger, this);
|
|
ui->html->setPage(webEnginePage);
|
|
connect(webEnginePage, &MyQWebEnginePage::linkClicked, this, &HtmlWidget::linkClicked);
|
|
connect(ui->html, &QWebEngineView::loadFinished, this, &HtmlWidget::loadFinished);
|
|
connect(ui->html, &QWebEngineView::urlChanged, this, &HtmlWidget::urlChanged);
|
|
connect(ui->html, &QWebEngineView::titleChanged, this, &HtmlWidget::titleChanged);
|
|
}
|
|
|
|
HtmlWidget::~HtmlWidget()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void HtmlWidget::back()
|
|
{
|
|
ui->html->back();
|
|
}
|
|
|
|
QString HtmlWidget::title() const
|
|
{
|
|
return ui->html->title();
|
|
}
|
|
|
|
QUrl HtmlWidget::url() const
|
|
{
|
|
return ui->html->url();
|
|
}
|
|
|
|
bool HtmlWidget::showHTML(const QUrl &url)
|
|
{
|
|
if (!url.isValid())
|
|
{
|
|
WARNING_LOG(m_logger) << "Invalid url: " << url.toString();
|
|
return false;
|
|
}
|
|
ui->html->load(url);
|
|
return true;
|
|
}
|
|
|
|
void HtmlWidget::setZoomFactor(double newZoomFactor)
|
|
{
|
|
ui->html->setZoomFactor(newZoomFactor);
|
|
}
|
|
|
|
void HtmlWidget::print(QPrinter *printer) const
|
|
{
|
|
ui->html->page()->print(printer, [](bool) {});
|
|
}
|
|
|
|
} // namespace THP
|
|
|
|
#include "thp_html_widget.moc"
|