DataControlPlugin.cc 16.2 KB
Newer Older
Jan Möbius's avatar
 
Jan Möbius committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//=============================================================================
//
//                               OpenFlipper
//        Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen
//                           www.openflipper.org
//
//-----------------------------------------------------------------------------
//
//                                License
//
//  OpenFlipper is free software: you can redistribute it and/or modify
//  it under the terms of the GNU Lesser General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
15
//
Jan Möbius's avatar
 
Jan Möbius committed
16
17
18
19
//  OpenFlipper is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Lesser General Public License for more details.
20
//
Jan Möbius's avatar
 
Jan Möbius committed
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//  You should have received a copy of the GNU Lesser General Public License
//  along with OpenFlipper.  If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
//   $Revision$
//   $Author$
//   $Date$
//
//=============================================================================





#include <QtGui>

#include "DataControlPlugin.hh"

#include <QLayout>
41
#include <QGridLayout>
Jan Möbius's avatar
 
Jan Möbius committed
42
#include <QItemSelectionModel>
43

Jan Möbius's avatar
 
Jan Möbius committed
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <iostream>
#include <ACG/GL/GLState.hh>
#include <QStringList>
#include <ACG/Scenegraph/BaseNode.hh>
#include <QModelIndexList>

#include <queue>

#include <OpenFlipper/BasePlugin/PluginFunctions.hh>


void DataControlPlugin::pluginsInitialized() {
  QMenu* contextMenu = new QMenu("Object selection");
57

Jan Möbius's avatar
 
Jan Möbius committed
58
59
60
61
62
  //Target Objects
  QAction* hideAction = new QAction(tr("&Hide"), this);
  hideAction->setStatusTip(tr("Hide object"));
  connect(hideAction, SIGNAL(triggered()), this, SLOT(slotContextMenuHide()) );
  contextMenu->addAction(hideAction);
63

Jan Möbius's avatar
 
Jan Möbius committed
64
65
66
67
68
69
  //Target Objects
  targetAction_ = new QAction(tr("&target"), this);
  targetAction_->setCheckable(true);
  targetAction_->setStatusTip(tr("Set object as target"));
  connect(targetAction_, SIGNAL(triggered()), this, SLOT(slotContextMenuTarget()) );
  contextMenu->addAction(targetAction_);
70

Jan Möbius's avatar
 
Jan Möbius committed
71
72
73
74
75
  //Source Objects
  sourceAction_ = new QAction(tr("&source"), this);
  sourceAction_->setCheckable(true);
  sourceAction_->setStatusTip(tr("Set object as source"));
  connect(sourceAction_, SIGNAL(triggered()), this, SLOT(slotContextMenuSource()) );
76
77
78
  contextMenu->addAction(sourceAction_);

  emit addContextMenu(contextMenu , DATA_ALL , CONTEXTTOPLEVELMENU);
Jan Möbius's avatar
 
Jan Möbius committed
79
80
81
82
83
}

bool DataControlPlugin::initializeToolbox(QWidget*& _widget)
{
   locked = false;
84
   tool_ = new QWidget();
Jan Möbius's avatar
 
Jan Möbius committed
85
86
   _widget = tool_;
   QSize size(300, 300);
87
88
89
   tool_->resize(size);
   MeshDialogLayout_ = new QGridLayout( tool_);

Jan Möbius's avatar
 
Jan Möbius committed
90
   model_ = new TreeModel( );
91

Jan Möbius's avatar
 
Jan Möbius committed
92
93
   view_ = new QTreeView(0);
   view_->setModel(model_);
94

Jan Möbius's avatar
 
Jan Möbius committed
95
96
97
   view_->QTreeView::resizeColumnToContents(1);
   view_->QTreeView::resizeColumnToContents(2);
   view_->QTreeView::resizeColumnToContents(3);
98

Jan Möbius's avatar
 
Jan Möbius committed
99
   view_->setContextMenuPolicy(Qt::CustomContextMenu);
100

Jan Möbius's avatar
 
Jan Möbius committed
101
102
   view_->setSelectionBehavior(QAbstractItemView::SelectRows);
   view_->setSelectionMode(QAbstractItemView::ExtendedSelection);
103

Jan Möbius's avatar
 
Jan Möbius committed
104
105
   connect( model_,SIGNAL(dataChanged( const QModelIndex&, const QModelIndex& ) ),
             this,SLOT(slotDataChanged( const QModelIndex&, const QModelIndex& )));
106

Jan Möbius's avatar
 
Jan Möbius committed
107
108
   connect( model_ , SIGNAL(rowsRemoved( const QModelIndex &, int , int ) ),
            this , SLOT(slotRowsRemoved ( const QModelIndex &, int , int ) ) );
109

Jan Möbius's avatar
 
Jan Möbius committed
110
111
   connect( view_,SIGNAL(customContextMenuRequested ( const QPoint &  )  ),
            this,SLOT(slotCustomContextMenuRequested ( const QPoint & ) ));
112
113
114
115

   MeshDialogLayout_->addWidget( view_ , 0,0  );

   viewHeader_ = view_->header();
Jan Möbius's avatar
 
Jan Möbius committed
116
   viewHeader_->setContextMenuPolicy(Qt::CustomContextMenu);
117

Jan Möbius's avatar
 
Jan Möbius committed
118
119
120
   // connect the slot for the context menu
   connect( viewHeader_, SIGNAL(customContextMenuRequested ( const QPoint &  )  ),
            this,        SLOT(slotHeaderCustomContextMenuRequested ( const QPoint & ) ));
121

Jan Möbius's avatar
 
Jan Möbius committed
122
123
124
125
126
127
128
   return true;
}

void DataControlPlugin::slotObjectUpdated( int _identifier ) {
  model_->updatedObject( _identifier );
}

Dirk Wilden's avatar
Dirk Wilden committed
129
void DataControlPlugin::slotCellClicked(int /*_row*/ , int /*_col*/) {
130

Jan Möbius's avatar
 
Jan Möbius committed
131
132
133
134
//    if ( _col == 0 ) {
//          QTableWidgetItem* target = objectList_->item(_row,_col);
//          if ( target->checkState() == Qt::Checked ) {
//             target->setCheckState(Qt::Unchecked);
135
136
//             (*data_)[_row]->target(false);
//          } else {
Jan Möbius's avatar
 
Jan Möbius committed
137
//             target->setCheckState(Qt::Checked);
138
//             (*data_)[_row]->target(true);
Jan Möbius's avatar
 
Jan Möbius committed
139
140
141
142
143
//          }
//         emit activeObjectChanged();
//    }
}

Dirk Wilden's avatar
Dirk Wilden committed
144
void DataControlPlugin::verticalHeaderClicked( int /*_row*/ ) {
Jan Möbius's avatar
 
Jan Möbius committed
145
146
147
148
//     (*data_)[_row]->target ( !(*data_)[_row]->target() );
//    QTableWidgetItem* target = objectList_->item(_row,3);
//    if ( target->checkState() == Qt::Checked ) {
//       target->setCheckState(Qt::Unchecked);
149
150
//       (*data_)[_row]->target(false);
//    } else {
Jan Möbius's avatar
 
Jan Möbius committed
151
//       target->setCheckState(Qt::Checked);
152
//       (*data_)[_row]->target(true);
Jan Möbius's avatar
 
Jan Möbius committed
153
154
155
156
157
158
//    }
//    emit activeObjectChanged();
// //    QTableWidgetSelectionRange range(5,0,5,3);
// //    objectList_->setRangeSelected(range,true);
}

Dirk Wilden's avatar
Dirk Wilden committed
159
void DataControlPlugin::verticalCountClicked( int  /*id*/ , int /*old*/ , int /*newc*/ ) {
Jan Möbius's avatar
 
Jan Möbius committed
160
161
162
163
//    emit log(LOGWARN,"VHeader : Count " + QString::number(id) + " " + QString::number(old) + " " + QString::number(newc));
}


164
void DataControlPlugin::slotActiveObjectChanged()
Jan Möbius's avatar
 
Jan Möbius committed
165
166
167
168
169
170
171
172
173
{
  ///@todo set all target checkboxes right
  // hint : dont call slotObjectUpdated -1 as this will do a redraw
//   slotObjectUpdated(-1);
  update_active();
}

void DataControlPlugin::update_active( ) {
  // find changed manipulator
174
  for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
Jan Möbius's avatar
 
Jan Möbius committed
175
176
177
178
179
180
181
182
183
184
185
186
                                        o_it != PluginFunctions::objects_end(); ++o_it)  {
      if ( o_it->target() ) {
               o_it->materialNode()->disable_blending();
               OpenMesh::Vec4f base_color = o_it->materialNode()->base_color();
               base_color[3] = 1.0;
               o_it->materialNode()->set_base_color(base_color);
               OpenMesh::Vec4f ambient_color = o_it->materialNode()->ambient_color();
               ambient_color[3] = 1.0;
               o_it->materialNode()->set_ambient_color(ambient_color);
               OpenMesh::Vec4f diffuse_color = o_it->materialNode()->diffuse_color();
               diffuse_color[3] = 1.0;
               o_it->materialNode()->set_diffuse_color(diffuse_color);
187
      }  else {
Jan Möbius's avatar
 
Jan Möbius committed
188
189
190
191
192
193
194
195
196
197
            o_it->materialNode()->enable_blending();
            OpenMesh::Vec4f base_color = o_it->materialNode()->base_color();
            base_color[3] = 0.4;
            o_it->materialNode()->set_base_color(base_color);
            OpenMesh::Vec4f ambient_color = o_it->materialNode()->ambient_color();
            ambient_color[3] = 0.4;
            o_it->materialNode()->set_ambient_color(ambient_color);
            OpenMesh::Vec4f diffuse_color = o_it->materialNode()->diffuse_color();
            diffuse_color[3] = 0.4;
            o_it->materialNode()->set_diffuse_color(diffuse_color);
198
      }
Jan Möbius's avatar
 
Jan Möbius committed
199
  }
200

Jan Möbius's avatar
 
Jan Möbius committed
201
202
203
204
205
206
207
208
  emit update_view();
}

void DataControlPlugin::slotKeyEvent( QKeyEvent* _event )
{

//    QList<QTableWidgetItem *> selected ;
//    QList<QTableWidgetSelectionRange> ranges;
209
//    switch (_event->key())
Jan Möbius's avatar
 
Jan Möbius committed
210
//    {
211
//      case Qt::Key_M :
Jan Möbius's avatar
 
Jan Möbius committed
212
213
214
215
//           for ( uint i = 0 ; i < data_->size() ; ++i ) {
//                QTableWidgetSelectionRange range(i,0,i,3);
//                objectList_->setRangeSelected(range,true);
//          }
216
217
218
//          return;
//
//       case Qt::Key_N :
Jan Möbius's avatar
 
Jan Möbius committed
219
220
221
//          std::cerr << "Checking : " << std::endl;
//          for ( uint i = 0 ; i < data_->size() ; ++i ) {
//             QTableWidgetItem * item = objectList_->verticalHeaderItem ( i );
222
//             if ( objectList_->isItemSelected(item)  )
Jan Möbius's avatar
 
Jan Möbius committed
223
224
225
226
227
//                std::cerr << i << item->text().toStdString() << " : yes" << std::endl;
//             else {
//                std::cerr << i << item->text().toStdString() << " : no" << std::endl;
//             }
//          }
228
//
Jan Möbius's avatar
 
Jan Möbius committed
229
230
//          selected = objectList_->selectedItems();
//          std::cerr << "Selected " << selected.size() << std::endl;
231
//
Jan Möbius's avatar
 
Jan Möbius committed
232
233
//          ranges = objectList_->selectedRanges();
//          std::cerr << "Ranges " << ranges.size() << std::endl;
234
//
Jan Möbius's avatar
 
Jan Möbius committed
235
//          for ( int i = 0 ; i < ranges.size(); ++i ) {
236
237
//            std::cerr << "Range " << i << " : " << ranges[i].topRow() << " .. " << ranges[i].bottomRow() << std::endl;
//            std::cerr << "Range " << i << " : " << ranges[i].leftColumn() << " .. " << ranges[i].rightColumn() << std::endl;
Jan Möbius's avatar
 
Jan Möbius committed
238
//          }
239
//
Jan Möbius's avatar
 
Jan Möbius committed
240
//          return;
241
//       case Qt::Key_C :
Jan Möbius's avatar
 
Jan Möbius committed
242
//           if ( _event->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier) ) {
243
//                for ( uint i = 0 ; i < data_->size() ; ++i ) {
Jan Möbius's avatar
 
Jan Möbius committed
244
245
246
247
//                   (*data_)[i]->source(false);
//                }
//                emit updated_objects(-1);
//               return;
248
249
//           }
//
Jan Möbius's avatar
 
Jan Möbius committed
250
//           if ( _event->modifiers() == (Qt::AltModifier | Qt::ShiftModifier) ) {
251
//              for ( uint i = 0 ; i < data_->size() ; ++i ) {
Jan Möbius's avatar
 
Jan Möbius committed
252
253
254
255
//                 (*data_)[i]->target(false);
//               }
//               emit updated_objects(-1);
//              return;
256
257
//           }
//
Jan Möbius's avatar
 
Jan Möbius committed
258
//           return;
259
260
//
//        case Qt::Key_A :
Jan Möbius's avatar
 
Jan Möbius committed
261
//           if ( _event->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier) ) {
262
//                for ( uint i = 0 ; i < data_->size() ; ++i ) {
Jan Möbius's avatar
 
Jan Möbius committed
263
264
265
266
//                   (*data_)[i]->source(true);
//                }
//                emit updated_objects(-1);
//               return;
267
268
//           }
//
Jan Möbius's avatar
 
Jan Möbius committed
269
//           if ( _event->modifiers() == (Qt::AltModifier | Qt::ShiftModifier) ) {
270
//              for ( uint i = 0 ; i < data_->size() ; ++i ) {
Jan Möbius's avatar
 
Jan Möbius committed
271
272
273
274
//                 (*data_)[i]->target(true);
//               }
//               emit updated_objects(-1);
//              return;
275
276
//           }
//
Jan Möbius's avatar
 
Jan Möbius committed
277
278
279
280
//           return;
//       default:
//       break;
//   }
281

Jan Möbius's avatar
 
Jan Möbius committed
282
283
  if ( _event->modifiers() == Qt::ControlModifier ) {
    switch (_event->key()) {
284
      case Qt::Key_A :
Jan Möbius's avatar
 
Jan Möbius committed
285
286
287
288
289
290
291
292
293
          setAllTarget();
        return;
      default:
        return;
    }
  }
}

void DataControlPlugin::setAllTarget() {
294
295
296
  for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
                                    o_it != PluginFunctions::objects_end(); ++o_it)
  o_it->target(true);
Jan Möbius's avatar
 
Jan Möbius committed
297
  emit activeObjectChanged();
298
  emit updated_objects(-1);
Jan Möbius's avatar
 
Jan Möbius committed
299
300
301
}

void DataControlPlugin::setAllSource() {
302
303
304
305
  for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
                                    o_it != PluginFunctions::objects_end(); ++o_it)
  o_it->source(true);
  emit updated_objects(-1);
Jan Möbius's avatar
 
Jan Möbius committed
306
307
308
}

void DataControlPlugin::clearAllTarget() {
309
310
311
  for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
                                    o_it != PluginFunctions::objects_end(); ++o_it)
  o_it->target(false);
Jan Möbius's avatar
 
Jan Möbius committed
312
  emit activeObjectChanged();
313
  emit updated_objects(-1);
Jan Möbius's avatar
 
Jan Möbius committed
314
315
316
}

void DataControlPlugin::clearAllSource() {
317
318
319
320
  for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
                                    o_it != PluginFunctions::objects_end(); ++o_it)
  o_it->source(false);
  emit updated_objects(-1);
Jan Möbius's avatar
 
Jan Möbius committed
321
322
323
}

void DataControlPlugin::hideAll() {
324
325
326
  for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
                                    o_it != PluginFunctions::objects_end(); ++o_it)
    o_it->hide();
Jan Möbius's avatar
 
Jan Möbius committed
327
328
329
330
  emit update_view();
}

void DataControlPlugin::showAll() {
331
332
333
  for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
                                    o_it != PluginFunctions::objects_end(); ++o_it)
    o_it->show();
Jan Möbius's avatar
 
Jan Möbius committed
334
335
336
  emit update_view();
}

337
void DataControlPlugin::slotDataChanged ( const QModelIndex & topLeft,
Dirk Wilden's avatar
Dirk Wilden committed
338
                                          const QModelIndex & /*bottomRight*/ )
Jan Möbius's avatar
 
Jan Möbius committed
339
{
340

Jan Möbius's avatar
 
Jan Möbius committed
341
  switch (topLeft.column()) {
342
    // Name
Jan Möbius's avatar
 
Jan Möbius committed
343
    case 0:
Dirk Wilden's avatar
Dirk Wilden committed
344
      view_->expandToDepth(0);
Jan Möbius's avatar
 
Jan Möbius committed
345
      break;
346

Jan Möbius's avatar
 
Jan Möbius committed
347
348
    // show/hide
    case 1:
349
        emit update_view();
Jan Möbius's avatar
 
Jan Möbius committed
350
      break;
351

Jan Möbius's avatar
 
Jan Möbius committed
352
353
    // source
    case 2:
354
355
      break;

Jan Möbius's avatar
 
Jan Möbius committed
356
357
358
359
    // target
    case 3:
      emit activeObjectChanged();
      break;
360

Jan Möbius's avatar
 
Jan Möbius committed
361
362
363
364
365
    default:
      break;
  }
}

Dirk Wilden's avatar
Dirk Wilden committed
366
void DataControlPlugin::slotRowsRemoved ( const QModelIndex & /*_parent*/, int /*_start*/, int /*_end*/ ) {
Jan Möbius's avatar
 
Jan Möbius committed
367
368
369
370
371
  std::cerr << "Row removed! " << std::endl;
  emit update_view();
}

void DataControlPlugin::loadIniFileOptions( INIFile& _ini ) {
372
  if ( !_ini.section_exists( "Groups" ) )
Jan Möbius's avatar
 
Jan Möbius committed
373
    return;
374

Jan Möbius's avatar
 
Jan Möbius committed
375
376
  // Names of all groups
  QStringList groupNames;
377

Jan Möbius's avatar
 
Jan Möbius committed
378
379
  // names of the primary groups
  QStringList rootGroup;
380

Jan Möbius's avatar
 
Jan Möbius committed
381
382
  // Get the list of group names to the file
  _ini.get_entry(groupNames,"Groups","groups");
383

Jan Möbius's avatar
 
Jan Möbius committed
384
385
  // Get the primary group names to the file
  _ini.get_entry(rootGroup,"Groups","rootGroup");
386

Jan Möbius's avatar
 
Jan Möbius committed
387
388
389
390
  // Go over one level of the groups
  while ( rootGroup.size() > 0 ) {
    QString current = rootGroup[0];
    rootGroup.removeFirst();
391

Jan Möbius's avatar
 
Jan Möbius committed
392
393
    QStringList groupChildren;
    QStringList elementChildren;
394

Jan Möbius's avatar
 
Jan Möbius committed
395
396
    _ini.get_entry(elementChildren ,current,"children");
    _ini.get_entry(groupChildren ,current,"subgroups");
397

Jan Möbius's avatar
 
Jan Möbius committed
398
399
400
401
402
403
    // if we get a parent item, scan the tree for it or use the root node otherwise
    BaseObject* parentItem;
    QString parentName;
    if ( _ini.get_entry(parentName,current,"parent") ) {
      parentItem = PluginFunctions::objectRoot()->childExists(parentName);
      if ( parentItem == 0 )
404
405
406
407
408
409
        parentItem = PluginFunctions::objectRoot();
    } else
      parentItem = PluginFunctions::objectRoot();

    rootGroup << groupChildren;

Jan Möbius's avatar
 
Jan Möbius committed
410
411
    // check if this group already exists
    BaseObject* group =  PluginFunctions::objectRoot()->childExists( current );
412

Jan Möbius's avatar
 
Jan Möbius committed
413
414
    // group does not exist
    if ( !group ) {
415

Jan Möbius's avatar
 
Jan Möbius committed
416
      group = dynamic_cast< BaseObject* >( new GroupObject( current, dynamic_cast< GroupObject* >(parentItem ) ) );
417

Jan Möbius's avatar
 
Jan Möbius committed
418
419
420
      parentItem->appendChild(group);
      group->setParent(parentItem);
    }
421

Jan Möbius's avatar
 
Jan Möbius committed
422
423
424
425
426
427
428
429
430
431
    // process children
    for ( int i = 0 ; i < elementChildren.size() ; ++i ) {
      BaseObject* childItem =  PluginFunctions::objectRoot()->childExists( elementChildren[i] );
      if ( childItem ) {
        childItem->parent()->removeChild(childItem);
        childItem->setParent(group);
        group->appendChild(childItem);
      }
    }
  }
432
433

  emit updated_objects(-1);
Jan Möbius's avatar
 
Jan Möbius committed
434
435
436
}

void DataControlPlugin::saveIniFileOptions( INIFile& _ini ) {
437
438
439
  if ( !_ini.section_exists( "Groups" ) )
    _ini.add_section("Groups");

Jan Möbius's avatar
 
Jan Möbius committed
440
441
  std::queue< BaseObject* > children;
  children.push( PluginFunctions::objectRoot() );
442

Jan Möbius's avatar
 
Jan Möbius committed
443
  std::vector< BaseObject* > groups;
444

Jan Möbius's avatar
 
Jan Möbius committed
445
446
447
448
  // Get all groups from the tree
  while ( children.size() > 0 ) {
    BaseObject* item = children.front();
    children.pop();
449
450
451
452
453

    for ( int i = 0 ; i < item->childCount(); ++i )
      if ( item->child(i)->dataType(DATA_GROUP))
        children.push( item->child(i) );

Jan Möbius's avatar
 
Jan Möbius committed
454
455
456
    if ( item->dataType(DATA_GROUP) && (item != PluginFunctions::objectRoot() ) )
      groups.push_back(item);
  }
457

Jan Möbius's avatar
 
Jan Möbius committed
458
459
  // Names of all groups
  QStringList groupNames;
460

Jan Möbius's avatar
 
Jan Möbius committed
461
462
  // names of the primary groups
  QStringList rootGroup;
463

Jan Möbius's avatar
 
Jan Möbius committed
464
  for ( uint i = 0 ; i < groups.size() ; ++i ) {
465
466
467
468
469
    groupNames.push_back( groups[i]->name() );

    if ( !_ini.section_exists( groups[i]->name() ) )
      _ini.add_section(groups[i]->name());

Jan Möbius's avatar
 
Jan Möbius committed
470
    _ini.add_entry(groups[i]->name(),"groupname",groups[i]->name());
471
472

    // write the name of the parent
Jan Möbius's avatar
 
Jan Möbius committed
473
474
    if ( ( groups[i]->parent() != 0 ) && ( groups[i]->parent() != PluginFunctions::objectRoot() ) )
      _ini.add_entry(groups[i]->name(),"parent",groups[i]->parent()->name());
475

Jan Möbius's avatar
 
Jan Möbius committed
476
477
    if ( groups[i]->parent() == PluginFunctions::objectRoot() )
      rootGroup.push_back( groups[i]->name() );
478

Jan Möbius's avatar
 
Jan Möbius committed
479
480
481
482
483
484
485
486
487
    // Write a list of this groups children
    QStringList groupchildren;
    QStringList elementchildren;
    for ( int j = 0 ; j < groups[i]->childCount(); ++j ) {
      if  ( groups[i]->child(j)->dataType(DATA_GROUP) )
        groupchildren.push_back( groups[i]->child(j)->name() );
      else
        elementchildren.push_back( groups[i]->child(j)->name() );
    }
488

Jan Möbius's avatar
 
Jan Möbius committed
489
490
491
    _ini.add_entry(groups[i]->name(),"subgroups",groupchildren);
    _ini.add_entry(groups[i]->name(),"children",elementchildren);
  }
492

Jan Möbius's avatar
 
Jan Möbius committed
493
494
  // Write the list of group names to the file
  _ini.add_entry("Groups","groups",groupNames);
495

Jan Möbius's avatar
 
Jan Möbius committed
496
497
498
499
500
501
502
  // Write the primary group names to the file
  _ini.add_entry("Groups","rootGroup",rootGroup);
}


Q_EXPORT_PLUGIN2( datacontrolplugin , DataControlPlugin );