From 37b23aa49dd4ab05772906bed6f004cdb7b8282c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 6 Jan 2009 18:14:10 +0000 Subject: [PATCH] Renamed updatedObjects stuff internally in Core Call object->update in updated object when specific id is given git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@4169 383ad7c9-94d9-4d36-a494-682f7c89f535 --- Core/Core.cc | 2 +- Core/Core.hh | 4 ++-- Core/PluginCommunication.cc | 17 +++++++++++++++-- Core/PluginLoader.cc | 4 ++-- Core/openFunctions.cc | 4 ++-- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Core/Core.cc b/Core/Core.cc index 5ace81f1..d103e199 100644 --- a/Core/Core.cc +++ b/Core/Core.cc @@ -649,7 +649,7 @@ Core::clearAll() { objectRoot_->deleteSubtree(); emit allCleared(); - emit ObjectListUpdated(-1); + emit signalObjectUpdated(-1); slotScriptInfo( "core" , "clearAll()" ); } diff --git a/Core/Core.hh b/Core/Core.hh index f4e99af7..574fbd87 100644 --- a/Core/Core.hh +++ b/Core/Core.hh @@ -136,7 +136,7 @@ signals: void allCleared(); /// When this Signal is emitted all Plugins are informed that the object list changed - void ObjectListUpdated(int); + void signalObjectUpdated(int); /// When this Signal is emitted when a Wheel Event occures void PluginWheelEvent(QWheelEvent * , const std::string & ); @@ -200,7 +200,7 @@ signals: /** Called by the plugins if they changed something in the object list (deleted, added,...) * @param _identifier Id of the object */ - void slotObjectsListUpdated(int _identifier); + void slotObjectUpdated(int _identifier); /// Called by Plugins if they changed the active object void slotActiveObjectChanged(); diff --git a/Core/PluginCommunication.cc b/Core/PluginCommunication.cc index 1cb2a00f..8e9d065b 100644 --- a/Core/PluginCommunication.cc +++ b/Core/PluginCommunication.cc @@ -49,6 +49,8 @@ #include "OpenFlipper/BasePlugin/ToolboxInterface.hh" #include "OpenFlipper/BasePlugin/TextureInterface.hh" +#include "OpenFlipper/BasePlugin/PluginFunctions.hh" + //== IMPLEMENTATION ========================================================== //======================================================================================== @@ -58,7 +60,7 @@ /** This function is called by a plugin if it changed something in the object list (source,target,...). The information is passed to all plugins. * @param _identifier Id of the updated object */ -void Core::slotObjectsListUpdated(int _identifier) { +void Core::slotObjectUpdated(int _identifier) { if ( OpenFlipper::Options::doSlotDebugging() ) { if ( sender() != 0 ) { if ( sender()->metaObject() != 0 ) { @@ -68,8 +70,19 @@ void Core::slotObjectsListUpdated(int _identifier) { } } + // If we are called for a special object, we update it ourself so the Plugins dont need to do that. + if ( _identifier != -1 ) { + BaseObject* object = 0; + PluginFunctions::get_object(_identifier,object); + + if ( !object ) { + emit log(LOGERR,"updated_objects called for non existing object with id : " + QString::number(_identifier) ); + return; + } + } + // just inform the plugins as we dont do anything else - emit ObjectListUpdated(_identifier); + emit signalObjectUpdated(_identifier); } /** This function is called if the active object has changed. The information is passed to all plugins. diff --git a/Core/PluginLoader.cc b/Core/PluginLoader.cc index 02a7e8ab..471a1f1e 100644 --- a/Core/PluginLoader.cc +++ b/Core/PluginLoader.cc @@ -455,7 +455,7 @@ void Core::loadPlugin(QString filename, bool silent){ connect(plugin,SIGNAL(update_view()),this,SLOT(updateView())); if ( checkSignal(plugin,"updated_objects(int)") ) - connect(plugin,SIGNAL(updated_objects(int)),this,SLOT(slotObjectsListUpdated(int))); + connect(plugin,SIGNAL(updated_objects(int)),this,SLOT(slotObjectUpdated(int))); if ( checkSlot(plugin,"slotAllCleared()") ) connect(this,SIGNAL(allCleared()),plugin,SLOT(slotAllCleared())); @@ -467,7 +467,7 @@ void Core::loadPlugin(QString filename, bool silent){ connect(this,SIGNAL(activeObjectChanged()),plugin,SLOT(slotActiveObjectChanged() )); if ( checkSlot( plugin , "slotObjectUpdated(int)" ) ) - connect(this,SIGNAL(ObjectListUpdated(int)),plugin,SLOT(slotObjectUpdated(int))); + connect(this,SIGNAL(signalObjectUpdated(int)),plugin,SLOT(slotObjectUpdated(int))); if ( checkSlot( plugin , "pluginsInitialized()" ) ) connect(this,SIGNAL(pluginsInitialized()),plugin,SLOT(pluginsInitialized()), Qt::DirectConnection); diff --git a/Core/openFunctions.cc b/Core/openFunctions.cc index 02070094..a521581c 100644 --- a/Core/openFunctions.cc +++ b/Core/openFunctions.cc @@ -190,7 +190,7 @@ void Core::slotLoad(QString _filename, DataType _type, int& _id) { emit openedFile( _id ); // Tell the Plugins that the Object List and the active object have changed - emit ObjectListUpdated(_id); + emit signalObjectUpdated(_id); emit activeObjectChanged(); backupRequest(_id,"Original Object"); @@ -213,7 +213,7 @@ void Core::slotLoad(QString _filename, DataType _type, int& _id) { /// Slot gets called after a file-plugin has opened an object void Core::slotEmptyObjectAdded ( int _id ) { // Tell the Plugins that the Object List and the active object have changed - emit ObjectListUpdated(_id); + emit signalObjectUpdated(_id); emit activeObjectChanged(); backupRequest(_id,"Original Object"); -- GitLab