1 /** -*- mode: c++ ; c-basic-offset: 2 -*-
2  *
3  *  @file FilterSyncRunner.h
4  *
5  *  Copyright 2017 Sebastien Fourey
6  *
7  *  This file is part of G'MIC-Qt, a generic plug-in for raster graphics
8  *  editors, offering hundreds of filters thanks to the underlying G'MIC
9  *  image processing framework.
10  *
11  *  gmic_qt is free software: you can redistribute it and/or modify
12  *  it under the terms of the GNU General Public License as published by
13  *  the Free Software Foundation, either version 3 of the License, or
14  *  (at your option) any later version.
15  *
16  *  gmic_qt is distributed in the hope that it will be useful,
17  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *  GNU General Public License for more details.
20  *
21  *  You should have received a copy of the GNU General Public License
22  *  along with gmic_qt.  If not, see <http://www.gnu.org/licenses/>.
23  *
24  */
25 #ifndef GMIC_QT_FILTERSYNCRUNNER_H
26 #define GMIC_QT_FILTERSYNCRUNNER_H
27 
28 #include <QObject>
29 #include <QString>
30 #include <QTime>
31 
32 #include "Common.h"
33 #include "Host/GmicQtHost.h"
34 #include "GmicQt.h"
35 class QObject;
36 
37 namespace cimg_library
38 {
39 template <typename T> struct CImgList;
40 }
41 
42 namespace GmicQt
43 {
44 
45 class FilterSyncRunner : public QObject {
46   Q_OBJECT
47 public:
48   FilterSyncRunner(QObject * parent, const QString & command, const QString & arguments, const QString & environment, OutputMessageMode mode);
49 
50   virtual ~FilterSyncRunner();
51   void setArguments(const QString &);
52   void setInputImages(const cimg_library::CImgList<float> & list);
53   void setImageNames(const cimg_library::CImgList<char> & imageNames);
54   void swapImages(cimg_library::CImgList<float> & images);
55   const cimg_library::CImgList<float> & images() const;
56   const cimg_library::CImgList<char> & imageNames() const;
57   QStringList gmicStatus() const;
58   QList<int> parametersVisibilityStates() const;
59   QString errorMessage() const;
60   bool failed() const;
61   bool aborted() const;
62   float progress() const;
63   QString fullCommand() const;
64   void setLogSuffix(const QString & text);
65   void run();
66   void abortGmic();
67 
68 private:
69   QString _command;
70   QString _arguments;
71   QString _environment;
72   cimg_library::CImgList<float> * _images;
73   cimg_library::CImgList<char> * _imageNames;
74   bool _gmicAbort;
75   bool _failed;
76   QString _gmicStatus;
77   float _gmicProgress;
78   QString _errorMessage;
79   QString _name;
80   QString _logSuffix;
81   OutputMessageMode _messageMode;
82 };
83 
84 } // namespace GmicQt
85 
86 #endif // GMIC_QT_FILTERSYNCRUNNER_H
87