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

#include <CQAutolayoutWizard.h>

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

Public Member Functions

 CQAutolayoutWizard (const CModel &model, QWidget *parent=0, Qt::WindowFlags flags=0)
 
const std::set< const
CCompartment * > & 
getSelectedCompartments () const
 
const std::set< const CMetab * > & getSelectedMetabolites () const
 
const std::set< const
CReaction * > & 
getSelectedReactions () const
 
const std::set< const CMetab * > & getSideMetabolites () const
 
virtual int nextId () const
 
 ~CQAutolayoutWizard ()
 

Protected Types

enum  PageOrder {
  NO_PAGE = -1, SELECTION_PAGE_ID = 1, NO_SELECTION_ERROR_PAGE_ID = 2, SIDE_COMPOUND_PAGE_ID = 3,
  LAYOUT_PARAMETER_PAGE_ID = 4
}
 

Protected Slots

void slotCurrentIdChanged (int id)
 

Protected Member Functions

QWizardPage * createErrorPage ()
 
QWizardPage * createLayoutParameterPage ()
 
QWizardPage * createSelectionPage ()
 
QWizardPage * createSideCompoundPage ()
 
virtual void done (int result)
 

Protected Attributes

std::set< const CCompartment * > mCompartments
 
PageOrder mLastPageId
 
const CModelmModel
 
std::set< const CReaction * > mReactions
 
std::set< const CMetab * > mSideSpecies
 
std::set< const CMetab * > mSpecies
 

Detailed Description

Definition at line 213 of file CQAutolayoutWizard.h.

Member Enumeration Documentation

Enumerator
NO_PAGE 
SELECTION_PAGE_ID 
NO_SELECTION_ERROR_PAGE_ID 
SIDE_COMPOUND_PAGE_ID 
LAYOUT_PARAMETER_PAGE_ID 

Definition at line 218 of file CQAutolayoutWizard.h.

Constructor & Destructor Documentation

CQAutolayoutWizard::CQAutolayoutWizard ( const CModel model,
QWidget *  parent = 0,
Qt::WindowFlags  flags = 0 
)

Constructor needs a const reference to a COPASI model and a layout object that is filled by the wizard.

Constructor needs a const reference to a COPASI model.

Definition at line 890 of file CQAutolayoutWizard.cpp.

References createErrorPage(), createSelectionPage(), createSideCompoundPage(), NO_SELECTION_ERROR_PAGE_ID, SELECTION_PAGE_ID, SIDE_COMPOUND_PAGE_ID, and slotCurrentIdChanged().

890  :
891  QWizard(parent, flags)
892  , mModel(model)
894 {
895  this->setOptions(this->options() | QWizard::HaveFinishButtonOnEarlyPages);
896  this->setOptions(this->options() & ~QWizard::NoCancelButton);
897  this->setWindowTitle(tr("Autolayout Wizard"));
898  this->setPage(SELECTION_PAGE_ID, this->createSelectionPage());
899  this->setPage(NO_SELECTION_ERROR_PAGE_ID, this->createErrorPage());
900  this->setPage(SIDE_COMPOUND_PAGE_ID, this->createSideCompoundPage());
901  //this->setPage(LAYOUT_PARAMETER_PAGE_ID,this->createLayoutParameterPage());
902  connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotCurrentIdChanged(int)));
903 }
QWizardPage * createErrorPage()
QWizardPage * createSelectionPage()
void slotCurrentIdChanged(int id)
QWizardPage * createSideCompoundPage()
CQAutolayoutWizard::~CQAutolayoutWizard ( )

Definition at line 906 of file CQAutolayoutWizard.cpp.

907 {
908  // do nothing
909 }

Member Function Documentation

QWizardPage * CQAutolayoutWizard::createErrorPage ( )
protected

Definition at line 936 of file CQAutolayoutWizard.cpp.

Referenced by CQAutolayoutWizard().

QWizardPage * CQAutolayoutWizard::createLayoutParameterPage ( )
protected

Definition at line 929 of file CQAutolayoutWizard.cpp.

QWizardPage * CQAutolayoutWizard::createSelectionPage ( )
protected

Definition at line 913 of file CQAutolayoutWizard.cpp.

References mModel.

Referenced by CQAutolayoutWizard().

914 {
915  return new CQSelectionWizardPage(this->mModel);
916 }
QWizardPage * CQAutolayoutWizard::createSideCompoundPage ( )
protected

Definition at line 921 of file CQAutolayoutWizard.cpp.

Referenced by CQAutolayoutWizard().

void CQAutolayoutWizard::done ( int  result)
protectedvirtual

Definition at line 941 of file CQAutolayoutWizard.cpp.

References LAYOUT_PARAMETER_PAGE_ID, mCompartments, mReactions, mSideSpecies, mSpecies, SELECTION_PAGE_ID, and SIDE_COMPOUND_PAGE_ID.

942 {
943  // depending on the result, I have to update
944  // the selections
945  if (result == QDialog::Accepted)
946  {
947  // right now, the dialog can only be ended on the second page,
948  // so in theory we only have to update the side compounds
949  // But I would like to change the wizard so that the user is
950  // not forced to go through all pages and that he can close the
951  // wizard at each step
952  if (this->currentId() == CQAutolayoutWizard::SELECTION_PAGE_ID)
953  {
954  static_cast<CQSelectionWizardPage*>(this->currentPage())->fillContainers(this->mCompartments, this->mReactions, this->mSpecies);
955  }
956  else if (this->currentId() == CQAutolayoutWizard::SIDE_COMPOUND_PAGE_ID)
957  {
958  static_cast<CQSideCompoundWizardPage*>(this->currentPage())->getSideCompounds(this->mSideSpecies);
959  }
960  else if (this->currentId() == CQAutolayoutWizard::LAYOUT_PARAMETER_PAGE_ID)
961  {
962  // do nothing right now
963  }
964 
965  // make sure that the side species container does not contain
966  // any species that is not in the species container
967  std::set<const CMetab*>::iterator it = this->mSideSpecies.begin(), endit = this->mSideSpecies.end(), speciesEnd = this->mSpecies.end();
968 
969  while (it != endit)
970  {
971  if (this->mSpecies.find(*it) == speciesEnd)
972  {
973  // remove the item from the side species
974  // this is not very efficient, but should be ok since this code
975  // is probably not critical
976  this->mSideSpecies.erase(*it);
977  // back to start
978  it = this->mSideSpecies.begin();
979  endit = this->mSideSpecies.end();
980  continue;
981  }
982 
983  ++it;
984  }
985  }
986  else
987  {
988  this->mCompartments.clear();
989  this->mReactions.clear();
990  this->mSpecies.clear();
991  this->mSideSpecies.clear();
992  }
993 
994  this->QWizard::done(result);
995 }
std::set< const CReaction * > mReactions
std::set< const CMetab * > mSideSpecies
std::set< const CCompartment * > mCompartments
std::set< const CMetab * > mSpecies
const std::set<const CCompartment*>& CQAutolayoutWizard::getSelectedCompartments ( ) const
inline

Definition at line 260 of file CQAutolayoutWizard.h.

References mCompartments.

Referenced by CQLayoutsWidget::slotBtnNewClicked().

261  {
262  return this->mCompartments;
263  }
std::set< const CCompartment * > mCompartments
const std::set<const CMetab*>& CQAutolayoutWizard::getSelectedMetabolites ( ) const
inline

Definition at line 270 of file CQAutolayoutWizard.h.

References mSpecies.

Referenced by CQLayoutsWidget::slotBtnNewClicked().

271  {
272  return this->mSpecies;
273  }
std::set< const CMetab * > mSpecies
const std::set<const CReaction*>& CQAutolayoutWizard::getSelectedReactions ( ) const
inline

Definition at line 265 of file CQAutolayoutWizard.h.

References mReactions.

Referenced by CQLayoutsWidget::slotBtnNewClicked().

266  {
267  return this->mReactions;
268  }
std::set< const CReaction * > mReactions
const std::set<const CMetab*>& CQAutolayoutWizard::getSideMetabolites ( ) const
inline

Definition at line 275 of file CQAutolayoutWizard.h.

References mSideSpecies.

Referenced by CQLayoutsWidget::slotBtnNewClicked().

276  {
277  return this->mSideSpecies;
278  }
std::set< const CMetab * > mSideSpecies
int CQAutolayoutWizard::nextId ( ) const
virtual

Definition at line 1023 of file CQAutolayoutWizard.cpp.

References LAYOUT_PARAMETER_PAGE_ID, mCompartments, mReactions, mSpecies, NO_PAGE, NO_SELECTION_ERROR_PAGE_ID, SELECTION_PAGE_ID, and SIDE_COMPOUND_PAGE_ID.

1024 {
1025  PageOrder nextPage = NO_PAGE;
1026 
1027  switch (this->currentId())
1028  {
1029  case SELECTION_PAGE_ID:
1030  static_cast<CQSelectionWizardPage*>(this->currentPage())->fillContainers(this->mCompartments, this->mReactions, this->mSpecies);
1031 
1032  if (this->mCompartments.empty() && this->mSpecies.empty())
1033  {
1034  nextPage = NO_SELECTION_ERROR_PAGE_ID;
1035  }
1036  else
1037  {
1038  nextPage = SIDE_COMPOUND_PAGE_ID;
1039  }
1040 
1041  break;
1042 
1044  break;
1045 
1046  case SIDE_COMPOUND_PAGE_ID:
1047  //nextPage=LAYOUT_PARAMETER_PAGE_ID;
1048  break;
1049 
1051  break;
1052  }
1053 
1054  return nextPage;
1055 }
std::set< const CReaction * > mReactions
std::set< const CCompartment * > mCompartments
std::set< const CMetab * > mSpecies
void CQAutolayoutWizard::slotCurrentIdChanged ( int  id)
protectedslot

Definition at line 997 of file CQAutolayoutWizard.cpp.

References mLastPageId, mSideSpecies, mSpecies, SELECTION_PAGE_ID, and SIDE_COMPOUND_PAGE_ID.

Referenced by CQAutolayoutWizard().

998 {
999  // if the last id was the id of the selection widget, we
1000  // have to store the selection data
1002  {
1003  // this is now done in the nextId method
1004  //static_cast<CQSelectionWizardPage*>(this->page(CQAutolayoutWizard::SELECTION_PAGE_ID))->fillContainers(this->mCompartments,this->mReactions,this->mSpecies);
1005  }
1006  // if the last id is that of the side compound page,
1007  // we have to save the side compounds
1009  {
1010  static_cast<CQSideCompoundWizardPage*>(this->page(CQAutolayoutWizard::SIDE_COMPOUND_PAGE_ID))->getSideCompounds(this->mSideSpecies);
1011  }
1012 
1013  // if we are in the side compound page,
1014  // we have to update the species
1016  {
1017  static_cast<CQSideCompoundWizardPage*>(this->page(CQAutolayoutWizard::SIDE_COMPOUND_PAGE_ID))->setSpeciesList(this->mSpecies);
1018  }
1019 
1020  this->mLastPageId = (PageOrder)id;
1021 }
std::set< const CMetab * > mSideSpecies
std::set< const CMetab * > mSpecies

Member Data Documentation

std::set<const CCompartment*> CQAutolayoutWizard::mCompartments
mutableprotected

Definition at line 239 of file CQAutolayoutWizard.h.

Referenced by done(), getSelectedCompartments(), and nextId().

PageOrder CQAutolayoutWizard::mLastPageId
protected

Definition at line 245 of file CQAutolayoutWizard.h.

Referenced by slotCurrentIdChanged().

const CModel& CQAutolayoutWizard::mModel
protected

Definition at line 227 of file CQAutolayoutWizard.h.

Referenced by createSelectionPage().

std::set<const CReaction*> CQAutolayoutWizard::mReactions
mutableprotected

Definition at line 242 of file CQAutolayoutWizard.h.

Referenced by done(), getSelectedReactions(), and nextId().

std::set<const CMetab*> CQAutolayoutWizard::mSideSpecies
mutableprotected

Definition at line 236 of file CQAutolayoutWizard.h.

Referenced by done(), getSideMetabolites(), and slotCurrentIdChanged().

std::set<const CMetab*> CQAutolayoutWizard::mSpecies
mutableprotected

Definition at line 231 of file CQAutolayoutWizard.h.

Referenced by done(), getSelectedMetabolites(), nextId(), and slotCurrentIdChanged().


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