COPASI API  4.16.103
CQProgressDialog.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2014 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 // Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
7 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
8 // and The University of Manchester.
9 // All rights reserved.
10 
11 // Copyright (C) 2005 - 2007 by Pedro Mendes, Virginia Tech Intellectual
12 // Properties, Inc. and EML Research, gGmbH.
13 // All rights reserved.
14 
15 #include "CQProgressDialog.h"
16 
17 #include <QtCore/QVariant>
18 #include <QtGui/QApplication>
19 #include <QtCore/QTimer>
20 
21 #include "copasiui3window.h"
22 
24 
25 /*
26  * Constructs a CQProgressDialog as a child of 'parent', with the
27  * name 'name' and widget flags set to 'f'.
28  *
29  * The dialog will by default be Qt::WindowModal.
30  */
31 CQProgressDialog::CQProgressDialog(QWidget* parent, const char* name, Qt::WindowModality windowModality, Qt::WindowFlags fl)
32  : QDialog(parent, fl)
33 {
34  setObjectName(QString::fromUtf8(name));
35 
36  setupUi(this);
37 
38  setWindowModality(windowModality);
39 
40  init();
41 }
42 
43 /*
44  * Destroys the object and frees any allocated resources
45  */
47 {
48  // no need to delete child widgets, Qt does it all for us
49 }
50 
52 {
53  if (mItemCount == 0) mpLine->show();
54 
55  vboxLayout->removeItem(mpSpacer);
56  vboxLayout->addWidget(pItem);
57  vboxLayout->addItem(mpSpacer);
58 
59  pItem->show();
60 
61  mItemCount++;
62  return true;
63 }
64 
66 {
67  vboxLayout->removeWidget(pItem);
68 
69  mItemCount--;
70 
71  if (mItemCount == 0) mpLine->hide();
72 
73  return true;
74 }
75 
77 {
79  mpBtnContinue->setIcon(CQIconResource::icon(CQIconResource::playerStart));
81 
82  mpLine->hide();
83  // mpBtnPause->hide();
84  // mpBtnContinue->hide();
85 
86  mpBtnContinue->setEnabled(false);
87 
88  mItemCount = 0;
89 
90  mPause = false;
91  mProceed = true;
92 
93  QTimer::singleShot(1500, this, SLOT(timerShow()));
94 
95  return;
96 }
97 
99 {
100  // ignore
101 }
103 {
104  // ignore
105 }
107 {
108  // ignore
109 }
110 
112 {
113  mPause = false;
114 
115  mpBtnPause->setEnabled(true);
116  mpBtnContinue->setEnabled(false);
117 }
118 
120 {
121  mPause = true;
122 
123  mpBtnPause->setEnabled(false);
124  mpBtnContinue->setEnabled(true);
125 }
126 
128 {
129  mPause = false;
130  mProceed = false;
131 
132  mpBtnPause->setEnabled(false);
133  mpBtnContinue->setEnabled(false);
134  mpBtnStop->setEnabled(false);
135 }
136 
138 {
139  if (CopasiUI3Window::getMainWindow() != NULL &&
140  CopasiUI3Window::getMainWindow()->messageShown())
141  {
142  QTimer::singleShot(1500, this, SLOT(timerShow()));
143  }
144  else
145  {
146  show();
147  }
148 }
unsigned C_INT32 mItemCount
virtual void done(int)
bool removeProgressItem(CQProgressItem *pItem)
static CopasiUI3Window * getMainWindow()
bool insertProgressItem(CQProgressItem *pItem)
CQProgressDialog(QWidget *parent=0, const char *name=0, Qt::WindowModality windowModality=Qt::WindowModal, Qt::WindowFlags fl=0)
static const QIcon & icon(const IconID &id)
virtual void btnContinuePressed()
virtual void btnPausePressed()
bool fl(const C_FLOAT64 &d1, const C_FLOAT64 &d2)
virtual void accept()
virtual void reject()
virtual void btnStopPressed()