FileInterface Class Reference

Interface class for file handling. More...

#include <OpenFlipper/BasePlugin/FileInterface.hh>

Inheritance diagram for FileInterface:
Inheritance graph
[legend]

List of all members.

Public Member Functions

Widgets

virtual ~FileInterface ()
 Destructor.
virtual QWidget * saveOptionsWidget (QString _currentFilter)=0
virtual QWidget * loadOptionsWidget (QString _currentFilter)=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

Load Save Implementation



virtual void openedFile (int _id)
 This signal has to be emitted if an object has been loaded from a file.
virtual int addEmpty ()
 Create an empty object.
virtual int loadObject (QString _filename)=0
 Load an object from the given file.
virtual int loadObject (QString _filename, DataType _type)
 Load an object from the given file.
virtual bool saveObject (int _id, QString _filename)=0
 Save an object from the given file.
virtual bool saveObjects (IdList _ids, QString _filename)
 Save multiple objects to one file.

Detailed Description

Interface class for file handling.

Detailed description

Loading and saving of files in OpenFlipper is handled via the file plugins. These have to implement this class.

Definition at line 63 of file FileInterface.hh.


Member Function Documentation

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.

Returns:
Id of the new Object
Todo:
Add an addEmpty function with a given type as an attribute. The plugin should then create only an empty object of the given type. It can be assumed that there is only one type given at a time.

Definition at line 147 of file FileInterface.hh.

virtual QString FileInterface::getLoadFilters (  )  [pure virtual]

Return the Qt Filters for File dialogs 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  _filename  )  [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 int FileInterface::loadObject ( QString  _filename,
DataType  _type 
) [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 with this function.

This forcing is used for example by the recent files function for choosing between poly or triangle mesh loading.

Definition at line 178 of file FileInterface.hh.

virtual QWidget* FileInterface::loadOptionsWidget ( QString  _currentFilter  )  [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 don't need one

virtual void FileInterface::openedFile ( int  _id  )  [inline, virtual, signal]

This signal has to be emitted if an object has been loaded from a file.

Every time a new object is added to the scene from a file, this signal has to be emitted.

Parameters:
_id Id of the new object

Definition at line 136 of file FileInterface.hh.

virtual bool FileInterface::saveObject ( int  _id,
QString  _filename 
) [pure virtual, slot]

Save an object from the given file.

The Core will call this slot if you should save an object to a file. The core will check if you support the given object depending on the provided dataTypes ( see supportedType ). Additionally to the filename you get the id of the object to save

virtual bool FileInterface::saveObjects ( IdList  _ids,
QString  _filename 
) [inline, virtual, slot]

Save multiple objects to one file.

The Core will call this slot if the user wants to save multiple files in one file. The core will check if you support the given object depending on the provided dataTypes ( see supportedType ). Additionally to the filename you get ids of the objects to save

Definition at line 196 of file FileInterface.hh.

virtual QWidget* FileInterface::saveOptionsWidget ( QString  _currentFilter  )  [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 don't 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 combine them bitwise here. The function is used from the load and save code to check if your plugin can handle an object of a given dataType.

Referenced by Core::loadPlugin().


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