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  ~pqProgressManager() override;
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) override;
91 
92 public Q_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 
136  bool unblockEvents(bool val);
137 
138 Q_SIGNALS:
142  void abort();
143 
144  void progress(const QString& message, int progress);
145 
146  void enableProgress(bool);
147 
148  void enableAbort(bool);
149 
150  void progressStartEvent();
151  void progressEndEvent();
152 
153 protected Q_SLOTS:
157  void onStartProgress();
158  void onEndProgress();
159  void onProgress(vtkObject*);
160  void onServerAdded(pqServer*);
161 
162 protected:
163  QPointer<QObject> Lock;
164  QList<QPointer<QObject> > NonBlockableObjects;
166  bool InUpdate; // used to avoid recursive updates.
167 
171 
172 private:
173  Q_DISABLE_COPY(pqProgressManager)
174 };
175 
176 #endif
void removeNonBlockableObject(QObject *o)
QList< QPointer< QObject > > NonBlockableObjects
pqProgressManager is progress manager.
progress
#define PQCORE_EXPORT
Definition: pqCoreModule.h:15
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