COPASI API  4.16.103
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CQProgressItemBar Class Reference

#include <CQProgressItemBar.h>

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

Public Member Functions

 CQProgressItemBar (QWidget *parent=0, const char *name=0)
 
virtual bool initFromProcessReportItem (CProcessReportItem *pItem)
 
virtual bool process ()
 
virtual bool reset ()
 
 ~CQProgressItemBar ()
 
- Public Member Functions inherited from CQProgressItem
 CQProgressItem (QWidget *parent=0, const char *name=0, Qt::WindowFlags fl=0)
 
 ~CQProgressItem ()
 

Private Member Functions

void destroy ()
 
void init ()
 
virtual void setValueFromDOUBLE ()
 
virtual void setValueFromINT ()
 
virtual void setValueFromUINT ()
 

Private Attributes

C_INT32 mCurrentValue
 
CCopasiParameter::Value mEnd
 
C_FLOAT64 mFactor
 
C_INT32 mLastSet
 
void(CQProgressItemBar::* mpSetValue )()
 
CCopasiParameter::Value mStart
 
CCopasiParameter::Value mValue
 

Additional Inherited Members

- Protected Attributes inherited from CQProgressItem
CProcessReportItemmpItem
 

Detailed Description

Definition at line 26 of file CQProgressItemBar.h.

Constructor & Destructor Documentation

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

Definition at line 27 of file CQProgressItemBar.cpp.

References init().

28  : CQProgressItem(parent, name)
29 {
30  Ui::CQProgressItemBar::setupUi(this);
31 
32  init();
33 }
CQProgressItem(QWidget *parent=0, const char *name=0, Qt::WindowFlags fl=0)
CQProgressItemBar::~CQProgressItemBar ( )

Definition at line 38 of file CQProgressItemBar.cpp.

References destroy().

39 {
40  destroy();
41  // no need to delete child widgets, Qt does it all for us
42 }

Member Function Documentation

void CQProgressItemBar::destroy ( )
private

Definition at line 127 of file CQProgressItemBar.cpp.

References CCopasiParameter::DOUBLE, CCopasiParameter::getType(), CCopasiParameter::INT, CQProgressItem::mpItem, mStart, pdelete, CCopasiParameter::Value::pDOUBLE, CCopasiParameter::Value::pINT, CCopasiParameter::Value::pUINT, CCopasiParameter::UDOUBLE, and CCopasiParameter::UINT.

Referenced by initFromProcessReportItem(), and ~CQProgressItemBar().

128 {
129  if (mpItem == NULL) return;
130 
131  switch (mpItem->getType())
132  {
136  break;
137 
140  break;
141 
144  break;
145 
146  default:
147  break;
148  }
149 }
#define pdelete(p)
Definition: copasi.h:215
const CCopasiParameter::Type & getType() const
CProcessReportItem * mpItem
unsigned C_INT32 * pUINT
CCopasiParameter::Value mStart
void CQProgressItemBar::init ( )
private

Definition at line 151 of file CQProgressItemBar.cpp.

References CQProgressItem::mpItem, mStart, and CCopasiParameter::Value::pVOID.

Referenced by CQProgressItemBar().

152 {
153  mpItem = NULL;
154  mStart.pVOID = NULL;
155 }
CProcessReportItem * mpItem
CCopasiParameter::Value mStart
bool CQProgressItemBar::initFromProcessReportItem ( CProcessReportItem pItem)
virtual

Reimplemented from CQProgressItem.

Definition at line 45 of file CQProgressItemBar.cpp.

References destroy(), FROM_UTF8, CProcessReportItem::getEndValue(), CCopasiObject::getObjectName(), CCopasiParameter::getValue(), mEnd, mLastSet, CQProgressItem::mpItem, mStart, mValue, CCopasiParameter::Value::pVOID, and reset().

46 {
47  mpItem = pItem;
48  mValue = mpItem->getValue();
49  mEnd = mpItem->getEndValue();
50 
51  mItemName->setText(FROM_UTF8(mpItem->getObjectName()));
52  mProgressBar->setMinimum(0);
53  mProgressBar->setMaximum(100);
54 
55  mLastSet = -1; // indicates was never set;
56 
57  // needed so that reset() does allocation
58  if (mStart.pVOID != NULL) destroy();
59 
60  return reset();
61 }
CCopasiParameter::Value mValue
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
const std::string & getObjectName() const
virtual bool reset()
const Value & getValue() const
const CCopasiParameter::Value & getEndValue() const
CProcessReportItem * mpItem
CCopasiParameter::Value mStart
CCopasiParameter::Value mEnd
bool CQProgressItemBar::process ( )
virtual

Reimplemented from CQProgressItem.

Definition at line 63 of file CQProgressItemBar.cpp.

References mCurrentValue, mLastSet, and mpSetValue.

Referenced by reset().

64 {
65  (this->*mpSetValue)();
66 
67  if (mCurrentValue != mLastSet)
68  {
69  mProgressBar->setValue(mCurrentValue);
71  }
72 
73  return true;
74 }
void(CQProgressItemBar::* mpSetValue)()
bool CQProgressItemBar::reset ( )
virtual

Reimplemented from CQProgressItem.

Definition at line 76 of file CQProgressItemBar.cpp.

References C_FLOAT64, C_INT32, CCopasiParameter::DOUBLE, CCopasiParameter::getType(), CCopasiParameter::INT, mEnd, mFactor, CQProgressItem::mpItem, mpSetValue, mStart, mValue, CCopasiParameter::Value::pDOUBLE, CCopasiParameter::Value::pINT, process(), CCopasiParameter::Value::pUINT, setValueFromDOUBLE(), setValueFromINT(), setValueFromUINT(), CCopasiParameter::UDOUBLE, and CCopasiParameter::UINT.

Referenced by initFromProcessReportItem().

77 {
78  switch (mpItem->getType())
79  {
82 
83  if (!mStart.pDOUBLE)
84  mStart.pDOUBLE = new C_FLOAT64;
85 
87  mFactor = 100.0 / (* mEnd.pDOUBLE - * mStart.pDOUBLE);
89  break;
90 
92 
93  if (!mStart.pINT)
94  mStart.pINT = new C_INT32;
95 
96  * mStart.pINT = * mValue.pINT;
97  mFactor = 100.0 / ((C_FLOAT64)(* mEnd.pINT - * mStart.pINT));
99  break;
100 
102 
103  if (!mStart.pUINT)
104  mStart.pUINT = new unsigned C_INT32;
105 
106  * mStart.pUINT = * mValue.pUINT;
107  mFactor = 100.0 / ((C_FLOAT64)(* mEnd.pUINT - * mStart.pUINT));
109  break;
110 
111  default:
112  break;
113  }
114 
115  return process();
116 }
CCopasiParameter::Value mValue
virtual bool process()
#define C_INT32
Definition: copasi.h:90
void(CQProgressItemBar::* mpSetValue)()
const CCopasiParameter::Type & getType() const
CProcessReportItem * mpItem
unsigned C_INT32 * pUINT
virtual void setValueFromDOUBLE()
virtual void setValueFromUINT()
#define C_FLOAT64
Definition: copasi.h:92
virtual void setValueFromINT()
CCopasiParameter::Value mStart
CCopasiParameter::Value mEnd
void CQProgressItemBar::setValueFromDOUBLE ( )
privatevirtual

Definition at line 118 of file CQProgressItemBar.cpp.

References C_INT32, mCurrentValue, mFactor, mStart, mValue, and CCopasiParameter::Value::pDOUBLE.

Referenced by reset().

CCopasiParameter::Value mValue
#define C_INT32
Definition: copasi.h:90
CCopasiParameter::Value mStart
void CQProgressItemBar::setValueFromINT ( )
privatevirtual

Definition at line 121 of file CQProgressItemBar.cpp.

References C_INT32, mCurrentValue, mFactor, mStart, mValue, and CCopasiParameter::Value::pINT.

Referenced by reset().

CCopasiParameter::Value mValue
#define C_INT32
Definition: copasi.h:90
CCopasiParameter::Value mStart
void CQProgressItemBar::setValueFromUINT ( )
privatevirtual

Definition at line 124 of file CQProgressItemBar.cpp.

References C_INT32, mCurrentValue, mFactor, mStart, mValue, and CCopasiParameter::Value::pUINT.

Referenced by reset().

CCopasiParameter::Value mValue
#define C_INT32
Definition: copasi.h:90
unsigned C_INT32 * pUINT
CCopasiParameter::Value mStart

Member Data Documentation

C_INT32 CQProgressItemBar::mCurrentValue
private

Definition at line 45 of file CQProgressItemBar.h.

Referenced by process(), setValueFromDOUBLE(), setValueFromINT(), and setValueFromUINT().

CCopasiParameter::Value CQProgressItemBar::mEnd
private

Definition at line 41 of file CQProgressItemBar.h.

Referenced by initFromProcessReportItem(), and reset().

C_FLOAT64 CQProgressItemBar::mFactor
private

Definition at line 40 of file CQProgressItemBar.h.

Referenced by reset(), setValueFromDOUBLE(), setValueFromINT(), and setValueFromUINT().

C_INT32 CQProgressItemBar::mLastSet
private

Definition at line 44 of file CQProgressItemBar.h.

Referenced by initFromProcessReportItem(), and process().

void(CQProgressItemBar::* CQProgressItemBar::mpSetValue)()
private

Definition at line 39 of file CQProgressItemBar.h.

Referenced by process(), and reset().

CCopasiParameter::Value CQProgressItemBar::mStart
private
CCopasiParameter::Value CQProgressItemBar::mValue
private

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