mcqThread.h 1.57 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 *
 * MassChroQ: Mass Chromatogram Quantification software.
 * Copyright (C) 2010 Olivier Langella, Edlira Nano, Benoit Valot, Michel Zivy.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope thatx it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

/**
 * \file mcqThread.h
 * \date December 19, 2011
 * \author Edlira Nano
 */

#ifndef MCQ_THREAD_H_
#define MCQ_THREAD_H_ 1

#include <QDebug>
Langella Olivier's avatar
Langella Olivier committed
31
32
#include <QMutex>
#include <QThread>
33

Langella Olivier's avatar
Langella Olivier committed
34
35
class McqThread : public QThread
{
Langella Olivier's avatar
Langella Olivier committed
36
  Q_OBJECT
37

Langella Olivier's avatar
Langella Olivier committed
38
  public:
Langella Olivier's avatar
Langella Olivier committed
39
40
  McqThread(QObject *parent = 0, const unsigned int maxProgress = 0);
  ~McqThread();
41

Langella Olivier's avatar
Langella Olivier committed
42
  unsigned int getProgressValue();
43

Langella Olivier's avatar
Langella Olivier committed
44
  void setMaxProgress(const unsigned int value);
45

Langella Olivier's avatar
Langella Olivier committed
46
  unsigned int getMaxProgress();
47

Langella Olivier's avatar
Langella Olivier committed
48
  public slots:
Langella Olivier's avatar
Langella Olivier committed
49
  void canceled();
50

Langella Olivier's avatar
Langella Olivier committed
51
  protected:
Langella Olivier's avatar
Langella Olivier committed
52
  virtual void run() = 0;
53

Langella Olivier's avatar
Langella Olivier committed
54
55
  void setProgressValue(const unsigned int val);
  void incrementProgressValue();
Langella Olivier's avatar
Langella Olivier committed
56
57
  bool getAbord();
  bool getRestart();
58

Langella Olivier's avatar
Langella Olivier committed
59
60
  bool _abort;
  bool _restart;
61

Langella Olivier's avatar
Langella Olivier committed
62
  private:
Langella Olivier's avatar
Langella Olivier committed
63
64
65
  QMutex _progressMutex;
  unsigned int _maxProgressValue;
  unsigned int _progressValue;
66
67
};
#endif /* MCQ_THREAD_H_ */