1 /**
2  * This file is a part of LuminanceHDR package.
3  * ----------------------------------------------------------------------
4  * Copyright (C) 2013 Franco Comida
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 2 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, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  * ----------------------------------------------------------------------
20  *
21  * @author Franco Comida <fcomida@users.sourceforge.net>
22  */
23 
24 #ifndef ALIGN_H
25 #define ALIGN_H
26 
27 #include <QFuture>
28 #include <QFutureWatcher>
29 #include <QProcess>
30 #include <QScopedPointer>
31 
32 #include "Common/LuminanceOptions.h"
33 #include "HdrWizard/HdrCreationItem.h"
34 
35 class Align : public QObject {
36     Q_OBJECT
37 
38    public:
39     Align(HdrCreationItemContainer &data, bool fromCommandLine,
40           int savingMode = 1, float minLum = 0.0f, float maxLum = 1.0f);
41     ~Align();
42 
43     void align_with_ais(bool ais_crop_flag);
44     void reset();
45     void removeTempFiles();
46 
47    signals:
48     void finishedAligning(int);
49     void failedAligning(QProcess::ProcessError);
50     void dataReady(QByteArray &);
51 
52    protected slots:
53     void ais_finished(int exitcode, QProcess::ExitStatus exitstatus);
54     void alignedFilesLoaded();
55     void ais_failed_slot(QProcess::ProcessError error);
56     void readData();
57 
58    protected:
59     HdrCreationItemContainer m_data;
60     bool m_fromCommandLine;
61     int m_savingMode;
62     float m_minLum;
63     float m_maxLum;
64     QScopedPointer<QProcess> m_ais;
65     LuminanceOptions m_luminance_options;
66     QFutureWatcher<void> m_futureWatcher;
67 };
68 
69 #endif
70