COPASI API  4.16.103
CQAnimationSettingsEditor.cpp
Go to the documentation of this file.
1 // Copyright (C) 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
9 
10 CQAnimationSettingsEditor::CQAnimationSettingsEditor(QWidget *parent, Qt::WindowFlags f)
11  : QDialog(parent, f)
12 {
13  setupUi(this);
14 }
15 
17 {
18 }
19 
21 {
22 }
23 
25 {
26 }
27 
29 {
30 }
31 
33 {
34  // go through last selection to save changes
35  for (int i = 0; i < mLastSelection.size(); ++i)
36  {
37  QListWidgetItem* current = mLastSelection[i];
38  int index = current->data(Qt::UserRole).toInt();
39  widget->saveTo(mEntries[index], mLastSelection.size() > 1);
40  }
41 }
42 
44 {
45  saveChanges();
46 
47  // fill with new entries
48  QList<QListWidgetItem*> selected = listWidget->selectedItems();
49 
50  for (int i = 0; i < selected.size(); ++i)
51  {
52  QListWidgetItem* current = selected[i];
53  int index = current->data(Qt::UserRole).toInt();
54  widget->initFrom(mEntries[index], selected.size() > 1);
55  }
56 
57  mLastSelection = selected;
58 }
59 
61 {
63  radGlobal->setChecked(true);
64  else
65  radIndividual->setChecked(true);
66 
67  std::vector<CQEffectDescription*> entries = other->getEntries();
68  std::vector<CQEffectDescription*>::iterator it = entries.begin();
69  mEntries.clear();
70 
71  while (it != entries.end())
72  {
73  CQEffectDescription* current = *it;
74 
75  QListWidgetItem* item = new QListWidgetItem(current->getCN().c_str());
76  item->setData(Qt::UserRole, (int)mEntries.size());
77  listWidget->addItem(item);
78  mEntries.push_back(current);
79 
80  ++it;
81  }
82 }
83 
85 {
86  saveChanges();
87 
88  if (radGlobal->isChecked())
90  else
92 }
ScaleMode getScaleMode() const
const std::string & getCN() const
void setScaleMode(ScaleMode mode)
std::vector< CQEffectDescription * > & getEntries()
CQAnimationSettingsEditor(QWidget *parent=0, Qt::WindowFlags f=0)
QList< QListWidgetItem * > mLastSelection
void saveTo(CQCopasiAnimation *target)
std::vector< CQEffectDescription * > mEntries
void initFrom(CQCopasiAnimation *other)