API Documentation
Loading...
Searching...
No Matches
WindowManager3D.h
Go to the documentation of this file.
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{
42 class QCustomDockWidget;
43 class SceneTreeWidget;
44 class SelectionWidget;
45 class DownloadDatasetWidget;
46 class LibraryWidget;
47 class ReportGeneratorDialog;
48 class AsciiFileOutputStream;
49 class ModelCommandsWidget;
50 class QTResourceListener;
51 class Toolbar;
52 class GettingStartedDialog;
53 class DrawCommandsWidget;
54 class MeasurementCommandsWidget;
55 class NDEVRRibbon;
56 class StatusBar;
57 class CameraPane;
58 class CameraView;
59 class MainWindow;
60 class CustomDockButton;
61 /**--------------------------------------------------------------------------------------------------
62 \brief Manages all windows and logic surrounding dialogs and views for displaying and managing a 3D environment
63
64 Author: Tyler Parke
65
66 Date: 2023-01-16
67 **/
68 class NDEVR_API QTWindowManager : public WindowManager
69 {
70 Q_OBJECT
71 public:
72 QTWindowManager(QTModelManager* manager, const Buffer<String>& args = Buffer<String>());
73
74 /**--------------------------------------------------------------------------------------------------
75 \brief Adds a widget to be docked in the default location when a project has been loaded. If a project is
76 loaded, dialog will be added and docked immidiately
77
78 Author: Tyler Parke
79
80 Date: 2023-01-16
81 \param[in] widget - The widget to be docked
82 **/
83 virtual void addCustomDockWidget(DockInit* widget) override;
84
85 /**--------------------------------------------------------------------------------------------------
86 \brief Called when we want to show the dialog for editing a specific object using application default editing
87 dialogs. This can be called for creating new objects, editing existing objects, etc based on the
88 provided settings
89
90 Author: Tyler Parke
91
92 Date: 2023-01-16
93 \param[in] settings - The information used to generate the editing dialog
94 **/
95 virtual void showModelProperties(const ShowPropertiesSettings& settings) override;
96
97 /**--------------------------------------------------------------------------------------------------
98 \brief Called when application should check to see if the project has been modified since last save
99
100 Author: Tyler Parke
101
102 Date: 2023-01-16
103 **/
104 virtual void updateModified() override;
105
106 /**--------------------------------------------------------------------------------------------------
107 \brief Prompts the user to confirm an exit and save changes if required. If confirmed, exit_function will be
108 called and should contain the actual exit routine, typically including the call to exit()
109
110 Author: Tyler Parke
111
112 Date: 2023-01-16
113
114 \param[in] exit_function - The function to be called should the user elect to exit
115 \param[in] popup_origin - The origin where any animations should occur
116 **/
117 virtual void requestExitWithFunction(std::function<void()> exit_function, const PopupInfo& popup_origin = PopupInfo()) override;
118
119 /**--------------------------------------------------------------------------------------------------
120 \brief Saves user settings and exits the application, relaunching if requested
121
122 Author: Tyler Parke
123
124 Date: 2023-01-16
125 \param[in] relaunch - Whether or not to re-open the application after closing it
126 **/
127 virtual void exit(bool relaunch = false, const String& relaunch_options = "--relaunch") override;
128
129 /**--------------------------------------------------------------------------------------------------
130 \brief Returns the primary container widget for adding new docks
131
132 Author: Tyler Parke
133
134 Date: 2023-01-16
135
136 \returns The primary container widget, as defined by the application
137 **/
138 virtual ContainerWidget* container() const override;
139
140 /**--------------------------------------------------------------------------------------------------
141 \brief Returns the primary window for the application
142
143 Author: Tyler Parke
144
145 Date: 2023-01-16
146
147 \returns The primary window, as defined by the application
148 **/
149 virtual QWidget* mainWindow() const override;
150
151 /**--------------------------------------------------------------------------------------------------
152 \brief Zooms the dialog to an object, and if required, shows a viewport if none are visible
153
154 Author: Tyler Parke
155
156 Date: 2023-01-17
157 \param[in] id - The id of the model to zoom to
158 **/
159 virtual void userZoomToModel(const UUID& id);
160
161 template<class t_dock_type>
162 DockWidget<t_dock_type>* customDock() const
163 {
164 for (uint04 i = 0; i < m_custom_dock_widgets.size(); i++)
165 {
166 if (m_custom_dock_widgets[i] != nullptr)
167 {
168 if (DockWidget<t_dock_type>* dock = dynamic_cast<DockWidget<t_dock_type>*>(m_custom_dock_widgets[i]->getDock()))
169 return dock;
170 }
171 }
172 return nullptr;
173 }
174 const Buffer<String>& args() const { return m_args; }
175 virtual void setAutoCreateCameras(bool autocreate) { m_auto_create_camera_windows = autocreate; }
176 virtual bool autoCreateWindows() { return m_auto_create_camera_windows; }
177 virtual MainWindow* createWindow(uint04 monitor_number);
178 virtual void addWindow(MainWindow* window);
179 virtual uint04 windowCount() const { return m_main_windows.size(); };
180 void finishInitialSetup();
181 virtual bool isClosing() const { return m_is_exiting; }
182 virtual MainWindow* window(uint04 index) const { return m_main_windows[index]; };
183 virtual NDEVRRibbon* ribbon() const;
184 virtual DockWidget<GettingStartedDialog>* home() const;
185 virtual DockWidget<SceneTreeWidget>* sceneTree() const;
186 virtual DockWidget<SelectionWidget>* selectionWidget();
187 virtual DockWidget<DrawCommandsWidget>* drawEditor();
188 virtual DockWidget<MeasurementCommandsWidget>* measureEditor();
189 virtual DockWidget<LibraryWidget>* libraryEditor();
190 virtual DockWidget<ModelCommandsWidget>* modelEditor();
191 virtual DockWidget<DownloadDatasetWidget>* downloadWidget();
192 virtual Toolbar* verticalModeToolbar();
193 virtual void closeWindow(MainWindow* window, QCloseEvent* event);
194 virtual String mainWindowPreferedName() const;
195 virtual DockWidget<CameraPane>* cameraPane() const;
196 DockWidget<CameraView>* cameraView(const UUID& camera) const;
197 Buffer<QPointer<DockWidget<CameraView>>> cameraViews() const;
198 virtual void onViewportSelection(UUID id);
199 protected:
200 virtual void closeWindow(uint04 index, QCloseEvent* event);
201 virtual void setupViews();
202 bool eventFilter(QObject* Object, QEvent* Event) override;
203 virtual MainWindow* createMainWindow(uint04 monitor_number);
204 virtual SceneTreeWidget* createSceneTree() const;
205 virtual SelectionWidget* createSelectionWidget() const;
206 virtual GettingStartedDialog* createGettingStartedDialog() const;
207 virtual LibraryWidget* createLibraryWidget() const;
208 virtual LogManagerDialog* createLogView() override;
209 virtual DownloadDatasetWidget* createDownloadDatabaseWidget();
210 void setupLogs();
211 virtual QCustomDockWidget* largestCameraView(bool check_visible = true) const;
212 virtual void recoverLastData() override;
213 virtual void setupRibbons(bool setup_all);
214 virtual void setupCameraPanels();
215 virtual void readArgs(const Buffer<String>& args);
216 virtual void readArg(const String& arg, const String& data);
217 virtual DropArea defaultDropArea(const QCustomDockWidget* dock_widget) const override;
218 virtual SectionWidget* defaultDropReference(const QCustomDockWidget* dock_widget = nullptr) const override;
219 virtual RibbonArea defaultRibbonArea(const QCustomDockWidget* dock_widget) override;
220 virtual void updateRemoteWidgets(const Buffer<QPointer<QWidget>>& widgets, bool are_remote);
221 virtual void clearAll() override;
222 void layoutAll() override;
223 void swapCameras(DockWidget<CameraView>* camera_a, DockWidget<CameraView>* camera_b);
224 void onCameraLayoutUpdated(Buffer<QPointer<DockWidget<CameraView>>>& removed_views);
225 void hideCurrentSelectionEditorDialog();
226 public slots:
227 void setupRemoteWidgetsSlot();
228 void setupSelectionWidget();
229 void refreshCameraSwap();
230 void cameraSwapSlot(UUID camera);
231 protected slots:
232 void addUserData(Buffer<UUID> object);
233 void designObjectAdded(Buffer<UUID> object);
234 void designObjectModifiedSlot(UUID object);
235 void onDesignObjectDelete(Buffer<UUID> object);
236 void onCameraDelete(UUID camera);
237 void onCameraAdd(UUID camera);
238 void updateProject(UUID id);
239 void onClearSlot();
240 protected:
241 Buffer<String> m_args;
242 Buffer<QPointer<QWidget>> m_active_screen_widgets;
243 Buffer<QPointer<QWidget>> m_inactive_screen_widgets;
244 StatusBar* m_status_bar = nullptr;
245 mutable DockWidget<SceneTreeWidget>* m_scene_tree_dock = nullptr;
246 mutable DockWidget<SelectionWidget>* m_selection_dock = nullptr;
247 DockWidget<ReportGeneratorDialog>* m_report_generator = nullptr;
248 DockWidget<DrawCommandsWidget>* m_draw_editor_dock = nullptr;
249 DockWidget<DownloadDatasetWidget>* m_download_widget = nullptr;
250 DockWidget<LibraryWidget>* m_library_dock = nullptr;
251 QPointer<DockWidget<ModelCommandsWidget>> m_model_edit_dock = nullptr;
252 QPointer<DockWidget<MeasurementCommandsWidget>> m_measure_editor_dock = nullptr;
253 Toolbar* m_vertical_mode_toolbar = nullptr;
254 CustomDockButton* m_add_camera_button = nullptr;
255 Buffer<MainWindow*> m_main_windows;
256 UUID m_selected_editor_id = Constant<UUID>::Invalid;
257 bool m_auto_create_camera_windows;
258 bool m_has_model_content;
259 };
260}
261#endif
#define NDEVR_API
Definition DLLInfo.h:50
Definition ACIColor.h:37
RibbonArea
Requests a ribbon or tab area to be in a certain location and orientation relative to another widget.
Definition RibbonArea.h:71
DropArea
relates where a widget should be dropped relative to another.
Definition RibbonArea.h:46
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96