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  @brief Header of ...
36 
37  @author Aline LIBRES <aline.libres@gmail.com>
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 
114  FindReplaceDialog* mp_FindReplaceDialog;
115 
116  WareSrcWidget* currentWareWidget();
117 
118  bool isModified() const;
119 
120  bool isProcessRunning() const;
121 
122  void closeWareTab(WareSrcWidget* Ware);
123 
124  void openWare(openfluid::ware::WareType Type, const QString& Title);
125 
126  void newWare(openfluid::ware::WareType Type);
127 
128 
129  signals:
130 
131  void editorSaved();
132 
133  void currentTabChanged(const QString& Path);
134 
135  void modifiedStatusChanged(bool CurrentEditorModified, bool CurrentWareModified);
136 
137  void configureLaunched(openfluid::ware::WareType Type, const QString& ID);
138 
139  void configureFinished(openfluid::ware::WareType Type, const QString& ID);
140 
141  void buildLaunched(openfluid::ware::WareType Type, const QString& ID);
142 
143  void buildFinished(openfluid::ware::WareType Type, const QString& ID);
144 
145 
146  public slots:
147 
148  void openPath(const QString& Path);
149 
150  void setCurrent(const QString& Path);
151 
152  void openExplorer(const QString& Path = "");
153 
154  void openTerminal(const QString& Path = "");
155 
156  void setReleaseMode();
157 
158  void setDebugMode();
159 
160  void setBuildWithInstallMode();
161 
162  void setBuildNoInstallMode();
163 
164  void configure();
165 
166  void build();
167 
168  void saveCurrentEditor();
169 
170  void saveAsMayBeAboveWare();
171 
172  /**
173  @param TopDirectory The path to the topmost directory where may be saved the file,
174  an empty string meaning the current ware directory
175  @return The path where has been saved the file if it's above this ware, an empty string otherwise
176  */
177  QString saveAs(const QString& TopDirectory = "");
178 
179  void saveAllCurrent();
180 
181  void closeCurrentEditor();
182 
183  void openFile();
184 
185  void openSimulator();
186 
187  void openObserver();
188 
189  void openBuilderExtension();
190 
191  void newFile();
192 
193  void deleteCurrentFile();
194 
195  void newSimulator();
196 
197  void newSimulatorFromGhost(const openfluid::ware::SimulatorSignature& Signature);
198 
199  void newObserver();
200 
201  void newBuilderExtension();
202 
203  void showFindReplaceDialog();
204 
205  void copyText();
206 
207  void cutText();
208 
209  void pasteText();
210 
211  void openAPIDoc();
212 
213  void goToLine();
214 
215  void closeEditor(const QString& FilePath);
216 
217  void updateEditorsSettings();
218 
219 
220  public:
221 
222  WareSrcWidgetCollection(QTabWidget* TabWidget, bool IsStandalone);
223 
225 
226  /**
227  Returns false is there is unchanged modifications and user chooses to cancel closing, true otherwise
228  */
229  bool closeAllWidgets();
230 
231  QStringList getOpenWarePaths();
232 
233  QString getCurrentWarePath();
234 
235  bool isDebugMode();
236 
237  bool isBuildNoInstallMode();
238 
239  void deleteWare(const QString& WarePath);
240 
241 };
242 
243 
244 } } } // namespaces
245 
246 
247 #endif /* __OPENFLUID_UIWARESDEV_WARESRCWIDGETCOLLECTION_HPP__ */
Header of ...
Header of ...
Definition: WareSrcManager.hpp:57
#define OPENFLUID_API
Definition: dllexport.hpp:87
Definition: ApplicationException.hpp:47
Definition: WareSrcWidgetCollection.hpp:71
BuildMode
Definition: WareSrcContainer.hpp:68
ConfigMode
Definition: WareSrcContainer.hpp:63
Definition: SimulatorSignature.hpp:307
FindReplaceAction
Definition: FindReplaceDialog.hpp:67
Definition: WareSrcWidget.hpp:63
Definition: FindReplaceDialog.hpp:61
WareType
Definition: TypeDefs.hpp:62