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