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

#include <CQMiriamWidget.h>

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

Public Member Functions

 CQMiriamWidget (QWidget *parent=0, const char *name=0)
 
const CMIRIAMInfogetMIRIAMInfo () const
 
virtual bool leave ()
 
virtual bool update (ListViews::ObjectType objectType, ListViews::Action action, const std::string &key)
 
void updateResourcesList ()
 
 ~CQMiriamWidget ()
 
- 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 Slots

virtual void dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight)
 
virtual void slotBtnBrowseDescription (const QModelIndex &index)
 
virtual void slotBtnBrowseReference (const QModelIndex &index)
 
virtual void slotBtnClearClicked ()
 
virtual void slotBtnCopy ()
 
virtual void slotBtnDeleteClicked ()
 
virtual void slotCopyEvent ()
 
virtual void slotCreatedDTChanged (QDateTime newDT)
 
- Protected Slots inherited from CopasiWidget
virtual bool protectedNotify (ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
 

Protected Member Functions

virtual bool enterProtected ()
 
virtual void showEvent (QShowEvent *event)
 

Private Member Functions

void deleteSelectedAuthors ()
 
void deleteSelectedBiologicalDescriptions ()
 
void deleteSelectedModifieds ()
 
void deleteSelectedReferences ()
 
void keyPressEvent (QKeyEvent *ev)
 

Private Attributes

std::vector< CQBaseDataModel * > mDMs
 
std::string mKeyToCopy
 
CQBiologicalDescriptionDMmpBiologicalDescriptionDM
 
CQSortFilterProxyModelmpBiologicalDescriptionPDM
 
CQCreatorDMmpCreatorDM
 
CQSortFilterProxyModelmpCreatorPDM
 
CMIRIAMInfompMIRIAMInfo
 
CQModifiedDMmpModifiedDM
 
CQSortFilterProxyModelmpModifiedPDM
 
CQComboDelegatempPredicateDelegate
 
QStringList mPredicates
 
CQReferenceDMmpReferenceDM
 
CQSortFilterProxyModelmpReferencePDM
 
CQComboDelegatempResourceDelegate1
 
CQComboDelegatempResourceDelegate2
 
std::vector
< CQSortFilterProxyModel * > 
mProxyDMs
 
QStringList mReferences
 
QStringList mResources
 
std::vector< CQTableView * > mWidgets
 

Additional Inherited Members

- Protected Attributes inherited from CopasiWidget
int mFramework
 
bool mIgnoreUpdates
 
std::string mKey
 
CCopasiDataModelmpDataModel
 
ListViewsmpListView
 
CCopasiObjectmpObject
 

Detailed Description

Definition at line 28 of file CQMiriamWidget.h.

Constructor & Destructor Documentation

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

Definition at line 34 of file CQMiriamWidget.cpp.

References COL_RELATIONSHIP, COL_RESOURCE_BD, COL_RESOURCE_REFERENCE, COL_ROW_NUMBER, CRDFPredicate::copasi_encodes, CRDFPredicate::copasi_hasPart, CRDFPredicate::copasi_hasVersion, CRDFPredicate::copasi_is, CRDFPredicate::copasi_isEncodedBy, CRDFPredicate::copasi_isHomologTo, CRDFPredicate::copasi_isPartOf, CRDFPredicate::copasi_isVersionOf, dataChanged(), FROM_UTF8, CRDFPredicate::getDisplayName(), mDMs, mpBiologicalDescriptionDM, mpBiologicalDescriptionPDM, mpCreatorDM, mpCreatorPDM, mpMIRIAMInfo, mpModifiedDM, mpModifiedPDM, mpPredicateDelegate, mPredicates, mpReferenceDM, mpReferencePDM, mpResourceDelegate1, mpResourceDelegate2, mProxyDMs, mReferences, mResources, mWidgets, CopasiWidget::protectedNotify(), slotBtnBrowseDescription(), slotBtnBrowseReference(), and updateResourcesList().

35  : CopasiWidget(parent, name),
36  mKeyToCopy("")
37 {
38  setupUi(this);
39 
40  // Create the MIRIAM Info
41  mpMIRIAMInfo = new CMIRIAMInfo();
42 
43  //Create Data Models for the 4 tables
48 
49  //Create Proxy Data Models for the 4 tables
54 
55  //Create Required Delegates
56  mpResourceDelegate1 = new CQComboDelegate(&mResources, this, false);
57  mpTblReferences->setItemDelegateForColumn(COL_RESOURCE_REFERENCE, mpResourceDelegate1);
58 
59  mpResourceDelegate2 = new CQComboDelegate(&mReferences, this, false);
60  mpTblDescription->setItemDelegateForColumn(COL_RESOURCE_BD, mpResourceDelegate2);
61 
62  mpPredicateDelegate = new CQComboDelegate(&mPredicates, this, false);
63  mpTblDescription->setItemDelegateForColumn(COL_RELATIONSHIP, mpPredicateDelegate);
64 
65  mWidgets.push_back(mpTblAuthors); mDMs.push_back(mpCreatorDM); mProxyDMs.push_back(mpCreatorPDM);
66  mWidgets.push_back(mpTblReferences); mDMs.push_back(mpReferenceDM); mProxyDMs.push_back(mpReferencePDM);
67  mWidgets.push_back(mpTblDescription); mDMs.push_back(mpBiologicalDescriptionDM); mProxyDMs.push_back(mpBiologicalDescriptionPDM);
68  mWidgets.push_back(mpTblModified); mDMs.push_back(mpModifiedDM); mProxyDMs.push_back(mpModifiedPDM);
69 
70  // Build the list of supported predicates
71  mPredicates.push_back("-- select --");
80 
81  std::vector<CQTableView*>::const_iterator it = mWidgets.begin();
82  std::vector<CQTableView*>::const_iterator end = mWidgets.end();
83 
84  std::vector<CQBaseDataModel*>::const_iterator itDM = mDMs.begin();
85  std::vector<CQBaseDataModel*>::const_iterator endDM = mDMs.end();
86 
87  std::vector<CQSortFilterProxyModel*>::const_iterator itPDM = mProxyDMs.begin();
88  std::vector<CQSortFilterProxyModel*>::const_iterator endPDM = mProxyDMs.end();
89 
90  for (; it != end && itDM != endDM && itPDM != endPDM; it++, itDM++, itPDM++)
91  {
92  //Set Proxy Data Model properties
93  (*itPDM)->setDynamicSortFilter(true);
94  (*itPDM)->setSortCaseSensitivity(Qt::CaseInsensitive);
95 
96  (*it)->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
97  (*it)->verticalHeader()->hide();
98  (*it)->sortByColumn(COL_ROW_NUMBER, Qt::AscendingOrder);
99 
100  connect((*itDM), SIGNAL(notifyGUI(ListViews::ObjectType, ListViews::Action, const std::string)),
101  this, SLOT(protectedNotify(ListViews::ObjectType, ListViews::Action, const std::string)));
102  connect((*itDM), SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
103  this, SLOT(dataChanged(const QModelIndex&, const QModelIndex&)));
104  }
105 
106  connect(mpTblDescription, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(slotBtnBrowseDescription(const QModelIndex&)));
107  connect(mpTblReferences, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(slotBtnBrowseReference(const QModelIndex&)));
108 
109  // Build the list of known resources
111 }
#define COL_RESOURCE_BD
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
CQSortFilterProxyModel * mpCreatorPDM
std::vector< CQSortFilterProxyModel * > mProxyDMs
CMIRIAMInfo * mpMIRIAMInfo
CQSortFilterProxyModel * mpModifiedPDM
CQSortFilterProxyModel * mpBiologicalDescriptionPDM
QStringList mResources
CQModifiedDM * mpModifiedDM
std::vector< CQTableView * > mWidgets
CQReferenceDM * mpReferenceDM
static const std::string & getDisplayName(const CRDFPredicate &predicate)
std::string mKeyToCopy
CopasiWidget(QWidget *parent=0, const char *name=0, Qt::WFlags f=0)
QStringList mReferences
#define COL_RESOURCE_REFERENCE
Definition: CQReferenceDM.h:26
virtual void slotBtnBrowseReference(const QModelIndex &index)
virtual bool protectedNotify(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
std::vector< CQBaseDataModel * > mDMs
CQCreatorDM * mpCreatorDM
CQComboDelegate * mpResourceDelegate2
CQComboDelegate * mpPredicateDelegate
#define COL_RELATIONSHIP
QStringList mPredicates
void updateResourcesList()
CQComboDelegate * mpResourceDelegate1
virtual void slotBtnBrowseDescription(const QModelIndex &index)
CQSortFilterProxyModel * mpReferencePDM
CQBiologicalDescriptionDM * mpBiologicalDescriptionDM
virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
#define COL_ROW_NUMBER
CQMiriamWidget::~CQMiriamWidget ( )

Definition at line 116 of file CQMiriamWidget.cpp.

References mpBiologicalDescriptionPDM, mpCreatorPDM, mpMIRIAMInfo, mpModifiedPDM, mpReferencePDM, and pdelete.

117 {
118  // no need to delete child widgets or objects, Qt does it all for us
124 }
#define pdelete(p)
Definition: copasi.h:215
CQSortFilterProxyModel * mpCreatorPDM
CMIRIAMInfo * mpMIRIAMInfo
CQSortFilterProxyModel * mpModifiedPDM
CQSortFilterProxyModel * mpBiologicalDescriptionPDM
CQSortFilterProxyModel * mpReferencePDM

Member Function Documentation

void CQMiriamWidget::dataChanged ( const QModelIndex &  topLeft,
const QModelIndex &  bottomRight 
)
protectedvirtualslot

Definition at line 444 of file CQMiriamWidget.cpp.

References mWidgets.

Referenced by CQMiriamWidget().

445 {
446  std::vector<CQTableView*>::const_iterator it = mWidgets.begin();
447  std::vector<CQTableView*>::const_iterator end = mWidgets.end();
448 
449  for (; it != end; it++)
450  (*it)->resizeColumnsToContents();
451 }
std::vector< CQTableView * > mWidgets
void CQMiriamWidget::deleteSelectedAuthors ( )
private

Definition at line 138 of file CQMiriamWidget.cpp.

References mpCreatorDM, mpCreatorPDM, and CQCreatorDM::removeRows().

Referenced by slotBtnDeleteClicked().

139 {
140  QModelIndexList selRows = mpTblAuthors->selectionModel()->selectedRows(0);
141 
142  if (selRows.empty())
143  {return;}
144 
145  QModelIndexList mappedSelRows;
146  QModelIndexList::const_iterator i;
147 
148  for (i = selRows.begin(); i != selRows.end(); ++i)
149  {mappedSelRows.append(mpCreatorPDM->mapToSource(*i));}
150 
151  mpCreatorDM->removeRows(mappedSelRows);
152 }
CQSortFilterProxyModel * mpCreatorPDM
CQCreatorDM * mpCreatorDM
bool removeRows(QModelIndexList rows, const QModelIndex &index=QModelIndex())
void CQMiriamWidget::deleteSelectedBiologicalDescriptions ( )
private

Definition at line 170 of file CQMiriamWidget.cpp.

References mpBiologicalDescriptionDM, mpBiologicalDescriptionPDM, and CQBiologicalDescriptionDM::removeRows().

Referenced by slotBtnDeleteClicked().

171 {
172 
173  QModelIndexList selRows = mpTblDescription->selectionModel()->selectedRows(0);
174 
175  if (selRows.empty())
176  {return;}
177 
178  QModelIndexList mappedSelRows;
179  QModelIndexList::const_iterator i;
180 
181  for (i = selRows.begin(); i != selRows.end(); ++i)
182  {mappedSelRows.append(mpBiologicalDescriptionPDM->mapToSource(*i));}
183 
184  mpBiologicalDescriptionDM->removeRows(mappedSelRows);
185 }
bool removeRows(QModelIndexList rows, const QModelIndex &index=QModelIndex())
CQSortFilterProxyModel * mpBiologicalDescriptionPDM
CQBiologicalDescriptionDM * mpBiologicalDescriptionDM
void CQMiriamWidget::deleteSelectedModifieds ( )
private

Definition at line 187 of file CQMiriamWidget.cpp.

References mpModifiedDM, mpModifiedPDM, and CQModifiedDM::removeRows().

Referenced by slotBtnDeleteClicked().

188 {
189 
190  QModelIndexList selRows = mpTblModified->selectionModel()->selectedRows(0);
191 
192  if (selRows.empty())
193  {return;}
194 
195  QModelIndexList mappedSelRows;
196  QModelIndexList::const_iterator i;
197 
198  for (i = selRows.begin(); i != selRows.end(); ++i)
199  {mappedSelRows.append(mpModifiedPDM->mapToSource(*i));}
200 
201  mpModifiedDM->removeRows(mappedSelRows);
202 }
CQSortFilterProxyModel * mpModifiedPDM
CQModifiedDM * mpModifiedDM
bool removeRows(QModelIndexList rows, const QModelIndex &index=QModelIndex())
void CQMiriamWidget::deleteSelectedReferences ( )
private

Definition at line 154 of file CQMiriamWidget.cpp.

References mpReferenceDM, mpReferencePDM, and CQReferenceDM::removeRows().

Referenced by slotBtnDeleteClicked().

155 {
156  QModelIndexList selRows = mpTblReferences->selectionModel()->selectedRows(0);
157 
158  if (selRows.empty())
159  {return;}
160 
161  QModelIndexList mappedSelRows;
162  QModelIndexList::const_iterator i;
163 
164  for (i = selRows.begin(); i != selRows.end(); ++i)
165  {mappedSelRows.append(mpReferencePDM->mapToSource(*i));}
166 
167  mpReferenceDM->removeRows(mappedSelRows);
168 }
CQReferenceDM * mpReferenceDM
CQSortFilterProxyModel * mpReferencePDM
bool removeRows(QModelIndexList rows, const QModelIndex &index=QModelIndex())
bool CQMiriamWidget::enterProtected ( )
protectedvirtual

Reimplemented from CopasiWidget.

Definition at line 401 of file CQMiriamWidget.cpp.

402 {
403  // loading is now deferred until the window is made visible
404  return true;
405 }
const CMIRIAMInfo & CQMiriamWidget::getMIRIAMInfo ( ) const

Definition at line 413 of file CQMiriamWidget.cpp.

References mpMIRIAMInfo.

414 {return *mpMIRIAMInfo;}
CMIRIAMInfo * mpMIRIAMInfo
void CQMiriamWidget::keyPressEvent ( QKeyEvent *  ev)
private

Definition at line 435 of file CQMiriamWidget.cpp.

References slotBtnDeleteClicked(), and slotCopyEvent().

436 {
437  if (ev->key() == Qt::Key_Delete)
439  else if (ev->key() == Qt::Key_C &&
440  (ev->modifiers() & Qt::ControlModifier))
441  slotCopyEvent();
442 }
virtual void slotBtnDeleteClicked()
virtual void slotCopyEvent()
bool CQMiriamWidget::leave ( )
virtual

Reimplemented from CopasiWidget.

Definition at line 407 of file CQMiriamWidget.cpp.

References mpMIRIAMInfo, and CMIRIAMInfo::save().

408 {
409  mpMIRIAMInfo->save();
410  return true;
411 }
CMIRIAMInfo * mpMIRIAMInfo
void CQMiriamWidget::showEvent ( QShowEvent *  event)
protectedvirtual

Definition at line 327 of file CQMiriamWidget.cpp.

References CAnnotation::castObject(), CCopasiMessage::clearDeque(), CQMessageBox::critical(), CCopasiMessage::ERROR, CCopasiMessage::EXCEPTION, FROM_UTF8, CCopasiMessage::getAllMessageText(), CMIRIAMInfo::getCreatedDT(), CCopasiMessage::getHighestSeverity(), CCopasiRootContainer::getKeyFactory(), CAnnotation::getMiriamAnnotation(), CMIRIAMInfo::load(), mDMs, CopasiWidget::mKey, mKeyToCopy, mpMIRIAMInfo, CopasiWidget::mpObject, mProxyDMs, mWidgets, CAnnotation::setMiriamAnnotation(), and CCopasiMessage::size().

328 {
329  if (!isVisible() || mKey.empty()) return;
330 
332 
333  if (mKeyToCopy != "")
334  {
335  CAnnotation * pAnnotation = CAnnotation::castObject(dynamic_cast< CCopasiObject * >(CCopasiRootContainer::getKeyFactory()->get(mKeyToCopy)));
336 
337  std::string pMiriamAnnotation = pAnnotation->getMiriamAnnotation();
338 
339  pAnnotation = CAnnotation::castObject(mpObject);
340 
341  pAnnotation->setMiriamAnnotation(pMiriamAnnotation, mKey, mKeyToCopy);
342 
343  mKeyToCopy = "";
344  }
345 
347 
348  //Set Models for the 4 TableViews
349  std::vector<CQTableView*>::const_iterator it = mWidgets.begin();
350  std::vector<CQTableView*>::const_iterator end = mWidgets.end();
351 
352  std::vector<CQBaseDataModel*>::const_iterator itDM = mDMs.begin();
353  std::vector<CQBaseDataModel*>::const_iterator endDM = mDMs.end();
354 
355  std::vector<CQSortFilterProxyModel*>::const_iterator itPDM = mProxyDMs.begin();
356  std::vector<CQSortFilterProxyModel*>::const_iterator endPDM = mProxyDMs.end();
357 
358  for (; it != end && itDM != endDM && itPDM != endPDM; it++, itDM++, itPDM++)
359  {
360  (*itPDM)->setSourceModel(*itDM);
361  (*it)->setModel(NULL);
362  (*it)->setModel(*itPDM);
363  (*it)->resizeColumnsToContents();
364  }
365 
366  QDateTime DTCreated;
367 
368  if (mpMIRIAMInfo->getCreatedDT() != "")
369  DTCreated = QDateTime::fromString(FROM_UTF8(mpMIRIAMInfo->getCreatedDT()), Qt::ISODate);
370 
371  if (DTCreated.isValid())
372  mpDTCreated->setDateTime(DTCreated);
373  else
374  {
375  mpDTCreated->setDateTime(QDateTime::currentDateTime());
376  }
377 
378  if (CCopasiMessage::size() > 0)
379  {
381  {
382  // we decided to not display the warning about not recognized terms
383  // at the last meeting
384  // case CCopasiMessage::WARNING:
385  // CQMessageBox::information(this, "Information", FROM_UTF8(CCopasiMessage::getAllMessageText()));
386  // break;
387 
391  break;
392 
393  default:
394  break;
395  }
396 
398  }
399 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
void load(const std::string &key="")
std::vector< CQSortFilterProxyModel * > mProxyDMs
CMIRIAMInfo * mpMIRIAMInfo
static std::string getAllMessageText(const bool &chronological=true)
CCopasiObject * mpObject
Definition: copasiWidget.h:64
void setMiriamAnnotation(const std::string &miriamAnnotation, const std::string &newId, const std::string &oldId)
std::vector< CQTableView * > mWidgets
const std::string & getMiriamAnnotation() const
static void clearDeque()
static CAnnotation * castObject(CCopasiObject *pObject)
Definition: CAnnotation.cpp:32
std::string mKeyToCopy
const std::string getCreatedDT() const
static size_t size()
std::vector< CQBaseDataModel * > mDMs
static CKeyFactory * getKeyFactory()
static StandardButton critical(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
std::string mKey
Definition: copasiWidget.h:63
static CCopasiMessage::Type getHighestSeverity()
void CQMiriamWidget::slotBtnBrowseDescription ( const QModelIndex &  index)
protectedvirtualslot

Definition at line 225 of file CQMiriamWidget.cpp.

References CMIRIAMInfo::getBiologicalDescriptions(), CMIRIAMResourceObject::getIdentifiersOrgURL(), CBiologicalDescription::getMIRIAMResourceObject(), mpMIRIAMInfo, openMiriamReference(), and CCopasiVector< T >::size().

Referenced by CQMiriamWidget().

226 {
227  if (mpMIRIAMInfo == NULL ||
228  index.column() > 1 ||
229  index.row() < 0 ||
230  index.row() >= (int)mpMIRIAMInfo->getBiologicalDescriptions().size())
231  return;
232 
233  const CBiologicalDescription *pRef = mpMIRIAMInfo->getBiologicalDescriptions()[index.row()];
234 
235  openMiriamReference(pRef->getMIRIAMResourceObject().getIdentifiersOrgURL() + "?profile=most_reliable");
236 }
CMIRIAMInfo * mpMIRIAMInfo
void openMiriamReference(const std::string &reference)
const CCopasiVector< CBiologicalDescription > & getBiologicalDescriptions() const
virtual size_t size() const
std::string getIdentifiersOrgURL() const
Definition: CConstants.cpp:138
const CMIRIAMResourceObject & getMIRIAMResourceObject() const
void CQMiriamWidget::slotBtnBrowseReference ( const QModelIndex &  index)
protectedvirtualslot

Definition at line 212 of file CQMiriamWidget.cpp.

References CMIRIAMResourceObject::getIdentifiersOrgURL(), CReference::getMIRIAMResourceObject(), CMIRIAMInfo::getReferences(), mpMIRIAMInfo, openMiriamReference(), and CCopasiVector< T >::size().

Referenced by CQMiriamWidget().

213 {
214  if (mpMIRIAMInfo == NULL ||
215  index.column() > 1 ||
216  index.row() < 0 ||
217  index.row() >= (int)mpMIRIAMInfo->getReferences().size())
218  return;
219 
220  const CReference *pRef = mpMIRIAMInfo->getReferences()[index.row()];
221 
222  openMiriamReference(pRef->getMIRIAMResourceObject().getIdentifiersOrgURL() + "?profile=most_reliable");
223 }
CMIRIAMInfo * mpMIRIAMInfo
void openMiriamReference(const std::string &reference)
virtual size_t size() const
const CMIRIAMResourceObject & getMIRIAMResourceObject() const
Definition: CReference.cpp:90
std::string getIdentifiersOrgURL() const
Definition: CConstants.cpp:138
const CCopasiVector< CReference > & getReferences() const
void CQMiriamWidget::slotBtnClearClicked ( )
protectedvirtualslot

Definition at line 238 of file CQMiriamWidget.cpp.

References CQBaseDataModel::clear(), mpBiologicalDescriptionDM, mpCreatorDM, mpModifiedDM, mpReferenceDM, and CQMessageBox::question().

239 {
240  if (mpDTCreated->hasFocus())
241  {
242  mpDTCreated->setDateTime(QDateTime::currentDateTime());
243  return;
244  }
245 
246  if (mpTblAuthors->hasFocus())
247  {
248  int ret = CQMessageBox::question(this, tr("Confirm Delete"), "Delete all Creators?",
249  QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
250 
251  if (ret == QMessageBox::Yes)
252  {
253  mpCreatorDM->clear();
254  }
255  }
256  else if (mpTblReferences->hasFocus())
257  {
258  int ret = CQMessageBox::question(this, tr("Confirm Delete"), "Delete all References?",
259  QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
260 
261  if (ret == QMessageBox::Yes)
262  {
263  mpReferenceDM->clear();
264  }
265  }
266  else if (mpTblDescription->hasFocus())
267  {
268  int ret = CQMessageBox::question(this, tr("Confirm Delete"), "Delete all Descriptions?",
269  QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
270 
271  if (ret == QMessageBox::Yes)
272  {
274  }
275  }
276  else if (mpTblModified->hasFocus())
277  {
278  int ret = CQMessageBox::question(this, tr("Confirm Delete"), "Delete all Date/Time Modifieds?",
279  QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
280 
281  if (ret == QMessageBox::Yes)
282  {
283  mpModifiedDM->clear();
284  }
285  }
286 }
virtual bool clear()
CQModifiedDM * mpModifiedDM
CQReferenceDM * mpReferenceDM
CQCreatorDM * mpCreatorDM
CQBiologicalDescriptionDM * mpBiologicalDescriptionDM
static StandardButton question(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
void CQMiriamWidget::slotBtnCopy ( )
protectedvirtualslot

Definition at line 511 of file CQMiriamWidget.cpp.

References CopasiWidget::mKey, and mKeyToCopy.

512 {
513  mKeyToCopy = mKey;
514 }
std::string mKeyToCopy
std::string mKey
Definition: copasiWidget.h:63
void CQMiriamWidget::slotBtnDeleteClicked ( )
protectedvirtualslot

Definition at line 126 of file CQMiriamWidget.cpp.

References deleteSelectedAuthors(), deleteSelectedBiologicalDescriptions(), deleteSelectedModifieds(), and deleteSelectedReferences().

Referenced by keyPressEvent().

127 {
128  if (mpTblAuthors->hasFocus())
130  else if (mpTblReferences->hasFocus())
132  else if (mpTblModified->hasFocus())
134  else if (mpTblDescription->hasFocus())
136 }
void deleteSelectedModifieds()
void deleteSelectedAuthors()
void deleteSelectedReferences()
void deleteSelectedBiologicalDescriptions()
void CQMiriamWidget::slotCopyEvent ( )
protectedvirtualslot

Definition at line 453 of file CQMiriamWidget.cpp.

References mpBiologicalDescriptionDM, mpBiologicalDescriptionPDM, mpCreatorDM, mpCreatorPDM, mpModifiedDM, mpModifiedPDM, mpReferenceDM, and mpReferencePDM.

Referenced by keyPressEvent().

454 {
455  CQSortFilterProxyModel* pProxyModel = NULL;
456  CQBaseDataModel* pBaseDM = NULL;
457  CQTableView* pTbl = NULL;
458 
459  if (mpTblAuthors->hasFocus())
460  {
461  pProxyModel = mpCreatorPDM;
462  pBaseDM = mpCreatorDM;
463  pTbl = mpTblAuthors;
464  }
465  else if (mpTblReferences->hasFocus())
466  {
467  pProxyModel = mpReferencePDM;
468  pBaseDM = mpReferenceDM;
469  pTbl = mpTblReferences;
470  }
471  else if (mpTblModified->hasFocus())
472  {
473  pProxyModel = mpModifiedPDM;
474  pBaseDM = mpModifiedDM;
475  pTbl = mpTblModified;
476  }
477  else if (mpTblDescription->hasFocus())
478  {
479  pProxyModel = mpBiologicalDescriptionPDM;
480  pBaseDM = mpBiologicalDescriptionDM;
481  pTbl = mpTblDescription;
482  }
483 
484  QModelIndexList selRows = pTbl->selectionModel()->selectedRows(0);
485 
486  if (selRows.empty())
487  {return;}
488 
489  QString str;
490  QModelIndexList::const_iterator i;
491 
492  for (i = selRows.begin(); i != selRows.end(); ++i)
493  {
494  for (int x = 0; x < pBaseDM->columnCount(); ++x)
495  {
496  if (!pTbl->isColumnHidden(x))
497  {
498  if (!str.isEmpty())
499  str += "\t";
500 
501  str += pBaseDM->index(pProxyModel->mapToSource(*i).row(), x).data().toString();
502  }
503  }
504 
505  str += "\n";
506  }
507 
508  QApplication::clipboard()->setText(str);
509 }
CQSortFilterProxyModel * mpCreatorPDM
CQSortFilterProxyModel * mpModifiedPDM
CQSortFilterProxyModel * mpBiologicalDescriptionPDM
CQModifiedDM * mpModifiedDM
CQReferenceDM * mpReferenceDM
CQCreatorDM * mpCreatorDM
CQSortFilterProxyModel * mpReferencePDM
CQBiologicalDescriptionDM * mpBiologicalDescriptionDM
void CQMiriamWidget::slotCreatedDTChanged ( QDateTime  newDT)
protectedvirtualslot

Definition at line 308 of file CQMiriamWidget.cpp.

References CMIRIAMInfo::getCreatedDT(), mpMIRIAMInfo, CMIRIAMInfo::setCreatedDT(), and TO_UTF8.

309 {
310  //Now update.
311  // Created at
312  std::string DT = "";
313 
314  if (newDT.isValid())
315  {
316  DT = TO_UTF8(newDT.toString(Qt::ISODate));
317  DT += "Z";
318 
319  if (DT != mpMIRIAMInfo->getCreatedDT())
320  {
322  }
323  }
324 }
CMIRIAMInfo * mpMIRIAMInfo
const std::string getCreatedDT() const
#define TO_UTF8(__x)
Definition: qtUtilities.h:74
void setCreatedDT(const std::string &dt)
bool CQMiriamWidget::update ( ListViews::ObjectType  objectType,
ListViews::Action  action,
const std::string &  key 
)
virtual

Reimplemented from CopasiWidget.

Definition at line 288 of file CQMiriamWidget.cpp.

References FROM_UTF8, CMIRIAMInfo::getCreatedDT(), CopasiWidget::getIgnoreUpdates(), CMIRIAMInfo::getKey(), CMIRIAMInfo::load(), ListViews::MIRIAM, and mpMIRIAMInfo.

289 {
290  if (getIgnoreUpdates())
291  return true;
292 
294  return true;
295 
296  if (key == "" || key != mpMIRIAMInfo->getKey())
297  return true;
298 
299  bool success = true;
300  mpMIRIAMInfo->load(key);
301 
302  if (mpMIRIAMInfo->getCreatedDT() != "")
303  mpDTCreated->setDateTime(QDateTime::fromString(FROM_UTF8(mpMIRIAMInfo->getCreatedDT()), Qt::ISODate));
304 
305  return success;
306 }
objectType
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
void load(const std::string &key="")
CMIRIAMInfo * mpMIRIAMInfo
virtual const std::string & getKey() const
const std::string getCreatedDT() const
bool getIgnoreUpdates()
void CQMiriamWidget::updateResourcesList ( )

Definition at line 416 of file CQMiriamWidget.cpp.

References FROM_UTF8, CCopasiRootContainer::getConfiguration(), CCopasiRootContainer::getDatamodelList(), CMIRIAMResource::getMIRIAMCitation(), CMIRIAMResource::getMIRIAMDisplayName(), CMIRIAMResources::getMIRIAMResource(), CConfigurationFile::getRecentMIRIAMResources(), CMIRIAMResources::getResourceList(), mReferences, mResources, and CCopasiParameterGroup::size().

Referenced by CQMiriamWidget().

417 {
418  mResources.clear();
419  mReferences.clear();
420  // Build the list of known resources
421  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
423  mResources.push_back("-- select --");
424  mReferences.push_back("-- select --");
425 
426  size_t i, imax = pResource->getResourceList().size();
427 
428  for (i = 0; i < imax; i++)
429  if (pResource->getMIRIAMResource(i).getMIRIAMCitation())
430  mResources.push_back(FROM_UTF8(pResource->getMIRIAMResource(i).getMIRIAMDisplayName()));
431  else
432  mReferences.push_back(FROM_UTF8(pResource->getMIRIAMResource(i).getMIRIAMDisplayName()));
433 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
const CMIRIAMResource & getMIRIAMResource(const size_t index) const
const CCopasiParameterGroup & getResourceList() const
QStringList mResources
const std::string & getMIRIAMDisplayName() const
static CConfigurationFile * getConfiguration()
CMIRIAMResources & getRecentMIRIAMResources()
QStringList mReferences
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
const bool & getMIRIAMCitation() const

Member Data Documentation

std::vector< CQBaseDataModel * > CQMiriamWidget::mDMs
private

Definition at line 62 of file CQMiriamWidget.h.

Referenced by CQMiriamWidget(), and showEvent().

std::string CQMiriamWidget::mKeyToCopy
private

Definition at line 69 of file CQMiriamWidget.h.

Referenced by showEvent(), and slotBtnCopy().

CQBiologicalDescriptionDM* CQMiriamWidget::mpBiologicalDescriptionDM
private
CQSortFilterProxyModel* CQMiriamWidget::mpBiologicalDescriptionPDM
private
CQCreatorDM* CQMiriamWidget::mpCreatorDM
private
CQSortFilterProxyModel* CQMiriamWidget::mpCreatorPDM
private
CMIRIAMInfo* CQMiriamWidget::mpMIRIAMInfo
private
CQModifiedDM* CQMiriamWidget::mpModifiedDM
private
CQSortFilterProxyModel* CQMiriamWidget::mpModifiedPDM
private
CQComboDelegate* CQMiriamWidget::mpPredicateDelegate
private

Definition at line 57 of file CQMiriamWidget.h.

Referenced by CQMiriamWidget().

QStringList CQMiriamWidget::mPredicates
private

Definition at line 58 of file CQMiriamWidget.h.

Referenced by CQMiriamWidget().

CQReferenceDM* CQMiriamWidget::mpReferenceDM
private
CQSortFilterProxyModel* CQMiriamWidget::mpReferencePDM
private
CQComboDelegate* CQMiriamWidget::mpResourceDelegate1
private

Definition at line 55 of file CQMiriamWidget.h.

Referenced by CQMiriamWidget().

CQComboDelegate* CQMiriamWidget::mpResourceDelegate2
private

Definition at line 56 of file CQMiriamWidget.h.

Referenced by CQMiriamWidget().

std::vector< CQSortFilterProxyModel * > CQMiriamWidget::mProxyDMs
private

Definition at line 63 of file CQMiriamWidget.h.

Referenced by CQMiriamWidget(), and showEvent().

QStringList CQMiriamWidget::mReferences
private

Definition at line 60 of file CQMiriamWidget.h.

Referenced by CQMiriamWidget(), and updateResourcesList().

QStringList CQMiriamWidget::mResources
private

Definition at line 59 of file CQMiriamWidget.h.

Referenced by CQMiriamWidget(), and updateResourcesList().

std::vector< CQTableView * > CQMiriamWidget::mWidgets
private

Definition at line 61 of file CQMiriamWidget.h.

Referenced by CQMiriamWidget(), dataChanged(), and showEvent().


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