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