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