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  void openPath(const QString& Path);
151 
152  void setCurrent(const QString& Path);
153 
154  void openExplorer(const QString& Path = "");
155 
156  void openTerminal(const QString& Path = "");
157 
158  void setConfigureMode(openfluid::waresdev::WareSrcContainer::ConfigMode Mode);
159 
160  void setBuildMode(openfluid::waresdev::WareSrcContainer::BuildMode Mode);
161 
162  void setBuildJobs(unsigned int Jobs);
163 
164  void configure();
165 
166  void build();
167 
168  void generateDoc();
169 
170  void saveCurrentEditor();
171 
172  void saveAsMayBeAboveWare();
173 
174  /**
175  @param TopDirectory The path to the topmost directory where may be saved the file,
176  an empty string meaning the current ware directory
177  @return The path where has been saved the file if it's above this ware, an empty string otherwise
178  */
179  QString saveAs(const QString& TopDirectory = "");
180 
181  void saveAllCurrent();
182 
183  void closeCurrentEditor();
184 
185  void openFile();
186 
187  void openSimulator();
188 
189  void openObserver();
190 
191  void openBuilderExtension();
192 
193  void newFile();
194 
195  void deleteCurrentFile();
196 
197  void newSimulator();
198 
199  void newSimulatorFromGhost(const openfluid::ware::SimulatorSignature& Signature);
200 
201  void newObserver();
202 
203  void newBuilderExtension();
204 
205  void showFindReplaceDialog();
206 
207  void copyText();
208 
209  void cutText();
210 
211  void pasteText();
212 
213  void openAPIDoc();
214 
215  void goToLine();
216 
217  void closeEditor(const QString& FilePath);
218 
219  void updateEditorsSettings();
220 
221 
222  public:
223 
224  WareSrcWidgetCollection(QTabWidget* TabWidget, bool IsStandalone);
225 
226  virtual ~WareSrcWidgetCollection();
227 
228  /**
229  Returns false is there is unchanged modifications and user chooses to cancel closing, true otherwise
230  */
231  bool closeAllWidgets();
232 
233  QStringList getOpenWarePaths();
234 
235  QString getCurrentWarePath();
236 
237  bool isDebugMode();
238 
239  bool isBuildNoInstallMode();
240 
241  void deleteWare(const QString& WarePath);
242 
243 };
244 
245 
246 } } } // namespaces
247 
248 
249 #endif /* __OPENFLUID_UIWARESDEV_WARESRCWIDGETCOLLECTION_HPP__ */
Definition: WareSrcWidgetCollection.hpp:72
Header of ...
BuildMode
Definition: WareSrcContainer.hpp:69
ConfigMode
Definition: WareSrcContainer.hpp:64
Definition: WareSrcWidget.hpp:63
FindReplaceAction
Definition: FindReplaceDialog.hpp:67
WareType
Definition: TypeDefs.hpp:60
Definition: FindReplaceDialog.hpp:61
Definition: ApplicationException.hpp:47
Header of ...
Definition: SimulatorSignature.hpp:305
#define OPENFLUID_API
Definition: dllexport.hpp:86
Definition: WareSrcManager.hpp:57