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

#include <CQTSSAWidget.h>

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

Public Slots

void slotDuration ()
 
void slotIntervals ()
 
void slotIntervalSize ()
 
- Public Slots inherited from TaskWidget
void adjustTable ()
 
void slotFinishThread ()
 

Public Member Functions

 CQTSSAWidget (QWidget *parent=0, const char *name=0)
 
virtual bool runTask ()
 
 ~CQTSSAWidget ()
 
- 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 destroy ()
 
void init ()
 

Private Attributes

CTSSAProblemmpTSSAProblem
 
CQValidatorDoublempValidatorDelay
 
CQValidatorDoublempValidatorDuration
 
CQValidatorIntmpValidatorIntervals
 
CQValidatorDoublempValidatorIntervalSize
 

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 32 of file CQTSSAWidget.h.

Constructor & Destructor Documentation

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

Definition at line 47 of file CQTSSAWidget.cpp.

References init().

48  : TaskWidget(parent, name)
49 {
50  setupUi(this);
51 
52  init();
53 }
TaskWidget(QWidget *parent=0, const char *name=0, Qt::WFlags fl=0)
Definition: TaskWidget.cpp:52
CQTSSAWidget::~CQTSSAWidget ( )

Definition at line 58 of file CQTSSAWidget.cpp.

References destroy().

59 {
60  destroy();
61  // no need to delete child widgets, Qt does it all for us
62 }

Member Function Documentation

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

Implements TaskWidget.

Definition at line 226 of file CQTSSAWidget.cpp.

References CTSSAMethod::createMethod().

227 {
228  return CTSSAMethod::createMethod(type);
229 }
static CTSSAMethod * createMethod(CCopasiMethod::SubType subType=CCopasiMethod::unset)
Definition: CTSSAMethod.cpp:44
void CQTSSAWidget::destroy ( )
private

Definition at line 98 of file CQTSSAWidget.cpp.

References mpTSSAProblem, and pdelete.

Referenced by ~CQTSSAWidget().

99 {
101 }
#define pdelete(p)
Definition: copasi.h:215
CTSSAProblem * mpTSSAProblem
Definition: CQTSSAWidget.h:57
void CQTSSAWidget::init ( )
private

Definition at line 75 of file CQTSSAWidget.cpp.

References max, TaskWidget::mpBtnWidget, TaskWidget::mpHeaderWidget, TaskWidget::mpMethodWidget, mpTSSAProblem, mpValidatorDuration, mpValidatorIntervalSize, CQValidatorDouble::setRange(), CQTaskHeaderWidget::setTaskName(), CQTaskMethodWidget::setValidMethods(), CQTaskMethodWidget::showMethodParameters(), and CTSSATask::ValidMethods.

Referenced by CQTSSAWidget().

76 {
77  mpTSSAProblem = NULL;
78 
79  mpHeaderWidget->setTaskName("Time Scale Separation Analysis");
80 
81  vboxLayout->insertWidget(0, mpHeaderWidget); // header
82  // vboxLayout->insertSpacing(1, 14); // space between header and body
83 
86  vboxLayout->addWidget(mpMethodWidget);
87 
88  vboxLayout->addWidget(mpBtnWidget); // 'footer'
89 
90  mpValidatorDuration = new CQValidatorDouble(mpEditDuration);
91  mpEditDuration->setValidator(mpValidatorDuration);
92 
93  mpValidatorIntervalSize = new CQValidatorDouble(mpEditIntervalSize);
95  mpEditIntervalSize->setValidator(mpValidatorIntervalSize);
96 }
CQValidatorDouble * mpValidatorIntervalSize
Definition: CQTSSAWidget.h:59
bool setTaskName(const std::string &name)
void showMethodParameters(const bool &show)
CQTaskMethodWidget * mpMethodWidget
Definition: TaskWidget.h:123
static const unsigned int ValidMethods[]
Definition: CTSSATask.h:50
CQTaskBtnWidget * mpBtnWidget
Definition: TaskWidget.h:124
CQTaskHeaderWidget * mpHeaderWidget
Definition: TaskWidget.h:122
void setRange(const C_FLOAT64 &lowerBound, const C_FLOAT64 &upperBound)
Definition: CQValidator.cpp:80
CQValidatorDouble * mpValidatorDuration
Definition: CQTSSAWidget.h:58
CTSSAProblem * mpTSSAProblem
Definition: CQTSSAWidget.h:57
void setValidMethods(const unsigned int *validMethods)
#define max(a, b)
Definition: f2c.h:176
bool CQTSSAWidget::loadTask ( )
protectedvirtual

Implements TaskWidget.

Definition at line 197 of file CQTSSAWidget.cpp.

References CTSSAProblem::getDuration(), CCopasiTask::getProblem(), CTSSAProblem::getStepNumber(), CTSSAProblem::getStepSize(), TaskWidget::loadCommon(), TaskWidget::loadMethod(), TaskWidget::mpTask, mpTSSAProblem, mpValidatorDuration, mpValidatorIntervalSize, pdelete, pTask, and CQValidator< Type >::saved().

198 {
199  CTSSATask * pTask =
200  dynamic_cast< CTSSATask * >(mpTask);
201 
202  if (!pTask) return false;
203 
204  loadCommon();
205  loadMethod();
206 
207  CTSSAProblem* tssaproblem =
208  dynamic_cast<CTSSAProblem *>(pTask->getProblem());
209  assert(tssaproblem);
210 
212  mpTSSAProblem = new CTSSAProblem(*tssaproblem);
213 
214  //numbers
215  mpEditIntervalSize->setText(QString::number(tssaproblem->getStepSize()));
216  mpEditIntervals->setText(QString::number(tssaproblem->getStepNumber()));
217  mpEditDuration->setText(QString::number(tssaproblem->getDuration()));
218 
219 
222 
223  return true;
224 }
#define pdelete(p)
Definition: copasi.h:215
CQValidatorDouble * mpValidatorIntervalSize
Definition: CQTSSAWidget.h:59
CCopasiProblem * getProblem()
bool loadCommon()
Definition: TaskWidget.cpp:247
bool loadMethod()
Definition: TaskWidget.cpp:284
const C_FLOAT64 & getStepSize() const
CTSSATask * pTask
virtual void saved() const
Definition: CQValidator.h:71
const unsigned C_INT32 & getStepNumber() const
CCopasiTask * mpTask
Definition: TaskWidget.h:130
CQValidatorDouble * mpValidatorDuration
Definition: CQTSSAWidget.h:58
CTSSAProblem * mpTSSAProblem
Definition: CQTSSAWidget.h:57
const C_FLOAT64 & getDuration() const
bool CQTSSAWidget::runTask ( )
virtual

Implements TaskWidget.

Definition at line 231 of file CQTSSAWidget.cpp.

References TaskWidget::commonBeforeRunTask(), TaskWidget::commonRunTask(), CTSSAMethod::emptyVectors(), CCopasiRootContainer::getDatamodelList(), and CCopasiTask::getMethod().

232 {
233  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
234  pCTSSATask =
235  dynamic_cast<CTSSATask *>((*(*CCopasiRootContainer::getDatamodelList())[0]->getTaskList())["Time Scale Separation Analysis"]);
236 
237  if (!pCTSSATask) return false;
238 
239  pTSSMethod = dynamic_cast<CTSSAMethod*>(pCTSSATask->getMethod());
240 
241  if (!pTSSMethod)
243 
244  if (!commonBeforeRunTask()) return false;
245 
246  bool success = true;
247 
248  if (!commonRunTask()) success = false;
249 
250  return success;
251 }
CTSSATask * pCTSSATask
CTSSAMethod * pTSSMethod
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
CCopasiMethod * getMethod()
bool commonRunTask()
Definition: TaskWidget.cpp:395
void emptyVectors()
bool commonBeforeRunTask()
Definition: TaskWidget.cpp:317
bool CQTSSAWidget::saveTask ( )
protectedvirtual

Implements TaskWidget.

Definition at line 158 of file CQTSSAWidget.cpp.

References CTSSAProblem::getDuration(), CCopasiTask::getProblem(), CTSSAProblem::getStepNumber(), CTSSAProblem::getStepSize(), TaskWidget::mChanged, TaskWidget::mpTask, mpValidatorDuration, mpValidatorIntervalSize, pTask, TaskWidget::saveCommon(), CQValidator< Type >::saved(), TaskWidget::saveMethod(), CTSSAProblem::setDuration(), CTSSAProblem::setStepNumber(), and CTSSAProblem::setStepSize().

159 {
160  CTSSATask * pTask =
161  dynamic_cast< CTSSATask * >(mpTask);
162 
163  if (!pTask) return false;
164 
165  saveCommon();
166  saveMethod();
167 
168  CTSSAProblem* tssaproblem =
169  dynamic_cast<CTSSAProblem *>(pTask->getProblem());
170  assert(tssaproblem);
171 
172  //numbers
173  if (tssaproblem->getStepSize() != mpEditIntervalSize->text().toDouble())
174  {
175  tssaproblem->setStepSize(mpEditIntervalSize->text().toDouble());
176  mChanged = true;
177  }
178  else if (tssaproblem->getStepNumber() != mpEditIntervals->text().toULong())
179  {
180  tssaproblem->setStepNumber(mpEditIntervals->text().toLong());
181  mChanged = true;
182  }
183 
184  if (tssaproblem->getDuration() != mpEditDuration->text().toDouble())
185  {
186  tssaproblem->setDuration(mpEditDuration->text().toDouble());
187  mChanged = true;
188  }
189 
190 
193 
194  return true;
195 }
bool saveMethod()
Definition: TaskWidget.cpp:308
CQValidatorDouble * mpValidatorIntervalSize
Definition: CQTSSAWidget.h:59
CCopasiProblem * getProblem()
void setStepNumber(const unsigned C_INT32 &stepNumber)
bool saveCommon()
Definition: TaskWidget.cpp:258
bool mChanged
Definition: TaskWidget.h:133
const C_FLOAT64 & getStepSize() const
CTSSATask * pTask
virtual void saved() const
Definition: CQValidator.h:71
const unsigned C_INT32 & getStepNumber() const
CCopasiTask * mpTask
Definition: TaskWidget.h:130
void setStepSize(const C_FLOAT64 &stepSize)
void setDuration(const C_FLOAT64 &duration)
CQValidatorDouble * mpValidatorDuration
Definition: CQTSSAWidget.h:58
const C_FLOAT64 & getDuration() const
void CQTSSAWidget::slotDuration ( )
slot

Definition at line 103 of file CQTSSAWidget.cpp.

References FROM_UTF8, CCopasiMessage::getAllMessageText(), CTSSAProblem::getStepNumber(), CTSSAProblem::getStepSize(), CQMessageBox::information(), mpTSSAProblem, mpValidatorIntervalSize, CQValidator< Type >::revalidate(), and CTSSAProblem::setDuration().

104 {
105  try
106  {
107  mpTSSAProblem->setDuration(mpEditDuration->text().toDouble());
108  }
109  catch (...)
110  {
111  CQMessageBox::information(this, QString("Information"),
113  QMessageBox::Ok, QMessageBox::Ok);
114  }
115 
116  mpEditIntervalSize->setText(QString::number(mpTSSAProblem->getStepSize()));
118  mpEditIntervals->setText(QString::number(mpTSSAProblem->getStepNumber()));
119 
120 }
CQValidatorDouble * mpValidatorIntervalSize
Definition: CQTSSAWidget.h:59
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
static std::string getAllMessageText(const bool &chronological=true)
static StandardButton information(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
const C_FLOAT64 & getStepSize() const
virtual State revalidate()
Definition: CQValidator.h:63
const unsigned C_INT32 & getStepNumber() const
void setDuration(const C_FLOAT64 &duration)
CTSSAProblem * mpTSSAProblem
Definition: CQTSSAWidget.h:57
void CQTSSAWidget::slotIntervals ( )
slot

Definition at line 141 of file CQTSSAWidget.cpp.

References FROM_UTF8, CCopasiMessage::getAllMessageText(), CTSSAProblem::getStepSize(), CQMessageBox::information(), mpTSSAProblem, mpValidatorIntervalSize, CQValidator< Type >::revalidate(), and CTSSAProblem::setStepNumber().

142 {
143  try
144  {
145  mpTSSAProblem->setStepNumber(mpEditIntervals->text().toULong());
146  }
147  catch (...)
148  {
149  CQMessageBox::information(this, QString("Information"),
151  QMessageBox::Ok, QMessageBox::Ok);
152  }
153 
154  mpEditIntervalSize->setText(QString::number(mpTSSAProblem->getStepSize()));
156 }
CQValidatorDouble * mpValidatorIntervalSize
Definition: CQTSSAWidget.h:59
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
void setStepNumber(const unsigned C_INT32 &stepNumber)
static std::string getAllMessageText(const bool &chronological=true)
static StandardButton information(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
const C_FLOAT64 & getStepSize() const
virtual State revalidate()
Definition: CQValidator.h:63
CTSSAProblem * mpTSSAProblem
Definition: CQTSSAWidget.h:57
void CQTSSAWidget::slotIntervalSize ( )
slot

Definition at line 122 of file CQTSSAWidget.cpp.

References FROM_UTF8, CCopasiMessage::getAllMessageText(), CTSSAProblem::getStepNumber(), CTSSAProblem::getStepSize(), CQMessageBox::information(), mpTSSAProblem, mpValidatorIntervalSize, CQValidator< Type >::revalidate(), and CTSSAProblem::setStepSize().

123 {
124  try
125  {
126  mpTSSAProblem->setStepSize(mpEditIntervalSize->text().toDouble());
127  }
128 
129  catch (...)
130  {
131  CQMessageBox::information(this, QString("Information"),
133  QMessageBox::Ok, QMessageBox::Ok);
134  }
135 
136  mpEditIntervalSize->setText(QString::number(mpTSSAProblem->getStepSize()));
138  mpEditIntervals->setText(QString::number(mpTSSAProblem->getStepNumber()));
139 }
CQValidatorDouble * mpValidatorIntervalSize
Definition: CQTSSAWidget.h:59
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
static std::string getAllMessageText(const bool &chronological=true)
static StandardButton information(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
const C_FLOAT64 & getStepSize() const
virtual State revalidate()
Definition: CQValidator.h:63
const unsigned C_INT32 & getStepNumber() const
void setStepSize(const C_FLOAT64 &stepSize)
CTSSAProblem * mpTSSAProblem
Definition: CQTSSAWidget.h:57
bool CQTSSAWidget::taskFinishedEvent ( )
protectedvirtual

Reimplemented from TaskWidget.

Definition at line 253 of file CQTSSAWidget.cpp.

References CQTSSAResultSubWidget::discardOldResults(), CQTSSAResultSubWidget::displayResult(), ListViews::findWidgetFromId(), CQTSSAResultWidget::getSubWidget(), CQTSSAResultWidget::loadFromBackend(), CopasiWidget::mpListView, pResult, and ListViews::switchToOtherWidget().

254 {
255  bool success = true;
256  // We need to load the result here as this is the only place where
257  // we know that it is correct.
259  dynamic_cast< CQTSSAResultWidget * >(mpListView->findWidgetFromId(271));
260 
261  if (pResult == NULL)
262  {
263  return false;
264  }
265 
266  success &= pResult->loadFromBackend();
267 
268  pTSSResultSubWidget = pResult->getSubWidget();
269 
270  if (!pTSSResultSubWidget)
271  return false;
272 
274 
275 
276 
277  if (success)
278  {
279 
281 
282  mpListView->switchToOtherWidget(271, ""); //change to the results window
283  }
284 
285  return success;
286 }
void switchToOtherWidget(const size_t &id, const std::string &key)
Definition: listviews.cpp:926
CQTSSAResultSubWidget * pTSSResultSubWidget
CopasiWidget * findWidgetFromId(const size_t &id) const
Definition: listviews.cpp:678
ListViews * mpListView
Definition: copasiWidget.h:62
CQTSSAResultSubWidget * getSubWidget()
const CArrayAnnotation * pResult

Member Data Documentation

CTSSAProblem* CQTSSAWidget::mpTSSAProblem
private

Definition at line 57 of file CQTSSAWidget.h.

Referenced by destroy(), init(), loadTask(), slotDuration(), slotIntervals(), and slotIntervalSize().

CQValidatorDouble* CQTSSAWidget::mpValidatorDelay
private

Definition at line 60 of file CQTSSAWidget.h.

CQValidatorDouble* CQTSSAWidget::mpValidatorDuration
private

Definition at line 58 of file CQTSSAWidget.h.

Referenced by init(), loadTask(), and saveTask().

CQValidatorInt* CQTSSAWidget::mpValidatorIntervals
private

Definition at line 61 of file CQTSSAWidget.h.

CQValidatorDouble* CQTSSAWidget::mpValidatorIntervalSize
private

Definition at line 59 of file CQTSSAWidget.h.

Referenced by init(), loadTask(), saveTask(), slotDuration(), slotIntervals(), and slotIntervalSize().


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