ParaView
pqProgressManager.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: pqProgressManager.h
5 
6  Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
7  All rights reserved.
8 
9  ParaView is a free software; you can redistribute it and/or modify it
10  under the terms of the ParaView license version 1.2.
11 
12  See License_v1.2.txt for the full ParaView license.
13  A copy of this license can be obtained by contacting
14  Kitware Inc.
15  28 Corporate Drive
16  Clifton Park, NY 12065
17  USA
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
23 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 ========================================================================*/
32 #ifndef pqProgressManager_h
33 #define pqProgressManager_h
34 
35 #include "pqCoreModule.h"
36 #include <QList>
37 #include <QObject>
38 #include <QPointer>
39 
40 class vtkObject;
41 class pqServer;
47 class PQCORE_EXPORT pqProgressManager : public QObject
48 {
49  Q_OBJECT
50 public:
51  pqProgressManager(QObject* parent=0);
52  virtual ~pqProgressManager();
53 
57  void lockProgress(QObject* object);
58 
60  void unlockProgress(QObject* object);
61 
63  bool isLocked() const;
64 
69  void addNonBlockableObject(QObject* o)
70  { this->NonBlockableObjects.push_back(o); }
71  void removeNonBlockableObject(QObject* o)
72  { this->NonBlockableObjects.removeAll(o); }
73 
75  const QList<QPointer<QObject> >& nonBlockableObjects() const
76  {return this->NonBlockableObjects; }
77 protected:
79  bool eventFilter(QObject* obj, QEvent *event);
80 
81 public slots:
85  void setProgress(const QString& message, int progress);
86 
88  void setEnableProgress(bool);
89 
91  void beginProgress() { this->setEnableProgress(true); }
92  void endProgress() { this->setEnableProgress(false); }
93 
95  void setEnableAbort(bool);
96 
99  void triggerAbort();
100 signals:
102  void abort();
103 
104  void progress(const QString& message, int progress);
105 
106  void enableProgress(bool);
107 
108  void enableAbort(bool);
109 
110  void progressStartEvent();
111  void progressEndEvent();
112 
113 protected slots:
115  void onStartProgress();
116  void onEndProgress();
117  void onProgress(vtkObject*);
118  void onMessage(vtkObject*);
119  void onServerAdded(pqServer*);
120 
121 protected:
122  QPointer<QObject> Lock;
123  QList<QPointer<QObject> > NonBlockableObjects;
125  bool InUpdate; // used to avoid recursive updates.
126 
130 private:
131  Q_DISABLE_COPY(pqProgressManager)
132 };
133 
134 #endif
135 
void removeNonBlockableObject(QObject *o)
QList< QPointer< QObject > > NonBlockableObjects
pqProgressManager is progress manager.
QPointer< QObject > Lock
void addNonBlockableObject(QObject *o)
When progress is enabled, the manager eats all mouse and key events fired except for those objects wh...
const QList< QPointer< QObject > > & nonBlockableObjects() const
Returns the list of non-blockable objects.
void beginProgress()
Convenience slots that simply call setEnableProgress().
pqServer (should be renamed to pqSession) is a pqServerManagerModelItem subclass that represents a vt...
Definition: pqServer.h:62