NDEVR
API Documentation
WindowManager3D.h
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: NDEVR
28File: QTWindowManager
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#if NDEVR_VIEWPORT
35#include <NDEVR/WindowManager.h>
36#include <NDEVR/WidgetInit.h>
37#include <NDEVR/Pointer.h>
38#include <NDEVR/Buffer.h>
39#include <QPointer>
40namespace NDEVR
41{
43 class SceneTreeWidget;
44 class SelectionWidget;
46 class LibraryWidget;
47 class ReportGeneratorDialog;
51 class Toolbar;
54 class MeasurementCommandsWidget;
55 class NDEVRRibbon;
56 class StatusBar;
57 class CameraPane;
58 class CameraView;
59 class MainWindow;
60 class CustomDockButton;
68 class NDEVR_API QTWindowManager : public WindowManager
69 {
70 Q_OBJECT
71 public:
78
88 virtual void addCustomDockWidget(DockInit* widget) override;
89
100 virtual void showModelProperties(const ShowPropertiesSettings& settings) override;
101
109 virtual void updateModified() override;
110
122 virtual void requestExitWithFunction(std::function<void()> exit_function, const PopupInfo& popup_origin = PopupInfo()) override;
123
132 virtual void exit(bool relaunch = false, const StringView& relaunch_options = "--relaunch") override;
133
143 virtual ContainerWidget* container() const override;
144
154 virtual QWidget* mainWindow() const override;
155
164 virtual void userZoomToModel(const UUID& id);
165
170 template<class t_dock_type>
172 {
173 for (uint04 i = 0; i < m_custom_dock_widgets.size(); i++)
174 {
175 if (m_custom_dock_widgets[i] != nullptr)
176 {
177 if (DockWidget<t_dock_type>* dock = dynamic_cast<DockWidget<t_dock_type>*>(m_custom_dock_widgets[i]->getDock()))
178 return dock;
179 }
180 }
181 return nullptr;
182 }
183
187 const Buffer<String>& args() const { return m_args; }
192 virtual void setAutoCreateCameras(bool autocreate) { m_auto_create_camera_windows = autocreate; }
203 virtual MainWindow* createWindow(uint04 monitor_number);
213 virtual uint04 windowCount() const { return m_main_windows.size(); };
222 virtual bool isClosing() const { return m_is_exiting; }
228 virtual MainWindow* window(uint04 index) const { return m_main_windows[index]; };
233 virtual NDEVRRibbon* ribbon() const;
284 virtual void closeWindow(MainWindow* window, QCloseEvent* event);
310 virtual void onViewportSelection(UUID id);
311 protected:
317 virtual void closeWindow(uint04 index, QCloseEvent* event);
321 virtual void setupViews();
328 bool eventFilter(QObject* Object, QEvent* Event) override;
334 virtual MainWindow* createMainWindow(uint04 monitor_number);
359 virtual LogManagerDialog* createLogView() override;
368 void setupLogs();
374 virtual QCustomDockWidget* largestCameraView(bool check_visible = true) const;
378 virtual void recoverLastData() override;
383 virtual void setupRibbons(bool setup_all);
387 virtual void setupCameraPanels();
392 virtual void readArgs(const Buffer<String>& args);
398 virtual void readArg(const StringView& arg, const StringView& data);
404 virtual DropArea defaultDropArea(const QCustomDockWidget* dock_widget) const override;
410 virtual SectionWidget* defaultDropReference(const QCustomDockWidget* dock_widget = nullptr) const override;
416 virtual RibbonArea defaultRibbonArea(const QCustomDockWidget* dock_widget) override;
422 virtual void updateRemoteWidgets(const Buffer<QPointer<QWidget>>& widgets, bool are_remote);
426 virtual void clearAll() override;
430 void layoutAll() override;
441 void onCameraLayoutUpdated(Buffer<QPointer<DockWidget<CameraView>>>& removed_views);
446 public slots:
463 void cameraSwapSlot(UUID camera);
464 protected slots:
484 void onCameraDelete(UUID camera);
489 void onCameraAdd(UUID camera);
498 protected:
509 QPointer<DockWidget<ModelCommandsWidget>> m_model_edit_dock = nullptr;
510 QPointer<DockWidget<MeasurementCommandsWidget>> m_measure_editor_dock = nullptr;
514 UUID m_selected_editor_id = Constant<UUID>::Invalid;
517 };
518}
519#endif
A LogStream that writes log messages directly to a specified ASCII text file.
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
The default container for multiple Viewports in the NDEVR environment.
Definition CameraPane.h:56
manages a series of SectionContent that can share the same space or lay out in various patterns inclu...
A DockItem that represents a button.
Provides a way to optionally lazily initialize widgets when needed but still pass them to container d...
Definition WidgetInit.h:43
A type-safe dock widget that wraps a specific widget type.
A popup that is shown when a remote project is being downloaded.
A widget for interfacing with GeometryMaker to allow the user to draw 3D objects or shapes.
This dialog is shown front and center before the user has loaded any data or created a project In tou...
Allows the user to select Models or Materials from a list to add to the scene.
A dialog which shows multiple log views, where each log is a tab.
The primary Window within the NDEVR API.
Definition MainWindow.h:69
A widget for interfacing with ModelEditController to allow the user to edit or modify objects in the ...
The Ribbon that typically appears on the top of the window or, in touch mode, to the side of the wind...
Provides a wrapper for a widget that can be docked inside a Container or floated as a top-level windo...
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
A ResourceListener which will always be executed on the main UI thread and can be tied to a Qt Object...
Definition QTTools.h:493
void refreshCameraSwap()
Slot that refreshes the camera swap state.
QPointer< DockWidget< MeasurementCommandsWidget > > m_measure_editor_dock
The measurement commands editor dock.
virtual bool isClosing() const
Checks whether the application is currently closing.
virtual QWidget * mainWindow() const override
Returns the primary window for the application.
virtual DockWidget< DrawCommandsWidget > * drawEditor()
Returns the draw commands editor dock widget.
DockWidget< DownloadDatasetWidget > * m_download_widget
The dataset download dock.
UUID m_selected_editor_id
The UUID of the currently selected editor target.
void setupSelectionWidget()
Slot that initializes or refreshes the selection widget.
virtual void setupRibbons(bool setup_all)
Sets up the ribbon toolbars.
void layoutAll() override
Performs a full layout pass, arranging all dock widgets and panels.
DockWidget< SelectionWidget > * m_selection_dock
The selection properties dock widget.
virtual DockWidget< SceneTreeWidget > * sceneTree() const
Returns the scene tree dock widget.
virtual NDEVRRibbon * ribbon() const
Returns the primary ribbon widget.
virtual void updateModified() override
Called when application should check to see if the project has been modified since last save.
DockWidget< LibraryWidget > * m_library_dock
The asset library dock.
DockWidget< ReportGeneratorDialog > * m_report_generator
The report generator dock widget.
virtual void closeWindow(MainWindow *window, QCloseEvent *event)
Closes a specific main window, handling the close event.
virtual DockWidget< ModelCommandsWidget > * modelEditor()
Returns the model commands editor dock widget.
virtual void setAutoCreateCameras(bool autocreate)
Sets whether camera viewport windows are automatically created for new cameras.
virtual void addWindow(MainWindow *window)
Adds an existing main window to the manager.
QPointer< DockWidget< ModelCommandsWidget > > m_model_edit_dock
The model commands editor dock.
virtual void setupViews()
Sets up the initial viewport views and camera panels.
virtual String mainWindowPreferedName() const
Returns the preferred name for the main window title.
bool m_has_model_content
Whether the project contains model content.
Buffer< MainWindow * > m_main_windows
All managed main windows.
Toolbar * m_vertical_mode_toolbar
The vertical mode toolbar.
void hideCurrentSelectionEditorDialog()
Hides the currently displayed selection editor dialog.
virtual LibraryWidget * createLibraryWidget() const
Creates a new library widget for asset browsing.
void addUserData(Buffer< UUID > object)
Slot invoked when user data has been added to the project.
virtual DockWidget< CameraPane > * cameraPane() const
Returns the camera pane dock widget.
DockWidget< t_dock_type > * customDock() const
Searches custom dock widgets for one matching the given type.
virtual void showModelProperties(const ShowPropertiesSettings &settings) override
Called when we want to show the dialog for editing a specific object using application default editin...
void onCameraDelete(UUID camera)
Slot invoked when a camera is deleted.
virtual uint04 windowCount() const
Returns the number of managed main windows.
virtual void exit(bool relaunch=false, const StringView &relaunch_options="--relaunch") override
Saves user settings and exits the application, relaunching if requested.
virtual void closeWindow(uint04 index, QCloseEvent *event)
Closes the main window at the given index, handling the close event.
Buffer< QPointer< QWidget > > m_active_screen_widgets
Widgets displayed on the active screen.
void cameraSwapSlot(UUID camera)
Slot invoked to swap a camera view to the primary viewport position.
Buffer< QPointer< DockWidget< CameraView > > > cameraViews() const
Returns all camera view dock widgets.
void designObjectAdded(Buffer< UUID > object)
Slot invoked when design objects have been added to the project.
void onClearSlot()
Slot invoked when the project is cleared.
virtual DropArea defaultDropArea(const QCustomDockWidget *dock_widget) const override
Returns the default drop area for a dock widget.
virtual bool autoCreateWindows()
Checks whether camera viewport windows are automatically created.
virtual void updateRemoteWidgets(const Buffer< QPointer< QWidget > > &widgets, bool are_remote)
Updates the remote widget display, toggling between embedded and remote modes.
virtual void userZoomToModel(const UUID &id)
Zooms the dialog to an object, and if required, shows a viewport if none are visible.
CustomDockButton * m_add_camera_button
Button for adding new camera viewports.
virtual void setupCameraPanels()
Sets up the camera panels based on the current viewport layout.
virtual RibbonArea defaultRibbonArea(const QCustomDockWidget *dock_widget) override
Returns the default ribbon area for a dock widget.
virtual GettingStartedDialog * createGettingStartedDialog() const
Creates a new getting started dialog for the home screen.
QTWindowManager(QTModelManager *manager, const Buffer< String > &args=Buffer< String >())
Constructs a 3D window manager with the given model manager and command-line arguments.
virtual LogManagerDialog * createLogView() override
Creates and returns a new LogManagerDialog instance.
virtual void requestExitWithFunction(std::function< void()> exit_function, const PopupInfo &popup_origin=PopupInfo()) override
Prompts the user to confirm an exit and save changes if required.
virtual MainWindow * window(uint04 index) const
Returns the main window at the given index.
virtual DockWidget< SelectionWidget > * selectionWidget()
Returns the selection properties dock widget.
void setupRemoteWidgetsSlot()
Slot that sets up remote widgets based on the current configuration.
bool m_auto_create_camera_windows
Whether to auto-create camera viewport windows.
DockWidget< DrawCommandsWidget > * m_draw_editor_dock
The draw commands editor dock.
virtual QCustomDockWidget * largestCameraView(bool check_visible=true) const
Returns the largest camera view dock widget, optionally filtering by visibility.
virtual DockWidget< DownloadDatasetWidget > * downloadWidget()
Returns the dataset download widget dock.
virtual SectionWidget * defaultDropReference(const QCustomDockWidget *dock_widget=nullptr) const override
Returns the default section widget to drop relative to.
virtual void recoverLastData() override
Attempts to recover data from the last session if it was not properly saved.
Buffer< String > m_args
Command-line arguments passed at construction.
virtual SelectionWidget * createSelectionWidget() const
Creates a new selection widget for displaying selected object properties.
bool eventFilter(QObject *Object, QEvent *Event) override
Filters events for managed objects.
virtual DockWidget< GettingStartedDialog > * home() const
Returns the getting started / home dialog dock widget.
virtual void clearAll() override
Resets the entire display to the initial state with no project loaded.
void onCameraLayoutUpdated(Buffer< QPointer< DockWidget< CameraView > > > &removed_views)
Handles a camera layout update, cleaning up removed views.
virtual void addCustomDockWidget(DockInit *widget) override
Adds a widget to be docked in the default location when a project has been loaded.
virtual DockWidget< MeasurementCommandsWidget > * measureEditor()
Returns the measurement commands editor dock widget.
Buffer< QPointer< QWidget > > m_inactive_screen_widgets
Widgets on inactive screens.
virtual DockWidget< LibraryWidget > * libraryEditor()
Returns the library widget dock for asset browsing.
void updateProjectSlot()
Slot invoked to update the display when the project changes.
void swapCameras(DockWidget< CameraView > *camera_a, DockWidget< CameraView > *camera_b)
Swaps the positions of two camera view dock widgets.
void finishInitialSetup()
Completes the initial setup process and transitions to the main application state.
virtual void onViewportSelection(UUID id)
Handles a viewport selection event for the given object.
virtual SceneTreeWidget * createSceneTree() const
Creates a new scene tree widget.
virtual MainWindow * createWindow(uint04 monitor_number)
Creates a new main window on the specified monitor.
StatusBar * m_status_bar
The status bar widget.
void setupLogs()
Sets up log stream connections to the status bar and log dock.
virtual ContainerWidget * container() const override
Returns the primary container widget for adding new docks.
virtual void readArg(const StringView &arg, const StringView &data)
Processes a single command-line argument and its associated data.
void onCameraAdd(UUID camera)
Slot invoked when a new camera is added.
virtual MainWindow * createMainWindow(uint04 monitor_number)
Creates a new main window on the specified monitor.
const Buffer< String > & args() const
Returns the command-line arguments passed at construction.
virtual DownloadDatasetWidget * createDownloadDatabaseWidget()
Creates a new download dataset widget.
virtual void readArgs(const Buffer< String > &args)
Parses and applies the command-line arguments.
DockWidget< CameraView > * cameraView(const UUID &camera) const
Returns the camera view dock widget for a specific camera.
void onDesignObjectDelete(Buffer< UUID > object)
Slot invoked when design objects are being deleted.
DockWidget< SceneTreeWidget > * m_scene_tree_dock
The scene tree dock widget.
virtual Toolbar * verticalModeToolbar()
Returns the vertical mode toolbar.
A container widget that wraps a SceneTree with an optional ribbon toolbar for buttons.
SectionWidget manages multiple instances of SectionContent.
A widget that displays controls and information for the currently selected design objects.
A simple widget that shows a Status and optionally a progressbar.
Definition StatusBar.h:49
The core String View class for the NDEVR API.
Definition StringView.h:58
The core String class for the NDEVR API.
Definition String.h:95
Class which displays progress and the current action being performed.
Definition Toolbar.h:15
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:61
Buffer< DockInit * > m_custom_dock_widgets
Custom dock widgets registered by modules.
WindowManager(QTModelManager *manager)
Constructs a WindowManager with the given model manager.
bool m_is_exiting
Whether the application is in the process of exiting.
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...
DropArea
relates where a widget should be dropped relative to another.
Definition RibbonArea.h:46
RibbonArea
Requests a ribbon or tab area to be in a certain location and orientation relative to another widget.
Definition RibbonArea.h:71
Base class for user-driven events which are typically KeyEvent or MouseEvent.
Definition Event.h:42
Class which is used to pass arguments and requests for creating a popup dialog or widget.
Definition PopupInfo.h:16
Stores settings for setting up and displaying a DesignObjectDialog such as whether the dialog is part...