COPASI API  4.16.103
CQMoietiesTaskWidget.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 #include <QtGui/QCheckBox>
12 #include <QtCore/QVariant>
13 
16 
19 #include "CQMoietiesTaskWidget.h"
20 
21 /*
22  * Constructs a CQMoietiesTaskWidget which is a child of 'parent', with the
23  * name 'name'.'
24  */
25 CQMoietiesTaskWidget::CQMoietiesTaskWidget(QWidget* parent, const char* name)
26  : TaskWidget(parent, name)
27 {
28  setupUi(this);
29 
30  init();
31 }
32 
33 /*
34  * Destroys the object and frees any allocated resources
35  */
37 {
38  destroy();
39  // no need to delete child widgets, Qt does it all for us
40 }
41 
43 {
44  mpHeaderWidget->setTaskName("Mass Conservation");
45  mpHeaderWidget->mpUpdateModel->hide();
46 
47  vboxLayout->insertWidget(0, mpHeaderWidget);
48  vboxLayout->addWidget(mpBtnWidget);
49 }
50 
52 {}
53 
55 {
56  if (dynamic_cast< CMoietiesTask * >(mpTask) == NULL)
57  return false;
58 
59  if (!commonBeforeRunTask()) return false;
60 
61  return commonRunTask();
62 }
63 
65 {
66  bool success = true;
67 
68  if (success && isVisible())
69  mpListView->switchToOtherWidget(2221, ""); //change to the results window
70 
71  return success;
72 }
73 
75 {
76  if (dynamic_cast< CMoietiesTask * >(mpTask) == NULL)
77  return false;
78 
79  saveCommon();
80 
81  return true;
82 }
83 
85 {
86  if (dynamic_cast< CMoietiesTask * >(mpTask) == NULL)
87  return false;
88 
89  loadCommon();
90 
91  return true;
92 }
93 
95 {
96  return CMoietiesMethod::createMethod(type);
97 }
void switchToOtherWidget(const size_t &id, const std::string &key)
Definition: listviews.cpp:926
bool loadCommon()
Definition: TaskWidget.cpp:247
bool saveCommon()
Definition: TaskWidget.cpp:258
bool setTaskName(const std::string &name)
ListViews * mpListView
Definition: copasiWidget.h:62
CCopasiTask * mpTask
Definition: TaskWidget.h:130
virtual CCopasiMethod * createMethod(const CCopasiMethod::SubType &type)
static CMoietiesMethod * createMethod(const CCopasiMethod::SubType &subType=CCopasiMethod::Householder)
bool commonRunTask()
Definition: TaskWidget.cpp:395
CQTaskBtnWidget * mpBtnWidget
Definition: TaskWidget.h:124
CQTaskHeaderWidget * mpHeaderWidget
Definition: TaskWidget.h:122
bool commonBeforeRunTask()
Definition: TaskWidget.cpp:317
CQMoietiesTaskWidget(QWidget *parent=0, const char *name=0)
virtual bool taskFinishedEvent()