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

#include <CQEFMResultWidget.h>

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

Public Member Functions

 CQEFMResultWidget (QWidget *parent=0, const char *name=0)
 
virtual bool leave ()
 
virtual bool loadResult (const CCopasiTask *pTask)
 
virtual bool update (ListViews::ObjectType objectType, ListViews::Action action, const std::string &key)
 
virtual ~CQEFMResultWidget ()
 
- 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 bool enterProtected ()
 

Private Slots

void slotSave ()
 

Private Attributes

CQEFMNetReactionDMmpNetReactionDM
 
CQSortFilterProxyModelmpProxyModelNetReactions
 
CQSortFilterProxyModelmpProxyModelReactions
 
CQSortFilterProxyModelmpProxyModelSpecies
 
CQEFMReactionDMmpReactionDM
 
CQEFMSpeciesDMmpSpeciesDM
 
const CEFMTaskmpTask
 

Additional Inherited Members

- Protected Slots inherited from CopasiWidget
virtual bool protectedNotify (ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
 
- Protected Attributes inherited from CopasiWidget
int mFramework
 
bool mIgnoreUpdates
 
std::string mKey
 
CCopasiDataModelmpDataModel
 
ListViewsmpListView
 
CCopasiObjectmpObject
 

Detailed Description

Definition at line 34 of file CQEFMResultWidget.h.

Constructor & Destructor Documentation

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

Definition at line 24 of file CQEFMResultWidget.cpp.

References COL_REACTION_NAME, COL_ROW_NUMBER, mpNetReactionDM, mpProxyModelNetReactions, mpProxyModelReactions, mpProxyModelSpecies, mpReactionDM, and mpSpeciesDM.

24  :
25  CopasiWidget(parent, name),
26  mpTask(NULL),
28  mpReactionDM(NULL),
29  mpProxyModelSpecies(NULL),
30  mpSpeciesDM(NULL),
32  mpNetReactionDM(NULL)
33 {
34  setupUi(this);
35 
36  mpReactionMatrix->sortByColumn(COL_ROW_NUMBER, Qt::AscendingOrder);
37  mpReactionMatrix->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
38  mpReactionMatrix->verticalHeader()->hide();
39 
40  //Create Source Data Model.
41  mpReactionDM = new CQEFMReactionDM(this);
42 
43  //Create the Proxy Model for sorting/filtering and set its properties.
45  mpProxyModelReactions->setSortCaseSensitivity(Qt::CaseInsensitive);
46  mpProxyModelReactions->setFilterKeyColumn(COL_REACTION_NAME);
47 
48  mpProxyModelReactions->setSourceModel(mpReactionDM);
49 
50  //Set Model for the TableView
51  mpReactionMatrix->setModel(NULL);
52  mpReactionMatrix->setModel(mpProxyModelReactions);
53  mpReactionMatrix->resizeColumnsToContents();
54 
55  mpSpeciesMatrix->sortByColumn(COL_ROW_NUMBER, Qt::AscendingOrder);
56  mpSpeciesMatrix->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
57  mpSpeciesMatrix->verticalHeader()->hide();
58 
59  //Create Source Data Model.
60  mpSpeciesDM = new CQEFMSpeciesDM(this);
61 
62  //Create the Proxy Model for sorting/filtering and set its properties.
64  mpProxyModelSpecies->setSortCaseSensitivity(Qt::CaseInsensitive);
65  mpProxyModelSpecies->setFilterKeyColumn(COL_REACTION_NAME);
66 
67  mpProxyModelSpecies->setSourceModel(mpSpeciesDM);
68 
69  //Set Model for the TableView
70  mpSpeciesMatrix->setModel(NULL);
71  mpSpeciesMatrix->setModel(mpProxyModelSpecies);
72  mpSpeciesMatrix->resizeColumnsToContents();
73 
74  mpNetReactions->sortByColumn(COL_ROW_NUMBER, Qt::AscendingOrder);
75  mpNetReactions->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
76  mpNetReactions->verticalHeader()->hide();
77 
78  //Create Source Data Model.
80 
81  //Create the Proxy Model for sorting/filtering and set its properties.
83  mpProxyModelNetReactions->setSortCaseSensitivity(Qt::CaseInsensitive);
84  mpProxyModelNetReactions->setFilterKeyColumn(COL_REACTION_NAME);
85 
87 
88  //Set Model for the TableView
89  mpNetReactions->setModel(NULL);
90  mpNetReactions->setModel(mpProxyModelNetReactions);
91  mpNetReactions->resizeColumnsToContents();
92 }
const CEFMTask * mpTask
CQEFMSpeciesDM * mpSpeciesDM
CQSortFilterProxyModel * mpProxyModelReactions
CopasiWidget(QWidget *parent=0, const char *name=0, Qt::WFlags f=0)
CQSortFilterProxyModel * mpProxyModelNetReactions
#define COL_REACTION_NAME
Definition: CQFluxModeDM.h:30
CQEFMNetReactionDM * mpNetReactionDM
CQEFMReactionDM * mpReactionDM
CQSortFilterProxyModel * mpProxyModelSpecies
#define COL_ROW_NUMBER
CQEFMResultWidget::~CQEFMResultWidget ( )
virtual

Definition at line 94 of file CQEFMResultWidget.cpp.

References mpProxyModelNetReactions, mpProxyModelReactions, mpProxyModelSpecies, and pdelete.

95 {
99 }
#define pdelete(p)
Definition: copasi.h:215
CQSortFilterProxyModel * mpProxyModelReactions
CQSortFilterProxyModel * mpProxyModelNetReactions
CQSortFilterProxyModel * mpProxyModelSpecies

Member Function Documentation

bool CQEFMResultWidget::enterProtected ( )
protectedvirtual

Reimplemented from CopasiWidget.

Definition at line 138 of file CQEFMResultWidget.cpp.

139 {
140  return true;
141 }
bool CQEFMResultWidget::leave ( )
virtual

Reimplemented from CopasiWidget.

Definition at line 102 of file CQEFMResultWidget.cpp.

103 {
104  return true;
105 }
bool CQEFMResultWidget::loadResult ( const CCopasiTask pTask)
virtual

Definition at line 144 of file CQEFMResultWidget.cpp.

References CEFMTask::getFluxModes(), mpNetReactionDM, mpProxyModelNetReactions, mpProxyModelReactions, mpProxyModelSpecies, mpReactionDM, mpSpeciesDM, mpTask, pTask, CQEFMReactionDM::setTask(), CQEFMNetReactionDM::setTask(), and CQEFMSpeciesDM::setTask().

Referenced by CQEFMWidget::taskFinishedEvent(), and update().

145 {
146  mpTask = dynamic_cast<const CEFMTask *>(pTask);
147 
148  if (mpTask != NULL)
149  {
150  mpEditFluxModes->setText(QString::number(mpTask->getFluxModes().size()));
151  }
152  else
153  {
154  mpEditFluxModes->setText(QString::number(0));
155  }
156 
157  bool success = true;
158  success &= mpEFMListWidget->loadResult(mpTask);
159 
161 
162  mpProxyModelReactions->setSourceModel(mpReactionDM);
163 
164  //Set Model for the TableView
165  mpReactionMatrix->setModel(NULL);
166  mpReactionMatrix->setModel(mpProxyModelReactions);
167  mpReactionMatrix->resizeColumnsToContents();
168 
170 
171  mpProxyModelSpecies->setSourceModel(mpSpeciesDM);
172 
173  //Set Model for the TableView
174  mpSpeciesMatrix->setModel(NULL);
175  mpSpeciesMatrix->setModel(mpProxyModelSpecies);
176  mpSpeciesMatrix->resizeColumnsToContents();
177 
179 
180  mpProxyModelNetReactions->setSourceModel(mpNetReactionDM);
181 
182  //Set Model for the TableView
183  mpNetReactions->setModel(NULL);
184  mpNetReactions->setModel(mpProxyModelNetReactions);
185  mpNetReactions->resizeColumnsToContents();
186 
187  return success;
188 }
void setTask(const CEFMTask *pTask)
void setTask(const CEFMTask *pTask)
const CEFMTask * mpTask
const std::vector< CFluxMode > & getFluxModes() const
Definition: CEFMTask.cpp:183
CQEFMSpeciesDM * mpSpeciesDM
CTSSATask * pTask
CQSortFilterProxyModel * mpProxyModelReactions
CQSortFilterProxyModel * mpProxyModelNetReactions
void setTask(const CEFMTask *pTask)
CQEFMNetReactionDM * mpNetReactionDM
CQEFMReactionDM * mpReactionDM
CQSortFilterProxyModel * mpProxyModelSpecies
void CQEFMResultWidget::slotSave ( )
privateslot

Definition at line 190 of file CQEFMResultWidget.cpp.

References C_INT32, checkSelection(), CLocaleString::fromUtf8(), CCopasiTask::getResult(), CopasiFileDialog::getSaveFileName(), mpTask, and TO_UTF8.

191 {
192  C_INT32 Answer = QMessageBox::No;
193  QString fileName;
194 
195  while (Answer == QMessageBox::No)
196  {
197  fileName =
198  CopasiFileDialog::getSaveFileName(this, "Save File Dialog",
199  "untitled.txt", "TEXT Files (*.txt)", "Save to");
200 
201  if (fileName.isEmpty()) return;
202 
203  // Checks whether the file exists
204  Answer = checkSelection(fileName);
205 
206  if (Answer == QMessageBox::Cancel) return;
207  }
208 
209  std::ofstream file(CLocaleString::fromUtf8(TO_UTF8(fileName)).c_str());
210 
211  if (file.fail())
212  return;
213 
214  if (mpTask != NULL)
215  file << mpTask->getResult();
216 
217  return;
218 }
const CEFMTask * mpTask
#define C_INT32
Definition: copasi.h:90
C_INT32 checkSelection(const QString &file)
const CResult & getResult() const
#define TO_UTF8(__x)
Definition: qtUtilities.h:74
static CLocaleString fromUtf8(const std::string &utf8)
static QString getSaveFileName(QWidget *parent=0, const char *name=0, const QString &startWith=QString::null, const QString &filter=QString::null, const QString &caption=QString::null, QString *pSelectedFilter=NULL, QFileDialog::Options options=0)
bool CQEFMResultWidget::update ( ListViews::ObjectType  objectType,
ListViews::Action  action,
const std::string &  key 
)
virtual

Reimplemented from CopasiWidget.

Definition at line 108 of file CQEFMResultWidget.cpp.

References ListViews::ADD, ListViews::DELETE, loadResult(), and ListViews::MODEL.

111 {
112  // We need to update the task when a new model is loaded.
113  switch (objectType)
114  {
115  case ListViews::MODEL:
116 
117  switch (action)
118  {
119  case ListViews::ADD:
120  case ListViews::DELETE:
121  loadResult(NULL);
122  break;
123 
124  default:
125  break;
126  }
127 
128  break;
129 
130  default:
131  break;
132  }
133 
134  return true;
135 }
objectType
virtual bool loadResult(const CCopasiTask *pTask)

Member Data Documentation

CQEFMNetReactionDM* CQEFMResultWidget::mpNetReactionDM
private

Definition at line 65 of file CQEFMResultWidget.h.

Referenced by CQEFMResultWidget(), and loadResult().

CQSortFilterProxyModel* CQEFMResultWidget::mpProxyModelNetReactions
private

Definition at line 64 of file CQEFMResultWidget.h.

Referenced by CQEFMResultWidget(), loadResult(), and ~CQEFMResultWidget().

CQSortFilterProxyModel* CQEFMResultWidget::mpProxyModelReactions
private

Definition at line 58 of file CQEFMResultWidget.h.

Referenced by CQEFMResultWidget(), loadResult(), and ~CQEFMResultWidget().

CQSortFilterProxyModel* CQEFMResultWidget::mpProxyModelSpecies
private

Definition at line 61 of file CQEFMResultWidget.h.

Referenced by CQEFMResultWidget(), loadResult(), and ~CQEFMResultWidget().

CQEFMReactionDM* CQEFMResultWidget::mpReactionDM
private

Definition at line 59 of file CQEFMResultWidget.h.

Referenced by CQEFMResultWidget(), and loadResult().

CQEFMSpeciesDM* CQEFMResultWidget::mpSpeciesDM
private

Definition at line 62 of file CQEFMResultWidget.h.

Referenced by CQEFMResultWidget(), and loadResult().

const CEFMTask* CQEFMResultWidget::mpTask
private

Definition at line 56 of file CQEFMResultWidget.h.

Referenced by loadResult(), and slotSave().


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