Commit de1ae774 authored by Jan Möbius's avatar Jan Möbius

Datacontrol function to get object datatype and stringlist of all available...

Datacontrol function to get object datatype and stringlist of all available datatypes. Started scripting documentation. refs #394 

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@13556 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 2974685d
......@@ -313,6 +313,9 @@ class DataControlPlugin : public QObject, BaseInterface, ToolboxInterface, KeyIn
/// Get the id of an object by its name
int getObject( QString _name );
/// Get the DataType of a given object
DataType dataType( int objectId );
/// Hide the given Object
void hideObject( int objectId );
......@@ -367,6 +370,9 @@ class DataControlPlugin : public QObject, BaseInterface, ToolboxInterface, KeyIn
/// Returns the number of groups
unsigned int groupCount() const;
/// Returns a list of all available DataTypes
QStringList availableDataTypeNames() const;
/// Print information about all open objects to the console
void printObjectInfoToLog();
......
......@@ -58,6 +58,9 @@ void DataControlPlugin::setDescriptions(){
emit setSlotDescription("getObjectName(int)",tr("Returns the name of an object with given id."),
QStringList(tr("objectId")), QStringList(tr("ID of an object")));
emit setSlotDescription("dataType(int)",tr("Returns the DataType of the object with the given id."),
QStringList(tr("objectId")), QStringList(tr("ID of an object")));
emit setSlotDescription("hideObject(int)",tr("Hide object with the given id."),
QStringList(tr("objectId")), QStringList(tr("ID of an object")));
......@@ -113,6 +116,9 @@ void DataControlPlugin::setDescriptions(){
emit setSlotDescription("hideAll()",tr("Hide all objects"),
QStringList(), QStringList());
emit setSlotDescription("availableDataTypeNames()",tr("Returns a QStringList of all available DataType names."),
QStringList(tr("")), QStringList(tr("")));
emit setSlotDescription("printObjectInfoToLog()",tr("Print info about all objects to log"),
QStringList(), QStringList());
......@@ -172,6 +178,19 @@ QString DataControlPlugin::getObjectName( int objectId ) {
}
//******************************************************************************
/// Get the DataType of a given object
DataType DataControlPlugin::dataType( int _objectId ) {
BaseObject* object = 0;
PluginFunctions::getObject(_objectId,object);
if ( object )
return object->dataType();
else
return DATA_UNKNOWN;
}
//******************************************************************************
......@@ -548,3 +567,21 @@ unsigned int DataControlPlugin::groupCount() const {
}
//******************************************************************************
/** \brief Return available dataType
*
* Returns a space separated list of all available DataTypes
*
* @return List of available data types
*/
QStringList DataControlPlugin::availableDataTypeNames() const {
QStringList list;
for ( std::vector< TypeInfo >::const_iterator dataType = typesBegin(); dataType != typesEnd(); ++dataType )
list.push_back(dataType->name);
return list;
}
//******************************************************************************
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