COPASI API  4.16.103
CScanWidgetTask.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 // Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
7 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
8 // and The University of Manchester.
9 // All rights reserved.
10 
11 // Copyright (C) 2005 - 2007 by Pedro Mendes, Virginia Tech Intellectual
12 // Properties, Inc. and EML Research, gGmbH.
13 // All rights reserved.
14 
15 #include <QtGui/QValidator>
16 
17 #include <iostream>
18 
19 #include "CScanWidgetTask.h"
20 #include "CCopasiSelectionDialog.h"
21 
22 #include "copasi.h"
23 
26 #include "scan/CScanProblem.h"
27 
28 /*
29  * Constructs a CScanWidgetTask as a child of 'parent', with the
30  * name 'name' and widget flags set to 'f'.
31  */
32 CScanWidgetTask::CScanWidgetTask(QWidget* parent, const char* name, Qt::WindowFlags f):
33  QWidget(parent, f),
34  mpObject(NULL),
35  mpModel(NULL)
36 
37 {
38  setObjectName(QString::fromUtf8(name));
39  setupUi(this);
40 }
41 
42 /*
43  * Destroys the object and frees any allocated resources
44  */
46 {
47  // no need to delete child widgets, Qt does it all for us
48 }
49 
51 {}
52 
53 // virtual
55 {
56  CCopasiTask::Type type = pg->getSubtask();
57  int n;
58 
59  switch (type)
60  {
62  n = 0;
63  break;
64 
66  n = 1;
67  break;
68 
69  case CCopasiTask::mca:
70  n = 2;
71  break;
72 
73  case CCopasiTask::lyap:
74  n = 3;
75  break;
76 
78  n = 4;
79  break;
80 
82  n = 5;
83  break;
84 
85  case CCopasiTask::sens:
86  n = 6;
87  break;
88 
89  case CCopasiTask::lna:
90  n = 7;
91  break;
92 
94  n = 8;
95  break;
96 
98  n = 9;
99  break;
100 
101  default:
102  n = 0;
103  break;
104  }
105 
106  comboType->setCurrentIndex(n);
107 
108  mpCheckContinue->setChecked(pg->getContinueFromCurrentState());
109 
110  checkOutput->setChecked(pg->getOutputInSubtask());
111 
112  return;
113 }
114 
115 // virtual
117 {
118  bool changed = false;
119  int type = comboType->currentIndex();
120 
121  CCopasiTask::Type Type;
122 
123  switch (type)
124  {
125  case 0:
127  break;
128 
129  case 1:
131  break;
132 
133  case 2:
134  Type = CCopasiTask::mca;
135  break;
136 
137  case 3:
138  Type = CCopasiTask::lyap;
139  break;
140 
141  case 4:
143  break;
144 
145  case 5:
147  break;
148 
149  case 6:
150  Type = CCopasiTask::sens;
151  break;
152 
153  case 7:
154  Type = CCopasiTask::lna;
155  break;
156 
157  case 8:
159  break;
160 
161  case 9:
163  break;
164 
165  default :
167  break;
168  }
169 
170  if (Type != pg->getSubtask())
171  {
172  pg->setSubtask(Type);
173  changed = true;
174  }
175 
176  if (pg->getContinueFromCurrentState() != mpCheckContinue->isChecked())
177  {
178  pg->setContinueFromCurrentState(mpCheckContinue->isChecked());
179  changed = true;
180  }
181 
182  if (pg->getOutputInSubtask() != checkOutput->isChecked())
183  {
184  pg->setOutputInSubtask(checkOutput->isChecked());
185  changed = true;
186  }
187 
188  return changed;
189 }
190 
192 {
193  switch (n)
194  {
195  case 1:
196  case 8:
197  checkOutput->setChecked(true);
198  break;
199 
200  default:
201  checkOutput->setChecked(false);
202  break;
203  }
204 }
void setSubtask(CCopasiTask::Type type)
virtual void typeChanged(int n)
virtual void load(const CScanProblem *pg)
void setContinueFromCurrentState(bool aic)
bool getContinueFromCurrentState() const
void setOutputInSubtask(bool ois)
CScanWidgetTask(QWidget *parent=0, const char *name=0, Qt::WindowFlags fl=0)
const bool & getOutputInSubtask() const
CCopasiTask::Type getSubtask() const
virtual bool save(CScanProblem *pg) const