NDEVR
API Documentation
AsciiModelFileDialog.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: AsciiModelFileDialog
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/AutoModelFileDialog.h>
34#include <NDEVR/DesignParameter.h>
35class QPushButton;
36class QComboBox;
37class QLabel;
38namespace Ui
39{
40 class AsciiImportUI;
41}
42namespace NDEVR
43{
44 class File;
45 class FieldChooser;
46 class INIFactory;
57
61 {
62 Q_OBJECT
63 public:
72
78 AsciiModelFileDialog(bool is_import, InfoPipe* log, QWidget* parent = nullptr);
84 virtual void setRequests(const Buffer<FactoryParameters>& file) override;
94 void enabledFormatChoosing(bool enabled);
104 void updateOptions(FactoryOptions& new_options) override;
109 virtual void setUUIDs(Buffer<UUID> models) override;
110 protected:
115 QSize sizeHint() const override;
131 void predictFirstLine(uint04& line, uint04& row_count) const;
136 bool predictHasHeaders() const;
146 void setColumn(uint04 index, const DesignParameter& params);
153 bool existsOutsideOf(uint04 index, const DesignParameter& params) const;
160 bool existsBefore(uint04 index, const DesignParameter& params) const;
181 virtual void filterModelsToExport() override;
224 void updateUINow() override;
225 public slots:
234 void showColumnContextMenu(const QPoint& point);
239 void selectColumn(uint04 column);
252 protected:
253 Ui::AsciiImportUI* ascii_ui;
257 QMenu* m_field_menu = nullptr;
258 bool m_ignore_update = false;
259 bool m_pulling_template = false;
261 };
262}
void updateOptions(FactoryOptions &new_options) override
Updates the given factory options with the current dialog settings.
QMenu * m_field_menu
The context menu for column field operations.
void selectColumn(uint04 column)
Selects and highlights the specified column in the preview table.
bool m_ignore_update
Whether to suppress UI update callbacks temporarily.
virtual void filterModelsToExport() override
Filters the list of models to export based on current dialog settings.
bool checkValidity()
Validates the current dialog settings and column assignments.
bool predictHasHeaders() const
Predicts whether the file contains column header names.
AsciiError
Error codes for ASCII file validation.
@ e_file_is_empty
The file contains no data.
@ e_valid
The file is valid and can be processed.
Buffer< DesignParameter > getPossibleChannels(const String &option)
Returns the possible design parameter channels matching the given option string.
QMenu * createColumnMenu()
Creates a context menu for column operations.
virtual void setUUIDs(Buffer< UUID > models) override
Sets the UUIDs of models to export.
void showColumnContextMenu(const QPoint &point)
Displays a context menu for the column at the given position.
QSize sizeHint() const override
Returns the recommended size for this dialog.
virtual void setRequests(const Buffer< FactoryParameters > &file) override
Sets the file requests to be processed by the dialog.
AsciiModelFileDialog(bool is_import, InfoPipe *log, QWidget *parent=nullptr)
Constructs the ASCII model file dialog.
void setupDelimiterCombo()
Populates the delimiter combo box with available delimiter choices.
static FileFormat AsciiTemplateFormat()
Returns the file format descriptor for ASCII template files.
void updateColumnsFromParams()
Updates the column UI widgets from the current parameter assignments.
bool existsBefore(uint04 index, const DesignParameter &params) const
Checks whether a design parameter is assigned to any column before the specified index.
void onFieldChooserDeleted()
Slot invoked when the field chooser selection is deleted.
Buffer< DesignParameter > getChannelWhitelist() const
Returns the whitelist of allowed design parameter channels.
uint04 m_line_preview_count
The number of lines to show in the preview table.
bool existsOutsideOf(uint04 index, const DesignParameter &params) const
Checks whether a design parameter is assigned to any column other than the specified one.
void updateUINow() override
Immediately refreshes the dialog UI to reflect current settings.
Ui::AsciiImportUI * ascii_ui
The auto-generated UI form for ASCII import/export.
void onFieldChooserEdited()
Slot invoked when the field chooser value is edited by the user.
void setupColumnHeaders()
Populates the column header UI based on the current ASCII options.
AsciiError updateUIFromFile(AsciiOptions &options)
Updates the dialog UI from the given file using the specified ASCII options.
File templateFolder() const
Returns the folder path where ASCII templates are stored.
AsciiError updateExportPreview()
Updates the export preview table based on current settings.
bool m_pulling_template
Whether a template is currently being loaded.
void enabledFormatChoosing(bool enabled)
Enables or disables the format chooser controls in the dialog.
void setColumn(uint04 index, const DesignParameter &params)
Assigns a design parameter to a specific column.
void predictColumnType(AsciiOptions &options)
Attempts to automatically detect column types from the file content.
Buffer< ColumnDetails > m_column_details
Details for each column in the file.
uint04 m_selected_column
The index of the currently selected column.
void predictDelimiter(AsciiOptions &options) const
Attempts to automatically detect the column delimiter from the file content.
void onFieldChooserAccepted()
Slot invoked when the field chooser selection is accepted.
DynamicPointer< Scanner > m_scanner
The scanner used for reading file content.
Buffer< DesignParameter > getAvailableChannels(const Buffer< UUID > &models)
Returns the available design parameter channels for the given models.
void predictFirstLine(uint04 &line, uint04 &row_count) const
Predicts the first data line and total row count from the file content.
void updateFromUISlot()
Slot invoked when the user modifies any UI control, triggering a preview refresh.
AsciiOptions asciiOptions() const
Returns the current ASCII options as configured by the dialog.
void insertNewColumn(uint04 index)
Inserts a new column at the specified index.
Storage class for all IO options related to an Ascii file output used by an IOFactory services that w...
AutoModelFileDialog(bool is_import, InfoPipe *log, QWidget *parent=nullptr)
Constructs the AutoModelFileDialog.
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
A definition of data that is logically stored in the Model hierarchy.
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:356
User-defined options that define preferences for importing and exporting using IOFactory objects.
A Widget for setting up and choosing a Field used for importing and exporting data.
Data that describes a particular file format and how to use the format with the program.
Definition FileFormat.h:45
Logic for reading or writing to a file as well as navigating filesystems or other common file operati...
Definition File.h:53
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...
FactoryOptions options() const
Returns the current factory options.
The core String class for the NDEVR API.
Definition String.h:95
Stores information about a type, relevant for certain templated functions.
Definition TypeInfo.h:43
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...
@ file
The source file path associated with this object.
Stores the data for AsciiModelFileDialog user specified columns.
DesignParameter selected_option
The design parameter currently assigned to this column.
Buffer< DesignParameter > available_options
The list of valid design parameters that can be assigned.
bool has_decimals
Whether the column data contains decimal values.
TypeInfo type_info
Type information inferred from the column data.