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