OTB  6.7.0
Orfeo Toolbox
otbWrapperQtWidgetModel.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbWrapperQtWidgetModel_h
22 #define otbWrapperQtWidgetModel_h
23 
24 #include <QtWidgets>
25 #include <QTimer>
26 #include "otbWrapperApplication.h"
27 #include "otbQtLogOutput.h"
28 
29 namespace otb
30 {
31 
32 namespace Wrapper
33 {
34 
35 class OTBQtWidget_EXPORT AppliThread : public QThread
36 {
37  Q_OBJECT
38 
39  public:
40  AppliThread(Application::Pointer app) : m_Application(app)
41  {
42  }
43 
44  ~AppliThread() override;
45 
47  void Stop()
48  {
49  m_Application->Stop();
50  }
51 
52 signals:
58  void ApplicationExecutionDone( int status =0 );
59 
66  void ExceptionRaised( QString what );
67 
68 protected:
69  void run() override;
70 
71 private:
72  AppliThread(const AppliThread&) = delete;
73  void operator=(const AppliThread&) = delete;
74 
76 };
77 
78 
84 class OTBQtWidget_EXPORT QtWidgetModel : public QObject
85 {
86  Q_OBJECT
87 public:
89 
90  ~QtWidgetModel() override;
91 
93  {
94  return m_Application;
95  }
96 
98  {
99  return m_LogOutput;
100  }
101 
102  bool IsRunning() const;
103 
104  void Stop();
105 
107  void SendLogWARNING( const std::string & mes );
108 
110  void SendLogINFO( const std::string & mes );
111 
113  void SendLogDEBUG( const std::string & mes );
114 
115 signals:
116  void SetApplicationReady(bool);
117 
118  void SetProgressReportBegin();
119 
126  void SetProgressReportDone( int status =0 );
127 
134  void ExceptionRaised( QString what );
135 
136  void UpdateGui();
137 
138 public slots:
144  void NotifyUpdate();
145 
150  void ExecuteAndWriteOutputSlot();
151 
152 private slots:
158  void OnApplicationExecutionDone( int status );
159 
160 private:
161  QtWidgetModel(const QtWidgetModel&) = delete;
162  void operator=(const QtWidgetModel&) = delete;
163 
165 
167 
169 
170 public:
172 };
173 
174 
175 }
176 }
177 
178 #endif
AppliThread(Application::Pointer app)
Application::Pointer m_Application
QtLogOutput::Pointer GetLogOutput()
This class represent an application TODO.