NewSrcFileAssistant.hpp
Go to the documentation of this file.
1 /*
2 
3  This file is part of OpenFLUID software
4  Copyright(c) 2007, INRA - Montpellier SupAgro
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 /**
34  @file NewSrcFileAssistant.hpp
35  @brief Header of ...
36 
37  @author Aline LIBRES <aline.libres@gmail.com>
38  */
39 
40 
41 #ifndef __OPENFLUID_UIWARESDEV_NEWSRCFILEASSISTANT_HPP__
42 #define __OPENFLUID_UIWARESDEV_NEWSRCFILEASSISTANT_HPP__
43 
44 
45 #include <QWizard>
46 #include <QDir>
47 
48 #include <QFrame>
49 #include <QLabel>
50 
51 #include <openfluid/dllexport.hpp>
54 
55 
56 namespace Ui {
57 class EmptyPage;
58 class CppPage;
59 class CMakeConfigPage;
60 class NewSrcFileAssistant;
61 }
62 
63 namespace openfluid { namespace ui { namespace waresdev {
64 
65 
66 class OPENFLUID_API EmptyPage : public QWizardPage
67 {
68  Q_OBJECT
69 
70  private:
71 
72  Ui::EmptyPage* ui;
73 
74  QString m_WarePath;
75 
76  QString m_DefaultMsg = tr("Empty file");
77 
78  QString m_FilePathPlaceholder = "<i>"+tr("choose a file to create")+"</i>";
79 
80  protected:
81 
82  /**
83  * Reimplemented function
84  */
85  bool isComplete() const;
86 
87  public:
88 
89  EmptyPage(const QString& WarePath, QWidget* Parent = nullptr);
90 
91  ~EmptyPage();
92 
93  void initialize();
94 
95  private slots:
96 
97  void onEmptyBrowseToolButtonClicked();
98 };
99 
100 
101 // =====================================================================
102 // =====================================================================
103 
104 
105 class OPENFLUID_API CppPage: public QWizardPage
106 {
107  Q_OBJECT
108 
109  private:
110 
111  Ui::CppPage* ui;
112 
113  QDir m_WareDir;
114 
115  bool m_IsHpp;
116 
117  QString m_DefaultMsg;
118 
119  protected:
120 
121  /**
122  * Reimplemented function
123  */
124  bool isComplete() const;
125 
126  public:
127 
128  CppPage(const QDir& WareDir, QWidget* Parent = nullptr);
129 
130  ~CppPage();
131 
132  void initialize(bool IsHpp, bool IsUi, openfluid::ware::WareType Type);
133 
134  private slots:
135 
136  void onInformationChanged();
137 };
138 
139 
140 // =====================================================================
141 // =====================================================================
142 
143 
144 class OPENFLUID_API CMakeConfigPage: public QWizardPage
145 {
146  Q_OBJECT
147 
148  private:
149 
150  Ui::CMakeConfigPage* ui;
151 
152  QString m_DefaultMsg;
153 
154  protected:
155 
156  /**
157  * Reimplemented function
158  */
159  bool isComplete() const;
160 
161  public:
162 
163  CMakeConfigPage(openfluid::ware::WareType Type, QWidget* Parent = nullptr);
164 
165  ~CMakeConfigPage();
166 
167  private slots:
168 
169  void onRootfilenameTextChanged();
170 };
171 
172 
173 // =====================================================================
174 // =====================================================================
175 
176 
177 class OPENFLUID_API NewSrcFileAssistant: public QWizard
178 {
179  Q_OBJECT
180 
181  private:
182 
183  enum class PageType
184  {
185  INTRO_PAGE = 0,
186  EMPTY_PAGE = 1,
187  CMAKECONFIG_PAGE = 2,
188  CPP_PAGE = 3,
189  HPP_PAGE = 4,
190  CPP_UI_PAGE = 5,
191  HPP_UI_PAGE = 6
192  };
193 
194  Ui::NewSrcFileAssistant* ui;
195 
197 
198  const openfluid::waresdev::WareSrcContainer& mref_Container;
199 
200  QString m_NewFilePath;
201 
202  protected:
203 
204  /**
205  * Reimplemented function
206  */
207  void initializePage(int ID);
208 
209 
210  public:
211 
212  NewSrcFileAssistant(const openfluid::waresdev::WareSrcContainer& Container, QWidget* Parent = nullptr);
213 
215 
216  /**
217  * Reimplemented function
218  */
219  int nextId() const;
220 
221  /**
222  * Reimplemented function
223  */
224  void accept();
225 
226  QString getNewFilePath();
227 
228  static void setStatus(const QString DefaultMsg, const QString WarningMsg, QLabel* MsgLabel, QFrame* MsgFrame);
229 
230 
231  private slots :
232 
233  void onFileTypeButtonClicked(int ID);
234 };
235 
236 
237 } } } // namespaces
238 
239 
240 #endif /* __OPENFLUID_UIWARESDEV_NEWSRCFILEASSISTANT_HPP__ */
Definition: AboutDialog.hpp:51
Header of ...
Definition: NewSrcFileAssistant.hpp:105
Header of ...
Definition: NewSrcFileAssistant.hpp:177
Definition: NewSrcFileAssistant.hpp:144
Definition: WareSrcFactory.hpp:58
Definition: ApplicationException.hpp:47
Definition: NewSrcFileAssistant.hpp:66
WareType
Definition: TypeDefs.hpp:62
#define OPENFLUID_API
Definition: dllexport.hpp:87
Definition: WareSrcContainer.hpp:57