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;
49 class PQCORE_EXPORT pqProgressManager : public QObject
50 {
51  Q_OBJECT
52 public:
53  pqProgressManager(QObject* parent = 0);
54  virtual ~pqProgressManager();
55 
61  void lockProgress(QObject* object);
62 
66  void unlockProgress(QObject* object);
67 
71  bool isLocked() const;
72 
79  void addNonBlockableObject(QObject* o) { this->NonBlockableObjects.push_back(o); }
80  void removeNonBlockableObject(QObject* o) { this->NonBlockableObjects.removeAll(o); }
81 
85  const QList<QPointer<QObject> >& nonBlockableObjects() const { return this->NonBlockableObjects; }
86 protected:
90  bool eventFilter(QObject* obj, QEvent* event);
91 
92 public slots:
98  void setProgress(const QString& message, int progress);
99 
103  void setEnableProgress(bool);
104 
108  void beginProgress() { this->setEnableProgress(true); }
109  void endProgress() { this->setEnableProgress(false); }
110 
114  void setEnableAbort(bool);
115 
120  void triggerAbort();
121 signals:
125  void abort();
126 
127  void progress(const QString& message, int progress);
128 
129  void enableProgress(bool);
130 
131  void enableAbort(bool);
132 
133  void progressStartEvent();
134  void progressEndEvent();
135 
136 protected slots:
140  void onStartProgress();
141  void onEndProgress();
142  void onProgress(vtkObject*);
143  void onMessage(vtkObject*);
144  void onServerAdded(pqServer*);
145 
146 protected:
147  QPointer<QObject> Lock;
148  QList<QPointer<QObject> > NonBlockableObjects;
150  bool InUpdate; // used to avoid recursive updates.
151 
155 
156 private:
157  Q_DISABLE_COPY(pqProgressManager)
158 };
159 
160 #endif
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:64