Commit 8f58bde6 authored by Dirk Wilden's avatar Dirk Wilden

changes needed for backups and selections

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@11275 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 7014b4bc
...@@ -62,60 +62,19 @@ ...@@ -62,60 +62,19 @@
// === Backup Communication ============================ // === Backup Communication ============================
//======================================================================================== //========================================================================================
void Core::slotBackupGroup(QString _name, int& _groupId ) { /// Slot for generating type specific backups
if ( sender() != 0 ) { void Core::slotGenerateBackup( int _id, QString _name, UpdateType _type ) {
if ( sender()->metaObject() != 0 ) {
_name = QString(sender()->metaObject()->className()) + ": " + _name;
if ( OpenFlipper::Options::doSlotDebugging() )
emit log(LOGINFO,"slotBackupGroup( " + _name + " ) called by " + QString( sender()->metaObject()->className() ) );
}
}
_groupId = nextBackupGroupId_; BaseObjectData* obj = 0;
emit createBackupGroup( _name , nextBackupGroupId_); PluginFunctions::getObject(_id, obj);
++nextBackupGroupId_;
}
/// Called if a backup is requested by the plugins
void Core::slotBackup( int _objectId, QString _name, int& _internalId, int _groupId ) {
if ( sender() != 0 ) {
if ( sender()->metaObject() != 0 ) {
_name = QString(sender()->metaObject()->className()) + ": " + _name;
if ( OpenFlipper::Options::doSlotDebugging() )
emit log(LOGINFO,"slotBackup( " + QString::number(_objectId) + ", " + _name + "," + QString::number(_internalId) + (" ) called by ") + QString( sender()->metaObject()->className() ) );
}
}
_internalId = nextBackupId_; if (obj == 0)
emit createBackup( _objectId , _name , nextBackupId_, _groupId); return;
++nextBackupId_;
}
/// Called if a backup is requested by the plugins (convenience function without getting id of the object)
void Core::slotBackup( int _objectId, QString _name ) {
if ( sender() != 0 ) {
if ( sender()->metaObject() != 0 ) {
_name = QString(sender()->metaObject()->className()) + ": " + _name;
if ( OpenFlipper::Options::doSlotDebugging() )
emit log(LOGINFO,"slotBackup( " + QString::number(_objectId) + ", " + _name + tr(" ) called by ") + QString( sender()->metaObject()->className() ) );
}
}
emit createBackup( _objectId , _name , nextBackupId_); // Type plugins
++nextBackupId_; for (int i=0; i < (int)supportedDataTypes_.size(); i++)
} if ( supportedDataTypes_[i].type & obj->dataType() )
supportedDataTypes_[i].plugin->generateBackup(_id, _name, _type);
void Core::slotRestoreGroup( int _groupId) {
emit restoreGroup(_groupId);
}
void Core::slotRestore( int _objectId, int _internalId ) {
emit restoreObject(_objectId,_internalId);
} }
//============================================================================= //=============================================================================
...@@ -285,7 +285,7 @@ signals: ...@@ -285,7 +285,7 @@ signals:
void showFloodFillSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes); void showFloodFillSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
/// SelectionInterface: This signal is emitted when standard toggle selection has been performed /// SelectionInterface: This signal is emitted when standard toggle selection has been performed
void toggleSelection(QPoint _position, SelectionInterface::PrimitiveType _currentType, bool _deselect); void toggleSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
/// SelectionInterface: This signal is emitted when standard lasso selection has been performed /// SelectionInterface: This signal is emitted when standard lasso selection has been performed
void lassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect); void lassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
...@@ -297,13 +297,13 @@ signals: ...@@ -297,13 +297,13 @@ signals:
void surfaceLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect); void surfaceLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
/// SelectionInterface: This signal is emitted when standard sphere selection has been performed /// SelectionInterface: This signal is emitted when standard sphere selection has been performed
void sphereSelection(QPoint _position, double _radius, SelectionInterface::PrimitiveType _currentType, bool _deselect); void sphereSelection(QMouseEvent* _event, double _radius, SelectionInterface::PrimitiveType _currentType, bool _deselect);
/// SelectionInterface: This signal is emitted when standard closest boundary selection has been performed /// SelectionInterface: This signal is emitted when standard closest boundary selection has been performed
void closestBoundarySelection(QPoint _position, SelectionInterface::PrimitiveType _currentType, bool _deselect); void closestBoundarySelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
/// SelectionInterface: This signal is emitted when standard flood fill selection has been performed /// SelectionInterface: This signal is emitted when standard flood fill selection has been performed
void floodFillSelection(QPoint _position, double _maxAngle, SelectionInterface::PrimitiveType _currentType, bool _deselect); void floodFillSelection(QMouseEvent* _event, double _maxAngle, SelectionInterface::PrimitiveType _currentType, bool _deselect);
/// SelectionInterface: This signal is emitted when a custom selection operation has been performed /// SelectionInterface: This signal is emitted when a custom selection operation has been performed
void customSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, QString _customIdentifier, bool _deselect); void customSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, QString _customIdentifier, bool _deselect);
...@@ -347,33 +347,25 @@ signals: ...@@ -347,33 +347,25 @@ signals:
/// This signal is emitted before the core deletes its data and exits /// This signal is emitted before the core deletes its data and exits
void saveOnExit( INIFile& _ini ); void saveOnExit( INIFile& _ini );
/// Tell plugins to create a backup group /// Tell backup-plugin to create a backup
void createBackupGroup( QString _name , int _groupId); void createBackup( int _objectid, QString _name, UpdateType _type = UPDATE_ALL);
void createBackup( IdList _objectids, QString _name, std::vector<UpdateType> _types);
/// Tell plugins to create a backup
void createBackup( int _objectId , QString _name , int _internalId, int groupId = -1); /// Tell backup-plugin to undo/redo
void undo(int _objectid);
/// Tell Plugins to make a backup persistent void redo(int _objectid);
void makeBackupPersistent(int _objectid, int _internalId); void undo();
void redo();
/// Tell Backup Plugin to restore a group with the given group id
void restoreGroup( int _groupId); /// Backup Plugin tells other Plugins that a restore will happen
void aboutToRestore(int _objectId, UpdateType _type);
/// Tell Backup Plugin to restore an object with the given backup id
void restoreObject( int _objectId, int _internalId);
/** \brief Backup Plugin tells other Plugins that a restore will happen
*/
void aboutToRestore(int _objectId , int _internalId);
/** \brief Backup Plugin tells other Plugins that they should restore their own data /// Backup Plugin tells other Plugins that they should restore their own data
*/ void restore(int _objectId, UpdateType _type);
void restore(int _objectId , int _internalId);
/** \brief Backup Plugin tells other Plugins that a restore has happened /// Backup Plugin tells other Plugins that a restore has happened
*/ void restored( int _objectId, UpdateType _type);
void restored( int _objectId , int _internalId);
/// Tell the plugins that a file has been opened ( -> Database) /// Tell the plugins that a file has been opened ( -> Database)
void openedFile( int _id ); void openedFile( int _id );
...@@ -481,21 +473,6 @@ signals: ...@@ -481,21 +473,6 @@ signals:
///Called by plugins if a multi-texture's sub textures should be fetched ///Called by plugins if a multi-texture's sub textures should be fetched
void slotGetSubTextures( int _id, QString _multiTextureName, QStringList& _subTextures ); void slotGetSubTextures( int _id, QString _multiTextureName, QStringList& _subTextures );
/// Called if a backup group is requested by the plugins
void slotBackupGroup(QString _name, int& _groupId );
/// Called if a backup is requested by the plugins
void slotBackup( int _objectId, QString _name, int& _internalId, int _groupId = -1 );
/// Called if a backup is requested by the plugins
void slotBackup( int _objectId, QString _name );
/// Called if a group restore is requested by the plugins
void slotRestoreGroup( int _groupId);
/// Called if a backup is requested by the plugins
void slotRestore( int _objectId, int _internalId = -1 );
/// A plugin wants to load a given file /// A plugin wants to load a given file
void slotLoad(QString _filename, DataType _type, int& _id); void slotLoad(QString _filename, DataType _type, int& _id);
...@@ -549,7 +526,7 @@ signals: ...@@ -549,7 +526,7 @@ signals:
void slotShowFloodFillSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes); void slotShowFloodFillSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
/// SelectionInterface: Called when toggle selection operation has been performed /// SelectionInterface: Called when toggle selection operation has been performed
void slotToggleSelection(QPoint _position, SelectionInterface::PrimitiveType _currentType, bool _deselect); void slotToggleSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
/// SelectionInterface: Called when lasso selection operation has been performed /// SelectionInterface: Called when lasso selection operation has been performed
void slotLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect); void slotLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
...@@ -561,13 +538,13 @@ signals: ...@@ -561,13 +538,13 @@ signals:
void slotSurfaceLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect); void slotSurfaceLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
/// SelectionInterface: Called when sphere selection operation has been performed /// SelectionInterface: Called when sphere selection operation has been performed
void slotSphereSelection(QPoint _position, double _radius, SelectionInterface::PrimitiveType _currentType, bool _deselect); void slotSphereSelection(QMouseEvent* _event, double _radius, SelectionInterface::PrimitiveType _currentType, bool _deselect);
/// SelectionInterface: Called when closest boundary selection operation has been performed /// SelectionInterface: Called when closest boundary selection operation has been performed
void slotClosestBoundarySelection(QPoint _position, SelectionInterface::PrimitiveType _currentType, bool _deselect); void slotClosestBoundarySelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
/// SelectionInterface: Called when flood fill selection operation has been performed /// SelectionInterface: Called when flood fill selection operation has been performed
void slotFloodFillSelection(QPoint _position, double _maxAngle, SelectionInterface::PrimitiveType _currentType, bool _deselect); void slotFloodFillSelection(QMouseEvent* _event, double _maxAngle, SelectionInterface::PrimitiveType _currentType, bool _deselect);
/// SelectionInterface: Called when custom selection operation has been performed /// SelectionInterface: Called when custom selection operation has been performed
void slotCustomSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, QString _customIdentifier, bool _deselect); void slotCustomSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, QString _customIdentifier, bool _deselect);
...@@ -933,6 +910,9 @@ private slots: ...@@ -933,6 +910,9 @@ private slots:
/// Open Recent file /// Open Recent file
void slotRecentOpen(QAction* _action); void slotRecentOpen(QAction* _action);
/// Slot for generating type specific backups
void slotGenerateBackup( int _id, QString _name, UpdateType _type );
public slots: public slots:
/// Add a Toolbox from a plugin or from scripting /// Add a Toolbox from a plugin or from scripting
......
This diff is collapsed.
...@@ -110,8 +110,8 @@ void Core::slotShowFloodFillSelectionMode(QString _handleName, bool _show, Selec ...@@ -110,8 +110,8 @@ void Core::slotShowFloodFillSelectionMode(QString _handleName, bool _show, Selec
emit showFloodFillSelectionMode(_handleName, _show, _associatedTypes); emit showFloodFillSelectionMode(_handleName, _show, _associatedTypes);
} }
void Core::slotToggleSelection(QPoint _position, SelectionInterface::PrimitiveType _currentType, bool _deselect) { void Core::slotToggleSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect) {
emit toggleSelection(_position, _currentType, _deselect); emit toggleSelection(_event, _currentType, _deselect);
} }
void Core::slotLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect) { void Core::slotLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect) {
...@@ -126,16 +126,16 @@ void Core::slotSurfaceLassoSelection(QMouseEvent* _event, SelectionInterface::Pr ...@@ -126,16 +126,16 @@ void Core::slotSurfaceLassoSelection(QMouseEvent* _event, SelectionInterface::Pr
emit surfaceLassoSelection(_event, _currentType, _deselect); emit surfaceLassoSelection(_event, _currentType, _deselect);
} }
void Core::slotSphereSelection(QPoint _position, double _radius, SelectionInterface::PrimitiveType _currentType, bool _deselect) { void Core::slotSphereSelection(QMouseEvent* _event, double _radius, SelectionInterface::PrimitiveType _currentType, bool _deselect) {
emit sphereSelection(_position, _radius, _currentType, _deselect); emit sphereSelection(_event, _radius, _currentType, _deselect);
} }
void Core::slotClosestBoundarySelection(QPoint _position, SelectionInterface::PrimitiveType _currentType, bool _deselect) { void Core::slotClosestBoundarySelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect) {
emit closestBoundarySelection(_position, _currentType, _deselect); emit closestBoundarySelection(_event, _currentType, _deselect);
} }
void Core::slotFloodFillSelection(QPoint _position, double _maxAngle, SelectionInterface::PrimitiveType _currentType, bool _deselect) { void Core::slotFloodFillSelection(QMouseEvent* _event, double _maxAngle, SelectionInterface::PrimitiveType _currentType, bool _deselect) {
emit floodFillSelection(_position, _maxAngle, _currentType, _deselect); emit floodFillSelection(_event, _maxAngle, _currentType, _deselect);
} }
void Core::slotCustomSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, QString _customIdentifier, bool _deselect) { void Core::slotCustomSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, QString _customIdentifier, bool _deselect) {
......
...@@ -530,8 +530,7 @@ void Core::slotFileOpened ( int _id ) { ...@@ -530,8 +530,7 @@ void Core::slotFileOpened ( int _id ) {
// ================================================================================ // ================================================================================
// Create initial backup // Create initial backup
// ================================================================================ // ================================================================================
int backupId = 0; emit createBackup(_id,"Original Object");
slotBackup(_id,"Original Object",backupId);
// ================================================================================ // ================================================================================
// Add the file to the recent files menu // Add the file to the recent files menu
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment