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