Documentation for OpenFLUID 2.2.1
WareSrcUIContainer.hpp
Go to the documentation of this file.
1 /*
2 
3  This file is part of OpenFLUID software
4  Copyright(c) 2021-2026, INRAE
5 
6 
7  == GNU General Public License Usage ==
8 
9  OpenFLUID is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  OpenFLUID is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21 
22 
23  == Other Usage ==
24 
25  Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26  license, and requires a written agreement between You and INRA.
27  Licensees for Other Usage of OpenFLUID may use this file in accordance
28  with the terms contained in the written agreement between You and INRA.
29 
30  */
31 
32 /**
33  @file WareSrcUIContainer.hpp
34 
35  @author Jean-Christophe Fabre <jean-christophe.fabre@inrae.fr>
36 */
37 
38 
39 #ifndef __OPENFLUID_UIWARESDEV_WARESRCUICONTAINER_HPP__
40 #define __OPENFLUID_UIWARESDEV_WARESRCUICONTAINER_HPP__
41 
42 
43 #include <QObject>
44 #include <QProcess>
45 
52 #include <openfluid/dllexport.hpp>
53 
54 
55 namespace openfluid { namespace ui { namespace waresdev {
56 
57 
58 class WareSrcProcess : public QProcess
59 {
60 
61  Q_OBJECT
62 
63  public:
64 
65  enum class Type { NONE, CONFIGURE, BUILD, TEST};
66 
67  void setType(Type PT)
68  {
69  m_Type = PT;
70  }
71 
72  Type getType() const
73  {
74  return m_Type;
75  }
76 
77 
78  private:
79 
80  Type m_Type = Type::NONE;
81 
82 };
83 
84 
85 // =====================================================================
86 // =====================================================================
87 
88 
89 class OPENFLUID_API WareSrcUIContainer: public QObject,
92 {
93  Q_OBJECT
94 
95 
96  private slots:
97 
98  void processStandardOutput();
99 
100  void processErrorOutput();
101 
102  void processFinishedOutput(int ExitCode);
103 
104 
105  private:
106 
107  WareSrcProcess* mp_Process;
108 
109  WareSrcMsgStream* mp_Stream;
110 
111  openfluid::tools::Timer m_ProcessTimer;
112 
113  WareSrcMsgParser* mp_CurrentParser;
114 
115  QList<WareSrcMsgParser::WareSrcMsg> m_Messages;
116 
117  bool m_IsMsgFastMode;
118 
119  void runCommand(const openfluid::utils::Process::Command& Cmd, const QProcessEnvironment& Env,
121 
122 
123  signals:
124 
126 
128 
130 
132 
133  void buildProcessLaunched(openfluid::ware::WareType Type, const QString& ID);
134 
135  void buildProcessFinished(openfluid::ware::WareType Type, const QString& ID);
136 
137 
138  public:
139 
140  WareSrcUIContainer(const QString& AbsolutePath, openfluid::ware::WareType Type, const QString& WareID);
141 
143 
145 
146  void configure();
147 
148  void build();
149 
150  void test();
151 
152  void generateDoc();
153 
154  QProcessEnvironment getConfigureEnvironment() const;
155 
156  QProcessEnvironment getBuildEnvironment() const;
157 
158  QList<WareSrcMsgParser::WareSrcMsg> getMessages();
159 
160  bool isProcessRunning() const;
161 };
162 
163 
164 } } } // namespaces
165 
166 
167 #endif /* __OPENFLUID_UIWARESDEV_WARESRCUICONTAINER_HPP__ */
Definition: Timer.hpp:58
Definition: WareSrcMsgParser.hpp:64
Definition: WareSrcMsgStream.hpp:53
Definition: WareSrcUIContainer.hpp:59
Type getType() const
Definition: WareSrcUIContainer.hpp:72
void setType(Type PT)
Definition: WareSrcUIContainer.hpp:67
Type
Definition: WareSrcUIContainer.hpp:65
Definition: WareSrcUIContainer.hpp:92
void buildProcessFinished(openfluid::ware::WareType Type, const QString &ID)
void setMsgStream(WareSrcMsgStream &Stream)
WareSrcUIContainer(const QString &AbsolutePath, openfluid::ware::WareType Type, const QString &WareID)
void configureProcessFinished(openfluid::ware::WareType Type, const QString &ID)
QProcessEnvironment getBuildEnvironment() const
void configureProcessLaunched(openfluid::ware::WareType Type, const QString &ID)
QProcessEnvironment getConfigureEnvironment() const
QList< WareSrcMsgParser::WareSrcMsg > getMessages()
void buildProcessLaunched(openfluid::ware::WareType Type, const QString &ID)
Definition: WareSrcContainerOps.hpp:51
Definition: WareSrcContainer.hpp:56
#define OPENFLUID_API
Definition: dllexport.hpp:86
WareType
Definition: TypeDefs.hpp:61
Definition: ApplicationException.hpp:47
Definition: Process.hpp:95