|
VR-Engage
2.3
|
This class provides the main user interface for managing VREngage applications, including monitoring application status, assigning roles and entities to applications, and controlling spectator mode settings. It integrates with the VREngage status listener to maintain real-time status information.
#include <vreManagerWidget.h>
Public Slots | |
| virtual void | onSubmit () |
| virtual void | onSubmitWithConflicts () |
| virtual void | onRevert () |
| virtual void | onUserEditComplete () |
| virtual void | onDataChanged () |
| virtual void | onAssignmentStateChanged () |
| virtual void | handleVreAppAdded (const std::string &id) |
| virtual void | handleVreAppRemoved (const std::string &id) |
| virtual void | handleVreAppChanged (const std::string &id) |
Phase 3: New UI Interaction Slots | |
Slots for the two-panel splitter-based layout. | |
| virtual void | onEntitySearchChanged (const QString &text) |
| virtual void | onStationSearchChanged (const QString &text) |
| virtual void | onToggleExpandCollapse () |
| virtual void | onEntityRoleTreeClicked (const QModelIndex &index) |
| virtual void | onStationListClicked (const QModelIndex &index) |
| virtual void | onStationListContextMenu (const QPoint &pos) |
| virtual void | onSpectatorToggleClicked (const QString &stationId) |
| virtual void | onStatusIndicatorClicked (const QString &stationId) |
| virtual void | onStatusSortButtonClicked () |
| virtual void | onStationNameSortButtonClicked () |
| virtual void | onEntityRoleHeaderSortIndicatorChanged (int section, Qt::SortOrder order) |
| virtual void | onTreeHeaderContextMenu (const QPoint &pos) |
Phase 8: Assignment Persistence | |
Slots for save and load assignment file operations. | |
| virtual void | onSaveAssignments () |
| virtual void | onLoadAssignments () |
Signals | |
| void | entityForceTypeChanged (const QString &entityUUID, int newRawForceType) |
Public Member Functions | |
| virtual | ~DtVreManagerWidget () override |
| virtual QIcon | icon () override |
| virtual QString | title () override |
| virtual const std::string & | pageClassName () const override |
| virtual void | activate () override |
| virtual void | deactivate () override |
| virtual makVrv::DtQIconConfigurations | qIconConfigurations () const override |
| virtual QSize | sizeHint () const override |
| virtual QSize | minimumSizeHint () const override |
| void | setStartupAssignmentFile (const QString &filePath) |
| bool | entityExistsInCurrentExercise (const DtUUID &entityUUID) const |
| void | showPersistenceWarnings (const QStringList &warnings, const QString &title) |
| void | submitChanges (bool allowConflicts) |
Static Public Member Functions | |
| static void | vreAppAddedCallback (const std::string &id, void *usr) |
| static void | vreAppRemovedCallback (const std::string &id, void *usr) |
| static void | vreAppChangedCallback (const std::string &id, void *usr) |
Protected Member Functions | |
| virtual void | onModelSetChanged () |
| virtual void | changeEvent (QEvent *event) override |
| virtual void | showEvent (QShowEvent *event) override |
| bool | eventFilter (QObject *watched, QEvent *event) override |
| void | refreshExpandButtonIcon () |
| void | syncExpandButtonState () |
| void | setEntityRoleHeaderHoverActive (bool active) |
| void | refreshStatusSortButtonIcon () |
| void | refreshStationNameSortButtonIcon () |
| void | applyStationSortState () |
| virtual void | handleActivate () |
| virtual void | handleDeactivate () |
| DtVreManagerWidget (makVrv::DtDe &de, QWidget *parent=0, Qt::WindowFlags f=0) | |
| void | setupUi (QWidget *p) |
| void | setupNewUi () |
| void | populateEntitiesFromExercise () |
| void | tryAddEntityToTree (const DtUUID &uuid) |
| void | refreshSimEngineAddresses () |
| void | resolveAggregateChain (const makVrf::DtSimObjectReference &ref, std::vector< DtUUID > &chainUUIDs, std::vector< std::string > &chainNames, std::vector< QIcon > &chainIcons, std::vector< int > &chainForces) |
| void | removeEntityFromTree (const DtUUID &uuid) |
| void | updateStatusLabels () |
| void | updateSubmitButtonState () |
| bool | saveAssignmentsToFile (const QString &filePath) |
| bool | loadAssignmentsFromFile (const QString &filePath) |
Friends | |
| class | DtVreManagerWidgetCreator |
|
overridevirtual |
Virtual destructor.
Cleans up resources used by the manager widget, including the table model, entity selection dialog, and VREngage listener.
|
protected |
Constructor.
| de | The distributed environment reference |
| parent | The parent widget |
| f | Window flags to apply to the widget |
Initializes a new VREngage manager widget. This constructor is private and can only be called by the DtVreManagerWidgetCreator.
References de().
|
overridevirtual |
Gets the icon for this page.
Returns the icon representing the VREngage Manager in the application UI.
|
overridevirtual |
Gets the title for this page.
Returns the human-readable title for the VREngage Manager page.
Referenced by showPersistenceWarnings().
|
overridevirtual |
Gets the class name of the page.
Returns the unique identifier for this page class type. This name is used for page identification and persistence purposes.
|
overridevirtual |
Called when the page is displayed.
Activates the manager widget, setting up the necessary connections, initializing the table model, and refreshing the display. This is called whenever the page becomes visible to the user.
|
overridevirtual |
Called when the page is hidden.
Deactivates the manager widget, cleaning up resources and disconnecting signals. This is called whenever the page becomes invisible to the user.
|
overridevirtual |
Gets the icon configurations for the page.
Returns the configuration settings used to style the page's icon based on application settings and theme.
|
overridevirtual |
Returns preferred initial size for dock sizing.
Sized so that, when first opened in the right dock area, the panel shows roughly two station cards plus the entire bottom button row without requiring a manual resize.
|
overridevirtual |
Returns the smallest sensible size for the dock.
The dock can be shrunk down to this size but no further, so the Submit / Submit-with-Conflicts / Revert button row is never clipped.
|
static |
Static callback for VREngage application discovery.
| id | The unique identifier of the discovered application |
| usr | User-defined data (pointer to the manager widget instance) |
Static callback function invoked when a new VREngage application is discovered. Routes the callback to the appropriate instance method.
|
static |
Static callback for VREngage application removal.
| id | The unique identifier of the removed application |
| usr | User-defined data (pointer to the manager widget instance) |
Static callback function invoked when a VREngage application is removed. Routes the callback to the appropriate instance method.
|
static |
Static callback for VREngage application status changes.
| id | The unique identifier of the changed application |
| usr | User-defined data (pointer to the manager widget instance) |
Static callback function invoked when a VREngage application's status changes. Routes the callback to the appropriate instance method.
|
signal |
Emitted when a known entity's force type changes at runtime.
| entityUUID | UUID of the entity whose force type changed |
| newRawForceType | New SISO force-type value (0=Other, 1=Friendly, 2=Opposing, 3=Neutral) |
Fired inside tryAddEntityToTree() whenever the force type reported by the sim object reference differs from the last-observed value. The tree model slot DtVreEntityRoleTreeModel::moveEntityToForce() is connected to this signal via Qt::QueuedConnection so the move always executes on the GUI thread, even if the sim object manager fires its update callback from a different thread.
|
virtualslot |
Handles submission of changes.
Called when the user submits changes to VREngage application settings. Applies the changes to the affected applications.
|
virtualslot |
Handles submission of changes even when conflicts exist.
Called when the user forcefully submits changes despite unresolved conflicts. Uses the same send path as onSubmit().
|
virtualslot |
Handles reverting of changes.
Called when the user cancels changes to VREngage application settings. Reverts any pending changes and refreshes the display.
|
virtualslot |
Handles completion of user edits.
Called when the user completes an edit operation in the manager. Updates internal state and enables/disables UI elements accordingly.
|
virtualslot |
Handles data changes in the table model.
Called when data in the table model changes. Updates the Submit button state based on whether conflicts exist in the current assignments.
|
virtualslot |
Handles assignment tracker state changes.
Called when the assignment tracker's state changes (station added/removed, pending assignments changed, etc.). Used for testing Phase 1 integration.
|
virtualslot |
Handles VREngage application addition.
| id | The unique identifier of the added application |
Called when a new VREngage application is discovered. Updates the table model and refreshes the display to show the new application.
|
virtualslot |
Handles VREngage application removal.
| id | The unique identifier of the removed application |
Called when a VREngage application is removed or times out. Updates the table model and refreshes the display to remove the application.
|
virtualslot |
Handles VREngage application status changes.
| id | The unique identifier of the changed application |
Called when a VREngage application's status changes. Updates the table model and refreshes the display to show the updated status.
|
virtualslot |
Handles entity search text changes.
| text | The current search text |
Filters the entity/role tree to show only entities whose display name contains the search text (case-insensitive).
|
virtualslot |
Handles station search text changes.
| text | The current search text |
Filters the station list to show only stations whose name contains the search text (case-insensitive).
|
virtualslot |
Toggles between expanding and collapsing all entity nodes in the tree.
|
virtualslot |
Handles clicks on the entity/role tree.
| index | The model index of the clicked item |
Entity clicks toggle expand/collapse. Role clicks set the selected entity UUID and role name for the assignment workflow.
|
virtualslot |
Handles clicks on the station list.
| index | The model index of the clicked item |
If a role is armed (selected in the entity/role tree), clicking a station creates a pending assignment for that station to the armed role. Otherwise, records the selected station ID.
|
virtualslot |
Handles right-click context menu on the station list.
| pos | The position of the right-click in widget coordinates |
Shows a context menu with options to clear pending assignments for the clicked station.
|
virtualslot |
Handles a click on the spectator mode toggle button.
| stationId | The ID of the station whose spectator mode should be toggled |
Toggles spectator mode for the pending assignment on the given station. Called when the user clicks the spectator mode button embedded in a station card.
|
virtualslot |
Handles a click on the status indicator circle.
| stationId | The ID of the station to unassign or clear pending |
|
virtualslot |
Handles clicks on the assignment-status sort button.
|
virtualslot |
Handles clicks on the station-name sort button.
|
virtualslot |
Applies entity/role tree ordering when the header sort indicator changes.
| section | The logical column index owning the active sort indicator |
| order | The active Qt sort order (ascending/descending) |
Connected to QHeaderView::sortIndicatorChanged so the built-in header indicator drives the existing custom tree-model ordering exactly once (avoids section-click double-sort wiring).
|
virtualslot |
Pops the entity/role tree header context menu.
| pos | Position of the right-click within the header viewport |
Builds a small QMenu with one checkable action per toggleable column (currently just "Show Sim Engine column"). Designed so future optional columns can register themselves the same way without restructuring the slot.
|
virtualslot |
Opens a file dialog and saves the current assignment layout to JSON.
|
virtualslot |
Opens a file dialog and loads an assignment layout from JSON.
If pending changes exist, prompts the operator to confirm replacement before importing. On parse errors shows a critical dialog. On partial success shows a warning summary.
|
protectedvirtual |
Handles model set changes.
Populates the model sets that could possibly contain VREngage-controllable entities. This includes any SMS (Simulation Model Set) that derives from VR-Engage.sms somewhere in its ancestry. Called when the available model sets change.
|
overrideprotectedvirtual |
Responds to palette changes so toolbar icons repaint in the correct colour.
Catches QEvent::PaletteChange to rebuild the expand/collapse and sort button icons using the updated QPalette::Text colour (important for dark-mode switches).
|
overrideprotectedvirtual |
Repaints toolbar icons on first show.
The palette may not be fully resolved during setupNewUi() (before the widget is parented into the main window), so icons are also refreshed here to ensure they use the correct colour from the first visible frame.
|
overrideprotected |
Filters mouse events on the entity/role tree viewport.
Clears the tree selection when the user clicks empty space.
|
protected |
Rebuilds the expand/collapse toggle button icon from the current palette.
|
protected |
Syncs the expand/collapse toggle button to reflect the tree's actual state.
Computes whether every visible root entity node is expanded and updates myTreeExpanded and the button icon/tooltip accordingly. Call this after any operation that may change the expanded state without going through onToggleExpandCollapse (filter changes, model reset, entity add/remove, individual node expand/collapse by the user).
|
protected |
Mirrors header-hover visual state to the embedded expand/collapse button.
When active, the button receives the same subtle neutral overlay used by tree header hover so the two controls read as one continuous affordance.
|
protected |
Rebuilds the assignment-status sort button icon from the current palette.
|
protected |
Refreshes the station-name sort button presentation.
|
protected |
Applies station-list sort state to proxy and updates button visuals.
|
protectedvirtual |
Internal activation handler.
Implementation of the activation logic. Called by activate().
|
protectedvirtual |
Internal deactivation handler.
Implementation of the deactivation logic. Called by deactivate().
|
protected |
Sets up the UI components.
| p | The parent widget to set up UI on |
Initializes and configures the user interface components of the manager widget. Creates the table, buttons, and other controls, and connects signals and slots.
|
protected |
Sets up the new two-panel splitter UI (Phase 3)
Creates the new UI layout with entity/role tree on the left, station list on the right, search boxes, station sort controls, toolbar buttons, and status labels. Wires the Phase 2 models to the new views and connects all signals.
|
protected |
Populates the entity/role tree with all VRE-engageable entities.
Enumerates all sim objects in the exercise, filters to VRE-engageable entities via DtVreModelSetDb (those exposing non-empty engage roles), retrieves available roles, and adds each entity to the tree model. Also connects to sim object added/deleted signals for dynamic updates.
|
protected |
Attempts to add a single sim object to the tree if VRE-engageable.
| uuid | The entity UUID to evaluate and potentially add |
|
protected |
Refreshes the cached Sim Engine address for every tracked entity.
Iterates over all entities in myEntityForceTypes, looks up their current simEngineAddress(), and calls setEntitySimEngine() on the tree model. Because setEntitySimEngine() short-circuits when the cached value is unchanged, this is cheap to call periodically. Driven by mySimEngineRefreshTimer so ownership transfers that change an entity's simulating engine are reflected in the Sim Engine column.
|
protected |
Walk the aggregate parent chain for a sim-object reference (Phase 8)
| [in] | ref | Sim-object reference whose aggregate ancestry to walk |
| [out] | chainUUIDs | Aggregate ancestor UUIDs, root-most first |
| [out] | chainNames | Display names parallel to chainUUIDs |
| [out] | chainIcons | Pre-rendered icons parallel to chainUUIDs |
| [out] | chainForces | SISO force-type per aggregate (parallel) |
Empties the output vectors first, then descends from ref using DtSimObject::parent() until the chain ends. chainNames / chainIcons / chainForces are resolved via DtVrfGuiSimObjectManager / DtVrfGuiSymbolMapper. Each aggregate UUID encountered is also inserted into myKnownAggregates so a later signal_objectDeleted can be routed correctly.
|
protected |
Removes a sim object from the tree by UUID.
| uuid | The entity UUID to remove |
|
protected |
Updates the status labels with current counts.
Refreshes the entity and station status labels in the new UI with current entity count, station count, and unassigned count.
|
protected |
Updates the submit button text and enabled state.
Enables the submit button when pending changes exist and updates the button text to show pending and reassignment counts.
|
protected |
Saves assignment file data to the given file path.
|
protected |
Loads and imports assignments from the given file path.
| void makVre::DtVreManagerWidget::setStartupAssignmentFile | ( | const QString & | filePath | ) |
Sets the assignment file to load automatically on first activation.
| filePath | Path to a JSON assignment file, or empty to disable. |
When non-empty, the file is loaded once the first time activate() is called (i.e. when the Manager Panel first becomes visible). The stored path is cleared immediately after the load attempt so subsequent show/hide cycles do not re-trigger the load.
| bool makVre::DtVreManagerWidget::entityExistsInCurrentExercise | ( | const DtUUID & | entityUUID | ) | const |
Returns true if the given entity UUID exists in the current exercise.
| void makVre::DtVreManagerWidget::showPersistenceWarnings | ( | const QStringList & | warnings, |
| const QString & | title ) |
Shows a QMessageBox warning listing the given warnings under title.
References title().
| void makVre::DtVreManagerWidget::submitChanges | ( | bool | allowConflicts | ) |
Shared submit implementation.
| allowConflicts | If true, the submit proceeds even when conflicts exist |
|
friend |
Allows the creator class to create page instances.
References DtVreManagerWidgetCreator.
Referenced by DtVreManagerWidgetCreator.
|
protected |
Class name for this page type.
Unique string identifier for this page class.
|
protected |
UI components for the new two-panel splitter layout (Phase 3)
Contains the tree view, list view, search boxes, sort controls, toolbar buttons, and status labels for the redesigned Manager Panel.
|
protected |
Sort/filter proxy wrapping the station list model.
Provides alphabetical sorting of the station list display while leaving the source model's own filter logic intact.
|
protected |
VREngage status listener.
Tracks status information for VREngage applications.
|
protected |
Assignment tracker for managing pending and confirmed assignments.
Provides a unified view of station assignments, combining confirmed state from the status listener with pending user edits.
|
protected |
Tree model for entity/role hierarchy display (Phase 2)
Provides a two-level tree model where entities are at level 0 and roles are at level 1. Used for the left panel in the new UI design.
|
protected |
List model for station display (Phase 2)
Provides a flat list of all VR-Engage stations with assignment status. Used for the right panel in the new UI design.
|
protected |
Signal connection manager.
Manages Qt signal/slot connections for cleanup.
|
protected |
Guards against re-connecting the sim-object manager signals.
activate() may be called on every show; the sim-object manager signal connections must be made only once or each cycle would add a duplicate.
|
protected |
Assignment file to load automatically on the first activation.
Set via setStartupAssignmentFile() before the panel is first shown. Consumed and cleared in activate() after the first successful load attempt.
|
protected |
Currently selected (armed) entity UUID for assignment.
Set when the user clicks a role node in the entity/role tree. Cleared after an assignment is made or the selection is cancelled.
|
protected |
Currently selected (armed) role name for assignment.
Set together with mySelectedEntityUUID when a role node is clicked.
|
protected |
Currently selected station ID in the station list.
Set when the user clicks a station in the station list.
|
protected |
Tracks whether the entity/role tree is fully expanded.
Used by the toggle button to alternate between expand-all and collapse-all.
|
protected |
True when the assignment-status key is the active station sort key.
|
protected |
Active sort direction for the station list.
|
protected |
Exclusive group owning the two station sort buttons.
|
protected |
Overlay child widgets that draw active and hover-hint sort indicator arrows on top of the two station sort buttons. Stored as QWidget* because the concrete type lives in an anonymous namespace in the implementation file.
|
protected |
Currently selected (armed) entity UUID for assignment.
Set when the user clicks a role node in the entity/role tree. Cleared after an assignment is made or the selection is cancelled.
|
protected |
Expand/collapse toggle button embedded in the entity/role tree header.
Created programmatically and parented to the tree's QHeaderView. Positioned so it aligns with force-level disclosure triangles.
|
protected |
Tracks whether the entity/role header is currently hovered.
|
protected |
Tracks whether the embedded expand/collapse button is currently hovered.
|
protected |
Custom delegate installed on column 1 of the entity/role tree.
Renders the assignment-status column: entity icon + station name for role leaves; "<assigned>/<total>" count text for force / entity branching nodes.
|
protected |
Currently loaded SMS filename.
The filename of the currently loaded Simulation Model Set.
|
protected |
Save assignments toolbar button (new UI path)
|
protected |
Load assignments toolbar button (new UI path)
|
protected |
Cache of the last-observed force type for each entity in the tree.
Maps entity UUID to its last-known SISO force-type value. Updated in tryAddEntityToTree() whenever an entity is added or refreshed, and erased in removeEntityFromTree(). Used to detect force-type changes so that entityForceTypeChanged() can be emitted when the value differs.
|
protected |
Set of aggregate UUIDs currently mirrored into the tree (Phase 8)
Populated as we walk DtSimObject::parent() chains during tryAddEntityToTree(). Lets signal_objectDeleted distinguish aggregate sim-object deletions (which prune via removeAggregateNode()) from entity deletions (which prune via removeEntityFromTree()).
|
protected |
Whether the optional Sim Engine column (column 2) is currently visible.
Toggled at runtime via the entity/role tree header context menu (onTreeHeaderContextMenu). Kept purely in-memory — the column resets to hidden on every launch.
|
protected |
Periodic timer that refreshes the Sim Engine column.
Fires every 2 seconds and calls refreshSimEngineAddresses() to pick up ownership transfers that change an entity's simulating engine address. Owned as a QObject child — cleaned up automatically.
|
protected |
Re-entrancy guard for the per-column floor enforcement slot.
QHeaderView::minimumSectionSize is global, so per-column floors are enforced in setupNewUi() via a sectionResized lambda that calls resizeSection() back when a column drops below its floor. That nested resizeSection() re-enters the same signal; this flag short-circuits the second pass to avoid infinite recursion. See Phase 5a.