34#include <NDEVR/QTDesignObject.h>
35#include <NDEVR/ShowPropertiesSettings.h>
36#include <NDEVR/Editor.h>
37#include <NDEVR/QCustomDockWidget.h>
38#include <NDEVR/Pointer.h>
39#include <NDEVR/UnitManager.h>
100 virtual UUID id()
const override {
return m_id; };
238 template<
class t_type>
243 if (
dynamic_cast<t_type*
>(editor) !=
nullptr)
310 void updateButtons();
314 void updateButtonLayout();
320 template<
class t_type>
BasicObjectDialogSetupCallback(const StringView &type, const std::function< void(DesignObjectDialog *, const DynamicPointer< QTDesignObject > &)> &callback)
Constructs a callback for a specific object type name.
virtual UUID id() const override
Returns the unique identifier for this callback.
BasicObjectDialogSetupCallback(const std::function< void(DesignObjectDialog *, const DynamicPointer< QTDesignObject > &)> &callback)
Constructs a callback that applies to all object types.
virtual void setupDialog(const StringView &type_name, DesignObjectDialog *dialog, const DynamicPointer< QTDesignObject > &object) override
Configures the dialog using the stored callback function.
A thread that executes a user-provided callback function concurrently.
The equivelent of std::vector but with a bit more control.
Dictionary< UUID, DesignObjectDialogSetupCallback * > m_creation_callbacks
Map of registered setup callbacks by UUID.
void removeSetupCallback(DesignObjectDialogSetupCallback *callback)
Removes a setup callback from the factory.
static DesignObjectDialogFactory & DefaultInstance()
Returns the singleton instance of the factory.
void addSetupCallback(DesignObjectDialogSetupCallback *callback)
Registers a setup callback with the factory.
DesignObjectDialogFactory()
Protected default constructor.
void setupDialog(const StringView &type_name, const DynamicPointer< QTDesignObject > &object, DesignObjectDialog *dialog)
Invokes all registered callbacks to set up a dialog for the given object.
void removeSetupCallback(const UUID &id)
Removes a setup callback by its UUID.
Provides logic for modifying DesignObjectDialogs for specific objects.
virtual UUID id() const =0
Returns the unique identifier for this callback.
virtual void setupDialog(const StringView &type_name, DesignObjectDialog *dialog, const DynamicPointer< QTDesignObject > &object)=0
Called to configure a DesignObjectDialog for a specific object type.
A popup dialog for showing options or information to the user for a particular DesignObject.
virtual Buffer< QWidget * > printableWidgetOptions() override
Returns widgets that provide print configuration options.
virtual TranslatedString customDialogTitle() const override
Returns the custom dialog title, if set.
void dialogFinishedSignal()
Emitted when the dialog has completed all operations and is finished.
virtual void setTarget(const DynamicPointer< QTDesignObject > &object) override
Sets the target design object and refreshes all editors.
EditorShowMode showMode() const override
Returns the show mode for this editor.
SectionWidget * m_target_widget
The main content section widget.
DesignObjectDialog(const DynamicPointer< QTDesignObject > &object, const ShowPropertiesSettings &style)
Constructs a DesignObjectDialog for the given object and display style.
bool hasEditor() const
Checks whether this dialog contains an editor of the specified type.
Button * m_accept_button
Button for accepting and closing.
Model getModel() const
Returns the target as a Model.
void onCancelPressed()
Slot called when the cancel button is pressed.
void requestConfirmSignal()
Emitted when the user confirms the dialog.
virtual Buffer< QWidget * > printableWidgets() override
Returns the list of widgets that can be printed.
const DynamicPointer< QTDesignObject > & designObjectPtr()
Returns the pointer to the target design object.
void addTabDialog(QWidget *editor, uint04 index=Constant< uint04 >::Invalid)
Adds a generic widget as a tab in the dialog.
Buffer< QWidget * > m_tabs
The list of tab widgets.
void addEditor(Editor *editor, uint04 index=Constant< uint04 >::Invalid)
Adds an editor tab to the dialog.
ShowPropertiesSettings m_settings
Display settings controlling property visibility.
~DesignObjectDialog()
Destructor.
QWidget * m_button_layout_widget
Container widget for the button layout.
void setCustomTitle(const TranslatedString &title)
Sets a custom title for the dialog window.
Buffer< Editor * > m_editors
The list of editor tabs in this dialog.
QHBoxLayout * m_button_layout
Layout for the bottom button bar.
void requestBackSignal()
Emitted when the user presses the back button.
virtual Buffer< QWidget * > bottomOptions() override
Returns widgets displayed at the bottom of the dialog.
TranslatedString m_custom_title
Custom dialog title, if set.
void onConfirmPressed()
Slot called when the confirm/accept button is pressed.
Button * m_units_button
Button for changing unit settings.
QCustomTabWidget * m_tab_menu
The tab widget for switching between editors.
virtual void setReadOnly(bool read_only) override
Sets whether the dialog is in read-only mode.
void requestCancelSignal()
Emitted when the user cancels the dialog.
Button * m_save_button
Button for saving changes.
const UnitManager & dialogUnits() const
Returns the unit manager used by this dialog for value conversions.
void showCurrentIndex(uint04 index)
Shows the editor tab at the given index.
virtual StringView customDialogIcon() const override
Returns the custom dialog icon name, if set.
void requestPrintSignal()
Emitted when the user requests printing.
const Buffer< Editor * > & editors() const
Returns the list of editors in this dialog.
void setHorizontal(bool horizontal) override
Sets whether the dialog layout is horizontal or vertical.
bool showSubDialog()
Finds the editor of type t_type and displays its tab.
DesignObjectDialog(const ShowPropertiesSettings &style)
Constructs a DesignObjectDialog with the given display style but no target object.
void setType(const StringView &type)
Sets the type name used for dialog setup callbacks.
const QTDesignObject & designObject() const
Returns a const reference to the underlying QTDesignObject.
UnitManager m_dialog_units
Unit manager for value display conversions.
void checkIfBusy()
Checks if background operations are still busy before closing.
virtual void updateValues() override
Updates all editor values from the current target object state.
QSize sizeHint() const override
Returns the recommended size for this dialog.
void clearTabDialogs()
Removes all tab dialogs from the dialog.
Button * m_zoom_button
Button for zooming to the target object.
Button * m_print_button
Button for printing dialog content.
DesignObject getObject() const
Returns the target as a DesignObject.
void requestDeleteSignal()
Emitted when the user requests deletion of the target object.
Button * m_cancel_button
Button for canceling and closing.
A low-level database object that can be used to access general stored properties within the NDEVR Mod...
A hash-based key-value store, useful for quick associative lookups.
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
A base class for displaying options for editing a single DesignObject, typically a Model.
Editor(QWidget *parent=nullptr)
Constructs an Editor with no design object target.
DynamicPointer< QTDesignObject > m_design_object
The design object being edited.
A core class that represents a node on model hierarchy.
A pointer to a DesignObject within a QTModelManager that receives and emits update signals based on t...
Software Service Managers take a Software service to modify the behavior of the software.
Base interface for services that extend or modify software behavior through modules.
The core String View class for the NDEVR API.
The core String class for the NDEVR API.
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Manages a collection of units across multiple data categories with INI persistence.
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
EditorShowMode
Describes how an Editor should be displayed within the application UI.
Stores settings for setting up and displaying a DesignObjectDialog such as whether the dialog is part...