ifcviewer: replace qInfo/qWarning with a Qt-free logger seam

Add Log.h (in IfcViewerCore) — a tiny stream-style logger that backs
fprintf(stderr,...), with overloads for the common primitives + char
strings. Mimics qInfo()/qWarning()'s syntax surface enough that
mass-replacing qInfo()→Log::info() and qWarning()→Log::warn() keeps
existing call sites parsing unchanged; .noquote() / .nospace() exist
as compat no-ops so chained qInfo().noquote()<<x<<y patterns survive.

QString streaming is a transitional concern — the QString → std::string
sweep (#80) hasn't landed yet, so ViewportWindow and friends still
construct QStrings for log payloads. LogQt.h (in IfcViewer, not Core)
adds the QString / QStringView operator<< overloads so those streaming
sites work without source changes during the in-flight Qt removal.
When #80 retires QString, LogQt.h drops out.

ViewportWindow.cpp: 132 qInfo/qWarning callsites converted. The two
printf-style qInfo("fmt %s", ...) callsites get fprintf with explicit
[info]/[warn] prefixes to keep the output discoverable.

Also de-Qt'd:
  AreaMeasurement.cpp  — 1 qInfo("fmt", …) → fprintf
  SceneLoader.cpp      — 4 qDebug + 1 qWarning printf-style → fprintf
  GeometryStreamer.cpp — 2 qDebug printf-style → fprintf
  ifcviewer-minimal/main.cpp — 2 qWarning << → Log::warn

Drops <QDebug> from each. Closes #82.

Builds: desktop / bonsai / web all green. Tests 100/100 pass.
This commit is contained in:
Dion Moult
2026-06-05 08:58:45 +10:00
parent 77cf535b45
commit 6dd3558db9
8 changed files with 348 additions and 161 deletions
+9 -7
View File
@@ -34,7 +34,7 @@
#include <limits>
#include <set>
#include <QDebug>
#include <cstdio>
#include <QElapsedTimer>
struct MaterialInfo {
@@ -453,9 +453,10 @@ void GeometryStreamer::run(const std::string& path, int num_threads) {
return;
}
if (!gross_ids.empty()) {
qDebug("Excessive voids: %zu element(s) will be loaded without "
"opening subtractions",
gross_ids.size());
std::fprintf(stderr,
"[info] Excessive voids: %zu element(s) will be loaded without "
"opening subtractions\n",
gross_ids.size());
}
// Shared dedup + AABB state across passes — same geom.id() across
@@ -696,8 +697,9 @@ void GeometryStreamer::run(const std::string& path, int num_threads) {
double dedup_ratio = total_meshes > 0
? static_cast<double>(total_shapes) / static_cast<double>(total_meshes) : 1.0;
qDebug("Streamer done: %s %.2fs shapes=%u unique_meshes=%u dedup=%.2fx",
path.c_str(), stream_timer.elapsed() / 1000.0,
total_shapes, total_meshes, dedup_ratio);
std::fprintf(stderr,
"[info] Streamer done: %s %.2fs shapes=%u unique_meshes=%u dedup=%.2fx\n",
path.c_str(), stream_timer.elapsed() / 1000.0,
total_shapes, total_meshes, dedup_ratio);
succeeded_ = !cancel_requested_.load();
}