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... | |
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.
Enumerator | |
---|---|
UNDEFINED_FILE_MODE | |
OPEN_FILE_MODE | |
SAVE_FILE_MODE |
Definition at line 64 of file FileDialog.h.
Enumerator | |
---|---|
RASTER | |
VECTOR |
Definition at line 58 of file FileDialog.h.
te::qt::widgets::FileDialog::FileDialog | ( | QWidget * | parent, |
FileType | type, | ||
std::string | pathInfo = "" |
||
) |
Constructor.
parent | The QWidget parent argumnt. |
pathInfo | The type of file opened. Actually we assume three values: "vector", "raster", "database". Any other value may be not used in the system. |
File | Mode will be set to UNDEFINED_FILE_MODE. |
te::qt::widgets::FileDialog::FileDialog | ( | QWidget * | parent, |
const FileType & | type, | ||
const std::string & | pathInfo, | ||
const FileAccessMode & | fileMode | ||
) |
Constructor.
parent | The QWidget parent argumnt. |
pathInfo | The 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. |
|
inline |
Destructor.
Definition at line 91 of file FileDialog.h.
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.
std::string te::qt::widgets::FileDialog::getExtension | ( | ) |
This method will return the file extension.
std::string te::qt::widgets::FileDialog::getFileName | ( | ) |
This method will return the file name.
std::map< QString, QString > te::qt::widgets::FileDialog::getMappedExtensions | ( | QString | extensions | ) |
Genarate an extensions map with the extensions returned by driver.
The | extensions returned by driver. |
std::string te::qt::widgets::FileDialog::getPath | ( | ) |
This method will return the chosen path.
bool te::qt::widgets::FileDialog::hasInvalidCharacters | ( | std::string | filename | ) |
Verify if the file name has special characters.
The | name of the file. |
void te::qt::widgets::FileDialog::setAllowedExtensions | ( | std::set< std::string > | allowedExtensions | ) |
void te::qt::widgets::FileDialog::setExtension | ( | std::string | filePath | ) |
Sets the file extension.
The | file path with a file and an extension. |
void te::qt::widgets::FileDialog::setFileName | ( | std::string | filePath | ) |
Sets the file name.
The | file path with a file name. |
void te::qt::widgets::FileDialog::setPath | ( | std::string | filePath | ) |
Sets the file path.
The | file path. |
|
private |
Set of allowed extensions.
Definition at line 159 of file FileDialog.h.
|
private |
The extension of the file.
Definition at line 158 of file FileDialog.h.
|
private |
Definition at line 152 of file FileDialog.h.
|
private |
The name of the file.
Definition at line 157 of file FileDialog.h.
|
private |
The QWidget parent argumnt.
Definition at line 153 of file FileDialog.h.
|
private |
The path of the file.
Definition at line 156 of file FileDialog.h.
|
private |
The file path info.
Definition at line 155 of file FileDialog.h.
|
private |
The type of file.
Definition at line 154 of file FileDialog.h.