Skip to content
Snippets Groups Projects
Commit 5cf07313 authored by Jan Möbius's avatar Jan Möbius
Browse files

Don't use allow addEmpty in FileInterface anymore (deprecated long time ago!)

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@15086 383ad7c9-94d9-4d36-a494-682f7c89f535
parent a6e8295c
Branches
Tags
No related merge requests found
......@@ -138,15 +138,6 @@ signals:
public slots:
/** \brief Create an empty object
*
* When this slot is called you have to create an object of your supported type.
* @return 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.
*/
virtual int addEmpty() { return -1; };
/** \brief Load an object from the given file
*
* The Core will call this slot if you should load a file. The core will
......
......@@ -378,25 +378,18 @@ int Core::loadObject( DataType _type, QString _filename) {
int Core::addEmptyObject( DataType _type ) {
// Iterate over all plugins. The first plugin supporting the addEmpty function for the
// specified type will be used to create the new object.
// specified type will be used to create the new object. If adding the object failed,
// we iterate over the remaining plugins.
int retCode = -1;
// Type plugins
// Iterate over type plugins
for (int i=0; i < (int)supportedDataTypes_.size(); i++)
if ( supportedDataTypes_[i].type & _type )
retCode = supportedDataTypes_[i].plugin->addEmpty();
if(retCode != -1) return retCode;
// File plugins
for (int i=0; i < (int)supportedTypes().size(); i++)
if ( supportedTypes()[i].type & _type ) {
emit log(LOGERR, tr("File Plugins are not allowed to create empty objects anymore! Use the addEmpty call instead!") );
retCode = supportedTypes()[i].plugin->addEmpty();
if ( supportedDataTypes_[i].type & _type ) {
int retCode = supportedDataTypes_[i].plugin->addEmpty();
if ( retCode != -1 )
return retCode;
}
return retCode; // -1 if no plugin found
return -1; // no plugin found
}
//========================================================================================
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment