OpendTect-6_4  6.4
uitaskrunner.h
Go to the documentation of this file.
1 #ifndef uitaskrunner_h
2 #define uitaskrunner_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: K. Tingdahl
9  Date: December 2007
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "uitoolsmod.h"
16 #include "uidialog.h"
17 #include "threadlock.h"
18 #include "task.h"
19 
20 class uiProgressBar;
21 class uiLabel;
22 class Timer;
23 namespace Threads { class Thread; }
24 
25 
26 mExpClass(uiTools) uiTaskRunner : public uiDialog
27  , public TaskRunner
29 public:
30  uiTaskRunner(uiParent*,bool dispmsgonerr=true);
31  ~uiTaskRunner();
32 
33  bool execute(Task& t);
34  uiString lastMsg() const { return prevmessage_; }
35  int getState() const { return state_; }
36  void displayMsgOnError(bool yn) { dispmsgonerr_ = yn; }
37 
38 protected:
39 
42 
45  int symbidx_;
46 
55 
57  int state_; //-1 finished in error
58  // 0 finished without error
59  // 1 running
62  void doWork(CallBacker*);
63 
64  uiString finalizeTask();
65  void updateFields();
66  void onFinalise(CallBacker*);
67  void timerTick(CallBacker*);
68  virtual bool acceptOK(CallBacker*);
69 
70  virtual bool rejectOK(CallBacker*);
71 
72  void init();
73 };
74 
75 #endif
#define mExpClass(module)
Definition: commondefs.h:160
uiLabel * proglbl_
Definition: uitaskrunner.h:41
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
bool dispmsgonerr_
Definition: uitaskrunner.h:54
A lock of a type that (hopefully) suits your needs. To use it, you need the Locker class...
Definition: threadlock.h:53
Task * task_
Definition: uitaskrunner.h:47
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
Threads::Lock dispinfolock_
Definition: uitaskrunner.h:48
bool init()
Threads::Lock uitaskrunnerthreadlock_
Definition: uitaskrunner.h:61
uiString prevnrdonetext_
Definition: uitaskrunner.h:53
Definition: uistring.h:89
Definition: uiparent.h:26
int prevtotalnr_
Definition: uitaskrunner.h:49
int prevnrdone_
Definition: uitaskrunner.h:50
Definition: uidialog.h:42
interface to threads that should be portable.
Definition: atomic.h:28
Definition: uiprogressbar.h:20
Is the base class for all threads. Start it by creating it and give it the function or CallBack to ex...
Definition: thread.h:283
Class that can execute a task.
Definition: task.h:169
Threads::Thread * thread_
Definition: uitaskrunner.h:60
int symbidx_
Definition: uitaskrunner.h:45
uiString prevmessage_
Definition: uitaskrunner.h:52
Timer & tim_
Definition: uitaskrunner.h:43
int getState() const
Definition: uitaskrunner.h:35
int state_
Definition: uitaskrunner.h:57
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
Definition: uitaskrunner.h:26
Definition: uilabel.h:24
int prevpercentage_
Definition: uitaskrunner.h:51
uiString lastMsg() const
Definition: uitaskrunner.h:34
uiProgressBar * progbar_
Definition: uitaskrunner.h:40
void displayMsgOnError(bool yn)
Definition: uitaskrunner.h:36
Threads::Lock statelock_
Definition: uitaskrunner.h:56
BufferString execnm_
Definition: uitaskrunner.h:44
Timer class.
Definition: timer.h:25
Generalization of something (e.g. a computation) that needs to be done in multiple steps...
Definition: task.h:28

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019