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

#include <DataModelGUI.h>

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

Public Slots

void exportMathModelFinished ()
 
void exportSBMLFinished ()
 
void exportSBMLToStringFinished ()
 
void importSBMLFinished ()
 
void importSBMLFromStringFinished ()
 
void loadModelFinished ()
 
void miriamDownloadFinished (QNetworkReply *)
 
void miriamDownloadProgress (qint64 received, qint64 total)
 
void saveModelFinished ()
 

Signals

void finished (bool success)
 
void notifyView (ListViews::ObjectType objectType, ListViews::Action action, std::string key="")
 
void updateCompleteView ()
 

Public Member Functions

void buildChangedObjects ()
 
void commit ()
 
bool createModel ()
 
 DataModelGUI (QObject *parent)
 
void deregisterListView (ListViews *pListView)
 
void exportMathModel (const std::string &fileName, const std::string &filter, bool overwriteFile=false)
 
void exportMathModelRun ()
 
void exportSBML (const std::string &fileName, bool overwriteFile, int sbmlLevel, int sbmlVersion, bool exportIncomplete, bool exportCOPASIMIRIAM=true)
 
void exportSBMLRun ()
 
void exportSBMLToString (std::string &sbmlDocumentText)
 
void exportSBMLToStringRun ()
 
COutputDefinitionVectorgetPlotDefinitionList ()
 
void importCellDesigner ()
 
void importSBML (const std::string &fileName)
 
void importSBMLFromString (const std::string &sbmlDocumentText)
 
void importSBMLFromStringRun ()
 
void importSBMLRun ()
 
void loadFunctionDB (const std::string &fileName)
 
void loadModel (const std::string &fileName)
 
void loadModelRun ()
 
bool notify (ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
 
void refreshInitialValues ()
 
void registerListView (ListViews *pListView)
 
void saveFunctionDB (const std::string &fileName)
 
void saveModel (const std::string &fileName, bool overwriteFile=false)
 
void saveModelRun ()
 
void setFramework (int framework)
 
bool updateMIRIAM (CMIRIAMResources &miriamResources)
 
void updateMIRIAMResourceContents ()
 
virtual ~DataModelGUI ()
 

Private Member Functions

void linkDataModelToGUI ()
 
void threadFinished ()
 

Private Attributes

std::set< const CCopasiObject * > mChangedObjects
 
unsigned int mDownloadedBytes
 
unsigned int mDownloadedTotalBytes
 
std::string mExportFormat
 
std::string mFileName
 
int mFramework
 
std::set< ListViews * > mListViews
 
COutputHandlerPlot mOutputHandlerPlot
 
bool mOverWrite
 
QApplication * mpApp
 
CMIRIAMResourcesmpMiriamResources
 
CProgressBarmpProgressBar
 
std::string * mpSBMLExportString
 
CQThreadmpThread
 
bool mSBMLExportCOPASIMIRIAM
 
bool mSBMLExportIncomplete
 
std::string mSBMLImportString
 
int mSBMLLevel
 
int mSBMLVersion
 
bool mSuccess
 
size_t mUpdateItem
 
std::vector< Refresh * > mUpdateVector
 

Detailed Description

Definition at line 34 of file DataModelGUI.h.

Constructor & Destructor Documentation

DataModelGUI::DataModelGUI ( QObject *  parent)

Definition at line 79 of file DataModelGUI.cpp.

References CCopasiRootContainer::getDatamodelList(), and mOutputHandlerPlot.

79  :
80  QObject(parent),
81  mpApp(NULL),
83  mListViews(),
84  mFramework(0),
85  mUpdateVector(),
87  mpThread(NULL),
88  mpProgressBar(NULL),
89  mSuccess(false),
91  mpSBMLExportString(NULL),
92  mFileName(),
93  mOverWrite(false),
94  mSBMLLevel(2),
95  mSBMLVersion(4),
99 
100 #ifdef COPASI_SEDML
101  , mSEDMLImportString()
102  , mpSEDMLExportString(NULL)
103  , mSEDMLLevel(1)
104  , mSEDMLVersion(1)
105  , mSEDMLExportIncomplete(true)
106  , mSEDMLExportCOPASIMIRIAM(true)
107 #endif
108 
109 {
110  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
112 
113  //mpMathModel = NULL;
114  //mMathModelUpdateScheduled = false;
115 }
COutputHandlerPlot mOutputHandlerPlot
Definition: DataModelGUI.h:137
bool mSBMLExportIncomplete
Definition: DataModelGUI.h:152
std::vector< Refresh * > mUpdateVector
Definition: DataModelGUI.h:140
std::string mExportFormat
Definition: DataModelGUI.h:154
std::string mSBMLImportString
Definition: DataModelGUI.h:146
CQThread * mpThread
Definition: DataModelGUI.h:143
std::string mFileName
Definition: DataModelGUI.h:148
std::set< ListViews * > mListViews
Definition: DataModelGUI.h:138
QApplication * mpApp
Definition: DataModelGUI.h:136
std::string * mpSBMLExportString
Definition: DataModelGUI.h:147
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
CProgressBar * mpProgressBar
Definition: DataModelGUI.h:144
std::set< const CCopasiObject * > mChangedObjects
Definition: DataModelGUI.h:141
bool mSBMLExportCOPASIMIRIAM
Definition: DataModelGUI.h:153
DataModelGUI::~DataModelGUI ( )
virtual

Definition at line 117 of file DataModelGUI.cpp.

118 {
119 }

Member Function Documentation

void DataModelGUI::buildChangedObjects ( )

Definition at line 634 of file DataModelGUI.cpp.

References CArrayAnnotation::appendElementReferences(), CModelEntity::ASSIGNMENT, CCopasiVector< T >::begin(), CModel::buildInitialRefreshSequence(), CCopasiMessage::clearDeque(), CModel::compileIfNecessary(), CQMessageBox::critical(), CCopasiVector< T >::end(), CStateTemplate::endFixed(), FROM_UTF8, CCopasiRootContainer::getDatamodelList(), CStateTemplate::getEntities(), CMetab::getInitialConcentration(), CMetab::getInitialConcentrationReference(), CModelEntity::getInitialValueReference(), CCopasiMessage::getLastMessage(), CCopasiContainer::getObject(), CCopasiParameterGroup::getParameter(), CModel::getReactions(), CModel::getStateTemplate(), CMetab::isInitialConcentrationChangeAllowed(), mChangedObjects, mFramework, mUpdateVector, and CCopasiParameterGroup::size().

Referenced by refreshInitialValues().

635 {
636  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
637  CModel * pModel = (*CCopasiRootContainer::getDatamodelList())[0]->getModel();
638  pModel->compileIfNecessary(NULL);
639 
640  mChangedObjects.clear();
641 
642  CModelEntity ** ppEntity = pModel->getStateTemplate().getEntities();
643  CModelEntity ** ppEntityEnd = pModel->getStateTemplate().endFixed();
644 
645  CMetab * pMetab;
646  std::set< const CCopasiObject * > Objects;
647 
648  // The objects which are changed are all initial values of of all model entities including
649  // fixed and unused once. Additionally, all kinetic parameters are possibly changed.
650  // This is basically all the parameters in the parameter overview whose value is editable.
651 
652  // :TODO: Theoretically, it is possible that also task parameters influence the initial
653  // state of a model but that is currently not handled.
654 
655  for (; ppEntity != ppEntityEnd; ++ppEntity)
656  {
657  // If we have an initial expression we have no initial values
658  if ((*ppEntity)->getInitialExpression() != "" ||
659  (*ppEntity)->getStatus() == CModelEntity::ASSIGNMENT)
660  continue;
661 
662  // Metabolites have two initial values
663  if (mFramework == 0 &&
664  (pMetab = dynamic_cast< CMetab * >(*ppEntity)) != NULL)
665  {
666  // The concentration is assumed to be fix accept when this would lead to circular dependencies,
667  // for the parent's compartment's initial volume.
668  if (pMetab->isInitialConcentrationChangeAllowed() &&
669  !isnan(pMetab->getInitialConcentration()))
671  else
672  mChangedObjects.insert(pMetab->getInitialValueReference());
673  }
674  else
675  mChangedObjects.insert((*ppEntity)->getInitialValueReference());
676  }
677 
678  // The reaction parameters
681  size_t i, imax;
682 
683  for (; itReaction != endReaction; ++itReaction)
684  {
685  const CCopasiParameterGroup & Group = (*itReaction)->getParameters();
686 
687  for (i = 0, imax = Group.size(); i < imax; i++)
688  mChangedObjects.insert(static_cast< const CCopasiObject * >(Group.getParameter(i)->getObject(CCopasiObjectName("Reference=Value"))));
689  }
690 
691  // Fix for Issue 1170: We need to add elements of the stoichiometry, reduced stoichiometry,
692  // and link matrices.
693  const CArrayAnnotation * pMatrix = NULL;
694  pMatrix = dynamic_cast<const CArrayAnnotation *>(pModel->getObject(std::string("Array=Stoichiometry(ann)")));
695 
696  if (pMatrix != NULL)
698 
699  pMatrix = dynamic_cast<const CArrayAnnotation *>(pModel->getObject(std::string("Array=Reduced stoichiometry(ann)")));
700 
701  if (pMatrix != NULL)
703 
704  pMatrix = dynamic_cast<const CArrayAnnotation *>(pModel->getObject(std::string("Array=Link matrix(ann)")));
705 
706  if (pMatrix != NULL)
708 
709  try
710  {
712  }
713 
714  catch (...)
715  {
716  QString Message = "Error while updating the initial values!\n\n";
717  Message += FROM_UTF8(CCopasiMessage::getLastMessage().getText());
718 
719  CQMessageBox::critical(NULL, QString("COPASI Error"), Message,
720  QMessageBox::Ok, QMessageBox::Ok);
722 
723  mUpdateVector.clear();
724  return;
725  }
726 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
const C_FLOAT64 & getInitialConcentration() const
Definition: CMetab.cpp:220
CCopasiObject * getInitialValueReference() const
iterator begin()
std::vector< Refresh * > mUpdateVector
Definition: DataModelGUI.h:140
Definition: CMetab.h:178
static void clearDeque()
iterator end()
std::vector< CType * >::const_iterator const_iterator
Definition: CCopasiVector.h:57
CModelEntity ** endFixed()
Definition: CState.cpp:213
const bool & isInitialConcentrationChangeAllowed() const
Definition: CMetab.cpp:664
void appendElementReferences(std::set< const CCopasiObject * > &objects) const
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
CCopasiParameter * getParameter(const std::string &name)
static StandardButton critical(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
bool compileIfNecessary(CProcessReport *pProcessReport)
Definition: CModel.cpp:612
const CStateTemplate & getStateTemplate() const
Definition: CModel.cpp:1172
static CCopasiMessage getLastMessage()
CCopasiVectorNS< CReaction > & getReactions()
Definition: CModel.cpp:1039
std::set< const CCopasiObject * > mChangedObjects
Definition: DataModelGUI.h:141
Definition: CModel.h:50
virtual const CObjectInterface * getObject(const CCopasiObjectName &cn) const
CConcentrationReference * getInitialConcentrationReference() const
Definition: CMetab.cpp:861
std::vector< Refresh * > buildInitialRefreshSequence(std::set< const CCopasiObject * > &changedObjects)
Definition: CModel.cpp:4164
CModelEntity ** getEntities()
Definition: CState.cpp:204
void DataModelGUI::commit ( )
bool DataModelGUI::createModel ( )

Definition at line 200 of file DataModelGUI.cpp.

References CCopasiRootContainer::getDatamodelList(), getPlotDefinitionList(), linkDataModelToGUI(), mOutputHandlerPlot, and COutputHandlerPlot::setOutputDefinitionVector().

Referenced by CopasiUI3Window::newDoc(), CopasiUI3Window::slotFileOpenFinished(), CopasiUI3Window::slotImportSBMLFinished(), and CopasiUI3Window::slotImportSBMLFromStringFinished().

201 {
202  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
203 
204  if (!(*CCopasiRootContainer::getDatamodelList())[0]->newModel(NULL, false)) return false;
205 
207 
209  return true;
210 }
COutputHandlerPlot mOutputHandlerPlot
Definition: DataModelGUI.h:137
COutputDefinitionVector & getPlotDefinitionList()
void setOutputDefinitionVector(COutputDefinitionVector *pDefinitionVector)
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
void linkDataModelToGUI()
void DataModelGUI::deregisterListView ( ListViews pListView)

Definition at line 628 of file DataModelGUI.cpp.

References mListViews, and ListViews::setDataModel().

Referenced by CopasiUI3Window::~CopasiUI3Window().

629 {
630  pListView->setDataModel(NULL);
631  mListViews.erase(pListView);
632 }
void setDataModel(DataModelGUI *pDM)
Definition: listviews.cpp:267
std::set< ListViews * > mListViews
Definition: DataModelGUI.h:138
void DataModelGUI::exportMathModel ( const std::string &  fileName,
const std::string &  filter,
bool  overwriteFile = false 
)

Definition at line 487 of file DataModelGUI.cpp.

References CProgressBar::create(), exportMathModelFinished(), exportMathModelRun(), finished(), mExportFormat, mFileName, mOverWrite, mpProgressBar, mpThread, and mSuccess.

Referenced by exportMathModelRun(), and CopasiUI3Window::slotExportMathModel().

488 {
490 
491  mSuccess = true;
492  mFileName = fileName;
493  mOverWrite = overwriteFile;
494  mExportFormat = filter;
495 
497  connect(mpThread, SIGNAL(finished()), this, SLOT(exportMathModelFinished()));
498  mpThread->start();
499 }
void exportMathModelRun()
static CProgressBar * create(QWidget *parent=0, const char *name=0, Qt::WindowModality windowModality=Qt::WindowModal)
std::string mExportFormat
Definition: DataModelGUI.h:154
CQThread * mpThread
Definition: DataModelGUI.h:143
std::string mFileName
Definition: DataModelGUI.h:148
void exportMathModelFinished()
void finished(bool success)
CProgressBar * mpProgressBar
Definition: DataModelGUI.h:144
void DataModelGUI::exportMathModelFinished ( )
slot

Definition at line 515 of file DataModelGUI.cpp.

References finished(), mpThread, and threadFinished().

Referenced by exportMathModel().

516 {
517  disconnect(mpThread, SIGNAL(finished()), this, SLOT(exportMathModelFinished()));
518 
519  threadFinished();
520 }
void threadFinished()
CQThread * mpThread
Definition: DataModelGUI.h:143
void exportMathModelFinished()
void finished(bool success)
void DataModelGUI::exportMathModelRun ( )

Definition at line 501 of file DataModelGUI.cpp.

References exportMathModel(), CCopasiRootContainer::getDatamodelList(), mExportFormat, mFileName, mOverWrite, mpProgressBar, and mSuccess.

Referenced by exportMathModel().

502 {
503  try
504  {
505  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
507  }
508 
509  catch (...)
510  {
511  mSuccess = false;
512  }
513 }
std::string mExportFormat
Definition: DataModelGUI.h:154
std::string mFileName
Definition: DataModelGUI.h:148
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
CProgressBar * mpProgressBar
Definition: DataModelGUI.h:144
void exportMathModel(const std::string &fileName, const std::string &filter, bool overwriteFile=false)
void DataModelGUI::exportSBML ( const std::string &  fileName,
bool  overwriteFile,
int  sbmlLevel,
int  sbmlVersion,
bool  exportIncomplete,
bool  exportCOPASIMIRIAM = true 
)

Definition at line 446 of file DataModelGUI.cpp.

References CProgressBar::create(), exportSBMLFinished(), exportSBMLRun(), finished(), mFileName, mOverWrite, mpProgressBar, mpThread, mSBMLExportCOPASIMIRIAM, mSBMLExportIncomplete, mSBMLLevel, mSBMLVersion, and mSuccess.

Referenced by exportSBMLRun(), and CopasiUI3Window::slotExportSBML().

447 {
449 
450  mSuccess = true;
451  mFileName = fileName;
452  mOverWrite = overwriteFile;
453  mSBMLLevel = sbmlLevel;
454  mSBMLVersion = sbmlVersion;
455  mSBMLExportIncomplete = exportIncomplete;
456  mSBMLExportCOPASIMIRIAM = exportCOPASIMIRIAM;
457 
459  connect(mpThread, SIGNAL(finished()), this, SLOT(exportSBMLFinished()));
460  mpThread->start();
461 }
void exportSBMLRun()
static CProgressBar * create(QWidget *parent=0, const char *name=0, Qt::WindowModality windowModality=Qt::WindowModal)
bool mSBMLExportIncomplete
Definition: DataModelGUI.h:152
CQThread * mpThread
Definition: DataModelGUI.h:143
std::string mFileName
Definition: DataModelGUI.h:148
void exportSBMLFinished()
void finished(bool success)
CProgressBar * mpProgressBar
Definition: DataModelGUI.h:144
bool mSBMLExportCOPASIMIRIAM
Definition: DataModelGUI.h:153
void DataModelGUI::exportSBMLFinished ( )
slot

Definition at line 477 of file DataModelGUI.cpp.

References CRecentFiles::addFile(), finished(), CCopasiRootContainer::getConfiguration(), CConfigurationFile::getRecentSBMLFiles(), mFileName, mpThread, mSuccess, and threadFinished().

Referenced by exportSBML().

478 {
479  if (mSuccess)
481 
482  disconnect(mpThread, SIGNAL(finished()), this, SLOT(exportSBMLFinished()));
483 
484  threadFinished();
485 }
void threadFinished()
CQThread * mpThread
Definition: DataModelGUI.h:143
std::string mFileName
Definition: DataModelGUI.h:148
void exportSBMLFinished()
static CConfigurationFile * getConfiguration()
void finished(bool success)
void addFile(const std::string &file)
CRecentFiles & getRecentSBMLFiles()
void DataModelGUI::exportSBMLRun ( )

Definition at line 463 of file DataModelGUI.cpp.

References exportSBML(), CCopasiRootContainer::getDatamodelList(), mFileName, mOverWrite, mpProgressBar, mSBMLExportCOPASIMIRIAM, mSBMLExportIncomplete, mSBMLLevel, mSBMLVersion, and mSuccess.

Referenced by exportSBML().

464 {
465  try
466  {
467  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
469  }
470 
471  catch (...)
472  {
473  mSuccess = false;
474  }
475 }
bool mSBMLExportIncomplete
Definition: DataModelGUI.h:152
void exportSBML(const std::string &fileName, bool overwriteFile, int sbmlLevel, int sbmlVersion, bool exportIncomplete, bool exportCOPASIMIRIAM=true)
std::string mFileName
Definition: DataModelGUI.h:148
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
CProgressBar * mpProgressBar
Definition: DataModelGUI.h:144
bool mSBMLExportCOPASIMIRIAM
Definition: DataModelGUI.h:153
void DataModelGUI::exportSBMLToString ( std::string &  sbmlDocumentText)

Definition at line 395 of file DataModelGUI.cpp.

References CProgressBar::create(), exportSBMLToStringFinished(), exportSBMLToStringRun(), finished(), mpProgressBar, mpSBMLExportString, mpThread, and mSuccess.

Referenced by CopasiUI3Window::exportSBMLToString(), and exportSBMLToStringRun().

396 {
398 
399  mSuccess = true;
400  mpSBMLExportString = & sbmlDocumentText;
401 
403  connect(mpThread, SIGNAL(finished()), this, SLOT(exportSBMLToStringFinished()));
404  mpThread->start();
405 }
void exportSBMLToStringFinished()
void exportSBMLToStringRun()
static CProgressBar * create(QWidget *parent=0, const char *name=0, Qt::WindowModality windowModality=Qt::WindowModal)
CQThread * mpThread
Definition: DataModelGUI.h:143
void finished(bool success)
std::string * mpSBMLExportString
Definition: DataModelGUI.h:147
CProgressBar * mpProgressBar
Definition: DataModelGUI.h:144
void DataModelGUI::exportSBMLToStringFinished ( )
slot

Definition at line 421 of file DataModelGUI.cpp.

References finished(), mpThread, and threadFinished().

Referenced by exportSBMLToString().

422 {
423  disconnect(mpThread, SIGNAL(finished()), this, SLOT(exportSBMLToStringFinished()));
424 
425  threadFinished();
426 }
void threadFinished()
void exportSBMLToStringFinished()
CQThread * mpThread
Definition: DataModelGUI.h:143
void finished(bool success)
void DataModelGUI::exportSBMLToStringRun ( )

Definition at line 407 of file DataModelGUI.cpp.

References exportSBMLToString(), CCopasiRootContainer::getDatamodelList(), mpProgressBar, mpSBMLExportString, and mSuccess.

Referenced by exportSBMLToString().

408 {
409  try
410  {
411  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
413  }
414 
415  catch (...)
416  {
417  mSuccess = false;
418  }
419 }
std::string * mpSBMLExportString
Definition: DataModelGUI.h:147
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
CProgressBar * mpProgressBar
Definition: DataModelGUI.h:144
void exportSBMLToString(std::string &sbmlDocumentText)
void DataModelGUI::finished ( bool  success)
signal
COutputDefinitionVector& DataModelGUI::getPlotDefinitionList ( )
void DataModelGUI::importCellDesigner ( )

This method tries to import CellDesigner annotations.

Definition at line 782 of file DataModelGUI.cpp.

References CListOfLayouts::addLayout(), SBMLDocumentLoader::createLayout(), CCellDesignerImporter::determineVersion(), CCellDesignerImporter::findCellDesignerAnnotation(), CCellDesignerImporter::findCellDesignerNamespace(), CCopasiDataModel::getCopasi2SBMLMap(), CCopasiDataModel::getCurrentSBMLDocument(), CCopasiRootContainer::getDatamodelList(), SBMLUtils::getIdFromSBase(), CCellDesignerImporter::getLayout(), CCopasiDataModel::getListOfLayouts(), CQMessageBox::question(), CCopasiMessage::RAW, and CCopasiMessage::WARNING.

Referenced by importSBMLFinished(), and importSBMLFromStringFinished().

783 {
784  // add code to check for CellDesigner annotations
785  // ask the user if the annotations should be imported
787  assert(pDataModel != NULL);
788 
789  if (pDataModel != NULL)
790  {
791  SBMLDocument* pSBMLDocument = pDataModel->getCurrentSBMLDocument();
792 
793  if (pSBMLDocument != NULL &&
794  pSBMLDocument->getModel() != NULL &&
795  pSBMLDocument->getModel()->getAnnotation() != NULL)
796  {
797  // check for the CellDesigner namespace
798  std::pair<bool, std::string> foundNamespace = CCellDesignerImporter::findCellDesignerNamespace(pSBMLDocument);
799 
800  if (foundNamespace.first == true)
801  {
802  const XMLNode* pAnno = CCellDesignerImporter::findCellDesignerAnnotation(pSBMLDocument, pSBMLDocument->getModel()->getAnnotation());
803 
804  // first we check if there are supported cell designer annotations
805  if (pAnno != NULL)
806  {
807  // check if the file contains the correct version
808  double version = CCellDesignerImporter::determineVersion(pAnno);
809 
810  if (version < 4.0)
811  {
812  CCopasiMessage(CCopasiMessage::RAW, "CellDesigner annotation was found in the file, but the version is not supported.\nPlease open the file in the latest version of CellDesigner and save it again.");
813  }
814  else
815  {
816  bool importCD = false;
817 #if LIBSBML_VERSION >= 50400
818  // if we don't have a layout import it!
819  LayoutModelPlugin* mplugin = (LayoutModelPlugin*)pSBMLDocument->getModel()->getPlugin("layout");
820 
821  if (mplugin == NULL || (mplugin != NULL && mplugin->getNumLayouts() == 0))
822  importCD = true;
823 
824 #endif
825 
826  // ask the user if the CellDesigner annotation should be imported
827  if (importCD || CQMessageBox::question(NULL, "CellDesigner import", "A CellDesigner diagram was found in this file.\nDo you want to import the diagram?" , QMessageBox::Yes | QMessageBox::No , QMessageBox::No) == QMessageBox::Yes)
828  {
829  // do the import
830  CCellDesignerImporter cd_importer(pSBMLDocument);
831 
832  if (cd_importer.getLayout() == NULL)
833  {
834  CCopasiMessage(CCopasiMessage::WARNING, "Sorry, CellDesigner annotations could not be imported.");
835  }
836  else
837  {
838  // now we have to import the created layout
839  // create the model map
840  std::string s1, s2;
841  std::map<std::string, std::string> modelmap;
842  std::map<CCopasiObject*, SBase*>::const_iterator it;
843  std::map<CCopasiObject*, SBase*>::const_iterator itEnd = pDataModel->getCopasi2SBMLMap().end();
844 
845  for (it = pDataModel->getCopasi2SBMLMap().begin(); it != itEnd; ++it)
846  {
847  s1 = SBMLUtils::getIdFromSBase(it->second);
848 
849  if (it->first)
850  {
851  s2 = it->first->getKey();
852  }
853  else
854  {
855  s2 = "";
856  }
857 
858  if ((s1 != "") && (s2 != ""))
859  {
860  modelmap[s1] = s2;
861  }
862  }
863 
864  // the layout map and the id to key map can be empty
865  std::map<std::string, std::string> layoutmap;
866  std::map<std::string, std::string> idToKeyMap;
867  CLayout* pLayout = SBMLDocumentLoader::createLayout(*cd_importer.getLayout(), modelmap, layoutmap, idToKeyMap);
868 
869  // add the layout to the DataModel
870  if (pLayout != NULL && pDataModel->getListOfLayouts() != NULL)
871  {
872  // the addLayout methods expects a map as the second argument which currently is
873  // ignored, so we just pass an empty one
874  // TODO maybe the methods actually expects one of the maps above (layoutmap or idToKeyMap), but
875  // TODO this is not documented in CListOfLayouts
876  std::map<std::string, std::string> tmp;
877  pDataModel->getListOfLayouts()->addLayout(pLayout, tmp);
878  }
879  else
880  {
881  CCopasiMessage(CCopasiMessage::WARNING, "Sorry, Layout from CellDesigner annotations could not be created.");
882  }
883  }
884  }
885  }
886  }
887  else
888  {
889  CCopasiMessage(CCopasiMessage::RAW, "CellDesigner annotation was found in the file, but the version is not supported.\nPlease open the file in the latest version of CellDesigner and save it again.");
890  }
891  }
892  }
893  }
894 }
SBMLDocument * getCurrentSBMLDocument()
static const XMLNode * findCellDesignerAnnotation(SBMLDocument *pDocument, const XMLNode *pAnnotation)
static CLayout * createLayout(const Layout &sbmlLayout, const std::map< std::string, std::string > &modelmap, std::map< std::string, std::string > &layoutmap, const std::map< std::string, std::string > &globalIdToKeyMap, const CCopasiContainer *pParent=NULL)
static std::pair< bool, std::string > findCellDesignerNamespace(const SBMLDocument *pDocument)
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
CListOfLayouts * getListOfLayouts()
void addLayout(CLayout *layout, const std::map< std::string, std::string > &m)
static std::string getIdFromSBase(const SBase *s)
Definition: SBMLUtils.cpp:32
static double determineVersion(const XMLNode *pNode)
std::map< CCopasiObject *, SBase * > & getCopasi2SBMLMap()
static StandardButton question(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
void DataModelGUI::importSBML ( const std::string &  fileName)

Definition at line 354 of file DataModelGUI.cpp.

References CProgressBar::create(), finished(), importSBMLFinished(), importSBMLRun(), mFileName, mpProgressBar, mpThread, and mSuccess.

Referenced by importSBMLRun(), and CopasiUI3Window::slotImportSBML().

355 {
357 
358  mSuccess = true;
359  mFileName = fileName;
361  connect(mpThread, SIGNAL(finished()), this, SLOT(importSBMLFinished()));
362  mpThread->start();
363 }
static CProgressBar * create(QWidget *parent=0, const char *name=0, Qt::WindowModality windowModality=Qt::WindowModal)
CQThread * mpThread
Definition: DataModelGUI.h:143
std::string mFileName
Definition: DataModelGUI.h:148
void importSBMLFinished()
void finished(bool success)
CProgressBar * mpProgressBar
Definition: DataModelGUI.h:144
void importSBMLRun()
void DataModelGUI::importSBMLFinished ( )
slot

Definition at line 379 of file DataModelGUI.cpp.

References CRecentFiles::addFile(), finished(), CCopasiRootContainer::getConfiguration(), CCopasiRootContainer::getDatamodelList(), getPlotDefinitionList(), CConfigurationFile::getRecentSBMLFiles(), importCellDesigner(), linkDataModelToGUI(), mFileName, mOutputHandlerPlot, mpThread, mSuccess, COutputHandlerPlot::setOutputDefinitionVector(), and threadFinished().

Referenced by importSBML().

380 {
381  if (mSuccess)
382  {
383  this->importCellDesigner();
385 
388  }
389 
390  disconnect(mpThread, SIGNAL(finished()), this, SLOT(importSBMLFinished()));
391 
392  threadFinished();
393 }
void threadFinished()
COutputHandlerPlot mOutputHandlerPlot
Definition: DataModelGUI.h:137
COutputDefinitionVector & getPlotDefinitionList()
CQThread * mpThread
Definition: DataModelGUI.h:143
std::string mFileName
Definition: DataModelGUI.h:148
void importSBMLFinished()
static CConfigurationFile * getConfiguration()
void finished(bool success)
void addFile(const std::string &file)
void setOutputDefinitionVector(COutputDefinitionVector *pDefinitionVector)
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
CRecentFiles & getRecentSBMLFiles()
void linkDataModelToGUI()
void importCellDesigner()
void DataModelGUI::importSBMLFromString ( const std::string &  sbmlDocumentText)

Definition at line 290 of file DataModelGUI.cpp.

References CProgressBar::create(), finished(), importSBMLFromStringFinished(), importSBMLFromStringRun(), mpProgressBar, mpThread, mSBMLImportString, and mSuccess.

Referenced by CopasiUI3Window::importSBMLFromString(), and importSBMLFromStringRun().

291 {
293 
294  mSuccess = true;
295  mSBMLImportString = sbmlDocumentText;
296 
298  connect(mpThread, SIGNAL(finished()), this, SLOT(importSBMLFromStringFinished()));
299  mpThread->start();
300 }
void importSBMLFromStringRun()
static CProgressBar * create(QWidget *parent=0, const char *name=0, Qt::WindowModality windowModality=Qt::WindowModal)
void importSBMLFromStringFinished()
std::string mSBMLImportString
Definition: DataModelGUI.h:146
CQThread * mpThread
Definition: DataModelGUI.h:143
void finished(bool success)
CProgressBar * mpProgressBar
Definition: DataModelGUI.h:144
void DataModelGUI::importSBMLFromStringFinished ( )
slot

Definition at line 316 of file DataModelGUI.cpp.

References finished(), CCopasiRootContainer::getDatamodelList(), getPlotDefinitionList(), importCellDesigner(), linkDataModelToGUI(), mOutputHandlerPlot, mpThread, mSBMLImportString, mSuccess, COutputHandlerPlot::setOutputDefinitionVector(), and threadFinished().

Referenced by importSBMLFromString().

317 {
318  mSBMLImportString = "";
319 
320  if (mSuccess)
321  {
322  // can't run this in a separate thread because it uses GUI routines
323  // TODO maybe put the main part of this routine in a separate thread after
324  // TODO asking the user
325  this->importCellDesigner();
328  }
329 
330  disconnect(mpThread, SIGNAL(finished()), this, SLOT(importSBMLFromStringFinished()));
331 
332  threadFinished();
333 }
void threadFinished()
COutputHandlerPlot mOutputHandlerPlot
Definition: DataModelGUI.h:137
COutputDefinitionVector & getPlotDefinitionList()
void importSBMLFromStringFinished()
std::string mSBMLImportString
Definition: DataModelGUI.h:146
CQThread * mpThread
Definition: DataModelGUI.h:143
void finished(bool success)
void setOutputDefinitionVector(COutputDefinitionVector *pDefinitionVector)
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
void linkDataModelToGUI()
void importCellDesigner()
void DataModelGUI::importSBMLFromStringRun ( )

Definition at line 302 of file DataModelGUI.cpp.

References CCopasiRootContainer::getDatamodelList(), importSBMLFromString(), mpProgressBar, mSBMLImportString, and mSuccess.

Referenced by importSBMLFromString().

303 {
304  try
305  {
306  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
308  }
309 
310  catch (...)
311  {
312  mSuccess = false;
313  }
314 }
std::string mSBMLImportString
Definition: DataModelGUI.h:146
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
CProgressBar * mpProgressBar
Definition: DataModelGUI.h:144
void importSBMLFromString(const std::string &sbmlDocumentText)
void DataModelGUI::importSBMLRun ( )

Definition at line 365 of file DataModelGUI.cpp.

References CCopasiRootContainer::getDatamodelList(), importSBML(), mFileName, mpProgressBar, and mSuccess.

Referenced by importSBML().

366 {
367  try
368  {
369  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
371  }
372 
373  catch (...)
374  {
375  mSuccess = false;
376  }
377 }
void importSBML(const std::string &fileName)
std::string mFileName
Definition: DataModelGUI.h:148
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
CProgressBar * mpProgressBar
Definition: DataModelGUI.h:144
void DataModelGUI::linkDataModelToGUI ( )
private

Definition at line 123 of file DataModelGUI.cpp.

References CCopasiDataModel::deleteOldData(), CCopasiRootContainer::getDatamodelList(), and mListViews.

Referenced by createModel(), importSBMLFinished(), importSBMLFromStringFinished(), and loadModelFinished().

124 {
125  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
127  assert(pDataModel != NULL);
128 
129  std::set< ListViews * >::iterator it = mListViews.begin();
130  std::set< ListViews * >::iterator end = mListViews.end();
131 
132  for (; it != end; ++it)
133  {
134  (*it)->setDataModel(this);
135  }
136 
137  pDataModel->deleteOldData();
138 }
std::set< ListViews * > mListViews
Definition: DataModelGUI.h:138
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
void DataModelGUI::loadFunctionDB ( const std::string &  fileName)

Definition at line 344 of file DataModelGUI.cpp.

References ListViews::DELETE, ListViews::FUNCTION, CCopasiRootContainer::getFunctionList(), CFunctionDB::load(), and notify().

Referenced by CopasiUI3Window::slotFunctionDBLoad().

345 {
347 
348  if (pFunctionDB == NULL) return;
349 
350  if (pFunctionDB->load(fileName))
352 }
bool notify(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
static CFunctionDB * getFunctionList()
void DataModelGUI::loadModel ( const std::string &  fileName)

Definition at line 212 of file DataModelGUI.cpp.

References CProgressBar::create(), finished(), loadModelFinished(), loadModelRun(), mFileName, mpProgressBar, mpThread, and mSuccess.

Referenced by loadModelRun(), and CopasiUI3Window::slotFileOpen().

213 {
215 
216  mSuccess = true;
217  mFileName = fileName;
218 
220  connect(mpThread, SIGNAL(finished()), this, SLOT(loadModelFinished()));
221  mpThread->start();
222 }
static CProgressBar * create(QWidget *parent=0, const char *name=0, Qt::WindowModality windowModality=Qt::WindowModal)
CQThread * mpThread
Definition: DataModelGUI.h:143
std::string mFileName
Definition: DataModelGUI.h:148
void loadModelFinished()
void finished(bool success)
CProgressBar * mpProgressBar
Definition: DataModelGUI.h:144
void loadModelRun()
void DataModelGUI::loadModelFinished ( )
slot

Definition at line 238 of file DataModelGUI.cpp.

References CRecentFiles::addFile(), finished(), CCopasiRootContainer::getConfiguration(), CCopasiRootContainer::getDatamodelList(), getPlotDefinitionList(), CConfigurationFile::getRecentFiles(), linkDataModelToGUI(), mFileName, mOutputHandlerPlot, mpThread, mSuccess, COutputHandlerPlot::setOutputDefinitionVector(), and threadFinished().

Referenced by loadModel().

239 {
240  if (mSuccess)
241  {
243 
246  }
247 
248  disconnect(mpThread, SIGNAL(finished()), this, SLOT(loadModelFinished()));
249 
250  threadFinished();
251 }
void threadFinished()
COutputHandlerPlot mOutputHandlerPlot
Definition: DataModelGUI.h:137
COutputDefinitionVector & getPlotDefinitionList()
CRecentFiles & getRecentFiles()
CQThread * mpThread
Definition: DataModelGUI.h:143
std::string mFileName
Definition: DataModelGUI.h:148
void loadModelFinished()
static CConfigurationFile * getConfiguration()
void finished(bool success)
void addFile(const std::string &file)
void setOutputDefinitionVector(COutputDefinitionVector *pDefinitionVector)
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
void linkDataModelToGUI()
void DataModelGUI::loadModelRun ( )

Definition at line 224 of file DataModelGUI.cpp.

References CCopasiRootContainer::getDatamodelList(), loadModel(), mFileName, mpProgressBar, and mSuccess.

Referenced by loadModel().

225 {
226  try
227  {
228  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
230  }
231 
232  catch (...)
233  {
234  mSuccess = false;
235  }
236 }
void loadModel(const std::string &fileName)
std::string mFileName
Definition: DataModelGUI.h:148
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
CProgressBar * mpProgressBar
Definition: DataModelGUI.h:144
void DataModelGUI::miriamDownloadFinished ( QNetworkReply *  reply)
slot

Definition at line 522 of file DataModelGUI.cpp.

References finished(), COptions::getValue(), mDownloadedBytes, mpMiriamResources, mpProgressBar, mUpdateItem, pdelete, CProgressBar::progressItem(), and CMIRIAMResources::updateMIRIAMResourcesFromFile().

Referenced by updateMIRIAM().

523 {
524  bool success = true;
525  mDownloadedBytes = 100;
527 
528  CMIRIAMResources & miriamResources = *mpMiriamResources;
529 
530  if (reply != NULL && reply->error() == QNetworkReply::NoError)
531  {
532  std::string filename;
533  COptions::getValue("ConfigDir", filename);
534  filename += "/miriam.xml";
535 
536  QFile *miriamFile = new QFile(filename.c_str());
537 
538  if (miriamFile->open(QFile::WriteOnly))
539  {
540  miriamFile->write(reply->readAll());
541  miriamFile->flush();
542  miriamFile->close();
543  success = miriamResources.updateMIRIAMResourcesFromFile(mpProgressBar, filename);
544  }
545 
546  delete miriamFile;
547  }
548  else
549  {
550  success = false;
551  }
552 
553  reply->deleteLater();
554 
556 
557  // notify UI to pick up
558  emit finished(success);
559 }
CMIRIAMResources * mpMiriamResources
Definition: DataModelGUI.h:155
#define pdelete(p)
Definition: copasi.h:215
virtual bool progressItem(const size_t &handle)
size_t mUpdateItem
Definition: DataModelGUI.h:158
bool updateMIRIAMResourcesFromFile(CProcessReport *pProcessReport, const std::string &filename)
unsigned int mDownloadedBytes
Definition: DataModelGUI.h:156
void finished(bool success)
CProgressBar * mpProgressBar
Definition: DataModelGUI.h:144
static void getValue(const std::string &name, CType &value)
Definition: COptions.h:124
void DataModelGUI::miriamDownloadProgress ( qint64  received,
qint64  total 
)
slot

Definition at line 561 of file DataModelGUI.cpp.

References mDownloadedBytes, mpProgressBar, mUpdateItem, and CProgressBar::progressItem().

Referenced by updateMIRIAM().

562 {
563  if (total != -1)
564  {
565  mDownloadedBytes = 100 * double(received) / double(total);
566  }
567  else
568  {
570  }
571 
573  {
574  QNetworkReply *reply = dynamic_cast<QNetworkReply*>(sender());
575 
576  if (reply != NULL) reply->abort();
577  }
578 }
virtual bool progressItem(const size_t &handle)
size_t mUpdateItem
Definition: DataModelGUI.h:158
unsigned int mDownloadedBytes
Definition: DataModelGUI.h:156
CProgressBar * mpProgressBar
Definition: DataModelGUI.h:144
bool DataModelGUI::notify ( ListViews::ObjectType  objectType,
ListViews::Action  action,
const std::string &  key = "" 
)

Definition at line 607 of file DataModelGUI.cpp.

References mpProgressBar, notifyView(), refreshInitialValues(), and ListViews::RENAME.

Referenced by CopasiUI3Window::importSBMLFromString(), loadFunctionDB(), CQReportDefinitionSelect::loadReportDefinitionVector(), CopasiUI3Window::newDoc(), CopasiWidget::protectedNotify(), CopasiUI3Window::slotApplyInitialState(), CopasiUI3Window::slotConvertToIrreversible(), CopasiUI3Window::slotExpandModel(), CopasiUI3Window::slotFileOpen(), CopasiUI3Window::slotFileOpenFinished(), CopasiUI3Window::slotImportSBML(), CopasiUI3Window::slotImportSBMLFinished(), CopasiUI3Window::slotImportSBMLFromStringFinished(), and CopasiUI3Window::slotUpdateInitialState().

608 {
609  // The GUI is inactive whenever a progress bar exist. We wait with updates
610  // until then.
611  if (mpProgressBar != NULL) return false;
612 
613  // update all initial value
614  if (action != ListViews::RENAME)
616 
617  emit notifyView(objectType, action, key);
618 
619  return true;
620 }
objectType
void notifyView(ListViews::ObjectType objectType, ListViews::Action action, std::string key="")
void refreshInitialValues()
CProgressBar * mpProgressBar
Definition: DataModelGUI.h:144
void DataModelGUI::notifyView ( ListViews::ObjectType  objectType,
ListViews::Action  action,
std::string  key = "" 
)
signal

Referenced by notify().

void DataModelGUI::refreshInitialValues ( )

Definition at line 728 of file DataModelGUI.cpp.

References buildChangedObjects(), CCopasiRootContainer::getDatamodelList(), mUpdateVector, and CModel::refreshActiveParameterSet().

Referenced by notify(), CopasiSlider::setValue(), SliderDialog::updateAllSliders(), and CopasiSlider::updateValue().

729 {
731 
732  std::vector< Refresh * >::iterator it = mUpdateVector.begin();
733  std::vector< Refresh * >::iterator end = mUpdateVector.end();
734 
735  for (; it != end; ++it)
736  (**it)();
737 
738  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
739  CModel * pModel = (*CCopasiRootContainer::getDatamodelList())[0]->getModel();
740 
741  pModel->refreshActiveParameterSet();
742 }
void buildChangedObjects()
std::vector< Refresh * > mUpdateVector
Definition: DataModelGUI.h:140
void refreshActiveParameterSet()
Definition: CModel.cpp:1105
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
Definition: CModel.h:50
void DataModelGUI::registerListView ( ListViews pListView)

Definition at line 622 of file DataModelGUI.cpp.

References mListViews, and ListViews::setDataModel().

Referenced by CopasiUI3Window::CopasiUI3Window().

623 {
624  pListView->setDataModel(this);
625  mListViews.insert(pListView);
626 }
void setDataModel(DataModelGUI *pDM)
Definition: listviews.cpp:267
std::set< ListViews * > mListViews
Definition: DataModelGUI.h:138
void DataModelGUI::saveFunctionDB ( const std::string &  fileName)

Definition at line 335 of file DataModelGUI.cpp.

References CCopasiRootContainer::getFunctionList(), and CFunctionDB::save().

Referenced by CopasiUI3Window::slotFunctionDBSave().

336 {
338 
339  if (pFunctionDB == NULL) return;
340 
341  pFunctionDB->save(fileName);
342 }
static CFunctionDB * getFunctionList()
bool save(const std::string &fileName)
Definition: CFunctionDB.cpp:91
void DataModelGUI::saveModel ( const std::string &  fileName,
bool  overwriteFile = false 
)

Definition at line 253 of file DataModelGUI.cpp.

References CProgressBar::create(), finished(), mFileName, mOverWrite, mpProgressBar, mpThread, mSuccess, saveModelFinished(), and saveModelRun().

Referenced by saveModelRun(), CopasiUI3Window::slotFileSave(), and CopasiUI3Window::slotFileSaveAs().

254 {
256 
257  mSuccess = true;
258  mFileName = fileName;
259  mOverWrite = overwriteFile;
260 
262  connect(mpThread, SIGNAL(finished()), this, SLOT(saveModelFinished()));
263  mpThread->start();
264 }
void saveModelRun()
static CProgressBar * create(QWidget *parent=0, const char *name=0, Qt::WindowModality windowModality=Qt::WindowModal)
CQThread * mpThread
Definition: DataModelGUI.h:143
std::string mFileName
Definition: DataModelGUI.h:148
void finished(bool success)
CProgressBar * mpProgressBar
Definition: DataModelGUI.h:144
void saveModelFinished()
void DataModelGUI::saveModelFinished ( )
slot

Definition at line 280 of file DataModelGUI.cpp.

References CRecentFiles::addFile(), finished(), CCopasiRootContainer::getConfiguration(), CConfigurationFile::getRecentFiles(), mFileName, mpThread, mSuccess, and threadFinished().

Referenced by saveModel().

281 {
282  if (mSuccess)
284 
285  disconnect(mpThread, SIGNAL(finished()), this, SLOT(saveModelFinished()));
286 
287  threadFinished();
288 }
void threadFinished()
CRecentFiles & getRecentFiles()
CQThread * mpThread
Definition: DataModelGUI.h:143
std::string mFileName
Definition: DataModelGUI.h:148
static CConfigurationFile * getConfiguration()
void finished(bool success)
void addFile(const std::string &file)
void saveModelFinished()
void DataModelGUI::saveModelRun ( )

Definition at line 266 of file DataModelGUI.cpp.

References CCopasiRootContainer::getDatamodelList(), mFileName, mOverWrite, mpProgressBar, mSuccess, and saveModel().

Referenced by saveModel().

267 {
268  try
269  {
270  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
272  }
273 
274  catch (...)
275  {
276  mSuccess = false;
277  }
278 }
std::string mFileName
Definition: DataModelGUI.h:148
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
CProgressBar * mpProgressBar
Definition: DataModelGUI.h:144
void saveModel(const std::string &fileName, bool overwriteFile=false)
void DataModelGUI::setFramework ( int  framework)

Definition at line 744 of file DataModelGUI.cpp.

References mFramework, and mListViews.

Referenced by CopasiUI3Window::slotFrameworkChanged().

745 {
746  mFramework = framework;
747 
748  std::set< ListViews * >::iterator it = mListViews.begin();
749  std::set< ListViews * >::iterator end = mListViews.end();
750 
751  for (; it != end; ++it)
752  {
753  (*it)->setFramework(mFramework);
754  }
755 }
std::set< ListViews * > mListViews
Definition: DataModelGUI.h:138
void DataModelGUI::threadFinished ( )
private

Definition at line 428 of file DataModelGUI.cpp.

References CProgressBar::finish(), finished(), mpProgressBar, mpThread, and mSuccess.

Referenced by exportMathModelFinished(), exportSBMLFinished(), exportSBMLToStringFinished(), importSBMLFinished(), importSBMLFromStringFinished(), loadModelFinished(), and saveModelFinished().

429 {
430  if (mpThread != NULL)
431  {
432  mpThread->deleteLater();
433  mpThread = NULL;
434  }
435 
436  if (mpProgressBar != NULL)
437  {
439  mpProgressBar->deleteLater();
440  mpProgressBar = NULL;
441  }
442 
443  emit finished(mSuccess);
444 }
CQThread * mpThread
Definition: DataModelGUI.h:143
void finished(bool success)
CProgressBar * mpProgressBar
Definition: DataModelGUI.h:144
virtual bool finish()
void DataModelGUI::updateCompleteView ( )
signal
bool DataModelGUI::updateMIRIAM ( CMIRIAMResources miriamResources)

Definition at line 580 of file DataModelGUI.cpp.

References CProgressBar::create(), finished(), mDownloadedBytes, mDownloadedTotalBytes, miriamDownloadFinished(), miriamDownloadProgress(), mpMiriamResources, mpProgressBar, mUpdateItem, and CProgressBar::setName().

Referenced by CopasiUI3Window::slotUpdateMIRIAM().

581 {
582  bool success = true;
583 
584  mpMiriamResources = &miriamResources;
585 
587  mpProgressBar->setName("MIRIAM Resources Update...");
589  mUpdateItem = ((CProcessReport*)mpProgressBar)->addItem("Download MIRIAM info", mDownloadedBytes, &mDownloadedTotalBytes);
590 
591  QNetworkAccessManager *manager = new QNetworkAccessManager(this);
592 
593  connect(manager, SIGNAL(finished(QNetworkReply*)),
594  this, SLOT(miriamDownloadFinished(QNetworkReply*)));
595 
596  QNetworkReply* reply = manager->get(QNetworkRequest(QUrl("http://www.ebi.ac.uk/miriam/main/export/xml/")));
597  connect(reply, SIGNAL(downloadProgress(qint64, qint64)),
598  this, SLOT(miriamDownloadProgress(qint64, qint64)));
599 
600  return success;
601 }
CMIRIAMResources * mpMiriamResources
Definition: DataModelGUI.h:155
static CProgressBar * create(QWidget *parent=0, const char *name=0, Qt::WindowModality windowModality=Qt::WindowModal)
void miriamDownloadProgress(qint64 received, qint64 total)
size_t mUpdateItem
Definition: DataModelGUI.h:158
void miriamDownloadFinished(QNetworkReply *)
unsigned int mDownloadedBytes
Definition: DataModelGUI.h:156
void finished(bool success)
virtual bool setName(const std::string &name)
CProgressBar * mpProgressBar
Definition: DataModelGUI.h:144
unsigned int mDownloadedTotalBytes
Definition: DataModelGUI.h:157
void DataModelGUI::updateMIRIAMResourceContents ( )

Definition at line 757 of file DataModelGUI.cpp.

References mListViews.

Referenced by CopasiUI3Window::slotUpdateMIRIAMFinished().

758 {
759  std::set< ListViews * >::iterator it = mListViews.begin();
760  std::set< ListViews * >::iterator end = mListViews.end();
761 
762  for (; it != end; ++it)
763  {
764  (*it)->updateMIRIAMResourceContents();
765  }
766 }
std::set< ListViews * > mListViews
Definition: DataModelGUI.h:138

Member Data Documentation

std::set< const CCopasiObject * > DataModelGUI::mChangedObjects
private

Definition at line 141 of file DataModelGUI.h.

Referenced by buildChangedObjects().

unsigned int DataModelGUI::mDownloadedBytes
private

Definition at line 156 of file DataModelGUI.h.

Referenced by miriamDownloadFinished(), miriamDownloadProgress(), and updateMIRIAM().

unsigned int DataModelGUI::mDownloadedTotalBytes
private

Definition at line 157 of file DataModelGUI.h.

Referenced by updateMIRIAM().

std::string DataModelGUI::mExportFormat
private

Definition at line 154 of file DataModelGUI.h.

Referenced by exportMathModel(), and exportMathModelRun().

std::string DataModelGUI::mFileName
private
int DataModelGUI::mFramework
private

Definition at line 139 of file DataModelGUI.h.

Referenced by buildChangedObjects(), and setFramework().

std::set< ListViews * > DataModelGUI::mListViews
private
COutputHandlerPlot DataModelGUI::mOutputHandlerPlot
private
bool DataModelGUI::mOverWrite
private
QApplication* DataModelGUI::mpApp
private

Definition at line 136 of file DataModelGUI.h.

CMIRIAMResources* DataModelGUI::mpMiriamResources
private

Definition at line 155 of file DataModelGUI.h.

Referenced by miriamDownloadFinished(), and updateMIRIAM().

CProgressBar* DataModelGUI::mpProgressBar
private
std::string* DataModelGUI::mpSBMLExportString
private

Definition at line 147 of file DataModelGUI.h.

Referenced by exportSBMLToString(), and exportSBMLToStringRun().

CQThread* DataModelGUI::mpThread
private
bool DataModelGUI::mSBMLExportCOPASIMIRIAM
private

Definition at line 153 of file DataModelGUI.h.

Referenced by exportSBML(), and exportSBMLRun().

bool DataModelGUI::mSBMLExportIncomplete
private

Definition at line 152 of file DataModelGUI.h.

Referenced by exportSBML(), and exportSBMLRun().

std::string DataModelGUI::mSBMLImportString
private
int DataModelGUI::mSBMLLevel
private

Definition at line 150 of file DataModelGUI.h.

Referenced by exportSBML(), and exportSBMLRun().

int DataModelGUI::mSBMLVersion
private

Definition at line 151 of file DataModelGUI.h.

Referenced by exportSBML(), and exportSBMLRun().

bool DataModelGUI::mSuccess
private
size_t DataModelGUI::mUpdateItem
private

Definition at line 158 of file DataModelGUI.h.

Referenced by miriamDownloadFinished(), miriamDownloadProgress(), and updateMIRIAM().

std::vector< Refresh * > DataModelGUI::mUpdateVector
private

Definition at line 140 of file DataModelGUI.h.

Referenced by buildChangedObjects(), and refreshInitialValues().


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