Commit 8f2c01b0 authored by Jan Möbius's avatar Jan Möbius

objectProperties changed is now handled internally from core

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7933 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 23fb49f5
......@@ -131,15 +131,7 @@ class BaseInterface {
*
*/
virtual void nodeVisibilityChanged( int /*_identifier*/ ) {};
/** \brief Object properties have been changed
*
* This signal is used to tell the other plugins that the object properties (e.g. name ) have changed
*
*/
virtual void objectPropertiesChanged( int /*_identifier*/ ) {};
private slots:
/** \brief An object has been updated by another plugin
......
......@@ -136,6 +136,15 @@ void Core::slotObjectSelectionChanged( int _id )
void Core::slotObjectPropertiesChanged( int _id )
{
// std::cerr << "Object Properties changed " << _id << std::endl;
//
// BaseObject* baseObject = 0;
// PluginFunctions::getObject(_id,baseObject);
//
// if ( baseObject ) {
// baseObject->dumpTree();
// }
//
emit objectPropertiesChanged(_id);
}
......@@ -282,8 +291,9 @@ void Core::newObject(int _objectId) {
PluginFunctions::getObject(_objectId,baseObject);
if ( baseObject ) {
connect( baseObject, SIGNAL(visibilityChanged(int)), this, SLOT(slotVisibilityChanged(int)), Qt::DirectConnection) ;
connect( baseObject, SIGNAL(objectSelectionChanged(int)),this, SLOT(slotObjectSelectionChanged(int)), Qt::DirectConnection );
connect( baseObject, SIGNAL(visibilityChanged(int)), this, SLOT(slotVisibilityChanged(int)), Qt::DirectConnection) ;
connect( baseObject, SIGNAL(objectSelectionChanged(int)), this, SLOT(slotObjectSelectionChanged(int)), Qt::DirectConnection );
connect( baseObject, SIGNAL(objectPropertiesChanged(int)), this, SLOT(slotObjectPropertiesChanged(int)), Qt::DirectConnection );
} else {
emit log(LOGERR,tr("newObject received from objectManager with invalid id! This should not happen. The new Object will not work correctly!"));
}
......
......@@ -489,8 +489,12 @@ void Core::loadPlugin(QString filename, bool silent){
connect(this,SIGNAL(signalObjectUpdated(int)),plugin,SLOT(slotObjectUpdated(int)), Qt::DirectConnection);
if ( checkSignal(plugin,"objectPropertiesChanged(int)"))
connect(plugin,SIGNAL(objectPropertiesChanged(int)),this,SLOT(slotObjectPropertiesChanged(int)), Qt::DirectConnection);
if ( checkSignal(plugin,"objectPropertiesChanged(int)")) {
emit log (LOGERR,tr("Signal objectPropertiesChanged(int) is deprecated. " ));
emit log (LOGERR,tr("The signal will be automatically emitted by the object that has been changed and the core will deliver it to the plugins!. "));
emit log (LOGERR,tr("Please remove this signal from your plugins!. "));
// connect(plugin,SIGNAL(objectPropertiesChanged(int)),this,SLOT(slotObjectPropertiesChanged(int)), Qt::DirectConnection);
}
if ( checkSlot( plugin , "slotViewChanged()" ) )
connect(this,SIGNAL(pluginViewChanged()),plugin,SLOT(slotViewChanged()), Qt::DirectConnection);
......
......@@ -411,7 +411,19 @@ BaseObject* BaseObject::parent()
/// Set the parent pointer
void BaseObject::setParent(BaseObject* _parent) {
// remove this child from the old parents list
if ( parentItem_ != 0 )
parentItem_->removeChild(this);
// Add as child of new parent
if ( _parent != 0 )
_parent->appendChild(this);
// Store new parent
parentItem_ = _parent;
// Tell other plugins about this change
emit objectPropertiesChanged(id());
}
......@@ -650,6 +662,9 @@ QString BaseObject::name() {
void BaseObject::setName(QString _name ) {
name_ = _name;
// Tell plugins about the name change
emit objectPropertiesChanged(id());
}
// ===============================================================================
......
......@@ -325,6 +325,8 @@ class DLLEXPORTONLY BaseObject : public QObject {
* @{ */
//===========================================================================
public:
/// get the row of this item from the parent
int row() const;
......@@ -340,7 +342,9 @@ class DLLEXPORTONLY BaseObject : public QObject {
/** @name Tree : Children
* @{ */
//===========================================================================
public:
/// Check if the element exists in the subtree of this element
BaseObject* childExists(int _objectId);
......@@ -372,6 +376,8 @@ class DLLEXPORTONLY BaseObject : public QObject {
* @{ */
//===========================================================================
public:
/** Return the primary group of this object or -1 if ungrouped.
* As this is a tree structure this returns the first group of this object.
* Groups of groups are only suppurted via the other functions.
......@@ -410,6 +416,13 @@ class DLLEXPORTONLY BaseObject : public QObject {
* @{ */
//===========================================================================
signals:
/** This signal is emitted when properties of the object have been changed like its name
* or the parent changed
*/
void objectPropertiesChanged(int _objectId);
public:
/// return the name of the object. The name defaults to NONAME if unset.
QString name( );
......
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