From 7f153375b25e5d17d8017be82c5e9ba81cc5afce Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Sat, 9 May 2026 19:43:26 +1000 Subject: [PATCH] Rename interface modules Move interface features from panels into modules, move AddModelDialog into the models module, and rename module Widget surfaces to Panel. Generated with the assistance of an AI coding tool. --- src/interface/CMakeLists.txt | 58 ++++---- src/interface/MainWindow.cpp | 62 ++++---- src/interface/MainWindow.h | 40 ++--- .../project/Controller.cpp | 8 +- .../{panels => modules}/project/Controller.h | 16 +- .../properties/Panel.cpp} | 18 +-- .../Widget.h => modules/properties/Panel.h} | 12 +- .../{panels => modules}/properties/Types.h | 4 +- .../{panels => modules}/properties/View.cpp | 8 +- .../{panels => modules}/properties/View.h | 10 +- .../{panels => modules}/settings/Dialog.cpp | 4 +- .../{panels => modules}/settings/Dialog.h | 4 +- .../spatial_hierarchy/Panel.cpp} | 16 +- .../spatial_hierarchy/Panel.h} | 12 +- .../spatial_hierarchy/Types.h | 4 +- .../spatial_hierarchy/View.cpp | 10 +- .../spatial_hierarchy/View.h | 10 +- .../Widget.cpp => modules/todo/Panel.cpp} | 8 +- .../todo/Widget.h => modules/todo/Panel.h} | 12 +- .../viewport/Controller.cpp | 4 +- .../{panels => modules}/viewport/Controller.h | 4 +- .../Widget.cpp => modules/viewport/Panel.cpp} | 8 +- .../Widget.h => modules/viewport/Panel.h} | 12 +- src/interface/panels/add_model/Dialog.cpp | 140 ------------------ src/interface/panels/add_model/Dialog.h | 50 ------- 25 files changed, 172 insertions(+), 362 deletions(-) rename src/interface/{panels => modules}/project/Controller.cpp (96%) rename src/interface/{panels => modules}/project/Controller.h (82%) rename src/interface/{panels/properties/Widget.cpp => modules/properties/Panel.cpp} (93%) rename src/interface/{panels/properties/Widget.h => modules/properties/Panel.h} (86%) rename src/interface/{panels => modules}/properties/Types.h (95%) rename src/interface/{panels => modules}/properties/View.cpp (96%) rename src/interface/{panels => modules}/properties/View.h (89%) rename src/interface/{panels => modules}/settings/Dialog.cpp (99%) rename src/interface/{panels => modules}/settings/Dialog.h (96%) rename src/interface/{panels/spatial_hierarchy/Widget.cpp => modules/spatial_hierarchy/Panel.cpp} (87%) rename src/interface/{panels/spatial_hierarchy/Widget.h => modules/spatial_hierarchy/Panel.h} (84%) rename src/interface/{panels => modules}/spatial_hierarchy/Types.h (94%) rename src/interface/{panels => modules}/spatial_hierarchy/View.cpp (91%) rename src/interface/{panels => modules}/spatial_hierarchy/View.h (88%) rename src/interface/{panels/todo/Widget.cpp => modules/todo/Panel.cpp} (93%) rename src/interface/{panels/todo/Widget.h => modules/todo/Panel.h} (84%) rename src/interface/{panels => modules}/viewport/Controller.cpp (98%) rename src/interface/{panels => modules}/viewport/Controller.h (96%) rename src/interface/{panels/viewport/Widget.cpp => modules/viewport/Panel.cpp} (94%) rename src/interface/{panels/viewport/Widget.h => modules/viewport/Panel.h} (86%) delete mode 100644 src/interface/panels/add_model/Dialog.cpp delete mode 100644 src/interface/panels/add_model/Dialog.h diff --git a/src/interface/CMakeLists.txt b/src/interface/CMakeLists.txt index a0fce1ae86..9de468bebb 100644 --- a/src/interface/CMakeLists.txt +++ b/src/interface/CMakeLists.txt @@ -47,35 +47,35 @@ set(INTERFACE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/components/Section.h ${CMAKE_CURRENT_SOURCE_DIR}/components/Panel.cpp ${CMAKE_CURRENT_SOURCE_DIR}/components/Panel.h - ${CMAKE_CURRENT_SOURCE_DIR}/panels/add_model/Dialog.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/panels/add_model/Dialog.h - ${CMAKE_CURRENT_SOURCE_DIR}/panels/models/Types.h - ${CMAKE_CURRENT_SOURCE_DIR}/panels/models/Controller.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/panels/models/Controller.h - ${CMAKE_CURRENT_SOURCE_DIR}/panels/models/Widget.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/panels/models/Widget.h - ${CMAKE_CURRENT_SOURCE_DIR}/panels/models/View.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/panels/models/View.h - ${CMAKE_CURRENT_SOURCE_DIR}/panels/todo/Widget.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/panels/todo/Widget.h - ${CMAKE_CURRENT_SOURCE_DIR}/panels/properties/Types.h - ${CMAKE_CURRENT_SOURCE_DIR}/panels/properties/Widget.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/panels/properties/Widget.h - ${CMAKE_CURRENT_SOURCE_DIR}/panels/properties/View.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/panels/properties/View.h - ${CMAKE_CURRENT_SOURCE_DIR}/panels/project/Controller.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/panels/project/Controller.h - ${CMAKE_CURRENT_SOURCE_DIR}/panels/settings/Dialog.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/panels/settings/Dialog.h - ${CMAKE_CURRENT_SOURCE_DIR}/panels/spatial_hierarchy/Types.h - ${CMAKE_CURRENT_SOURCE_DIR}/panels/spatial_hierarchy/Widget.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/panels/spatial_hierarchy/Widget.h - ${CMAKE_CURRENT_SOURCE_DIR}/panels/spatial_hierarchy/View.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/panels/spatial_hierarchy/View.h - ${CMAKE_CURRENT_SOURCE_DIR}/panels/viewport/Widget.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/panels/viewport/Widget.h - ${CMAKE_CURRENT_SOURCE_DIR}/panels/viewport/Controller.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/panels/viewport/Controller.h + ${CMAKE_CURRENT_SOURCE_DIR}/modules/models/AddModelDialog.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/modules/models/AddModelDialog.h + ${CMAKE_CURRENT_SOURCE_DIR}/modules/models/Types.h + ${CMAKE_CURRENT_SOURCE_DIR}/modules/models/Controller.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/modules/models/Controller.h + ${CMAKE_CURRENT_SOURCE_DIR}/modules/models/Panel.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/modules/models/Panel.h + ${CMAKE_CURRENT_SOURCE_DIR}/modules/models/View.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/modules/models/View.h + ${CMAKE_CURRENT_SOURCE_DIR}/modules/todo/Panel.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/modules/todo/Panel.h + ${CMAKE_CURRENT_SOURCE_DIR}/modules/properties/Types.h + ${CMAKE_CURRENT_SOURCE_DIR}/modules/properties/Panel.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/modules/properties/Panel.h + ${CMAKE_CURRENT_SOURCE_DIR}/modules/properties/View.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/modules/properties/View.h + ${CMAKE_CURRENT_SOURCE_DIR}/modules/project/Controller.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/modules/project/Controller.h + ${CMAKE_CURRENT_SOURCE_DIR}/modules/settings/Dialog.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/modules/settings/Dialog.h + ${CMAKE_CURRENT_SOURCE_DIR}/modules/spatial_hierarchy/Types.h + ${CMAKE_CURRENT_SOURCE_DIR}/modules/spatial_hierarchy/Panel.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/modules/spatial_hierarchy/Panel.h + ${CMAKE_CURRENT_SOURCE_DIR}/modules/spatial_hierarchy/View.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/modules/spatial_hierarchy/View.h + ${CMAKE_CURRENT_SOURCE_DIR}/modules/viewport/Panel.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/modules/viewport/Panel.h + ${CMAKE_CURRENT_SOURCE_DIR}/modules/viewport/Controller.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/modules/viewport/Controller.h ${CMAKE_CURRENT_SOURCE_DIR}/interface_resources.qrc ) diff --git a/src/interface/MainWindow.cpp b/src/interface/MainWindow.cpp index 13c4c83b85..3dad893ab6 100644 --- a/src/interface/MainWindow.cpp +++ b/src/interface/MainWindow.cpp @@ -30,18 +30,18 @@ #include "components/Panel.h" #include "components/Style.h" #include "components/Tabs.h" -#include "panels/models/Controller.h" -#include "panels/todo/Widget.h" -#include "panels/models/View.h" -#include "panels/models/Widget.h" -#include "panels/project/Controller.h" -#include "panels/properties/View.h" -#include "panels/properties/Widget.h" -#include "panels/settings/Dialog.h" -#include "panels/spatial_hierarchy/View.h" -#include "panels/spatial_hierarchy/Widget.h" -#include "panels/viewport/Controller.h" -#include "panels/viewport/Widget.h" +#include "modules/models/Controller.h" +#include "modules/todo/Panel.h" +#include "modules/models/View.h" +#include "modules/models/Panel.h" +#include "modules/project/Controller.h" +#include "modules/properties/View.h" +#include "modules/properties/Panel.h" +#include "modules/settings/Dialog.h" +#include "modules/spatial_hierarchy/View.h" +#include "modules/spatial_hierarchy/Panel.h" +#include "modules/viewport/Controller.h" +#include "modules/viewport/Panel.h" #include #include @@ -152,7 +152,7 @@ QWidget* MainWindow::buildHomeRibbonPage() { auto* settings_button = components::buttons::makeButton("Settings", ":/icons/settings.svg", this); connect(settings_button, &QToolButton::clicked, this, [this]() { - panels::settings::SettingsDialog dialog(this); + modules::settings::SettingsDialog dialog(this); dialog.exec(); }); @@ -335,31 +335,31 @@ void MainWindow::setupRibbon() { } void MainWindow::setupViewport() { - viewport_widget_ = new panels::viewport::ViewportWidget(this); + viewport_widget_ = new modules::viewport::ViewportPanel(this); setCentralWidget(viewport_widget_); } void MainWindow::setupPanels() { - models_panel_ = new panels::models::ModelsPanelWidget(this); - spatial_panel_ = new panels::spatial_hierarchy::SpatialHierarchyPanelWidget(this); - properties_panel_ = new panels::properties::PropertiesPanelWidget(this); + models_panel_ = new modules::models::ModelsPanel(this); + spatial_panel_ = new modules::spatial_hierarchy::SpatialHierarchyPanel(this); + properties_panel_ = new modules::properties::PropertiesPanel(this); - models_controller_ = new panels::models::ModelsPanelController( - this, models_panel_, session_state_, viewport_widget_->viewport(), element_registry_, this); - models_view_ = new panels::models::ModelsPanelView(models_panel_, session_state_, this); - spatial_view_ = new panels::spatial_hierarchy::SpatialHierarchyPanelView(spatial_panel_, session_state_, this); - properties_view_ = new panels::properties::PropertiesPanelView(properties_panel_, session_state_, this); + models_controller_ = new modules::models::ModelsPanelController( + this, models_panel_, session_state_, viewport_widget_->viewport(), this); + models_view_ = new modules::models::ModelsPanelView(models_panel_, session_state_, this); + spatial_view_ = new modules::spatial_hierarchy::SpatialHierarchyPanelView(spatial_panel_, session_state_, this); + properties_view_ = new modules::properties::PropertiesPanelView(properties_panel_, session_state_, this); - layers_panel_ = new components::Panel("Layers", new panels::todo::TodoPanelWidget("Layers", this), this); + layers_panel_ = new components::Panel("Layers", new modules::todo::TodoPanel("Layers", this), this); stored_views_panel_ = new components::Panel( - "Stored Views", new panels::todo::TodoPanelWidget("Stored Views", this), this); + "Stored Views", new modules::todo::TodoPanel("Stored Views", this), this); search_panel_ = new components::Panel( - "Search and Query", new panels::todo::TodoPanelWidget("Search and Query", this), this); + "Search and Query", new modules::todo::TodoPanel("Search and Query", this), this); spreadsheet_panel_ = new components::Panel( - "Spreadsheet", new panels::todo::TodoPanelWidget("Spreadsheet", this), this); - audit_panel_ = new components::Panel("Audit", new panels::todo::TodoPanelWidget("Audit", this), this); - clash_panel_ = new components::Panel("Clash", new panels::todo::TodoPanelWidget("Clash", this), this); - issues_panel_ = new components::Panel("Issues", new panels::todo::TodoPanelWidget("Issues", this), this); + "Spreadsheet", new modules::todo::TodoPanel("Spreadsheet", this), this); + audit_panel_ = new components::Panel("Audit", new modules::todo::TodoPanel("Audit", this), this); + clash_panel_ = new components::Panel("Clash", new modules::todo::TodoPanel("Clash", this), this); + issues_panel_ = new components::Panel("Issues", new modules::todo::TodoPanel("Issues", this), this); addDockWidget(Qt::LeftDockWidgetArea, models_panel_); addDockWidget(Qt::LeftDockWidgetArea, spatial_panel_); @@ -423,9 +423,9 @@ void MainWindow::setupLoader() { element_registry_->bindLoader(loader_); session_state_->bindLoader(loader_); models_controller_->bindLoader(loader_); - viewport_controller_ = new panels::viewport::ViewportController( + viewport_controller_ = new modules::viewport::ViewportController( session_state_, viewport_widget_->viewport(), this); - project_controller_ = new panels::project::ProjectController( + project_controller_ = new modules::project::ProjectController( this, federation_, session_state_, element_registry_, viewport_widget_->viewport(), models_controller_, viewport_controller_, this); diff --git a/src/interface/MainWindow.h b/src/interface/MainWindow.h index 74992d823a..116331449b 100644 --- a/src/interface/MainWindow.h +++ b/src/interface/MainWindow.h @@ -34,16 +34,16 @@ class SceneLoader; namespace ifcinterface { class ElementRegistry; } namespace ifcinterface { class SessionState; } namespace ifcinterface::components { class TabBar; } -namespace ifcinterface::panels::models { class ModelsPanelController; } -namespace ifcinterface::panels::models { class ModelsPanelWidget; } -namespace ifcinterface::panels::models { class ModelsPanelView; } -namespace ifcinterface::panels::project { class ProjectController; } -namespace ifcinterface::panels::spatial_hierarchy { class SpatialHierarchyPanelWidget; } -namespace ifcinterface::panels::spatial_hierarchy { class SpatialHierarchyPanelView; } -namespace ifcinterface::panels::properties { class PropertiesPanelWidget; } -namespace ifcinterface::panels::properties { class PropertiesPanelView; } -namespace ifcinterface::panels::viewport { class ViewportController; } -namespace ifcinterface::panels::viewport { class ViewportWidget; } +namespace ifcinterface::modules::models { class ModelsPanelController; } +namespace ifcinterface::modules::models { class ModelsPanel; } +namespace ifcinterface::modules::models { class ModelsPanelView; } +namespace ifcinterface::modules::project { class ProjectController; } +namespace ifcinterface::modules::spatial_hierarchy { class SpatialHierarchyPanel; } +namespace ifcinterface::modules::spatial_hierarchy { class SpatialHierarchyPanelView; } +namespace ifcinterface::modules::properties { class PropertiesPanel; } +namespace ifcinterface::modules::properties { class PropertiesPanelView; } +namespace ifcinterface::modules::viewport { class ViewportController; } +namespace ifcinterface::modules::viewport { class ViewportPanel; } namespace ifcinterface::shell { @@ -73,26 +73,26 @@ private: QLabel* status_perf_label_ = nullptr; ifcinterface::components::TabBar* ribbon_tabs_ = nullptr; QStackedWidget* ribbon_pages_ = nullptr; - ifcinterface::panels::viewport::ViewportWidget* viewport_widget_ = nullptr; - ifcinterface::panels::viewport::ViewportController* viewport_controller_ = nullptr; + ifcinterface::modules::viewport::ViewportPanel* viewport_widget_ = nullptr; + ifcinterface::modules::viewport::ViewportController* viewport_controller_ = nullptr; SceneLoader* loader_ = nullptr; ifcinterface::ElementRegistry* element_registry_ = nullptr; ifcinterface::SessionState* session_state_ = nullptr; - ifcinterface::panels::models::ModelsPanelWidget* models_panel_ = nullptr; - ifcinterface::panels::spatial_hierarchy::SpatialHierarchyPanelWidget* spatial_panel_ = nullptr; + ifcinterface::modules::models::ModelsPanel* models_panel_ = nullptr; + ifcinterface::modules::spatial_hierarchy::SpatialHierarchyPanel* spatial_panel_ = nullptr; QDockWidget* layers_panel_ = nullptr; - ifcinterface::panels::properties::PropertiesPanelWidget* properties_panel_ = nullptr; + ifcinterface::modules::properties::PropertiesPanel* properties_panel_ = nullptr; QDockWidget* stored_views_panel_ = nullptr; QDockWidget* search_panel_ = nullptr; QDockWidget* spreadsheet_panel_ = nullptr; QDockWidget* audit_panel_ = nullptr; QDockWidget* clash_panel_ = nullptr; QDockWidget* issues_panel_ = nullptr; - ifcinterface::panels::models::ModelsPanelController* models_controller_ = nullptr; - ifcinterface::panels::models::ModelsPanelView* models_view_ = nullptr; - ifcinterface::panels::project::ProjectController* project_controller_ = nullptr; - ifcinterface::panels::spatial_hierarchy::SpatialHierarchyPanelView* spatial_view_ = nullptr; - ifcinterface::panels::properties::PropertiesPanelView* properties_view_ = nullptr; + ifcinterface::modules::models::ModelsPanelController* models_controller_ = nullptr; + ifcinterface::modules::models::ModelsPanelView* models_view_ = nullptr; + ifcinterface::modules::project::ProjectController* project_controller_ = nullptr; + ifcinterface::modules::spatial_hierarchy::SpatialHierarchyPanelView* spatial_view_ = nullptr; + ifcinterface::modules::properties::PropertiesPanelView* properties_view_ = nullptr; }; } // namespace ifcinterface::shell diff --git a/src/interface/panels/project/Controller.cpp b/src/interface/modules/project/Controller.cpp similarity index 96% rename from src/interface/panels/project/Controller.cpp rename to src/interface/modules/project/Controller.cpp index 98463b9176..f65bdc58f5 100644 --- a/src/interface/panels/project/Controller.cpp +++ b/src/interface/modules/project/Controller.cpp @@ -32,15 +32,15 @@ #include #include -namespace ifcinterface::panels::project { +namespace ifcinterface::modules::project { ProjectController::ProjectController(QWidget* host, Federation* federation, ifcinterface::SessionState* session_state, ifcinterface::ElementRegistry* element_registry, ViewportWindow* viewport, - ifcinterface::panels::models::ModelsPanelController* models_controller, - ifcinterface::panels::viewport::ViewportController* viewport_controller, + ifcinterface::modules::models::ModelsPanelController* models_controller, + ifcinterface::modules::viewport::ViewportController* viewport_controller, QObject* parent) : QObject(parent) , host_(host) @@ -204,4 +204,4 @@ bool ProjectController::confirmDiscardIfDirty() { return true; } -} // namespace ifcinterface::panels::project +} // namespace ifcinterface::modules::project diff --git a/src/interface/panels/project/Controller.h b/src/interface/modules/project/Controller.h similarity index 82% rename from src/interface/panels/project/Controller.h rename to src/interface/modules/project/Controller.h index 68d116c6f3..7e87fc34aa 100644 --- a/src/interface/panels/project/Controller.h +++ b/src/interface/modules/project/Controller.h @@ -28,10 +28,10 @@ class Federation; class ViewportWindow; namespace ifcinterface { class ElementRegistry; } namespace ifcinterface { class SessionState; } -namespace ifcinterface::panels::models { class ModelsPanelController; } -namespace ifcinterface::panels::viewport { class ViewportController; } +namespace ifcinterface::modules::models { class ModelsPanelController; } +namespace ifcinterface::modules::viewport { class ViewportController; } -namespace ifcinterface::panels::project { +namespace ifcinterface::modules::project { class ProjectController : public QObject { Q_OBJECT @@ -42,8 +42,8 @@ public: ifcinterface::SessionState* session_state, ifcinterface::ElementRegistry* element_registry, ViewportWindow* viewport, - ifcinterface::panels::models::ModelsPanelController* models_controller, - ifcinterface::panels::viewport::ViewportController* viewport_controller, + ifcinterface::modules::models::ModelsPanelController* models_controller, + ifcinterface::modules::viewport::ViewportController* viewport_controller, QObject* parent = nullptr); bool newProject(); @@ -62,10 +62,10 @@ private: ifcinterface::SessionState* session_state_ = nullptr; ifcinterface::ElementRegistry* element_registry_ = nullptr; ViewportWindow* viewport_ = nullptr; - ifcinterface::panels::models::ModelsPanelController* models_controller_ = nullptr; - ifcinterface::panels::viewport::ViewportController* viewport_controller_ = nullptr; + ifcinterface::modules::models::ModelsPanelController* models_controller_ = nullptr; + ifcinterface::modules::viewport::ViewportController* viewport_controller_ = nullptr; }; -} // namespace ifcinterface::panels::project +} // namespace ifcinterface::modules::project #endif diff --git a/src/interface/panels/properties/Widget.cpp b/src/interface/modules/properties/Panel.cpp similarity index 93% rename from src/interface/panels/properties/Widget.cpp rename to src/interface/modules/properties/Panel.cpp index 515da7554a..f9e4b4b0fb 100644 --- a/src/interface/panels/properties/Widget.cpp +++ b/src/interface/modules/properties/Panel.cpp @@ -18,7 +18,7 @@ * * ********************************************************************************/ -#include "Widget.h" +#include "Panel.h" #include "../../components/KeyValueTable.h" #include "../../components/Section.h" @@ -35,7 +35,7 @@ namespace { -QWidget* makePropertySetPanel(const ifcinterface::panels::properties::PropertySet& property_set, QWidget* parent = nullptr) { +QWidget* makePropertySetPanel(const ifcinterface::modules::properties::PropertySet& property_set, QWidget* parent = nullptr) { auto* group = new QGroupBox(property_set.title, parent); group->setObjectName("propertySetBox"); auto* layout = new QVBoxLayout(group); @@ -50,7 +50,7 @@ QWidget* makePropertySetPanel(const ifcinterface::panels::properties::PropertySe return group; } -QWidget* makeAttributeList(const QList& rows, QWidget* parent = nullptr) { +QWidget* makeAttributeList(const QList& rows, QWidget* parent = nullptr) { QList table_rows; for (const auto& row : rows) { table_rows.append({row.key, row.value, "keyValueValueLabel", "", "", 0}); @@ -58,7 +58,7 @@ QWidget* makeAttributeList(const QList& rows, QWidget* parent = nullptr) { +QWidget* makeRelationshipList(const QList& rows, QWidget* parent = nullptr) { QList table_rows; for (const auto& row_data : rows) { table_rows.append({row_data.key, @@ -91,7 +91,7 @@ QWidget* makeFilterWrapper(QLineEdit** field_out, QWidget* parent = nullptr) { return wrapper; } -QFrame* makeEntityBox(const ifcinterface::panels::properties::EntitySummary& entity, QWidget* parent = nullptr) { +QFrame* makeEntityBox(const ifcinterface::modules::properties::EntitySummary& entity, QWidget* parent = nullptr) { auto* entity_box = new QFrame(parent); entity_box->setObjectName("entityClassBox"); auto* entity_layout = new QHBoxLayout(entity_box); @@ -121,14 +121,14 @@ QFrame* makeEntityBox(const ifcinterface::panels::properties::EntitySummary& ent } // namespace -namespace ifcinterface::panels::properties { +namespace ifcinterface::modules::properties { -PropertiesPanelWidget::PropertiesPanelWidget(QWidget* parent) +PropertiesPanel::PropertiesPanel(QWidget* parent) : components::Panel("Properties", nullptr, parent, false, true) { } -void PropertiesPanelWidget::render(const PropertiesPanelState& state) { +void PropertiesPanel::render(const PropertiesPanelState& state) { clearBodyWidgets(); QList property_set_widgets; @@ -234,4 +234,4 @@ void PropertiesPanelWidget::render(const PropertiesPanelState& state) { addBodyWidget(quantities_section); } -} // namespace ifcinterface::panels::properties +} // namespace ifcinterface::modules::properties diff --git a/src/interface/panels/properties/Widget.h b/src/interface/modules/properties/Panel.h similarity index 86% rename from src/interface/panels/properties/Widget.h rename to src/interface/modules/properties/Panel.h index 752b339a19..fcc01fdb11 100644 --- a/src/interface/panels/properties/Widget.h +++ b/src/interface/modules/properties/Panel.h @@ -18,8 +18,8 @@ * * ********************************************************************************/ -#ifndef IFCINTERFACE_PANELS_PROPERTIESPANELWIDGET_H -#define IFCINTERFACE_PANELS_PROPERTIESPANELWIDGET_H +#ifndef IFCINTERFACE_MODULES_PROPERTIES_PANEL_H +#define IFCINTERFACE_MODULES_PROPERTIES_PANEL_H #include "Types.h" @@ -31,12 +31,12 @@ class QLabel; class QLineEdit; class QToolButton; -namespace ifcinterface::panels::properties { +namespace ifcinterface::modules::properties { -class PropertiesPanelWidget : public components::Panel { +class PropertiesPanel : public components::Panel { Q_OBJECT public: - explicit PropertiesPanelWidget(QWidget* parent = nullptr); + explicit PropertiesPanel(QWidget* parent = nullptr); void render(const PropertiesPanelState& state); @@ -51,6 +51,6 @@ private: QString quantities_filter_text_; }; -} // namespace ifcinterface::panels::properties +} // namespace ifcinterface::modules::properties #endif diff --git a/src/interface/panels/properties/Types.h b/src/interface/modules/properties/Types.h similarity index 95% rename from src/interface/panels/properties/Types.h rename to src/interface/modules/properties/Types.h index 9a1f8da9e7..b513be2562 100644 --- a/src/interface/panels/properties/Types.h +++ b/src/interface/modules/properties/Types.h @@ -25,7 +25,7 @@ #include #include -namespace ifcinterface::panels::properties { +namespace ifcinterface::modules::properties { struct KeyValueRow { QString key; @@ -55,6 +55,6 @@ struct PropertiesPanelState { QList quantity_sets; }; -} // namespace ifcinterface::panels::properties +} // namespace ifcinterface::modules::properties #endif diff --git a/src/interface/panels/properties/View.cpp b/src/interface/modules/properties/View.cpp similarity index 96% rename from src/interface/panels/properties/View.cpp rename to src/interface/modules/properties/View.cpp index aa93b85422..d31e804642 100644 --- a/src/interface/panels/properties/View.cpp +++ b/src/interface/modules/properties/View.cpp @@ -20,15 +20,15 @@ #include "View.h" -#include "Widget.h" +#include "Panel.h" #include "../../ElementRegistry.h" #include "../../SessionState.h" #include "../../../ifcviewer/AppSettings.h" -namespace ifcinterface::panels::properties { +namespace ifcinterface::modules::properties { -PropertiesPanelView::PropertiesPanelView(PropertiesPanelWidget* widget, +PropertiesPanelView::PropertiesPanelView(PropertiesPanel* widget, ifcinterface::SessionState* session_state, QObject* parent) : QObject(parent), widget_(widget), session_state_(session_state) @@ -120,4 +120,4 @@ void PropertiesPanelView::refresh(uint32_t object_id) { widget_->render(state); } -} // namespace ifcinterface::panels::properties +} // namespace ifcinterface::modules::properties diff --git a/src/interface/panels/properties/View.h b/src/interface/modules/properties/View.h similarity index 89% rename from src/interface/panels/properties/View.h rename to src/interface/modules/properties/View.h index 8ed49e1bfd..1762de908a 100644 --- a/src/interface/panels/properties/View.h +++ b/src/interface/modules/properties/View.h @@ -26,24 +26,24 @@ #include namespace ifcinterface { class SessionState; } -namespace ifcinterface::panels::properties { +namespace ifcinterface::modules::properties { -class PropertiesPanelWidget; +class PropertiesPanel; class PropertiesPanelView : public QObject { Q_OBJECT public: - explicit PropertiesPanelView(PropertiesPanelWidget* widget, + explicit PropertiesPanelView(PropertiesPanel* widget, ifcinterface::SessionState* session_state, QObject* parent = nullptr); private: void refresh(uint32_t object_id); - PropertiesPanelWidget* widget_ = nullptr; + PropertiesPanel* widget_ = nullptr; ifcinterface::SessionState* session_state_ = nullptr; }; -} // namespace ifcinterface::panels::properties +} // namespace ifcinterface::modules::properties #endif diff --git a/src/interface/panels/settings/Dialog.cpp b/src/interface/modules/settings/Dialog.cpp similarity index 99% rename from src/interface/panels/settings/Dialog.cpp rename to src/interface/modules/settings/Dialog.cpp index 33c6ee75cb..38f63710a2 100644 --- a/src/interface/panels/settings/Dialog.cpp +++ b/src/interface/modules/settings/Dialog.cpp @@ -39,7 +39,7 @@ #include #include -namespace ifcinterface::panels::settings { +namespace ifcinterface::modules::settings { SettingsDialog::SettingsDialog(QWidget* parent) : components::Dialog(parent) @@ -211,4 +211,4 @@ void SettingsDialog::onAccepted() { accept(); } -} // namespace ifcinterface::panels::settings +} // namespace ifcinterface::modules::settings diff --git a/src/interface/panels/settings/Dialog.h b/src/interface/modules/settings/Dialog.h similarity index 96% rename from src/interface/panels/settings/Dialog.h rename to src/interface/modules/settings/Dialog.h index d97fab3db6..45a10780e4 100644 --- a/src/interface/panels/settings/Dialog.h +++ b/src/interface/modules/settings/Dialog.h @@ -29,7 +29,7 @@ class QLineEdit; class QShowEvent; class QSpinBox; -namespace ifcinterface::panels::settings { +namespace ifcinterface::modules::settings { class SettingsDialog : public components::Dialog { Q_OBJECT @@ -54,6 +54,6 @@ private: QDoubleSpinBox* angular_tolerance_spin_ = nullptr; }; -} // namespace ifcinterface::panels::settings +} // namespace ifcinterface::modules::settings #endif diff --git a/src/interface/panels/spatial_hierarchy/Widget.cpp b/src/interface/modules/spatial_hierarchy/Panel.cpp similarity index 87% rename from src/interface/panels/spatial_hierarchy/Widget.cpp rename to src/interface/modules/spatial_hierarchy/Panel.cpp index 39f1efe4d9..c7c0e3cfa7 100644 --- a/src/interface/panels/spatial_hierarchy/Widget.cpp +++ b/src/interface/modules/spatial_hierarchy/Panel.cpp @@ -18,7 +18,7 @@ * * ********************************************************************************/ -#include "Widget.h" +#include "Panel.h" #include "../../components/Section.h" #include "../../components/SvgIcon.h" @@ -27,9 +27,9 @@ #include #include -namespace ifcinterface::panels::spatial_hierarchy { +namespace ifcinterface::modules::spatial_hierarchy { -SpatialHierarchyPanelWidget::SpatialHierarchyPanelWidget(QWidget* parent) +SpatialHierarchyPanel::SpatialHierarchyPanel(QWidget* parent) : components::Panel("Spatial Hierarchy", nullptr, parent) { auto* section = new components::Section("", components::SectionHeaderMode::Hidden, this); @@ -54,7 +54,7 @@ SpatialHierarchyPanelWidget::SpatialHierarchyPanelWidget(QWidget* parent) }); } -void SpatialHierarchyPanelWidget::setNodes(const QList& nodes) { +void SpatialHierarchyPanel::setNodes(const QList& nodes) { tree_->clear(); for (const auto& node : nodes) { addNode(tree_->invisibleRootItem(), node); @@ -62,7 +62,7 @@ void SpatialHierarchyPanelWidget::setNodes(const QList& nodes) { tree_->expandAll(); } -void SpatialHierarchyPanelWidget::addNode(QTreeWidgetItem* parent, const TreeNode& node) { +void SpatialHierarchyPanel::addNode(QTreeWidgetItem* parent, const TreeNode& node) { auto* item = new QTreeWidgetItem(parent, {node.name, ""}); item->setData(1, Qt::UserRole, node.visible); item->setSizeHint(0, QSize(0, 24)); @@ -73,7 +73,7 @@ void SpatialHierarchyPanelWidget::addNode(QTreeWidgetItem* parent, const TreeNod } } -NodePath SpatialHierarchyPanelWidget::itemPath(QTreeWidgetItem* item) const { +NodePath SpatialHierarchyPanel::itemPath(QTreeWidgetItem* item) const { NodePath path; while (item) { path.prepend(item->text(0)); @@ -82,7 +82,7 @@ NodePath SpatialHierarchyPanelWidget::itemPath(QTreeWidgetItem* item) const { return path; } -QString SpatialHierarchyPanelWidget::iconPath(ItemKind kind) const { +QString SpatialHierarchyPanel::iconPath(ItemKind kind) const { switch (kind) { case ItemKind::Site: return ":/icons/frame-alt.svg"; case ItemKind::Building: return ":/icons/city.svg"; @@ -92,4 +92,4 @@ QString SpatialHierarchyPanelWidget::iconPath(ItemKind kind) const { return ":/icons/frame-alt.svg"; } -} // namespace ifcinterface::panels::spatial_hierarchy +} // namespace ifcinterface::modules::spatial_hierarchy diff --git a/src/interface/panels/spatial_hierarchy/Widget.h b/src/interface/modules/spatial_hierarchy/Panel.h similarity index 84% rename from src/interface/panels/spatial_hierarchy/Widget.h rename to src/interface/modules/spatial_hierarchy/Panel.h index 5cb9c9610c..713e277e44 100644 --- a/src/interface/panels/spatial_hierarchy/Widget.h +++ b/src/interface/modules/spatial_hierarchy/Panel.h @@ -18,8 +18,8 @@ * * ********************************************************************************/ -#ifndef IFCINTERFACE_PANELS_SPATIALHIERARCHYPANELWIDGET_H -#define IFCINTERFACE_PANELS_SPATIALHIERARCHYPANELWIDGET_H +#ifndef IFCINTERFACE_MODULES_SPATIAL_HIERARCHY_PANEL_H +#define IFCINTERFACE_MODULES_SPATIAL_HIERARCHY_PANEL_H #include "Types.h" @@ -28,12 +28,12 @@ class QTreeWidget; class QTreeWidgetItem; -namespace ifcinterface::panels::spatial_hierarchy { +namespace ifcinterface::modules::spatial_hierarchy { -class SpatialHierarchyPanelWidget : public components::Panel { +class SpatialHierarchyPanel : public components::Panel { Q_OBJECT public: - explicit SpatialHierarchyPanelWidget(QWidget* parent = nullptr); + explicit SpatialHierarchyPanel(QWidget* parent = nullptr); void setNodes(const QList& nodes); @@ -48,6 +48,6 @@ private: QTreeWidget* tree_ = nullptr; }; -} // namespace ifcinterface::panels::spatial_hierarchy +} // namespace ifcinterface::modules::spatial_hierarchy #endif diff --git a/src/interface/panels/spatial_hierarchy/Types.h b/src/interface/modules/spatial_hierarchy/Types.h similarity index 94% rename from src/interface/panels/spatial_hierarchy/Types.h rename to src/interface/modules/spatial_hierarchy/Types.h index 90dd67b8fd..f5f64332d5 100644 --- a/src/interface/panels/spatial_hierarchy/Types.h +++ b/src/interface/modules/spatial_hierarchy/Types.h @@ -25,7 +25,7 @@ #include #include -namespace ifcinterface::panels::spatial_hierarchy { +namespace ifcinterface::modules::spatial_hierarchy { enum class ItemKind { Site, @@ -43,6 +43,6 @@ struct TreeNode { using NodePath = QStringList; -} // namespace ifcinterface::panels::spatial_hierarchy +} // namespace ifcinterface::modules::spatial_hierarchy #endif diff --git a/src/interface/panels/spatial_hierarchy/View.cpp b/src/interface/modules/spatial_hierarchy/View.cpp similarity index 91% rename from src/interface/panels/spatial_hierarchy/View.cpp rename to src/interface/modules/spatial_hierarchy/View.cpp index de78b3db31..78fbd04f73 100644 --- a/src/interface/panels/spatial_hierarchy/View.cpp +++ b/src/interface/modules/spatial_hierarchy/View.cpp @@ -20,11 +20,11 @@ #include "View.h" -#include "Widget.h" +#include "Panel.h" #include "../../SessionState.h" -namespace ifcinterface::panels::spatial_hierarchy { +namespace ifcinterface::modules::spatial_hierarchy { namespace { @@ -39,7 +39,7 @@ TreeNode* findNodeRecursive(QList& nodes, const NodePath& path, int de } // namespace -SpatialHierarchyPanelView::SpatialHierarchyPanelView(SpatialHierarchyPanelWidget* widget, +SpatialHierarchyPanelView::SpatialHierarchyPanelView(SpatialHierarchyPanel* widget, ifcinterface::SessionState* session_state, QObject* parent) : QObject(parent), widget_(widget), session_state_(session_state) @@ -52,7 +52,7 @@ SpatialHierarchyPanelView::SpatialHierarchyPanelView(SpatialHierarchyPanelWidget {"Core", ItemKind::Space, true, {}}}}}}}}, }; - connect(widget_, &SpatialHierarchyPanelWidget::visibilityToggleRequested, this, [this](const NodePath& path) { + connect(widget_, &SpatialHierarchyPanel::visibilityToggleRequested, this, [this](const NodePath& path) { if (auto* node = findNode(path)) { node->visible = !node->visible; reload(); @@ -72,4 +72,4 @@ TreeNode* SpatialHierarchyPanelView::findNode(const NodePath& path) { return findNodeRecursive(nodes_, path, 0); } -} // namespace ifcinterface::panels::spatial_hierarchy +} // namespace ifcinterface::modules::spatial_hierarchy diff --git a/src/interface/panels/spatial_hierarchy/View.h b/src/interface/modules/spatial_hierarchy/View.h similarity index 88% rename from src/interface/panels/spatial_hierarchy/View.h rename to src/interface/modules/spatial_hierarchy/View.h index 123db712ef..c2e8313fbe 100644 --- a/src/interface/panels/spatial_hierarchy/View.h +++ b/src/interface/modules/spatial_hierarchy/View.h @@ -26,14 +26,14 @@ #include namespace ifcinterface { class SessionState; } -namespace ifcinterface::panels::spatial_hierarchy { +namespace ifcinterface::modules::spatial_hierarchy { -class SpatialHierarchyPanelWidget; +class SpatialHierarchyPanel; class SpatialHierarchyPanelView : public QObject { Q_OBJECT public: - explicit SpatialHierarchyPanelView(SpatialHierarchyPanelWidget* widget, + explicit SpatialHierarchyPanelView(SpatialHierarchyPanel* widget, ifcinterface::SessionState* session_state, QObject* parent = nullptr); @@ -41,11 +41,11 @@ private: void reload(); TreeNode* findNode(const NodePath& path); - SpatialHierarchyPanelWidget* widget_ = nullptr; + SpatialHierarchyPanel* widget_ = nullptr; ifcinterface::SessionState* session_state_ = nullptr; QList nodes_; }; -} // namespace ifcinterface::panels::spatial_hierarchy +} // namespace ifcinterface::modules::spatial_hierarchy #endif diff --git a/src/interface/panels/todo/Widget.cpp b/src/interface/modules/todo/Panel.cpp similarity index 93% rename from src/interface/panels/todo/Widget.cpp rename to src/interface/modules/todo/Panel.cpp index 1f2e58d3dc..a73497ae7a 100644 --- a/src/interface/panels/todo/Widget.cpp +++ b/src/interface/modules/todo/Panel.cpp @@ -18,16 +18,16 @@ * * ********************************************************************************/ -#include "Widget.h" +#include "Panel.h" #include "../../components/Section.h" #include #include -namespace ifcinterface::panels::todo { +namespace ifcinterface::modules::todo { -TodoPanelWidget::TodoPanelWidget(const QString& title, QWidget* parent) +TodoPanel::TodoPanel(const QString& title, QWidget* parent) : QWidget(parent) { auto* layout = new QVBoxLayout(this); @@ -56,4 +56,4 @@ TodoPanelWidget::TodoPanelWidget(const QString& title, QWidget* parent) layout->addWidget(section); } -} // namespace ifcinterface::panels::todo +} // namespace ifcinterface::modules::todo diff --git a/src/interface/panels/todo/Widget.h b/src/interface/modules/todo/Panel.h similarity index 84% rename from src/interface/panels/todo/Widget.h rename to src/interface/modules/todo/Panel.h index 7ab3bba29b..cebf530123 100644 --- a/src/interface/panels/todo/Widget.h +++ b/src/interface/modules/todo/Panel.h @@ -18,19 +18,19 @@ * * ********************************************************************************/ -#ifndef IFCINTERFACE_PANELS_TODO_TODOPANELWIDGET_H -#define IFCINTERFACE_PANELS_TODO_TODOPANELWIDGET_H +#ifndef IFCINTERFACE_MODULES_TODO_PANEL_H +#define IFCINTERFACE_MODULES_TODO_PANEL_H #include -namespace ifcinterface::panels::todo { +namespace ifcinterface::modules::todo { -class TodoPanelWidget : public QWidget { +class TodoPanel : public QWidget { Q_OBJECT public: - explicit TodoPanelWidget(const QString& title, QWidget* parent = nullptr); + explicit TodoPanel(const QString& title, QWidget* parent = nullptr); }; -} // namespace ifcinterface::panels::todo +} // namespace ifcinterface::modules::todo #endif diff --git a/src/interface/panels/viewport/Controller.cpp b/src/interface/modules/viewport/Controller.cpp similarity index 98% rename from src/interface/panels/viewport/Controller.cpp rename to src/interface/modules/viewport/Controller.cpp index 5c8dd08154..440944fd91 100644 --- a/src/interface/panels/viewport/Controller.cpp +++ b/src/interface/modules/viewport/Controller.cpp @@ -28,7 +28,7 @@ #include -namespace ifcinterface::panels::viewport { +namespace ifcinterface::modules::viewport { ViewportController::ViewportController(ifcinterface::SessionState* session_state, ViewportWindow* viewport, @@ -191,4 +191,4 @@ void ViewportController::maybeGuessFederatedFalseOrigin(uint32_t mid) { AppSettings::instance().applyCoordinateOperation())); } -} // namespace ifcinterface::panels::viewport +} // namespace ifcinterface::modules::viewport diff --git a/src/interface/panels/viewport/Controller.h b/src/interface/modules/viewport/Controller.h similarity index 96% rename from src/interface/panels/viewport/Controller.h rename to src/interface/modules/viewport/Controller.h index f97d36d613..c473624ef7 100644 --- a/src/interface/panels/viewport/Controller.h +++ b/src/interface/modules/viewport/Controller.h @@ -26,7 +26,7 @@ namespace ifcinterface { class SessionState; } class ViewportWindow; -namespace ifcinterface::panels::viewport { +namespace ifcinterface::modules::viewport { class ViewportController : public QObject { Q_OBJECT @@ -50,6 +50,6 @@ private: ViewportWindow* viewport_ = nullptr; }; -} // namespace ifcinterface::panels::viewport +} // namespace ifcinterface::modules::viewport #endif diff --git a/src/interface/panels/viewport/Widget.cpp b/src/interface/modules/viewport/Panel.cpp similarity index 94% rename from src/interface/panels/viewport/Widget.cpp rename to src/interface/modules/viewport/Panel.cpp index 9b6faacd15..a6c8f5263b 100644 --- a/src/interface/panels/viewport/Widget.cpp +++ b/src/interface/modules/viewport/Panel.cpp @@ -18,7 +18,7 @@ * * ********************************************************************************/ -#include "Widget.h" +#include "Panel.h" #include "../../../ifcviewer/ViewportWindow.h" @@ -26,9 +26,9 @@ #include #include -namespace ifcinterface::panels::viewport { +namespace ifcinterface::modules::viewport { -ViewportWidget::ViewportWidget(QWidget* parent) +ViewportPanel::ViewportPanel(QWidget* parent) : QWidget(parent) { auto* root = new QVBoxLayout(this); @@ -57,4 +57,4 @@ ViewportWidget::ViewportWidget(QWidget* parent) root->addWidget(shell); } -} // namespace ifcinterface::panels::viewport +} // namespace ifcinterface::modules::viewport diff --git a/src/interface/panels/viewport/Widget.h b/src/interface/modules/viewport/Panel.h similarity index 86% rename from src/interface/panels/viewport/Widget.h rename to src/interface/modules/viewport/Panel.h index 08f9676759..d9a772af82 100644 --- a/src/interface/panels/viewport/Widget.h +++ b/src/interface/modules/viewport/Panel.h @@ -18,20 +18,20 @@ * * ********************************************************************************/ -#ifndef IFCINTERFACE_PANELS_VIEWPORT_WIDGET_H -#define IFCINTERFACE_PANELS_VIEWPORT_WIDGET_H +#ifndef IFCINTERFACE_MODULES_VIEWPORT_PANEL_H +#define IFCINTERFACE_MODULES_VIEWPORT_PANEL_H #include class ViewportWindow; -namespace ifcinterface::panels::viewport { +namespace ifcinterface::modules::viewport { -class ViewportWidget : public QWidget { +class ViewportPanel : public QWidget { Q_OBJECT public: - explicit ViewportWidget(QWidget* parent = nullptr); + explicit ViewportPanel(QWidget* parent = nullptr); ViewportWindow* viewport() const { return viewport_; } @@ -40,6 +40,6 @@ private: QWidget* viewport_container_ = nullptr; }; -} // namespace ifcinterface::panels::viewport +} // namespace ifcinterface::modules::viewport #endif diff --git a/src/interface/panels/add_model/Dialog.cpp b/src/interface/panels/add_model/Dialog.cpp deleted file mode 100644 index 415ed6c95b..0000000000 --- a/src/interface/panels/add_model/Dialog.cpp +++ /dev/null @@ -1,140 +0,0 @@ -// This file was generated with the assistance of an AI coding tool. -/******************************************************************************** - * * - * This file is part of IfcOpenShell. * - * * - * IfcOpenShell is free software: you can redistribute it and/or modify * - * it under the terms of the Lesser GNU General Public License as published by * - * the Free Software Foundation, either version 3.0 of the License, or * - * (at your option) any later version. * - * * - * IfcOpenShell is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * Lesser GNU General Public License for more details. * - * * - * You should have received a copy of the Lesser GNU General Public License * - * along with this program. If not, see . * - * * - ********************************************************************************/ - -#include "Dialog.h" - -#include "../../components/Dialog.h" -#include "../../components/Buttons.h" -#include "../../components/Section.h" -#include "../../components/Style.h" - -#include -#include -#include -#include -#include - -namespace ifcinterface::panels::add_model { - -namespace { - -class HoverDescriptionFilter : public QObject { -public: - HoverDescriptionFilter(QLabel* label, QString hover_text, QString default_text) - : label_(label), hover_text_(std::move(hover_text)), default_text_(std::move(default_text)) {} - -protected: - bool eventFilter(QObject* watched, QEvent* event) override { - Q_UNUSED(watched); - if (event->type() == QEvent::Enter) { - label_->setText(hover_text_); - } else if (event->type() == QEvent::Leave) { - label_->setText(default_text_); - } - return false; - } - -private: - QLabel* label_ = nullptr; - QString hover_text_; - QString default_text_; -}; - -} // namespace - -AddModelDialog::AddModelDialog(QWidget* parent) - : components::Dialog(parent) -{ - setObjectName("appDialog"); - setWindowTitle("Add Model"); - setModal(true); - setStyleSheet(components::style::buildAppStyleSheet()); - setupUi(); -} - -void AddModelDialog::setupUi() { - if (auto* root = qobject_cast(layout())) { - root->setSizeConstraint(QLayout::SetFixedSize); - } - - const QString default_description = "Choose what to add to the project"; - auto* description_section = new components::Section("", components::SectionHeaderMode::Hidden, this); - auto* description = new QLabel(default_description, description_section); - description->setProperty("textRole", "secondary"); - description->setWordWrap(true); - description->setAlignment(Qt::AlignCenter); - description->setMinimumWidth((90 * 4) + (components::style::metrics::padding * 3)); - description->setMinimumHeight(description->fontMetrics().lineSpacing() * 2 + 4); - description_section->addBodyWidget(description); - - auto* choices_section = new components::Section("", components::SectionHeaderMode::Hidden, this); - auto* choices = new QWidget(choices_section); - auto* row = new QHBoxLayout(choices); - row->setContentsMargins(0, 0, 0, 0); - row->setSpacing(components::style::metrics::padding); - - auto* add_ifc = components::buttons::makeButton("Add IFC File", ":/icons/cube.svg", choices); - connect(add_ifc, &QToolButton::clicked, this, [this]() { - selected_mode_ = SourceMode::IfcFile; - accept(); - }); - add_ifc->installEventFilter(new HoverDescriptionFilter( - description, - "Add IFC files and load both geometry and data.", - default_description)); - - auto* add_database = components::buttons::makeButton("Add IFC\nDatabase", ":/icons/database.svg", choices); - connect(add_database, &QToolButton::clicked, this, [this]() { - selected_mode_ = SourceMode::IfcDatabase; - accept(); - }); - add_database->installEventFilter(new HoverDescriptionFilter( - description, - "Add IFC RDB databases for optimised performance", - default_description)); - - auto* add_geometry = components::buttons::makeButton("Add Geometry", ":/icons/cube-bandage.svg", choices); - connect(add_geometry, &QToolButton::clicked, this, [this]() { - selected_mode_ = SourceMode::GeometryOnly; - accept(); - }); - add_geometry->installEventFilter(new HoverDescriptionFilter( - description, - "Add pure geometry for fast visualisation", - default_description)); - - auto* convert_database = components::buttons::makeButton("Convert IFC File\nto Database", ":/icons/database-restore.svg", choices); - connect(convert_database, &QToolButton::clicked, this, [description]() { - description->setText("IFC-to-database conversion is coming soon."); - }); - convert_database->installEventFilter(new HoverDescriptionFilter( - description, - "Convert IFC files to databases for smaller filesizes, reduced memory, and faster access. No data is lost.", - default_description)); - - row->addWidget(components::buttons::makeButtonGroup("ADD", {add_ifc, add_database, add_geometry}, choices, true, 8)); - row->addWidget(components::buttons::makeButtonGroup("TOOLS", {convert_database}, choices, false, 8)); - choices_section->addBodyWidget(choices); - - addBodyWidget(description_section); - addBodyWidget(choices_section); -} - -} // namespace ifcinterface::panels::add_model diff --git a/src/interface/panels/add_model/Dialog.h b/src/interface/panels/add_model/Dialog.h deleted file mode 100644 index 5e39e855de..0000000000 --- a/src/interface/panels/add_model/Dialog.h +++ /dev/null @@ -1,50 +0,0 @@ -// This file was generated with the assistance of an AI coding tool. -/******************************************************************************** - * * - * This file is part of IfcOpenShell. * - * * - * IfcOpenShell is free software: you can redistribute it and/or modify * - * it under the terms of the Lesser GNU General Public License as published by * - * the Free Software Foundation, either version 3.0 of the License, or * - * (at your option) any later version. * - * * - * IfcOpenShell is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * Lesser GNU General Public License for more details. * - * * - * You should have received a copy of the Lesser GNU General Public License * - * along with this program. If not, see . * - * * - ********************************************************************************/ - -#ifndef IFCINTERFACE_PANELS_ADDMODELDIALOG_H -#define IFCINTERFACE_PANELS_ADDMODELDIALOG_H - -#include "../../components/Dialog.h" - -namespace ifcinterface::panels::add_model { - -enum class SourceMode { - None, - IfcFile, - IfcDatabase, - GeometryOnly, -}; - -class AddModelDialog : public components::Dialog { - Q_OBJECT -public: - explicit AddModelDialog(QWidget* parent = nullptr); - - SourceMode selectedMode() const { return selected_mode_; } - -private: - void setupUi(); - - SourceMode selected_mode_ = SourceMode::None; -}; - -} // namespace ifcinterface::panels::add_model - -#endif