NDEVR
API Documentation
ModelFileDialog.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: ModelFileDialog
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/IOFactory.h>
35#include <NDEVR/File.h>
36#include <NDEVR/Buffer.h>
37
38#include <QWidget>
39class QPushButton;
40class QComboBox;
41class QLabel;
42namespace Ui
43{
44 class ImportSettings;
45}
46namespace NDEVR
47{
48 class Button;
49 class QTModelManager;
51 class INIFactory;
52 class Scene;
54 class FactoryFeatures;
59 class NDEVR_API ModelFileDialog : public QWidget
60 {
61 Q_OBJECT
62 public:
69 ModelFileDialog(bool is_import, InfoPipe* log, QWidget *parent = 0);
78 virtual void updateUINow();
87 bool shouldShow() const;
91 void closeEvent(QCloseEvent*) override
92 {
93 if (!m_accepted && !m_canceled)
95 };
96
100 virtual void isOptionMode(bool is_options_mode);
105 void setFormat(const FactoryParameters& format);
109 virtual void updateFeatures();
114 virtual void setFeatures(const FactoryFeatures& features);
115
116 protected:
125 virtual void onCancelled();
129 virtual void onAccepted();
130 signals:
135 void dialogEnded(bool accepted);
140 void ModelLoaded(const Scene* object);
141 protected slots:
158 public:
163 bool canRevertOptions() const;
168 bool canResetOptions() const;
182 static File INISettingsFolder(bool is_import);
187 File iniFile() const;
202 FactoryOptions options() const { return m_params.options; }
203
204 protected:
209 virtual void updateOptions(FactoryOptions& new_options);
212 Ui::ImportSettings* ui;
215 const bool m_is_import;
217 bool m_ui_dirty = false;
222 };
223}
Simple version of ResourceListener which allows for a simple function callback that will be executed ...
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
A core widget that allows the user to click one of many button types.
Definition Button.h:68
Allows IOFactories to report what features they support to make the import/export dialogs easier to s...
User-defined options that define preferences for importing and exporting using IOFactory objects.
IncludeProperties
Describes how a particular data field (vertex property or geometry type) should be handled during imp...
Logic for reading or writing to a file as well as navigating filesystems or other common file operati...
Definition File.h:53
Creates a clean formatted dialog for any number of GenericOptions within a GenericOptionGroup Each op...
Contains methods for easily reading and writing to an INI file including efficient casting,...
Definition INIReader.h:107
A light-weight base class for Log that allows processes to update, without the need for additional in...
const bool m_is_import
Whether this dialog is for importing (true) or exporting (false).
InfoPipe * m_log
The logging pipe for status messages.
bool m_accepted
Whether the dialog was accepted.
void saveOptionsAsDefault()
Saves the current options as the default for this file format.
void setOptionsToDefault()
Resets the current options to the saved defaults.
FactoryParameters m_params
The current factory parameters including format and options.
void ModelLoaded(const Scene *object)
Emitted when a model has been loaded from the import.
void closeEvent(QCloseEvent *) override
Handles the close event, treating it as a cancellation if not already accepted or canceled.
virtual void updateOptions(FactoryOptions &new_options)
Updates the given factory options from the current UI state.
bool canResetOptions() const
Returns whether the options can be reset to factory defaults.
FactoryOptions options() const
Returns the current factory options.
virtual void onCancelled()
Called when the user cancels the dialog.
const FactoryOptions & defaultOptions()
Returns the default factory options for the current format.
static void ResetAllImportOptionsToDefaults()
Resets all import options for all formats to factory defaults.
static void ResetAllExportOptionsToDefaults()
Resets all export options for all formats to factory defaults.
bool m_has_settings_change
Whether settings have been modified from defaults.
ModelFileDialog(bool is_import, InfoPipe *log, QWidget *parent=0)
Constructs the model file dialog for import or export settings.
virtual void updateUINow()
Immediately updates the UI to reflect the current options state.
UnitManager m_file_units
The unit manager for file unit conversions.
void setShowOnEachImport()
Toggles whether the options dialog is shown on each import.
bool m_ui_dirty
Whether the UI needs to be refreshed.
FactoryOptions::IncludeProperties getGenerationPrecision() const
Returns the generation precision setting from the current options.
File iniFile() const
Returns the INI settings file for the current format.
bool m_canceled
Whether the dialog was canceled.
void setWindingCalculation(WindingMode winding)
Sets the winding calculation mode for mesh imports.
bool canRevertOptions() const
Returns whether the options can be reverted to saved defaults.
virtual void onAccepted()
Called when the user accepts the dialog.
Buffer< GenericOptionsGroup * > m_generic_options_widgets
Widgets for format-specific generic options.
virtual void setFeatures(const FactoryFeatures &features)
Sets the factory features and updates the UI accordingly.
Ui::ImportSettings * ui
The auto-generated UI form.
FactoryOptions m_default_options
The default factory options for comparison.
void postUpdateUIRequest()
Posts a deferred request to update the UI on the next event loop cycle.
void setFormat(const FactoryParameters &format)
Sets the file format and parameters for this dialog.
static File INISettingsFolder(bool is_import)
Returns the folder where INI settings files are stored.
bool shouldShow() const
Returns whether this dialog has settings that warrant showing it to the user.
FactoryOptions::IncludeProperties getReadPrecision() const
Returns the read precision setting from the current options.
void revertOptionsToFactoryDefault()
Reverts the current options to the original factory defaults.
virtual void isOptionMode(bool is_options_mode)
Switches the dialog between options-only mode and full import/export mode.
virtual void updateFeatures()
Updates the UI to reflect the current factory feature set.
void dialogEnded(bool accepted)
Emitted when the dialog is closed, indicating acceptance or cancellation.
File m_ini_file
The INI file path for persisting options.
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
The root Model that is responsible for storing the underlying data for all Scene Models.
Definition Scene.h:52
Manages a collection of units across multiple data categories with INI persistence.
The primary namespace for the NDEVR SDK.
WindingMode
Describes the vertex winding order used to determine front-facing direction of polygons.
A container of input information that is to be filled with output information by an IOFactory.
Definition IOFactory.h:105