Commit Graph

417 Commits

Author SHA1 Message Date
679aaec6d4 feat(gui): add unified origin commands for PLM operations (#14)
Some checks are pending
Build and Test / build (push) Has started running
- Create CommandOrigin.cpp with Origin_Commit, Origin_Pull, Origin_Push,
  Origin_Info, Origin_BOM commands
- Commands delegate to current origin's extended operations
- Commands auto-disable based on origin capabilities (supportsRevisions,
  supportsBOM, supportsPartNumbers)
- Add 'Origin Tools' toolbar with PLM operations
- Add origin commands to File menu
- Register commands via CreateOriginCommands() in Application startup

This implements Issue #14: Dynamic toolbar extension for Silo commands
2026-02-05 14:49:22 -06:00
7535a48ec4 feat(gui): add origin abstraction layer for unified file operations
Implements Issue #9: Origin abstraction layer

This commit introduces a foundational abstraction for document origins,
enabling FreeCAD to work with different storage backends (local filesystem,
Silo PLM, future cloud services) through a unified interface.

## Core Components

### FileOrigin Abstract Base Class (FileOrigin.h/cpp)
- Defines interface for document origin handlers
- Identity methods: id(), name(), nickname(), icon(), type()
- Workflow characteristics: tracksExternally(), requiresAuthentication()
- Capability queries: supportsRevisions(), supportsBOM(), supportsPartNumbers()
- Connection state management with fastsignals notifications
- Document identity: documentIdentity() returns UUID, documentDisplayId() for display
- Property sync: syncProperties() for bidirectional database sync
- Core operations: newDocument(), openDocument(), saveDocument(), saveDocumentAs()
- Extended PLM operations: commitDocument(), pullDocument(), pushDocument(), etc.

### LocalFileOrigin Implementation
- Default origin for local filesystem documents
- ownsDocument(): Returns true if document has NO SiloItemId property
- Wraps existing FreeCAD file operations (App::GetApplication())

### OriginManager Singleton (OriginManager.h/cpp)
- Follows WorkbenchManager pattern (instance()/destruct())
- Manages registered FileOrigin instances
- Tracks current origin selection with persistence
- Provides document-to-origin resolution via findOwningOrigin()
- Emits signals: signalOriginRegistered, signalOriginUnregistered,
  signalCurrentOriginChanged
- Preferences stored at: User parameter:BaseApp/Preferences/General/Origin

### Python Bindings (FileOriginPython.h/cpp)
- Adapts Python objects to FileOrigin C++ interface
- Enables Silo addon to implement origins in Python
- Thread-safe with Base::PyGILStateLocker
- Static addOrigin()/removeOrigin() for registration

### Python API (ApplicationPy.cpp)
- FreeCADGui.addOrigin(obj) - Register Python origin
- FreeCADGui.removeOrigin(obj) - Unregister Python origin
- FreeCADGui.getOrigin(id) - Get origin info as dict
- FreeCADGui.listOrigins() - List all registered origin IDs
- FreeCADGui.activeOrigin() - Get current origin info
- FreeCADGui.setActiveOrigin(id) - Set active origin

## Design Decisions

1. **UUID Tracking**: Documents tracked by SiloItemId (immutable UUID),
   SiloPartNumber used for human-readable display only

2. **Ownership by Properties**: Origin ownership determined by document
   properties (SiloItemId), not file path location

3. **Local Storage Always**: All documents saved locally; origins change
   workflow and identity model, not storage location

4. **Property Syncing**: syncProperties() enables bidirectional sync of
   document metadata with database (Description, SourcingType, etc.)

## Files Added
- src/Gui/FileOrigin.h
- src/Gui/FileOrigin.cpp
- src/Gui/FileOriginPython.h
- src/Gui/FileOriginPython.cpp
- src/Gui/OriginManager.h
- src/Gui/OriginManager.cpp

## Files Modified
- src/Gui/CMakeLists.txt - Added new source files
- src/Gui/Application.cpp - Initialize/destruct OriginManager
- src/Gui/ApplicationPy.h - Added Python method declarations
- src/Gui/ApplicationPy.cpp - Added Python method implementations

Refs: #9
2026-02-05 13:17:23 -06:00
Kacper Donat
4e2221a913 Gui: Wrap strings with QStringLiteral 2025-12-19 13:14:25 -06:00
Kacper Donat
0120299a80 Gui: Respect both content size and minimum width for buttons
This is a hacky fix for https://github.com/FreeCAD/FreeCAD/issues/23607

Basically after widget is shown or polished we enforce it's minimum size to at
least cover the minimum size hint - something that QSS ignores if min-width is
specified.
2025-12-15 10:17:34 -06:00
PaddleStroke
a8bb43837e GUI: Fix broken build - splitbutton (#25892) 2025-12-02 20:24:57 -06:00
Chris Hennes
e0d12c2f6f Merge pull request #25713 from kadet1090/split-button
Gui: Use SplitButton for config migration modal
2025-12-01 10:52:19 -06:00
PaddleStroke
596aaf40a7 Core: Close partially opened document when doc is closed. (#25659) 2025-11-30 23:33:43 -06:00
Kacper Donat
061482ffb6 Gui: Add SplitButton widget
This adds SplitButton widget that has one primary action and possibly
more secondary ones accessible via menu.
2025-11-28 10:15:04 +01:00
pre-commit-ci[bot]
9fe130cd73 All: Reformat according to new standard 2025-11-11 13:49:01 +01:00
Kacper Donat
2167e9ddff Gui: Fix order of stylesheet applying 2025-10-20 09:26:22 -05:00
captain0xff
36573bf817 Gui: fix null handling logic in Application::setEditDocument 2025-10-16 12:54:20 -05:00
Sami Liedes
69fb78e2c9 Gui: Request 24-bit color depth if available
In some configurations, Qt apparently defaults to giving the "first
acceptable" buffer format. This often ends up being RGB565, which
gives us little color resolution.

Request 8-bit RGB samples to fix this.

This tends to happen easiest with
`QT_WAYLAND_DISABLE_WINDOWDECORATION=1` and `QT_QPA_PLATFORM=wayland`.
2025-10-06 10:48:30 -05:00
Sami Liedes
846b14e793 Gui/Application, QuarterWidget: request OpenGL compatibility profile (#23768)
On Wayland with Qt, the default OpenGL context often ends up being
OpenGL ES. ES is a stricter API based on the "core" profile and lacks
many legacy functions (e.g. glEnd). FreeCAD relies on some of these
functions, which work under Mesa’s permissive stack but fail outright
with NVIDIA’s proprietary drivers, resulting in a blank 3D view.

Fix this by explicitly requesting a desktop OpenGL compatibility
profile both before QApplication creation and in QuarterWidget. This
ensures the presence of the legacy entry points required by Coin/SoQt.

(NB: both requests appear to be necessary; a single change was not
sufficient in testing.)
2025-09-29 19:22:29 -05:00
Bas Ruigrok
dbcd6912d0 Don't inform Coin to use EGL for Coin 4.0.6+
Coin figures it out automatically starting from 4.0.6. Only for Coin 4.0.4 and 4.0.5 it is needed to explicitly tell Coin to use EGL.
2025-09-28 18:57:18 -05:00
Markus Reitböck
a72a0d6405 Gui: use CMake to generate precompiled headers on all platforms
"Professional CMake" book suggest the following:

"Targets should build successfully with or without compiler support for precompiled headers. It
should be considered an optimization, not a requirement. In particular, do not explicitly include a
precompile header (e.g. stdafx.h) in the source code, let CMake force-include an automatically
generated precompile header on the compiler command line instead. This is more portable across
the major compilers and is likely to be easier to maintain. It will also avoid warnings being
generated from certain code checking tools like iwyu (include what you use)."

Therefore, removed the "#include <PreCompiled.h>" from sources, also
there is no need for the "#ifdef _PreComp_" anymore
2025-09-14 09:47:03 +02:00
Pieter Hijma
deadbb5793 Part: Add deprecation warning for import/export 2025-09-12 16:30:25 -05:00
Kacper Donat
8ada1998f8 Gui: Fix reloading of themes 2025-08-28 17:14:55 -05:00
Kacper Donat
f3b5748643 Gui: Try to load Theme Parameters from file
This creates logic that tries to load user parameters from file as the
priority and pushes back older mechanism to lower layer. Older way of
loading theme parameters should be preserved until we release first 1.1
RC.
2025-08-25 00:47:55 +02:00
Max Wilfinger
6692dacc0a Gui: Update UI strings for consistency
Closes: #22135
2025-08-04 20:14:45 +02:00
PaddleStroke
59c6742155 Assembly: Use icon overlay for unconnected joints instead of annoying warning. (#22662)
* Core: FeaturePython : Add getOverlayIcons to python interface

* Assembly: unconnected joints icon overlay Fix #22643

* Update src/Mod/Assembly/Gui/ViewProviderAssembly.cpp

Co-authored-by: Kacper Donat <kadet1090@gmail.com>

* Update AssemblyObject.cpp

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update ViewProviderFeaturePython.h

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update ViewProviderFeaturePython.h

* Update JointObject.py

* Update ViewProviderFeaturePython.h

* Update ViewProviderFeaturePython.cpp

* Update Application.cpp

* Update ViewProviderFeaturePython.cpp

* Update ViewProviderFeaturePython.h

* Update ViewProviderAssembly.cpp

---------

Co-authored-by: Kacper Donat <kadet1090@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-07-26 22:35:24 +02:00
Kacper Donat
8d3f41059f Gui: Add ThemeTokenManager class to contain theme parameters
This class aims to implement Design Token idea into FreeCAD themes. It
allows themes to use generic variables with generic values so we could
use one qss theme and change the style based on values from preference
packs.
2025-07-07 00:07:31 +02:00
Kacper Donat
e65f69715b CAM: Fix origin indicator for Job
This commit fixes how origin (coordinate system) indicator looks. Before
it showed as disc, and now it shows as point which is more approperiate
given the context.
2025-07-05 18:46:01 +02:00
Bas Ruigrok
b7ac8a7afe Inform Coin to use EGL when on Wayland (#21917)
* Inform Coin to use EGL when on Wayland

* Only check for Wayland on Linux and BSD
2025-06-30 11:12:02 -05:00
wmayer
4cfc77d9ee Gui: Move define HAS_QTBUG_129596 to separate header file 2025-05-30 18:04:33 +02:00
Kacper Donat
aa47949f80 Gui: Add support for hints in status bar 2025-05-21 17:42:45 +02:00
bofdahof
ba2c2ca5ad Console: rename PascalCase named methods to camelCase 2025-05-06 17:50:21 +02:00
Ladislav Michl
9683cf1e4f Base: rename Exception's PascalCase methods to camelCase 2025-05-05 23:50:01 +02:00
Chris Hennes
f55063855a Merge pull request #20540 from 3x380V/cleanup-schemas-management
Simplify UnitsSchemas management
2025-05-05 10:43:27 -05:00
Benjamin Nauck
df3c324b7d Gui: use contains() and isEmpty() instead of count() where possible 2025-05-03 22:19:51 +02:00
João Neves
05f0c606d5 Core: Fixed a bug where an empty document disappears (#20554)
* Core: Fixed a bug where an empty document disappears

Created a flag named autoCreated to distinguish an autoCreated
document created in the startup from a manually document.
Implemented a setter and a getter for this new flag.
Added a codition that verifies if a document is autoCreated
when opening another document to close it in the correct case.
Implemented unit tests for theses cases. Fixes #19868.

Signed-off-by: João Neves <joao.antonio.neves@tecnico.ulisboa.pt>

* Tests: Fix failing auto-created document tests

Signed-off-by: João Neves <joao.antonio.neves@tecnico.ulisboa.pt>

* Tests: moved created tests to the existing Document test framework.

Signed-off-by: João Neves <joao.antonio.neves@tecnico.ulisboa.pt>

---------

Signed-off-by: João Neves <joao.antonio.neves@tecnico.ulisboa.pt>
2025-04-28 10:46:52 -05:00
bofdahof
353acbb27b Base: simplify UnitsSchemas management
Fixes: Maintaining schemas is difficult and error-prone

- Facilitate easy schemas add, remove, change, etc.
- Remove 14 files containing approx 2,190 lines of if/else code and data
- Place data in one file (UnitsSchemasData.h) using a normalized structure (including special functions)
- Isolate and simplify data operations (code)
- Remove schemas enum to keep data independent of code
- Separate responsibilities: Specifications, data, schemas, schema
- Add schema data 'isDefault'
- Add schema data name
- Prefer algorithms to raw loops
- Add schemas unit tests
- Tweak quantity unit tests
2025-04-27 00:45:54 +02:00
Alex Tran
353085d7e3 App: Running FreeCAD in verbose mode information to reflect Gui -> Help -> About Dialog info (#20487) 2025-04-16 08:29:07 +02:00
Kacper Donat
77e40b9747 Base: Use explicit pointer syntax for freecad_cast (#20694)
* Base: Use explicit pointer syntax for freecad_cast

This aligns our custom cast with other casts

* All: Use explicit pointer syntax for freecad_cast
2025-04-11 14:11:33 +00:00
Kacper Donat
9d97d1c895 Base: Rename Base::freecad_dynamic_cast into freecad_cast
This is to make it shorter and easier to use. QT does the same thing
with their qobject_cast.
2025-04-07 10:32:28 -05:00
Chris Hennes
44908ad721 Merge pull request #19428 from tritao/base-tracy-profiler
Base: Add Tracy frame profiling support.
2025-03-14 04:12:05 +00:00
Joao Matos
0feab195ac Base: Add build support and instrumentation for the Tracy profiler. 2025-03-14 03:41:30 +00:00
Chris Hennes
3ce193ddb8 Merge pull request #19921 from mosfet80/QT_CLEAN
REMOVE old QT<= 5.14 code
2025-03-11 20:54:59 +00:00
Joao Matos
6dd5246fa1 Rename DocumentCreateFlags to DocumentInitFlags. 2025-03-07 20:54:16 +00:00
Joao Matos
81a5b78b36 Convert DocumentCreateFlags instances to use designated initializer list. 2025-03-07 20:42:51 +00:00
Andrea
2d4ab5af20 REMOVE old QT<= 5.14 code
Ubuntu 22.04  use qt 1.15.3.
In the code is still used qt code <5.10.
A cleanup was done by removing qT code version used in ubuntu 18.04.
2025-03-05 09:32:06 +01:00
Syres916
7f3632ba8e [Gui] Trigger the same checks for Drag & Drop files as File > Open 2025-03-04 20:45:15 -06:00
Benjamin Bræstrup Sayoc
8d2d0a47f4 Gui: Use QStringLiteral 2025-02-10 18:34:57 +01:00
tritao
ff8e99f385 App: Provide temporary document creation flag to Python App.loadDocument. 2025-02-03 18:01:18 +01:00
Benjamin Nauck
1e91ad56bc Move where icons in menus attribute is set
Without this, icons are not visible on macOS
2024-12-20 11:55:21 -05:00
wmayer
5302033c76 Gui: Move Python functions from Application to ApplicationPy
This reduces build time when adding new Python functions because only one file must be compiled.
Handles also many linter warnings.
2024-12-20 11:50:07 -05:00
Chris Hennes
28752ca05b Merge pull request #18244 from wwmayer/space_mouse_runtime
Gui: Add runtime check to choose between modern and legacy space mous…
2024-12-09 11:36:17 -05:00
wmayer
7a044e7dcd Gui: Add runtime check to choose between modern and legacy space mouse devices 2024-12-03 18:54:21 +01:00
PaddleStroke
b2f965c06e ViewProviderOrigin: Renamed to ViewProviderCoordinateSystem 2024-11-27 12:15:53 +01:00
PaddleStroke
4ebb66838c Core: Add App::LocalCoordinateSystem.
Most of App::Origin is moved into this sub class of App::Origin.
Add App::Point. Change graphics of the planes/axis.
Remove scale-by-content behavior and make it fixed size on screen.
2024-11-26 17:36:02 +01:00
PaddleStroke
3993bfede7 Rename ViewProviderOriginFeature to ViewProviderDatum 2024-11-26 15:36:48 +01:00