Swap interface into IfcViewerFull

Replace the old IfcViewerFull application tree with the interface-based viewer while preserving the IfcViewerFull target and build workflow.

Generated with the assistance of an AI coding tool.
This commit is contained in:
Dion Moult
2026-05-15 07:18:26 +10:00
parent 03b8b9c1bd
commit 4a91e6a87d
117 changed files with 672 additions and 3201 deletions
+40 -35
View File
@@ -1,3 +1,4 @@
// This file was generated with the assistance of an AI coding tool.
/********************************************************************************
* *
* This file is part of IfcOpenShell. *
@@ -17,18 +18,40 @@
* *
********************************************************************************/
#include <QApplication>
#include <QSurfaceFormat>
#include <QCommandLineParser>
#include "MainWindow.h"
#include "InterfaceSettings.h"
#include "components/Style.h"
#include <QApplication>
#include <QCommandLineParser>
#include <QFont>
#include <QFontDatabase>
#include <QSurfaceFormat>
namespace {
void installUiFont() {
const int font_id = QFontDatabase::addApplicationFont(
":/fonts/DMSans-VariableFont_opsz,wght.ttf");
QString family;
if (font_id >= 0) {
const QStringList families = QFontDatabase::applicationFontFamilies(font_id);
if (!families.isEmpty()) {
family = families.front();
}
}
if (!family.isEmpty()) {
QApplication::setFont(QFont(family, 10));
}
}
} // namespace
int main(int argc, char* argv[]) {
QApplication app(argc, argv);
app.setApplicationName("IfcViewer");
app.setOrganizationName("IfcOpenShell");
// Request OpenGL 4.5 Core globally
QSurfaceFormat fmt;
fmt.setVersion(4, 5);
fmt.setProfile(QSurfaceFormat::CoreProfile);
@@ -38,39 +61,21 @@ int main(int argc, char* argv[]) {
QSurfaceFormat::setDefaultFormat(fmt);
QCommandLineParser parser;
parser.setApplicationDescription("IfcOpenShell IFC Viewer");
parser.setApplicationDescription("IfcOpenShell IFC viewer");
parser.addHelpOption();
parser.addPositionalArgument("files",
"IFC file(s) and/or one .ifcfed federation to open",
"[files...]");
parser.addOption({{"c", "camera"},
"Set camera: tx,ty,tz,dist,yaw,pitch", "params"});
parser.addOption({{"b", "benchmark"},
"Run N frames then print stats and exit", "frames"});
parser.process(app);
MainWindow window;
installUiFont();
const auto applyStyle = [&app]() {
app.setStyleSheet(ifcinterface::components::style::buildAppStyleSheet());
};
applyStyle();
QObject::connect(&ifcinterface::InterfaceSettings::instance(),
&ifcinterface::InterfaceSettings::themeChanged,
&app,
applyStyle);
ifcinterface::shell::MainWindow window;
window.show();
auto args = parser.positionalArguments();
QStringList file_args;
QString fed_arg;
for (const auto& a : args) {
if (fed_arg.isEmpty() && a.endsWith(".ifcfed", Qt::CaseInsensitive)) {
fed_arg = a;
} else {
file_args << a;
}
}
if (!fed_arg.isEmpty()) window.openFederation(fed_arg);
if (!file_args.isEmpty()) window.addFiles(file_args);
if (parser.isSet("camera")) {
window.setPendingCamera(parser.value("camera"));
}
if (parser.isSet("benchmark")) {
window.setPendingBenchmark(parser.value("benchmark").toInt());
}
return app.exec();
}