AstRawDark
Manage your astrophoto dark frames
 All Classes Functions Variables Enumerations Enumerator Pages
abstractCommand.h
1 /*
2  * AstRawDark
3  *
4  * Copyright (C) 2015 - Frédéric CORNU
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef ABSTRACTCOMMAND_H
21 #define ABSTRACTCOMMAND_H
22 
23 #include <QString>
24 #include <QObject>
25 #include <QElapsedTimer>
26 
27 #include "reports/commandReport.h"
28 
34 class AbstractCommand: public QObject
35 {
36  Q_OBJECT
37 
38 protected:
43 
44 public:
48  virtual ~AbstractCommand();
49 
53  enum Status {
54 
57 
60 
63  };
64 
65 
69  void execute();
70 
75  const QString& getDescription() const {return _description;}
76 
81  const Status& getStatus() const {return _status;}
82 
87  qint64 getElapsed() const {return _elapsed;}
88 
97  int getSerial() const {return _serial;}
98 
103  bool hasErrors() const {return _error;}
104 
109  bool hasWarning() const {return _warning;}
110 
115  const QStringList& getReportMessages() const {return _reportMessages;}
116 
123  const QString& getProgessMessage() const {return _message;}
124 
130 
135  const QString getStatusString() const;
136 
137 private:
139  static int SERIAL;
140 
141 protected:
146  virtual void setup() {}
151  virtual void cleanup() {}
152 
157  virtual void do_processing() = 0;
158 
160  QString _description;
162  QString _message;
164  QStringList _reportMessages;
168  QElapsedTimer _timer;
170  qint64 _elapsed;
172  int _serial;
174  bool _error;
176  bool _warning;
179 
180 
181 signals:
184 
186  void progress(int);
187 
189  void progressMax(int);
190 
191 };
192 
193 #endif // ABSTRACTCOMMAND_H