Manual for OpenFLUID 2.1.10

WareSrcWidgetCollection.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 WareSrcWidgetCollection.hpp
35 
36  @author Aline LIBRES <aline.libres@gmail.com>
37  @author Jean-Christophe Fabre <jean-christophe.fabre@inra.fr>
38 */
39 
40 
41 #ifndef __OPENFLUID_UIWARESDEV_WARESRCWIDGETCOLLECTION_HPP__
42 #define __OPENFLUID_UIWARESDEV_WARESRCWIDGETCOLLECTION_HPP__
43 
44 
45 #include <QObject>
46 #include <QMap>
47 #include <QString>
48 #include <QTextDocument>
49 
50 #include <openfluid/dllexport.hpp>
54 
55 
56 class QTabWidget;
57 
58 
59 namespace openfluid {
60 
61 namespace waresdev {
62 class WareSrcManager;
63 }
64 
65 
66 namespace ui { namespace waresdev {
67 
68 class WareSrcWidget;
69 class FindReplaceDialog;
70 
71 
73 {
74  Q_OBJECT
75 
76 
77  private slots:
78 
79  void onWareTxtModified(WareSrcWidget* Widget, bool Modified);
80 
81  void onCloseWareTabRequested(int Index);
82 
83  void onCurrentTabChanged(int Index);
84 
85  void onFindReplaceRequested(FindReplaceDialog::FindReplaceAction Action, const QString& StringToFind,
86  const QString& StringForReplace, QTextDocument::FindFlags Options);
87 
88  void checkModifiedStatus();
89 
90  void notifyConfigureLaunched(openfluid::ware::WareType Type, const QString& ID);
91 
92  void notifyConfigureFinished(openfluid::ware::WareType Type, const QString& ID);
93 
94  void notifyBuildLaunched(openfluid::ware::WareType Type, const QString& ID);
95 
96  void notifyBuildFinished(openfluid::ware::WareType Type, const QString& ID);
97 
98 
99  private:
100 
101  QTabWidget* mp_TabWidget;
102 
103  bool m_IsStandalone;
104 
106 
107  /**
108  * List of opened ware widgets by their absolute path
109  */
110  QMap<QString, WareSrcWidget*> m_WareSrcWidgetByPath;
111 
114  unsigned int m_DefaultBuildJobs;
115 
116  FindReplaceDialog* mp_FindReplaceDialog;
117 
118  WareSrcWidget* currentWareWidget();
119 
120  bool isModified() const;
121 
122  bool isProcessRunning() const;
123 
124  void closeWareTab(WareSrcWidget* Ware);
125 
126  void openWare(openfluid::ware::WareType Type, const QString& Title);
127 
128  void newWare(openfluid::ware::WareType Type);
129 
130 
131  signals:
132 
133  void editorSaved();
134 
135  void currentTabChanged(const QString& Path);
136 
137  void modifiedStatusChanged(bool CurrentEditorModified, bool CurrentWareModified);
138 
139  void configureLaunched(openfluid::ware::WareType Type, const QString& ID);
140 
141  void configureFinished(openfluid::ware::WareType Type, const QString& ID);
142 
143  void buildLaunched(openfluid::ware::WareType Type, const QString& ID);
144 
145  void buildFinished(openfluid::ware::WareType Type, const QString& ID);
146 
147 
148  public slots:
149 
150  bool openPath(const QString& Path);
151 
152  void setCurrent(const QString& Path);
153 
154  QString getContextualPath(const QString& Path);
155 
156  void openExplorerAtWarePath();
157 
158  void openExplorer(const QString& Path = "");
159 
160  void openTerminalAtWarePath();
161 
162  void openTerminal(const QString& Path = "");
163 
164  void openExternalTool(const QString& Command, const QString& Path = "");
165 
166  void setConfigureMode(openfluid::waresdev::WareSrcContainer::ConfigMode Mode);
167 
168  void setBuildMode(openfluid::waresdev::WareSrcContainer::BuildMode Mode);
169 
170  void setBuildJobs(unsigned int Jobs);
171 
172  void configure();
173 
174  void build();
175 
176  void generateDoc();
177 
178  void saveCurrentEditor();
179 
180  void saveAsMayBeAboveWare();
181 
182  /**
183  @param TopDirectory The path to the topmost directory where may be saved the file,
184  an empty string meaning the current ware directory
185  @return The path where has been saved the file if it's above this ware, an empty string otherwise
186  */
187  QString saveAs(const QString& TopDirectory = "");
188 
189  void saveAllCurrent();
190 
191  void closeCurrentEditor();
192 
193  void openFile();
194 
195  void openSimulator();
196 
197  void openObserver();
198 
199  void openBuilderExtension();
200 
201  void newFile();
202 
203  void deleteCurrentFile();
204 
205  void newSimulator();
206 
207  void newSimulatorFromGhost(const openfluid::ware::SimulatorSignature& Signature);
208 
209  void newObserver();
210 
211  void newBuilderExtension();
212 
213  void showFindReplaceDialog();
214 
215  void copyText();
216 
217  void cutText();
218 
219  void pasteText();
220 
221  void openAPIDoc();
222 
223  void goToLine();
224 
225  void closeEditor(const QString& FilePath);
226 
227  void updateEditorsSettings();
228 
229 
230  public:
231 
232  WareSrcWidgetCollection(QTabWidget* TabWidget, bool IsStandalone);
233 
234  virtual ~WareSrcWidgetCollection();
235 
236  /**
237  Returns false is there is unchanged modifications and user chooses to cancel closing, true otherwise
238  */
239  bool closeAllWidgets();
240 
241  QStringList getOpenWarePaths();
242 
243  QString getCurrentWarePath();
244 
245  bool isDebugMode();
246 
247  bool isBuildNoInstallMode();
248 
249  void deleteWare(const QString& WarePath);
250 
251 };
252 
253 
254 } } } // namespaces
255 
256 
257 #endif /* __OPENFLUID_UIWARESDEV_WARESRCWIDGETCOLLECTION_HPP__ */
Definition: ApplicationException.hpp:47
Header of ...
BuildMode
Definition: WareSrcContainer.hpp:69
Definition: WareSrcWidgetCollection.hpp:72
WareType
Definition: TypeDefs.hpp:60
Definition: SimulatorSignature.hpp:308
ConfigMode
Definition: WareSrcContainer.hpp:64
FindReplaceAction
Definition: FindReplaceDialog.hpp:67
Definition: WareSrcManager.hpp:57
#define OPENFLUID_API
Definition: dllexport.hpp:86
Definition: WareSrcWidget.hpp:63
Definition: FindReplaceDialog.hpp:61
Header of ...