COPASI API  4.16.103
CQEFMWidget.cpp
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/UI/CQEFMWidget.cpp,v $
3 // $Revision: 1.13 $
4 // $Name: $
5 // $Author: aekamal $
6 // $Date: 2011/06/20 16:07:08 $
7 // End CVS Header
8 
9 // Copyright (C) 2011 - 2010 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., University of Heidelberg, and The University
11 // of Manchester.
12 // All rights reserved.
13 
14 // Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
15 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
16 // and The University of Manchester.
17 // All rights reserved.
18 
19 #include "CQEFMWidget.h"
20 
21 #include "CQTaskBtnWidget.h"
22 #include "CQTaskHeaderWidget.h"
23 #include "CProgressBar.h"
24 #include "qtUtilities.h"
25 #include "CQMessageBox.h"
26 #include "CQEFMResultWidget.h"
27 
28 #include "copasi.h"
29 
32 
33 /*
34  * Constructs a CQEFMWidget which is a child of 'parent', with the
35  * name 'name'.'
36  */
37 CQEFMWidget::CQEFMWidget(QWidget* parent, const char* name)
38  : TaskWidget(parent, name)
39 {
40  setupUi(this);
41 
42  mpHeaderWidget->setTaskName("Elementary Flux Modes");
43  mpHeaderWidget->mpUpdateModel->hide();
44 
45  verticalLayout->insertWidget(0, mpHeaderWidget);
46  verticalLayout->addWidget(mpBtnWidget);
47 }
48 
49 /*
50  * Destroys the object and frees any allocated resources
51  */
53 {}
54 
56 {
57  if (dynamic_cast< CEFMTask * >(mpTask) == NULL)
58  return false;
59 
60  if (!commonBeforeRunTask()) return false;
61 
62  return commonRunTask();
63 }
64 
66 {
67  bool success = true;
68 
69  // We need to load the result here as this is the only place where
70  // we know that it is correct.
73 
74  if (pResult == NULL)
75  return false;
76 
77  success &= pResult->loadResult(mpTask);
78 
79  if (success && isVisible())
80  CopasiWidget::mpListView->switchToOtherWidget(2211, ""); //change to the results window
81 
82  return success;
83 }
84 
86 {
87  CEFMTask * pTask =
88  dynamic_cast< CEFMTask * >(mpTask);
89 
90  if (!pTask) return false;
91 
92  saveCommon();
93  saveMethod();
94 
95  return true;
96 }
97 
99 {
100  CEFMTask * pTask =
101  dynamic_cast< CEFMTask * >(mpTask);
102 
103  if (!pTask) return false;
104 
105  loadCommon();
106  loadMethod();
107 
108  return true;
109 }
110 
112 {
113  mpTask->setMethodType(type);
114  return mpTask->getMethod();
115 }
bool saveMethod()
Definition: TaskWidget.cpp:308
void switchToOtherWidget(const size_t &id, const std::string &key)
Definition: listviews.cpp:926
bool loadCommon()
Definition: TaskWidget.cpp:247
virtual bool loadTask()
Definition: CQEFMWidget.cpp:98
bool saveCommon()
Definition: TaskWidget.cpp:258
bool loadMethod()
Definition: TaskWidget.cpp:284
virtual bool saveTask()
Definition: CQEFMWidget.cpp:85
bool setTaskName(const std::string &name)
CTSSATask * pTask
virtual bool loadResult(const CCopasiTask *pTask)
CopasiWidget * findWidgetFromId(const size_t &id) const
Definition: listviews.cpp:678
ListViews * mpListView
Definition: copasiWidget.h:62
virtual bool taskFinishedEvent()
Definition: CQEFMWidget.cpp:65
CCopasiTask * mpTask
Definition: TaskWidget.h:130
virtual bool setMethodType(const int &type)
const CArrayAnnotation * pResult
CCopasiMethod * getMethod()
bool commonRunTask()
Definition: TaskWidget.cpp:395
CQTaskBtnWidget * mpBtnWidget
Definition: TaskWidget.h:124
CQTaskHeaderWidget * mpHeaderWidget
Definition: TaskWidget.h:122
bool commonBeforeRunTask()
Definition: TaskWidget.cpp:317
CQEFMWidget(QWidget *parent=0, const char *name=0)
Definition: CQEFMWidget.cpp:37
virtual CCopasiMethod * createMethod(const CCopasiMethod::SubType &type)
virtual bool runTask()
Definition: CQEFMWidget.cpp:55