ImportASCIIDialog Class Reference

Import ASCII file(s) dialog. More...

`#include <ImportASCIIDialog.h>`

Inheritance diagram for ImportASCIIDialog:

## Public Types

enum | ImportMode { NewTables, NewMatrices, NewColumns, NewRows, Overwrite }
| Possible destinations for the imported data. More...

## Public Slots

void | selectFilter (const QString &filter)

## Public Member Functions

QStringList | columnFormats ()
const QString | columnSeparator () const
| Return the selected column separator. More...
QList< int > | columnTypes ()
QString | commentString ()
| Returns a string used to comment lines when importing ASCII files. More...
QLocale | decimalSeparators ()
| Returns a locale having the decimal separators set to user custom settings. More...
int | endLineChar ()
| Returns the convention used for the end line character! More...
int | ignoredLines () const
| Return the number of lines to be skipped at the start of each file. More...
| ImportASCIIDialog (bool new_windows_only, QWidget *parent=0, bool extended=true, Qt::WFlags flags=0)
| Constructor. More...
bool | importComments ()
| Returns true if the second line of the ASCII file should be used to set comments in table. More...
ImportMode | importMode () const
| Return the selected import mode. More...
bool | readOnly () const
| Whether the user wants the import options to be saved. More...
bool | renameColumns () const
| Whether to rename columns based on the first (non-skipped) line. More...
void | setColumnSeparator (const QString &sep)
| Set the selected columns separator. More...
void | setCurrentPath (const QString &path)
bool | simplifySpaces () const
| Whether to replace sequences of whitespace charecters with a single space. More...
bool | stripSpaces () const
| Whether to remove whitespace from beginning and end of lines. More...
bool | useFirstRow () const
bool | useSecondRow () const
Public Member Functions inherited from ExtensibleFileDialog
| ExtensibleFileDialog (QWidget *parent=0, bool extended=true, Qt::WFlags flags=0)
| Constructor. More...
bool | isExtendable ()
| Tells weather the dialog has a valid extension widget. More...
bool | isExtended ()
void | setEditableFilter (bool on=true)
| Enables/Disables editing of the file type filter. More...
void | setExtended (bool extended)
| Toggle extension widget on/off. More...
void | setExtensionWidget (QWidget *extension)
| Set the extension widget to be displayed when the user presses the toggle button. More...
void | setExtentionToggleButtonText (const QString &text)
| Sets the text to be displayed in the toggle button. More...

## Private Slots

void | changePreviewFile (const QString &path)
void | displayHelp ()
| Display help for advanced options. More...
void | enableComments ()
void | enableTableOptions (bool on)
| Enable/Disable options which are only available for tables. More...
void | preview ()
void | showColTypeDialog ()
void | updateImportMode (int mode)
| For Overwrite mode, allow only one file to be selected. More...

## Private Member Functions

void | closeEvent (QCloseEvent *)
void | initAdvancedOptions ()
| Initialise d_advanced_options and everything it contains. More...
void | initPreview (int previewMode)
void | previewMatrix ()
void | previewTable ()
void | setNewWindowsOnly (bool on)

## Private Attributes

QComboBox * | boxDecimalSeparator
QComboBox * | boxEndLine
QGroupBox * | d_advanced_options
| Container widget for all advanced options. More...
QPushButton * | d_col_types_button
QComboBox * | d_column_separator
QLineEdit * | d_comment_string
QString | d_current_path
QComboBox * | d_first_line_role
QPushButton * | d_help_button
QSpinBox * | d_ignored_lines
QCheckBox * | d_import_comments
QComboBox * | d_import_mode
QCheckBox * | d_omit_thousands_sep
QCheckBox * | d_preview_button
QSpinBox * | d_preview_lines_box
PreviewMatrix * | d_preview_matrix
QStackedWidget * | d_preview_stack
PreviewTable * | d_preview_table
QCheckBox * | d_read_only
QCheckBox * | d_rename_columns
QCheckBox * | d_simplify_spaces
QCheckBox * | d_strip_spaces

## Additional Inherited Members

Protected Attributes inherited from ExtensibleFileDialog
QPushButton * | d_extension_toggle
| Button for toggling display of extension on/off. More...

## Detailed Description

Import ASCII file(s) dialog.

## Member Enumeration Documentation

enum ImportASCIIDialog::ImportMode

Possible destinations for the imported data.

Important: Keep this in sync with the initialization of d_import_mode in initAdvancedOptions().

Enumerator
NewTables | create a new table for each file (default)
NewMatrices | create a new matrix for each file
NewColumns | add each file as new columns to the current table
NewRows | add each file as new rows to the current table
Overwrite | replace content of current table with the selected file (like importing a single file in previous versions of QtiPlot)

## Constructor & Destructor Documentation

ImportASCIIDialog::ImportASCIIDialog | ( | bool | new_windows_only,
|  | QWidget * | parent = `0`,
|  | bool | extended = `true`,
|  | Qt::WFlags | flags = `0`
| ) |  |

Constructor.

Parameters

  importModeEnabled | flag: enable/disable import mode combo box
  parent | parent widget (only affects placement of the dialog)
  extended | flag: show/hide the advanced options on start-up
  flags | window flags

References boxDecimalSeparator, boxEndLine, changePreviewFile(), ApplicationWindow::columnSeparator, d_advanced_options, ApplicationWindow::d_ASCII_comment_string, ApplicationWindow::d_ASCII_end_line, ApplicationWindow::d_ASCII_import_comments, ApplicationWindow::d_ASCII_import_first_row_role, ApplicationWindow::d_ASCII_import_locale, ApplicationWindow::d_ASCII_import_mode, ApplicationWindow::d_ASCII_import_preview, ApplicationWindow::d_ASCII_import_read_only, d_column_separator, d_comment_string, d_current_path, d_first_line_role, d_ignored_lines, d_import_comments, d_import_mode, d_omit_thousands_sep, d_preview_button, ApplicationWindow::d_preview_lines, d_preview_lines_box, d_preview_stack, d_read_only, d_rename_columns, d_simplify_spaces, d_strip_spaces, ApplicationWindow::ignoredLines, initAdvancedOptions(), initPreview(), preview(), ApplicationWindow::renameColumns, selectFilter(), setColumnSeparator(), ExtensibleFileDialog::setEditableFilter(), ExtensibleFileDialog::setExtensionWidget(), setNewWindowsOnly(), ApplicationWindow::simplify_spaces, ApplicationWindow::strip_spaces, and updateImportMode().

## Member Function Documentation

void ImportASCIIDialog::changePreviewFile | ( | const QString & | path | ) |

private slot

References d_current_path, and preview().

Referenced by ImportASCIIDialog(), and setCurrentPath().

void ImportASCIIDialog::closeEvent | ( | QCloseEvent * | e | ) |

private

References ApplicationWindow::d_ASCII_file_filter, ApplicationWindow::d_ASCII_import_first_row_role, ApplicationWindow::d_ASCII_import_preview, ApplicationWindow::d_extended_import_ASCII_dialog, d_first_line_role, ApplicationWindow::d_import_ASCII_dialog_size, d_preview_button, ApplicationWindow::d_preview_lines, d_preview_lines_box, and ExtensibleFileDialog::isExtended().

QStringList ImportASCIIDialog::columnFormats | ( |  | ) |

inline

References PreviewTable::columnFormats(), and d_preview_table.

Referenced by ApplicationWindow::importASCII().

const QString ImportASCIIDialog::columnSeparator | ( |  | ) | const

Return the selected column separator.

References d_column_separator, and d_simplify_spaces.

Referenced by ApplicationWindow::importASCII(), previewMatrix(), and previewTable().

QList<int> ImportASCIIDialog::columnTypes | ( |  | ) |

inline

References PreviewTable::columnTypes(), and d_preview_table.

Referenced by ApplicationWindow::importASCII().

QString ImportASCIIDialog::commentString | ( |  | ) |

inline

Returns a string used to comment lines when importing ASCII files.

References d_comment_string.

Referenced by ApplicationWindow::importASCII().

QLocale ImportASCIIDialog::decimalSeparators | ( |  | ) |

Returns a locale having the decimal separators set to user custom settings.

References boxDecimalSeparator, and d_omit_thousands_sep.

Referenced by ApplicationWindow::importASCII(), previewMatrix(), and previewTable().

void ImportASCIIDialog::displayHelp | ( |  | ) |

private slot

Display help for advanced options.

Referenced by initAdvancedOptions().

void ImportASCIIDialog::enableComments | ( |  | ) |

private slot

References d_first_line_role, d_import_comments, and d_rename_columns.

Referenced by initAdvancedOptions().

void ImportASCIIDialog::enableTableOptions | ( | bool | on | ) |

private slot

Enable/Disable options which are only available for tables.

References d_col_types_button, d_import_comments, d_read_only, and d_rename_columns.

Referenced by initPreview().

int ImportASCIIDialog::endLineChar | ( |  | ) |

inline

Returns the convention used for the end line character!

References boxEndLine.

Referenced by ApplicationWindow::importASCII().

int ImportASCIIDialog::ignoredLines | ( |  | ) | const

inline

Return the number of lines to be skipped at the start of each file.

References d_ignored_lines.

Referenced by ApplicationWindow::importASCII().

bool ImportASCIIDialog::importComments | ( |  | ) |

Returns true if the second line of the ASCII file should be used to set comments in table.

References d_first_line_role, d_import_comments, and d_rename_columns.

Referenced by ApplicationWindow::importASCII(), and previewTable().

ImportMode ImportASCIIDialog::importMode | ( |  | ) | const

inline

Return the selected import mode.

See also
  ImportMode

References d_import_mode.

Referenced by ApplicationWindow::importASCII(), previewMatrix(), and previewTable().

void ImportASCIIDialog::initAdvancedOptions | ( |  | ) |

private

Initialise d_advanced_options and everything it contains.

References boxDecimalSeparator, boxEndLine, d_advanced_options, d_col_types_button, d_column_separator, d_comment_string, d_first_line_role, d_help_button, d_ignored_lines, d_import_comments, d_import_mode, d_omit_thousands_sep, d_preview_button, d_preview_lines_box, d_preview_matrix, d_preview_stack, d_preview_table, d_read_only, d_rename_columns, d_simplify_spaces, d_strip_spaces, displayHelp(), enableComments(), preview(), and showColTypeDialog().

Referenced by ImportASCIIDialog().

void ImportASCIIDialog::initPreview | ( | int | previewMode | ) |

private

References ApplicationWindow::activeWindow(), ApplicationWindow::d_decimal_digits, d_preview_matrix, d_preview_stack, d_preview_table, enableTableOptions(), NewColumns, NewMatrices, NewRows, NewTables, Overwrite, preview(), and PreviewTable::setNumericPrecision().

Referenced by ImportASCIIDialog(), and updateImportMode().

void ImportASCIIDialog::preview | ( |  | ) |

private slot

References d_preview_button, d_preview_matrix, d_preview_stack, d_preview_table, previewMatrix(), and previewTable().

Referenced by changePreviewFile(), ImportASCIIDialog(), initAdvancedOptions(), and initPreview().

void ImportASCIIDialog::previewMatrix | ( |  | ) |

private

References boxEndLine, PreviewMatrix::clear(), columnSeparator(), d_comment_string, d_current_path, d_ignored_lines, d_import_mode, d_preview_lines_box, d_preview_matrix, d_simplify_spaces, d_strip_spaces, decimalSeparators(), PreviewMatrix::importASCII(), importMode(), NewMatrices, and Matrix::Overwrite.

Referenced by preview().

void ImportASCIIDialog::previewTable | ( |  | ) |

private

References boxEndLine, PreviewTable::clear(), columnSeparator(), d_comment_string, d_current_path, d_ignored_lines, d_import_mode, d_preview_lines_box, d_preview_table, d_simplify_spaces, d_strip_spaces, decimalSeparators(), PreviewTable::importASCII(), importComments(), importMode(), NewTables, Table::Overwrite, renameColumns(), and PreviewTable::resetHeader().

Referenced by preview().

bool ImportASCIIDialog::readOnly | ( |  | ) | const

inline

Whether the user wants the import options to be saved.

References d_read_only.

Referenced by ApplicationWindow::importASCII().

bool ImportASCIIDialog::renameColumns | ( |  | ) | const

inline

Whether to rename columns based on the first (non-skipped) line.

References d_first_line_role, and d_rename_columns.

Referenced by ApplicationWindow::importASCII(), and previewTable().

void ImportASCIIDialog::selectFilter | ( | const QString & | filter | ) |

slot

Referenced by ApplicationWindow::importASCII(), and ImportASCIIDialog().

void ImportASCIIDialog::setColumnSeparator | ( | const QString & | sep | ) |

Set the selected columns separator.

References d_column_separator.

Referenced by ImportASCIIDialog().

void ImportASCIIDialog::setCurrentPath | ( | const QString & | path | ) |

References changePreviewFile(), and d_current_path.

Referenced by ApplicationWindow::importASCII().

void ImportASCIIDialog::setNewWindowsOnly | ( | bool | on | ) |

private

References d_import_mode, and d_preview_button.

Referenced by ImportASCIIDialog().

void ImportASCIIDialog::showColTypeDialog | ( |  | ) |

private slot

References d_preview_table, PreviewTable::setSelectedColumn(), and PreviewTable::showColTypeDialog().

Referenced by initAdvancedOptions().

bool ImportASCIIDialog::simplifySpaces | ( |  | ) | const

inline

Whether to replace sequences of whitespace charecters with a single space.

References d_simplify_spaces.

Referenced by ApplicationWindow::importASCII().

bool ImportASCIIDialog::stripSpaces | ( |  | ) | const

inline

Whether to remove whitespace from beginning and end of lines.

References d_strip_spaces.

Referenced by ApplicationWindow::importASCII().

void ImportASCIIDialog::updateImportMode | ( | int | mode | ) |

private slot

For Overwrite mode, allow only one file to be selected.

References initPreview(), and Overwrite.

Referenced by ImportASCIIDialog().

bool ImportASCIIDialog::useFirstRow | ( |  | ) | const

inline

References d_rename_columns.

Referenced by ApplicationWindow::importASCII().

bool ImportASCIIDialog::useSecondRow | ( |  | ) | const

inline

References d_import_comments.

Referenced by ApplicationWindow::importASCII().

## Member Data Documentation

QComboBox * ImportASCIIDialog::boxDecimalSeparator

private

Referenced by decimalSeparators(), ImportASCIIDialog(), and initAdvancedOptions().

QComboBox * ImportASCIIDialog::boxEndLine

private

Referenced by endLineChar(), ImportASCIIDialog(), initAdvancedOptions(), previewMatrix(), and previewTable().

QGroupBox* ImportASCIIDialog::d_advanced_options

private

Container widget for all advanced options.

Referenced by ImportASCIIDialog(), and initAdvancedOptions().

QPushButton * ImportASCIIDialog::d_col_types_button

private

Referenced by enableTableOptions(), and initAdvancedOptions().

QComboBox * ImportASCIIDialog::d_column_separator

private

Referenced by columnSeparator(), ImportASCIIDialog(), initAdvancedOptions(), and setColumnSeparator().

QLineEdit* ImportASCIIDialog::d_comment_string

private

Referenced by commentString(), ImportASCIIDialog(), initAdvancedOptions(), previewMatrix(), and previewTable().

QString ImportASCIIDialog::d_current_path

private

Referenced by changePreviewFile(), ImportASCIIDialog(), previewMatrix(), previewTable(), and setCurrentPath().

QComboBox* ImportASCIIDialog::d_first_line_role

private

Referenced by closeEvent(), enableComments(), ImportASCIIDialog(), importComments(), initAdvancedOptions(), and renameColumns().

QPushButton* ImportASCIIDialog::d_help_button

private

Referenced by initAdvancedOptions().

QSpinBox* ImportASCIIDialog::d_ignored_lines

private

Referenced by ignoredLines(), ImportASCIIDialog(), initAdvancedOptions(), previewMatrix(), and previewTable().

QCheckBox * ImportASCIIDialog::d_import_comments

private

Referenced by enableComments(), enableTableOptions(), ImportASCIIDialog(), importComments(), initAdvancedOptions(), and useSecondRow().

QComboBox* ImportASCIIDialog::d_import_mode

private

Referenced by ImportASCIIDialog(), importMode(), initAdvancedOptions(), previewMatrix(), previewTable(), and setNewWindowsOnly().

QCheckBox * ImportASCIIDialog::d_omit_thousands_sep

private

Referenced by decimalSeparators(), ImportASCIIDialog(), and initAdvancedOptions().

QCheckBox* ImportASCIIDialog::d_preview_button

private

Referenced by closeEvent(), ImportASCIIDialog(), initAdvancedOptions(), preview(), and setNewWindowsOnly().

QSpinBox * ImportASCIIDialog::d_preview_lines_box

private

Referenced by closeEvent(), ImportASCIIDialog(), initAdvancedOptions(), previewMatrix(), and previewTable().

PreviewMatrix* ImportASCIIDialog::d_preview_matrix

private

Referenced by initAdvancedOptions(), initPreview(), preview(), and previewMatrix().

QStackedWidget* ImportASCIIDialog::d_preview_stack

private

Referenced by ImportASCIIDialog(), initAdvancedOptions(), initPreview(), and preview().

PreviewTable* ImportASCIIDialog::d_preview_table

private

Referenced by columnFormats(), columnTypes(), initAdvancedOptions(), initPreview(), preview(), previewTable(), and showColTypeDialog().

QCheckBox* ImportASCIIDialog::d_read_only

private

Referenced by enableTableOptions(), ImportASCIIDialog(), initAdvancedOptions(), and readOnly().

QCheckBox* ImportASCIIDialog::d_rename_columns

private

Referenced by enableComments(), enableTableOptions(), ImportASCIIDialog(), importComments(), initAdvancedOptions(), renameColumns(), and useFirstRow().

QCheckBox * ImportASCIIDialog::d_simplify_spaces

private

Referenced by columnSeparator(), ImportASCIIDialog(), initAdvancedOptions(), previewMatrix(), previewTable(), and simplifySpaces().

QCheckBox * ImportASCIIDialog::d_strip_spaces

private

Referenced by ImportASCIIDialog(), initAdvancedOptions(), previewMatrix(), previewTable(), and stripSpaces().

The documentation for this class was generated from the following files:

- qtiplot/src/core/ImportASCIIDialog.h
- qtiplot/src/core/ImportASCIIDialog.cpp