Commit 2504be31 authored by Dirk Wilden's avatar Dirk Wilden

added scripting functions

target/source/object name

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@4986 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 0a00f143
......@@ -315,50 +315,6 @@ void DataControlPlugin::slotKeyEvent( QKeyEvent* _event )
}
void DataControlPlugin::setAllTarget() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
o_it != PluginFunctions::objectsEnd(); ++o_it)
o_it->target(true);
emit activeObjectChanged();
emit updatedObject(-1);
}
void DataControlPlugin::setAllSource() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
o_it != PluginFunctions::objectsEnd(); ++o_it)
o_it->source(true);
emit updatedObject(-1);
}
void DataControlPlugin::clearAllTarget() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
o_it != PluginFunctions::objectsEnd(); ++o_it)
o_it->target(false);
emit activeObjectChanged();
emit updatedObject(-1);
}
void DataControlPlugin::clearAllSource() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
o_it != PluginFunctions::objectsEnd(); ++o_it)
o_it->source(false);
emit updatedObject(-1);
}
void DataControlPlugin::hideAll() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
o_it != PluginFunctions::objectsEnd(); ++o_it)
o_it->hide();
emit updateView();
}
void DataControlPlugin::showAll() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
o_it != PluginFunctions::objectsEnd(); ++o_it)
o_it->show();
emit updateView();
}
void DataControlPlugin::slotDataChanged ( const QModelIndex & topLeft,
const QModelIndex & /*bottomRight*/ )
{
......
......@@ -269,6 +269,15 @@ class DataControlPlugin : public QObject, BaseInterface, ToolboxInterface, KeyIn
/// Show the given Object
void showObject( int objectId );
/// set the given Object as target
void setTarget( int objectId, bool _target );
/// set the given Object as source
void setSource( int objectId, bool _source );
/// set the name of the given object
void setObjectName( int objectId, QString _name );
/// Makes all available objects target
void setAllTarget();
......
......@@ -51,6 +51,18 @@ void DataControlPlugin::setDescriptions(){
emit setSlotDescription("showObject(int)","Show object with the given id.",
QStringList("objectId"), QStringList("ID of an object"));
emit setSlotDescription("setTarget(int,bool)","Set given object as target.",
QString("ObjectId,Target").split(","),
QString("id of the object, set object as target?").split(","));
emit setSlotDescription("setSource(int,bool)","Set given object as source.",
QString("ObjectId,Source").split(","),
QString("id of the object, set object as source?").split(","));
emit setSlotDescription("setObjectName(int,QString)","Set name of given object.",
QString("ObjectId,name").split(","),
QString("id of the object, the new name").split(","));
emit setSlotDescription("groupObjects(idList,QString)","Group given Objects together.",
QString("objectIds,groupName").split(","),
QString("List of objects that should be grouped., Name of the group.").split(","));
......@@ -64,6 +76,23 @@ void DataControlPlugin::setDescriptions(){
emit setSlotDescription("copyObject(int)","Create a copy of an object",
QStringList("objectId"), QStringList("Object to copy."));
emit setSlotDescription("setAllTarget()","Set All objects as targets",
QStringList(), QStringList());
emit setSlotDescription("setAllSource()","Set All objects as source",
QStringList(), QStringList());
emit setSlotDescription("clearAllTarget()","Clear targets",
QStringList(), QStringList());
emit setSlotDescription("clearAllSource()","Clear sources",
QStringList(), QStringList());
emit setSlotDescription("showAll()","Show all objects",
QStringList(), QStringList());
emit setSlotDescription("hideAll()","Hide all objects",
QStringList(), QStringList());
}
......@@ -116,6 +145,45 @@ void DataControlPlugin::hideObject( int objectId ) {
object->hide();
}
/// set the given Object as target
void DataControlPlugin::setTarget( int objectId, bool _target ) {
BaseObjectData* object;
if ( ! PluginFunctions::getObject(objectId,object) )
return;
if ( object == 0)
return;
object->target( _target );
}
/// set the given Object as source
void DataControlPlugin::setSource( int objectId, bool _source ) {
BaseObjectData* object;
if ( ! PluginFunctions::getObject(objectId,object) )
return;
if ( object == 0)
return;
object->source( _source );
}
/// set the name of the given Object as source
void DataControlPlugin::setObjectName( int objectId, QString _name ) {
BaseObjectData* object;
if ( ! PluginFunctions::getObject(objectId,object) )
return;
if ( object == 0)
return;
object->setName( _name );
}
void DataControlPlugin::deleteObject( int objectId ) {
BaseObjectData* object;
......@@ -188,3 +256,46 @@ void DataControlPlugin::groupObjects(idList _objectIDs, QString _groupName) {
emit updatedObject(-1);
}
void DataControlPlugin::setAllTarget() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
o_it != PluginFunctions::objectsEnd(); ++o_it)
o_it->target(true);
emit activeObjectChanged();
emit updatedObject(-1);
}
void DataControlPlugin::setAllSource() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
o_it != PluginFunctions::objectsEnd(); ++o_it)
o_it->source(true);
emit updatedObject(-1);
}
void DataControlPlugin::clearAllTarget() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
o_it != PluginFunctions::objectsEnd(); ++o_it)
o_it->target(false);
emit activeObjectChanged();
emit updatedObject(-1);
}
void DataControlPlugin::clearAllSource() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
o_it != PluginFunctions::objectsEnd(); ++o_it)
o_it->source(false);
emit updatedObject(-1);
}
void DataControlPlugin::hideAll() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
o_it != PluginFunctions::objectsEnd(); ++o_it)
o_it->hide();
emit updateView();
}
void DataControlPlugin::showAll() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
o_it != PluginFunctions::objectsEnd(); ++o_it)
o_it->show();
emit updateView();
}
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