COPASI API  4.16.103
Public Slots | Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
CQMCAWidget Class Reference

#include <CQMCAWidget.h>

Inheritance diagram for CQMCAWidget:
Inheritance graph
[legend]
Collaboration diagram for CQMCAWidget:
Collaboration graph
[legend]

Public Slots

virtual void slotSteadyStateChecked ()
 
- Public Slots inherited from TaskWidget
void adjustTable ()
 
void slotFinishThread ()
 

Public Member Functions

 CQMCAWidget (QWidget *parent=0, const char *name=0)
 
virtual bool runTask ()
 
 ~CQMCAWidget ()
 
- Public Member Functions inherited from TaskWidget
CCopasiTaskgetTask ()
 
virtual bool leave ()
 
 TaskWidget (QWidget *parent=0, const char *name=0, Qt::WFlags fl=0)
 
virtual bool update (ListViews::ObjectType objectType, ListViews::Action action, const std::string &key)
 
 ~TaskWidget ()
 
- Public Member Functions inherited from CopasiWidget
 CopasiWidget (QWidget *parent=0, const char *name=0, Qt::WFlags f=0)
 
bool enter (const std::string &key)
 
CCopasiDataModelgetDataModel ()
 
bool getIgnoreUpdates ()
 
virtual void setFramework (int framework)
 
void setIgnoreUpdates (bool v)
 

Protected Member Functions

virtual CCopasiMethodcreateMethod (const CCopasiMethod::SubType &type)
 
virtual bool loadTask ()
 
virtual bool saveTask ()
 
virtual bool taskFinishedEvent ()
 
- Protected Member Functions inherited from TaskWidget
bool commonAfterRunTask ()
 
bool commonBeforeRunTask ()
 
bool commonRunTask ()
 
virtual bool enterProtected ()
 
void finishTask ()
 
bool loadCommon ()
 
bool loadMethod ()
 
bool saveCommon ()
 
bool saveMethod ()
 

Private Member Functions

void init ()
 
bool loadParameterTable ()
 
bool saveParameterTable ()
 

Additional Inherited Members

- Protected Slots inherited from TaskWidget
void assistantBtnClicked ()
 
void reportBtnClicked ()
 
void revertBtnClicked ()
 
void runBtnClicked ()
 
- Protected Slots inherited from CopasiWidget
virtual bool protectedNotify (ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
 
- Protected Attributes inherited from TaskWidget
bool mChanged
 
CQTaskBtnWidgetmpBtnWidget
 
CQTaskHeaderWidgetmpHeaderWidget
 
CCopasiMethodmpMethod
 
QGridLayout * mpMethodLayout
 
CQTaskMethodWidgetmpMethodWidget
 
CProgressBarmProgressBar
 
QSpacerItem * mpSpacer1
 
QSpacerItem * mpSpacer2
 
CCopasiTaskmpTask
 
CQTaskThreadmpTaskThread
 
- Protected Attributes inherited from CopasiWidget
int mFramework
 
bool mIgnoreUpdates
 
std::string mKey
 
CCopasiDataModelmpDataModel
 
ListViewsmpListView
 
CCopasiObjectmpObject
 

Detailed Description

Definition at line 26 of file CQMCAWidget.h.

Constructor & Destructor Documentation

CQMCAWidget::CQMCAWidget ( QWidget *  parent = 0,
const char *  name = 0 
)

Definition at line 41 of file CQMCAWidget.cpp.

References init().

42  : TaskWidget(parent, name)
43 {
44  setupUi(this);
45 
46  init();
47 }
TaskWidget(QWidget *parent=0, const char *name=0, Qt::WFlags fl=0)
Definition: TaskWidget.cpp:52
CQMCAWidget::~CQMCAWidget ( )

Definition at line 52 of file CQMCAWidget.cpp.

53 {
54  // no need to delete child widgets, Qt does it all for us
55 }

Member Function Documentation

CCopasiMethod * CQMCAWidget::createMethod ( const CCopasiMethod::SubType type)
protectedvirtual

Implements TaskWidget.

Definition at line 89 of file CQMCAWidget.cpp.

90 {return new CMCAMethod;}
void CQMCAWidget::init ( )
private

Definition at line 146 of file CQMCAWidget.cpp.

References TaskWidget::mpBtnWidget, TaskWidget::mpHeaderWidget, TaskWidget::mpMethodWidget, CQTaskHeaderWidget::setTaskName(), and CQTaskMethodWidget::showMethodParameters().

Referenced by CQMCAWidget(), and loadParameterTable().

147 {
148  mpHeaderWidget->setTaskName("Metabolic Control Analysis");
149  mpHeaderWidget->mpUpdateModel->hide();
150 
151  vboxLayout->insertWidget(0, mpHeaderWidget); // header
152  // vboxLayout->insertSpacing(1, 14); // space between header and body
153 
155  vboxLayout->addWidget(mpMethodWidget);
156 
157  vboxLayout->addWidget(mpBtnWidget); // 'footer'
158 }
bool setTaskName(const std::string &name)
void showMethodParameters(const bool &show)
CQTaskMethodWidget * mpMethodWidget
Definition: TaskWidget.h:123
CQTaskBtnWidget * mpBtnWidget
Definition: TaskWidget.h:124
CQTaskHeaderWidget * mpHeaderWidget
Definition: TaskWidget.h:122
bool CQMCAWidget::loadParameterTable ( )
private

Definition at line 160 of file CQMCAWidget.cpp.

References FROM_UTF8, CCopasiRootContainer::getDatamodelList(), CCopasiTask::getMethod(), CCopasiParameterGroup::getName(), getParameterValue(), init(), TaskWidget::mpMethod, TaskWidget::mpMethodWidget, and CCopasiParameterGroup::size().

Referenced by loadTask(), and slotSteadyStateChecked().

161 {
162 
163  bool init = (mpMethodWidget->mpTableParameter->rowCount() == 0);
164 
165  size_t NumRows = mpMethod->size();
166  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
167 
168  if (mpCheckSteadyState->isChecked())
169  {
170  CSteadyStateTask * pSteadyStateTask =
171  dynamic_cast<CSteadyStateTask *>((*(*CCopasiRootContainer::getDatamodelList())[0]->getTaskList())["Steady-State"]);
172 
173  if (!pSteadyStateTask) return false;
174 
175  NumRows += pSteadyStateTask->getMethod()->size();
176  }
177 
178  mpMethodWidget->mpTableParameter->setRowCount((int) NumRows);
179 
180  size_t i, k;
182  QString value;
183 
184  for (i = 0; i < mpMethod->size() && init; i++)
185  {
186  mpMethodWidget->mpTableParameter->setVerticalHeaderItem((int) i, new QTableWidgetItem());
187  mpMethodWidget->mpTableParameter->verticalHeaderItem((int) i)->setText(FROM_UTF8(mpMethod->getName(i)));
188 
189  value = getParameterValue(mpMethod, i, &Type);
190  QTableWidgetItem *itemValue = new QTableWidgetItem(value);
191  itemValue->setTextAlignment(Qt::AlignRight);
192  mpMethodWidget->mpTableParameter->setItem((int) i, 0, itemValue);
193  }
194 
195  if (mpCheckSteadyState->isChecked())
196  {
197  CSteadyStateTask * pSteadyStateTask =
198  dynamic_cast<CSteadyStateTask *>((*(*CCopasiRootContainer::getDatamodelList())[0]->getTaskList())["Steady-State"]);
199 
200  if (!pSteadyStateTask) return false;
201 
202  CCopasiMethod * pMethod = pSteadyStateTask->getMethod();
203 
204  for (i = mpMethod->size(), k = 0; k < pMethod->size(); k++, i++)
205  {
206  // create item of the current row and give it a name
207  mpMethodWidget->mpTableParameter->setVerticalHeaderItem((int) i, new QTableWidgetItem());
208  mpMethodWidget->mpTableParameter->verticalHeaderItem((int) i)->setText(FROM_UTF8(pMethod->getName(k)));
209 
210  value = getParameterValue(pMethod, k, &Type);
211  QTableWidgetItem *itemValue = new QTableWidgetItem(value);
212  itemValue->setTextAlignment(Qt::AlignRight);
213  mpMethodWidget->mpTableParameter->setItem((int) i, 0, itemValue);
214  }
215  }
216 
217  // the table will be automatically adjusted -> 31.10.09
218 
219  return true;
220 }
virtual const std::string & getName(const size_t &index) const
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
QString getParameterValue(const CCopasiParameterGroup *group, const size_t &index, CCopasiParameter::Type *type)
Definition: qtUtilities.cpp:28
CQTaskMethodWidget * mpMethodWidget
Definition: TaskWidget.h:123
CCopasiMethod * getMethod()
CCopasiMethod * mpMethod
Definition: TaskWidget.h:131
bool CQMCAWidget::loadTask ( )
protectedvirtual

Implements TaskWidget.

Definition at line 92 of file CQMCAWidget.cpp.

References CCopasiTask::getProblem(), CMCAProblem::isSteadyStateRequested(), TaskWidget::loadCommon(), loadParameterTable(), TaskWidget::mChanged, TaskWidget::mpTask, and pTask.

93 {
94  CMCATask * pTask = dynamic_cast< CMCATask * >(mpTask);
95 
96  if (!pTask) return false;
97 
98  loadCommon();
99 // loadMethod(); --> we cannot do that because of different structure -- 08.04.09
100 
101  CMCAProblem * pProblem =
102  dynamic_cast< CMCAProblem * >(mpTask->getProblem());
103 
104  if (!pProblem) return false;
105 
106  // instead calling loadMethod(), the following codes is used
107  mpCheckSteadyState->setChecked(pProblem->isSteadyStateRequested());
108 
109  bool success = loadParameterTable();
110 
111  mChanged = false;
112 
113  return success;
114 }
CCopasiProblem * getProblem()
bool loadCommon()
Definition: TaskWidget.cpp:247
bool mChanged
Definition: TaskWidget.h:133
CTSSATask * pTask
bool isSteadyStateRequested() const
CCopasiTask * mpTask
Definition: TaskWidget.h:130
bool loadParameterTable()
bool CQMCAWidget::runTask ( )
virtual

Implements TaskWidget.

Definition at line 62 of file CQMCAWidget.cpp.

References TaskWidget::commonBeforeRunTask(), TaskWidget::commonRunTask(), CKeyFactory::get(), CCopasiRootContainer::getKeyFactory(), CopasiWidget::mKey, and pTask.

Referenced by SliderDialog::runMCATask().

63 {
64  CMCATask * pTask =
66 
67  if (!pTask) return false;
68 
69  if (!commonBeforeRunTask()) return false;
70 
71  bool success = commonRunTask();
72 
73  return success;
74 }
CCopasiObject * get(const std::string &key)
CTSSATask * pTask
static CKeyFactory * getKeyFactory()
bool commonRunTask()
Definition: TaskWidget.cpp:395
bool commonBeforeRunTask()
Definition: TaskWidget.cpp:317
std::string mKey
Definition: copasiWidget.h:63
bool CQMCAWidget::saveParameterTable ( )
private

Definition at line 222 of file CQMCAWidget.cpp.

References CCopasiRootContainer::getDatamodelList(), CCopasiTask::getMethod(), getParameterValue(), TaskWidget::mChanged, TaskWidget::mpMethod, TaskWidget::mpMethodWidget, setParameterValue(), and CCopasiParameterGroup::size().

Referenced by saveTask().

223 {
224  size_t i, k;
225  QString value;
227 
228  for (i = 0; i < mpMethod->size(); i++)
229  {
230  value = mpMethodWidget->mpTableParameter->item((int) i, 0)->text();
231 
232  if (value != getParameterValue(mpMethod, i, &Type))
233  {
234  setParameterValue(mpMethod, i, value);
235  mChanged = true;
236  }
237  }
238 
239  if (mpCheckSteadyState->isChecked())
240  {
241  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
242  CSteadyStateTask * pSteadyStateTask =
243  dynamic_cast<CSteadyStateTask *>((*(*CCopasiRootContainer::getDatamodelList())[0]->getTaskList())["Steady-State"]);
244 
245  if (!pSteadyStateTask) return false;
246 
247  CCopasiMethod * pMethod = pSteadyStateTask->getMethod();
248 
249  for (i = mpMethod->size(), k = 0; k < pMethod->size(); i++, k++)
250  {
251  value = mpMethodWidget->mpTableParameter->item((int) i, 0)->text();
252 
253  if (value != getParameterValue(pMethod, k, &Type))
254  {
255  setParameterValue(pMethod, k, value);
256  mChanged = true;
257  }
258  }
259  }
260 
261  return true;
262 }
bool setParameterValue(CCopasiParameterGroup *group, const size_t &index, const QString &value)
Definition: qtUtilities.cpp:94
bool mChanged
Definition: TaskWidget.h:133
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
QString getParameterValue(const CCopasiParameterGroup *group, const size_t &index, CCopasiParameter::Type *type)
Definition: qtUtilities.cpp:28
CQTaskMethodWidget * mpMethodWidget
Definition: TaskWidget.h:123
CCopasiMethod * getMethod()
CCopasiMethod * mpMethod
Definition: TaskWidget.h:131
bool CQMCAWidget::saveTask ( )
protectedvirtual

Implements TaskWidget.

Definition at line 116 of file CQMCAWidget.cpp.

References CCopasiRootContainer::getDatamodelList(), CCopasiTask::getProblem(), CMCAProblem::isSteadyStateRequested(), TaskWidget::mChanged, TaskWidget::mpTask, pTask, TaskWidget::saveCommon(), saveParameterTable(), and CMCAProblem::setSteadyStateRequested().

117 {
118  CMCATask * pTask = dynamic_cast< CMCATask * >(mpTask);
119 
120  if (!pTask) return false;
121 
122  saveCommon();
123  // saveMethod();
124 
125  CMCAProblem * pProblem =
126  dynamic_cast< CMCAProblem * >(mpTask->getProblem());
127 
128  if (!pProblem) return false;
129 
130  if (mpCheckSteadyState->isChecked() != pProblem->isSteadyStateRequested())
131  {
132  pProblem->setSteadyStateRequested(mpCheckSteadyState->isChecked());
133  mChanged = true;
134  }
135 
136  bool success = saveParameterTable();
137 
138  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
139 
140  if (mChanged)(*CCopasiRootContainer::getDatamodelList())[0]->changed();
141 
142  mChanged = false;
143  return success;
144 }
CCopasiProblem * getProblem()
void setSteadyStateRequested(const bool &steadyStateRequested)
bool saveCommon()
Definition: TaskWidget.cpp:258
bool mChanged
Definition: TaskWidget.h:133
CTSSATask * pTask
bool isSteadyStateRequested() const
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
bool saveParameterTable()
CCopasiTask * mpTask
Definition: TaskWidget.h:130
void CQMCAWidget::slotSteadyStateChecked ( )
virtualslot

Definition at line 57 of file CQMCAWidget.cpp.

References loadParameterTable().

58 {
60 }
bool loadParameterTable()
bool CQMCAWidget::taskFinishedEvent ( )
protectedvirtual

Reimplemented from TaskWidget.

Definition at line 76 of file CQMCAWidget.cpp.

References ListViews::findWidgetFromId(), CMCAResultWidget::loadFromBackend(), CopasiWidget::mpListView, pResult, and ListViews::switchToOtherWidget().

77 {
78  bool success = true;
80 
81  if (pResult) pResult->loadFromBackend();
82 
83  if (success && pResult)
84  mpListView->switchToOtherWidget(241, ""); //change to the results window
85 
86  return success;
87 }
void switchToOtherWidget(const size_t &id, const std::string &key)
Definition: listviews.cpp:926
CopasiWidget * findWidgetFromId(const size_t &id) const
Definition: listviews.cpp:678
ListViews * mpListView
Definition: copasiWidget.h:62
const CArrayAnnotation * pResult

The documentation for this class was generated from the following files: