te::qt::widgets::FileDialog Class Reference

Defines a component for choose a file. More...

#include <FileDialog.h>

Public Types

enum  FileAccessMode { UNDEFINED_FILE_MODE, OPEN_FILE_MODE, SAVE_FILE_MODE }
 
enum  FileType { RASTER, VECTOR }
 

Public Member Functions

void exec ()
 This method will open the dialog of file selection and populate the class members with the chosen file path. More...
 
 FileDialog (QWidget *parent, const FileType &type, const std::string &pathInfo, const FileAccessMode &fileMode)
 Constructor. More...
 
 FileDialog (QWidget *parent, FileType type, std::string pathInfo="")
 Constructor. More...
 
std::string getExtension ()
 This method will return the file extension. More...
 
std::string getFileName ()
 This method will return the file name. More...
 
std::map< QString, QString > getMappedExtensions (QString extensions)
 Genarate an extensions map with the extensions returned by driver. More...
 
std::string getPath ()
 This method will return the chosen path. More...
 
bool hasInvalidCharacters (std::string filename)
 Verify if the file name has special characters. More...
 
void setAllowedExtensions (std::set< std::string > allowedExtensions)
 
void setExtension (std::string filePath)
 Sets the file extension. More...
 
void setFileName (std::string filePath)
 Sets the file name. More...
 
void setPath (std::string filePath)
 Sets the file path. More...
 
 ~FileDialog ()
 Destructor. More...
 

Private Attributes

std::set< std::string > m_allowedExtensions
 Set of allowed extensions. More...
 
std::string m_extension
 The extension of the file. More...
 
FileAccessMode m_fileMode
 
std::string m_fileName
 The name of the file. More...
 
QWidget * m_parent
 The QWidget parent argumnt. More...
 
std::string m_path
 The path of the file. More...
 
std::string m_pathInfo
 The file path info. More...
 
FileType m_type
 The type of file. More...
 

Detailed Description

Defines a component for choose a file.

This class is used to create a QFileDialog in order to facilitate the use of file path, file name and file extension.

Definition at line 54 of file FileDialog.h.

Member Enumeration Documentation

◆ FileAccessMode

Enumerator
UNDEFINED_FILE_MODE 
OPEN_FILE_MODE 
SAVE_FILE_MODE 

Definition at line 64 of file FileDialog.h.

◆ FileType

Enumerator
RASTER 
VECTOR 

Definition at line 58 of file FileDialog.h.

Constructor & Destructor Documentation

◆ FileDialog() [1/2]

te::qt::widgets::FileDialog::FileDialog ( QWidget *  parent,
FileType  type,
std::string  pathInfo = "" 
)

Constructor.

Parameters
parentThe QWidget parent argumnt.
pathInfoThe type of file opened. Actually we assume three values: "vector", "raster", "database". Any other value may be not used in the system.
FileMode will be set to UNDEFINED_FILE_MODE.

◆ FileDialog() [2/2]

te::qt::widgets::FileDialog::FileDialog ( QWidget *  parent,
const FileType type,
const std::string &  pathInfo,
const FileAccessMode fileMode 
)

Constructor.

Parameters
parentThe QWidget parent argumnt.
pathInfoThe type of file opened. Actually we assume three values: "vector", "raster", "database". Any other value may be not used in the system. \fileMode File mode.

◆ ~FileDialog()

te::qt::widgets::FileDialog::~FileDialog ( )
inline

Destructor.

Definition at line 91 of file FileDialog.h.

Member Function Documentation

◆ exec()

void te::qt::widgets::FileDialog::exec ( )

This method will open the dialog of file selection and populate the class members with the chosen file path.

Note
te::common::Exception on errors.

◆ getExtension()

std::string te::qt::widgets::FileDialog::getExtension ( )

This method will return the file extension.

Returns
The complete chosen file extension.

◆ getFileName()

std::string te::qt::widgets::FileDialog::getFileName ( )

This method will return the file name.

Returns
The complete chosen file name.

◆ getMappedExtensions()

std::map<QString, QString> te::qt::widgets::FileDialog::getMappedExtensions ( QString  extensions)

Genarate an extensions map with the extensions returned by driver.

Parameters
Theextensions returned by driver.

◆ getPath()

std::string te::qt::widgets::FileDialog::getPath ( )

This method will return the chosen path.

Returns
The complete chosen path.

◆ hasInvalidCharacters()

bool te::qt::widgets::FileDialog::hasInvalidCharacters ( std::string  filename)

Verify if the file name has special characters.

Parameters
Thename of the file.

◆ setAllowedExtensions()

void te::qt::widgets::FileDialog::setAllowedExtensions ( std::set< std::string >  allowedExtensions)

◆ setExtension()

void te::qt::widgets::FileDialog::setExtension ( std::string  filePath)

Sets the file extension.

Parameters
Thefile path with a file and an extension.

◆ setFileName()

void te::qt::widgets::FileDialog::setFileName ( std::string  filePath)

Sets the file name.

Parameters
Thefile path with a file name.

◆ setPath()

void te::qt::widgets::FileDialog::setPath ( std::string  filePath)

Sets the file path.

Parameters
Thefile path.

Member Data Documentation

◆ m_allowedExtensions

std::set<std::string> te::qt::widgets::FileDialog::m_allowedExtensions
private

Set of allowed extensions.

Definition at line 159 of file FileDialog.h.

◆ m_extension

std::string te::qt::widgets::FileDialog::m_extension
private

The extension of the file.

Definition at line 158 of file FileDialog.h.

◆ m_fileMode

FileAccessMode te::qt::widgets::FileDialog::m_fileMode
private

Definition at line 152 of file FileDialog.h.

◆ m_fileName

std::string te::qt::widgets::FileDialog::m_fileName
private

The name of the file.

Definition at line 157 of file FileDialog.h.

◆ m_parent

QWidget* te::qt::widgets::FileDialog::m_parent
private

The QWidget parent argumnt.

Definition at line 153 of file FileDialog.h.

◆ m_path

std::string te::qt::widgets::FileDialog::m_path
private

The path of the file.

Definition at line 156 of file FileDialog.h.

◆ m_pathInfo

std::string te::qt::widgets::FileDialog::m_pathInfo
private

The file path info.

Definition at line 155 of file FileDialog.h.

◆ m_type

FileType te::qt::widgets::FileDialog::m_type
private

The type of file.

Definition at line 154 of file FileDialog.h.


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