Documentation for OpenFLUID 2.2.2
Loading...
Searching...
No Matches
WareSrcWidget.hpp
Go to the documentation of this file.
1/*
2
3 This file is part of OpenFLUID software
4 Copyright(c) 2021-2026, INRAE
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 @file WareSrcWidget.hpp
34
35 @author Aline LIBRES <aline.libres@gmail.com>
36 @author Jean-Christophe Fabre <jean-christophe.fabre@inra.fr>
37 @author Armel THÖNI <armel.thoni@inrae.fr>
38*/
39
40#ifndef __OPENFLUID_UIWARESDEV_WARESRCWIDGET_HPP__
41#define __OPENFLUID_UIWARESDEV_WARESRCWIDGET_HPP__
42
43
44#include <QWidget>
45#include <QFileSystemWatcher>
46
53
55
56
57namespace Ui {
58class WareSrcWidget;
59}
60
61
62namespace openfluid { namespace ui { namespace waresdev {
63
64
65class WareFileEditor;
66class TextEditMsgStream;
67class WareSrcToolbar;
68
69
70class OPENFLUID_API WareSrcWidget: public QWidget
71{
72 Q_OBJECT
73
74
75 private slots:
76
77 void onEditorTxtModified(WareFileEditor* Editor, bool Modified);
78
79 void onCurrentTabChanged(int Index);
80
81 void onProcessFinished();
82
83 void onMessageClicked(WareSrcMsgParser::WareSrcMsg& Msg);
84
85 void notifyConfigureLaunched(openfluid::ware::WareType Type, const QString& ID);
86
87 void notifyConfigureFinished(openfluid::ware::WareType Type, const QString& ID);
88
89 void notifyBuildLaunched(openfluid::ware::WareType Type, const QString& ID);
90
91 void notifyBuildFinished(openfluid::ware::WareType Type, const QString& ID);
92
93 void loadWareOptions();
94
95 void displayBuildOptionsDialog();
96
97
98 private:
99
100 Ui::WareSrcWidget* ui;
101
103
104 std::map<std::string, int> m_TabIndexByName;
105
107
109
111
112 QMap<QString, QAction*> m_ExternalToolsActions;
113
114 /**
115 * List of opened source file editors by their absolute path
116 */
117 QMap<QString, WareFileEditor*> m_WareFilesByPath;
118
119 openfluid::ui::waresdev::TextEditMsgStream* mp_TextEditMsgStream;
120
121 std::string m_TestFolderPath;
122
123 QFileSystemWatcher m_TestWatcher;
124
125 bool m_IsStandalone;
126
127 WareSrcToolbar* mp_WareSrcToolBar = nullptr;
128
129 void addNewFileTab(int Index, const QString& AbsolutePath, const QString& TabLabel, const QString& TabTooltip = "");
130
131 /**
132 Check if the file of the editor was changed and close it when conditions are satisfied
133 @return Editor index before it was removed
134 */
135 int editorCheckChangeClose(WareFileEditor* Editor, bool WithConfirm);
136
137 /**
138 Deletes Editor
139 @return Editor index before it was removed
140 */
141 int closeFileTab(WareFileEditor* Editor);
142
143 void clearEditorsMessages();
144
145 void enableSignatureEdition(bool Enabled);
146
147
148 protected:
149
150 bool eventFilter(QObject* Obj, QEvent* Event);
151
152
153 signals:
154
155 void wareTextModified(WareSrcWidget* Widget, bool Modified);
156
158
159 void currentTabChanged(const QString& Path);
160
162
164
166
167 void openExternalToolRequested(const QString& Context, const QString& Path);
168
169 void modifiedStatusChanged(bool CurrentEditorModified, bool FileOpen, bool WareModified);
170
172
173 void configureLaunched(openfluid::ware::WareType Type, const QString& ID);
174
175 void configureFinished(openfluid::ware::WareType Type, const QString& ID);
176
177 void buildLaunched(openfluid::ware::WareType Type, const QString& ID);
178
179 void buildFinished(openfluid::ware::WareType Type, const QString& ID);
180
181 void operationRequestedOnWare(const QString& OperationCode, const QString& WarePath);
182
183
184 public slots:
185
187
189
190 void setBuildJobs(unsigned int Jobs);
191
192 void configure();
193
194 void build();
195
196 void test();
197
199
201
203
204 int closeCurrentEditor(bool WithConfirm = true);
205
206 int onCloseFileTabRequested(int Index, bool WithConfirm = true);
207
209
210 void onOperationRequested(const QString& ActionCode);
211
212 void newFile();
213
215
216 void openFile();
217
219
220 void editSignature(QString Path = "");
221
222 /**
223 @param TopDirectory The path to the topmost directory where may be saved the file,
224 an empty string meaning this ware directory
225 @return The path where has been saved the file if it's above this ware, an empty string otherwise
226 */
227 QString saveAs(const QString& TopDirectory = "");
228
229 void copyText();
230
231 void cutText();
232
233 void pasteText();
234
235 void goToLine();
236
237
238 public:
239
241 QWidget* Parent = nullptr);
242
243 virtual ~WareSrcWidget();
244
246
248
249 /**
250 Set the file editor for the absolute path of Info as the current tab
251 @details Check if the file editor is already opened. If true, set this editor as the current tab.
252 Otherwise does nothing.
253 @return true if the file editor was already opened, false otherwise
254 */
256
258
260
262
264
265 void closeFileTabsInFolder(QString FolderPath, bool Confirm=true);
266
268
270
271 int closeFileTab(const QString& Path);
272
274
276
277};
278
279
280} } } // namespaces
281
282
283#endif /* __OPENFLUID_UIWARESDEV_WARESRCWIDGET_HPP__ */
Definition TextEditMsgStream.hpp:56
Definition WareFileEditor.hpp:55
Definition WareSrcActionsCollection.hpp:52
Definition WareSrcMsgViewer.hpp:55
Definition WareSrcToolbar.hpp:58
Definition WareSrcUIContainer.hpp:92
Definition WareSrcWidget.hpp:71
int onCloseFileTabRequested(int Index, bool WithConfirm=true)
void openExternalToolRequested(const QString &Context, const QString &Path)
WareSrcUIContainer & wareSrcContainer()
void setBuildJobs(unsigned int Jobs)
void buildLaunched(openfluid::ware::WareType Type, const QString &ID)
void wareTextModified(WareSrcWidget *Widget, bool Modified)
bool setCurrent(const openfluid::waresdev::WareSrcEnquirer::WarePathInfo &Info)
void openFileTab(const openfluid::waresdev::WareSrcEnquirer::WarePathInfo &Info, int Index=-1)
void modifiedStatusChanged(bool CurrentEditorModified, bool FileOpen, bool WareModified)
void currentTabChanged(const QString &Path)
void configureLaunched(openfluid::ware::WareType Type, const QString &ID)
int closeFileTab(const QString &Path)
bool eventFilter(QObject *Obj, QEvent *Event)
QString saveAs(const QString &TopDirectory="")
void closeFileTabsInFolder(QString FolderPath, bool Confirm=true)
void setBuildMode(openfluid::waresdev::WareSrcContainer::BuildMode Mode)
void operationRequestedOnWare(const QString &OperationCode, const QString &WarePath)
void onOperationRequested(const QString &ActionCode)
void configureFinished(openfluid::ware::WareType Type, const QString &ID)
WareSrcWidget(const openfluid::waresdev::WareSrcEnquirer::WarePathInfo &Info, bool IsStandalone, QWidget *Parent=nullptr)
int closeCurrentEditor(bool WithConfirm=true)
void setConfigureMode(openfluid::waresdev::WareSrcContainer::ConfigMode Mode)
void buildFinished(openfluid::ware::WareType Type, const QString &ID)
Definition WareStatusDashboardWidget.hpp:59
BuildMode
Definition WareSrcContainer.hpp:66
ConfigMode
Definition WareSrcContainer.hpp:61
#define OPENFLUID_API
Definition dllexport.hpp:86
Definition AboutDialog.hpp:51
WareType
Definition TypeDefs.hpp:61
Definition ApplicationException.hpp:47