Ilwis-Objects  1.0
GIS and Remote Sensing framework for data access and processing
 All Classes Functions Enumerations Pages
tranquilizer.h
1 #ifndef TRANQUILIZER_H
2 #define TRANQUILIZER_H
3 
4 #include <QObject>
5 #include <memory>
6 #include "locker.h"
7 
8 namespace Ilwis {
9 class Tranquilizer : public QObject
10 {
11  Q_OBJECT
12 public:
13  explicit Tranquilizer(QObject *parent = 0);
14  Tranquilizer(const QString &title, const QString &description, qint64 end, qint32 step);
15  void end(qint64 number);
16 
17  void move() {
18  if ( _current % _step){
19  Locker lock(_mutex);
20  emit(doMove(_id, _current));
21  }
22  _current += _step;
23 
24  }
25 
26 private:
27  static quint64 _trqId;
28  quint64 _id;
29  QString _title;
30  QString _desc;
31  qint64 _end;
32  qint64 _current;
33  qint32 _step;
34  std::mutex _mutex;
35 signals:
36  void doMove(quint64 id, qint32 amount);
37 
38 public slots:
39 
40 };
41 
42 }
43 
44 #endif // TRANQUILIZER_H