Commit c0a95faa authored by Jan Möbius's avatar Jan Möbius
Browse files

Made datacontrol scriptable and added printObjectInfoToLog function to show all objects

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@12677 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 0e334963
......@@ -82,6 +82,9 @@ void DataControlPlugin::pluginsInitialized() {
//set the slot descriptions
setDescriptions();
if ( ! OpenFlipper::Options::gui())
return;
QMenu* contextMenu = new QMenu("Object");
//Target Objects
......@@ -137,6 +140,9 @@ void DataControlPlugin::pluginsInitialized() {
void DataControlPlugin::initializePlugin()
{
if ( ! OpenFlipper::Options::gui())
return;
locked = false;
tool_ = new DatacontrolToolboxWidget();
connect( tool_ , SIGNAL( keyEvent( QKeyEvent* ) ),
......@@ -205,6 +211,9 @@ void DataControlPlugin::initializePlugin()
void DataControlPlugin::slotObjectSelectionChanged( int _identifier )
{
if ( ! OpenFlipper::Options::gui())
return;
BaseObjectData* obj = 0;
if ( PluginFunctions::getObject( _identifier, obj) )
......@@ -253,6 +262,9 @@ void DataControlPlugin::slotObjectSelectionChanged( int _identifier )
*/
void DataControlPlugin::slotVisibilityChanged( int _identifier ){
if ( ! OpenFlipper::Options::gui())
return;
// if onlyUp_ > 0 --> _identifier is a group and the selection
// does not have to be applied
if (onlyUp_ == 0){
......@@ -303,6 +315,10 @@ void DataControlPlugin::slotVisibilityChanged( int _identifier ){
* @param _identifier id of an object
*/
void DataControlPlugin::slotObjectPropertiesChanged( int _identifier ){
if ( ! OpenFlipper::Options::gui())
return;
model_->objectChanged( _identifier );
}
......@@ -326,6 +342,9 @@ void DataControlPlugin::slotObjectUpdated( int /*_identifier*/ , const UpdateTyp
*/
void DataControlPlugin::fileOpened(int _id){
if ( ! OpenFlipper::Options::gui())
return;
BaseObject* obj = 0;
if ( PluginFunctions::getObject(_id, obj) )
......@@ -353,6 +372,10 @@ void DataControlPlugin::addedEmptyObject(int _id){
* @param _id id of the object
*/
void DataControlPlugin::objectDeleted(int _id){
if ( ! OpenFlipper::Options::gui())
return;
model_->objectDeleted(_id);
}
......@@ -480,7 +503,7 @@ void DataControlPlugin::slotShowLightSources( int _state ) {
*/
void DataControlPlugin::loadIniFileOptionsLast( INIFile& _ini ) {
if ( _ini.section_exists( "BoundingBox" ) )
if ( _ini.section_exists( "BoundingBox" ) && OpenFlipper::Options::gui() )
{
bool value;
if (_ini.get_entry(value, "BoundingBox","notSelected"))
......@@ -632,11 +655,14 @@ void DataControlPlugin::saveIniFileOptions( INIFile& _ini ) {
// Write the primary group names to the file
_ini.add_entry("Groups","rootGroup",rootGroup);
if ( OpenFlipper::Options::gui() ) {
if ( !_ini.section_exists( "BoundingBox" ) )
_ini.add_section("BoundingBox");
_ini.add_entry("BoundingBox","notSelected",tool_->notSelected->isChecked ());
_ini.add_entry("BoundingBox","sourceSelected",tool_->sourceSelected->isChecked ());
_ini.add_entry("BoundingBox","targetSelected",tool_->targetSelected->isChecked ());
}
}
......
......@@ -123,6 +123,9 @@ class DataControlPlugin : public QObject, BaseInterface, ToolboxInterface, KeyIn
void addedEmptyObject(int _id);
void objectDeleted(int _id);
// Tell system that this plugin runs without ui
void noguiSupported( ) {} ;
public :
/// Destructor
~DataControlPlugin() {};
......@@ -357,6 +360,9 @@ class DataControlPlugin : public QObject, BaseInterface, ToolboxInterface, KeyIn
/// Get all source objects of given type
IdList getSourceObjects(DataType _type);
/// Print information about all open objects to the console
void printObjectInfoToLog();
/** @} */
public slots:
......
......@@ -109,6 +109,10 @@ void DataControlPlugin::setDescriptions(){
emit setSlotDescription("hideAll()",tr("Hide all objects"),
QStringList(), QStringList());
emit setSlotDescription("printObjectInfoToLog()",tr("Print info about all objects to log"),
QStringList(), QStringList());
}
......@@ -174,6 +178,9 @@ QString DataControlPlugin::getObjectName( int objectId ) {
*/
void DataControlPlugin::hideObject( int objectId ) {
if ( ! OpenFlipper::Options::gui())
return;
BaseObjectData* object;
if ( PluginFunctions::getObject(objectId,object) ){
object->hide();
......@@ -258,6 +265,9 @@ void DataControlPlugin::objectDelete( int objectId ) {
*/
void DataControlPlugin::showObject( int objectId ) {
if ( ! OpenFlipper::Options::gui())
return;
BaseObjectData* object;
if ( PluginFunctions::getObject(objectId,object) ){
object->show();
......@@ -434,6 +444,9 @@ void DataControlPlugin::clearAllSource() {
*/
void DataControlPlugin::hideAll() {
if ( ! OpenFlipper::Options::gui())
return;
DataType type = DATA_ALL;
//try to find dataType restriction if called by contextMenu
......@@ -457,6 +470,9 @@ void DataControlPlugin::hideAll() {
*/
void DataControlPlugin::showAll() {
if ( ! OpenFlipper::Options::gui())
return;
DataType type = DATA_ALL;
//try to find dataType restriction if called by contextMenu
......@@ -501,5 +517,14 @@ IdList DataControlPlugin::getSourceObjects(DataType _type) {
return list;
}
//******************************************************************************
/** \brief Prints information about all open objects to the Log
*
*/
void DataControlPlugin::printObjectInfoToLog() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS); o_it != PluginFunctions::objectsEnd(); ++o_it)
emit log(LOGINFO, tr("Object \"%1\" with ID %2 of type %3 ").arg(o_it->name()).arg(o_it->id()).arg(o_it->dataType().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