COPASI API  4.16.103
CQOscillationTaskWidget.cpp
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/UI/CQOscillationTaskWidget.cpp,v $
3 // $Revision: 1.2 $
4 // $Name: $
5 // $Author: shoops $
6 // $Date: 2011/09/16 18:13:46 $
7 // End CVS Header
8 
9 // Copyright (C) 2011 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., University of Heidelberg, and The University
11 // of Manchester.
12 // All rights reserved.
13 
14 /*
15  * Created by Paul Willy on 08/05/11.
16  */
17 
18 #include "copasi.h"
19 
21 #include "listviews.h"
22 #include "CQTaskBtnWidget.h"
23 #include "CQTaskHeaderWidget.h"
24 /*
25 #include "crosssection/CCrossSectionTask.h"
26 #include "crosssection/CCrossSectionProblem.h"
27 #include "crosssection/CCrossSectionMethod.h"
28 */
29 /*
30  * Constructs a CQCrossSectionWidget which is a child of 'parent', with the
31  * name 'name'.'
32  */
33 CQOscillationTaskWidget::CQOscillationTaskWidget(QWidget* parent, const char* name)
34  : TaskWidget(parent, name)
35 {
36  setupUi(this);
37 
38  init();
39 }
40 
41 /*
42  * Destroys the object and frees any allocated resources
43  */
45 {
46  destroy();
47  // no need to delete child widgets, Qt does it all for us
48 }
49 
51 {
52  mpHeaderWidget->setTaskName("Oscillation");
53 
54  oscillationTWLayout->insertWidget(0, mpHeaderWidget); // header
55  // crossSectionTWLayout->insertSpacing(1, 14); // space between header and body
56  oscillationTWLayout->addWidget(mpBtnWidget); // 'footer'
57 
58 // addMethodParameterTable(0);
59 }
60 
62 {
63  return true;
64 }
65 
66 bool CQOscillationTaskWidget::update(ListViews::ObjectType /* objectType */, ListViews::Action /* action */, const std::string & /* key */)
67 {
68  return true;
69 }
70 
71 /*
72  * Function to save actual changes of the Task
73  */
75 {
76  /*
77  // check the existence of Task
78  CCrossSectionTask * pTask =
79  dynamic_cast< CCrossSectionTask * >(mpTask);
80 
81  if (!pTask) return false;
82 
83  // save functions from the Parent, TaskWidget
84  saveCommon();
85  saveMethod();
86 
87  // check the existence of Problem
88  CCrossSectionProblem* pProblem =
89  dynamic_cast<CCrossSectionProblem *>(pTask->getProblem());
90  assert(pProblem);
91 
92  // save the actual changes
93 
94  if (mpCheckLC->isChecked())
95  pProblem->setCrossingsLimit(mpLineEditLC->text().toDouble());
96 
97  if (mpCheckLT->isChecked())
98  pProblem->setTimeLimit(mpLineEditLT->text().toDouble());
99 
100  if (mpCheck->isChecked())
101  pProblem->setOutputStartTime(mpLineEdit->text().toDouble());
102  */
103  return true;
104 }
105 
106 /*
107  * Function to load saved values of the Task
108  */
110 {
111  /*
112  // load Task
113  CCrossSectionTask * pTask =
114  dynamic_cast< CCrossSectionTask * >(mpTask);
115 
116  if (!pTask) return false;
117 
118  // load functions from the Parent, TaskWidget
119  loadCommon();
120  loadMethod();
121 
122  // load Problem
123  CCrossSectionProblem* pProblem =
124  dynamic_cast<CCrossSectionProblem *>(pTask->getProblem());
125  assert(pProblem);
126 
127  CCrossSectionMethod* pMethod =
128  dynamic_cast<CCrossSectionMethod *>(pTask->getMethod());
129  assert(pMethod);
130 
131  // load the saved values
132 
133  mpCheckLC->setChecked(pProblem->getFlagLimitCrossings());
134  mpLineEditLC->setEnabled(pProblem->getFlagLimitCrossings());
135 
136  if (pProblem->getFlagLimitCrossings())
137  mpLineEditLC->setText(QString::number(pProblem->getCrossingsLimit()));
138  else
139  mpLineEditLC->setText("");
140 
141  mpCheckLT->setChecked(pProblem->getFlagLimitTime());
142  mpLineEditLT->setEnabled(pProblem->getFlagLimitTime());
143 
144  if (pProblem->getFlagLimitTime())
145  mpLineEditLT->setText(QString::number(pProblem->getTimeLimit()));
146  else
147  mpLineEditLT->setText("");
148 
149  if (pProblem->getOutputStartTime() > 0.0)
150  {
151  mpCheck->setChecked(true);
152  mpLineEdit->setEnabled(true);
153  mpLineEdit->setText(QString::number(pProblem->getOutputStartTime()));
154  }
155  else
156  {
157  mpCheck->setChecked(false);
158  mpLineEdit->setEnabled(false);
159  mpLineEdit->setText("");
160  }
161  */
162  return true;
163 }
164 
166 {
167  return NULL;
168 }
virtual CCopasiMethod * createMethod(const CCopasiMethod::SubType &type)
virtual bool update(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key)
bool setTaskName(const std::string &name)
CQOscillationTaskWidget(QWidget *parent=0, const char *name=0)
CQTaskBtnWidget * mpBtnWidget
Definition: TaskWidget.h:124
CQTaskHeaderWidget * mpHeaderWidget
Definition: TaskWidget.h:122