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