Interface class for file and object handling. More...
#include <FileInterface.hh>
Public Slots | |
Load Save Implementation | |
| virtual int | addEmpty () |
| Create an empty object. | |
| virtual int | loadObject (QString)=0 |
| Load an object from the given file. | |
| virtual int | loadObject (QString, DataType) |
| Load an object from the given file. | |
| virtual bool | saveObject (int, QString)=0 |
| Save an object from the given file. | |
Public Member Functions | |
Widgets | |
| virtual | ~FileInterface () |
| Destructor. | |
| virtual QWidget * | saveOptionsWidget (QString)=0 |
| virtual QWidget * | loadOptionsWidget (QString)=0 |
Supported types | |
| virtual DataType | supportedType ()=0 |
| Return your supported object type( e.g. DATA_TRIANGLE_MESH ). | |
| virtual QString | getLoadFilters ()=0 |
| virtual QString | getSaveFilters ()=0 |
Interface class for file and object handling.
This interface class has to be fully implemented. When you want to support save and load for an object type you have to implement all functions in this class. The core manages the load and save interaction and gives the load and save actions to your plugin. The decision which plugin is called for saving an object depends on your supportedTypes() and the filters defined by your plugin.
Definition at line 70 of file FileInterface.hh.
| virtual int FileInterface::addEmpty | ( | ) | [inline, virtual, slot] |
Create an empty object.
When this slot is called you have to create an object of your supported type.
Definition at line 143 of file FileInterface.hh.
| virtual QString FileInterface::getLoadFilters | ( | ) | [pure virtual] |
Return the Qt Filters for Filedialogs when loading files (e.g. "Off files ( *.off )" )
Referenced by Core::loadPlugin().
| virtual QString FileInterface::getSaveFilters | ( | ) | [pure virtual] |
Get the Qt Filters for Filedialogs when saving files (e.g. "Off files ( *.off )" )
Referenced by Core::loadPlugin().
| virtual int FileInterface::loadObject | ( | QString | , | |
| DataType | ||||
| ) | [inline, virtual, slot] |
Load an object from the given file.
The Core will call this slot if you should load a file. The core will check if you support the given file type depending on the provided filters and dataTypes ( see supportedType and getLoadFilters )
if you just opened a file and did not create any object, return 0 here, telling the core that it was successfully loaded but no new object has been created!
If the Plugin is able to open the file in different DataTypes one of these DataTypes can be forced here
Definition at line 171 of file FileInterface.hh.
| virtual int FileInterface::loadObject | ( | QString | ) | [pure virtual, slot] |
Load an object from the given file.
The Core will call this slot if you should load a file. The core will check if you support the given file type depending on the provided filters and dataTypes ( see supportedType and getLoadFilters )
if you just opened a file and did not create any object, return 0 here, telling the core that it was successfully loaded but no new object has been created!
| virtual QWidget* FileInterface::loadOptionsWidget | ( | QString | ) | [pure virtual] |
You can provide a special widget showing options for loading your file types depending on the current filter
_currentFilter: one filter from loadFilters
Return 0 when you dont need one
| virtual bool FileInterface::saveObject | ( | int | , | |
| QString | ||||
| ) | [pure virtual, slot] |
| virtual QWidget* FileInterface::saveOptionsWidget | ( | QString | ) | [pure virtual] |
You can provide a special widget showing options for saving your file types depending on the current filter
_currentFilter: one filter from saveFilters
Return 0 when you dont need one
| virtual DataType FileInterface::supportedType | ( | ) | [pure virtual] |
Return your supported object type( e.g. DATA_TRIANGLE_MESH ).
If you support multiple datatypes you can use the bitwise or to combine them here. The function is used from addEmpty to check if your plugin can create an object of a given dataType.
Referenced by Core::loadPlugin().