OpenMS
|
holds a vector of known file types, e.g. as a way to specify supported input formats More...
#include <OpenMS/FORMAT/FileTypes.h>
Classes | |
struct | FilterElements_ |
hold filter items (for Qt dialogs) along with their OpenMS type More... | |
Public Member Functions | |
FileTypeList (const std::vector< FileTypes::Type > &types) | |
bool | contains (const FileTypes::Type &type) const |
check if type is contained in this array More... | |
const std::vector< FileTypes::Type > & | getTypes () const |
String | toFileDialogFilter (const FilterLayout style, bool add_all_filter) const |
FileTypes::Type | fromFileDialogFilter (const String &filter, const FileTypes::Type fallback=FileTypes::Type::UNKNOWN) const |
Convert a Qt filter back to a Type if possible. More... | |
Static Public Member Functions | |
static std::vector< FileTypes::Type > | typesWithProperties (const std::vector< FileTypes::FileProperties > features) |
Get a std::vector<FileTypes::Type> with all fileTypes that support a set of features. More... | |
Private Member Functions | |
FilterElements_ | asFilterElements_ (const FilterLayout style, bool add_all_filter) const |
Private Attributes | |
std::vector< FileTypes::Type > | type_list_ |
holds a vector of known file types, e.g. as a way to specify supported input formats
The vector can be exported in Qt's file dialog format.
struct OpenMS::FileTypeList::FilterElements_ |
FileTypeList | ( | const std::vector< FileTypes::Type > & | types | ) |
|
private |
creates Qt filters and the corresponding elements from type_list_
style | Create a combined filter, or single filters, or both |
add_all_filter | Add 'all files (*)' as a single filter at the end? |
bool contains | ( | const FileTypes::Type & | type | ) | const |
check if type
is contained in this array
Referenced by TOPPViewBase::addDataFile().
FileTypes::Type fromFileDialogFilter | ( | const String & | filter, |
const FileTypes::Type | fallback = FileTypes::Type::UNKNOWN |
||
) | const |
Convert a Qt filter back to a Type if possible.
E.g. from a full filter such as '"mzML files (*.mzML);;mzData files (*.mzData);;mzXML files (*.mzXML);;all files (*)"', as created by toFileDialogFilter(), the selected filter
could be "mzML files (*.mzML)", in which case the type is Type::MZML . However, for the filter "all files (*)", Type::UNKNOWN will be returned.
If the type is UNKNOWN, then the fallback is returned (by default also UNKNOWN). This is useful if you want a default type to fall back to.
filter | The filter returned by 'QFileDialog::getSaveFileName' and others, i.e. an item from the result of 'toFileDialogFilter'. |
fallback | If the filter is ambiguous, return this type instead |
Exception::ElementNotFound | if the given filter is not a filter produced by toFileDialogFilter() |
|
inline |
String toFileDialogFilter | ( | const FilterLayout | style, |
bool | add_all_filter | ||
) | const |
converts the array into a Qt-compatible filter for selecting files in a user dialog. e.g. "all readable files (*.mzML *.mzXML);;". See Filter enum.
style | Create a combined filter, or single filters, or both |
add_all_filter | Add 'all files (*)' as a single filter at the end? |
Referenced by TOPPViewBase::chooseFilesDialog_().
|
static |
Get a std::vector<FileTypes::Type> with all fileTypes that support a set of features.
features | A set of features that must be supported |
|
private |