All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
WareSrcWidget.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  @file WareSrcWidget.hpp
34  @brief Header of ...
35 
36  @author Aline LIBRES <aline.libres@gmail.com>
37  */
38 
39 #ifndef __OPENFLUID_UIWARESDEV_WARESRCWIDGET_HPP__
40 #define __OPENFLUID_UIWARESDEV_WARESRCWIDGET_HPP__
41 
42 #include <openfluid/dllexport.hpp>
43 
44 #include <QWidget>
45 
48 
49 namespace Ui {
50 class WareSrcWidget;
51 }
52 
53 
54 namespace openfluid { namespace ui { namespace waresdev {
55 
56 class WareSrcFileEditor;
57 class TextEditMsgStream;
58 class WareSrcToolbar;
59 
60 
61 class OPENFLUID_API WareSrcWidget: public QWidget
62 {
63  Q_OBJECT
64 
65  private:
66 
67  Ui::WareSrcWidget* ui;
68 
70 
71  /**
72  * List of opened source file editors by their absolute path
73  */
74  QMap<QString, WareSrcFileEditor*> m_WareSrcFilesByPath;
75 
76  openfluid::ui::waresdev::TextEditMsgStream* mp_TextEditMsgStream;
77 
78  bool m_IsStandalone;
79 
80  WareSrcToolbar* mp_StandaloneToolBar = 0;
81 
82  void addNewFileTab(int Index, const QString& AbsolutePath, const QString& TabLabel, const QString& TabTooltip = "");
83 
84  /**
85  * Deletes Editor
86  * @return Editor index before it was removed
87  */
88  int closeFileTab(WareSrcFileEditor* Editor);
89 
90  void clearEditorsMessages();
91 
92  protected:
93 
94  bool eventFilter(QObject* Obj, QEvent* Event);
95 
96  public:
97 
98  WareSrcWidget(const openfluid::waresdev::WareSrcManager::PathInfo& Info, bool IsStandalone,
100  openfluid::waresdev::WareSrcContainer::BuildMode Build, QWidget* Parent = 0);
101 
102  ~WareSrcWidget();
103 
104  void openFileTab(const openfluid::waresdev::WareSrcManager::PathInfo& Info, int Index = -1);
105 
106  void openDefaultFiles();
107 
108  /**
109  * Set the file editor for the absolute path of Info as the current tab
110  * @details Check if the file editor is already opened. If true, set this editor as the current tab.
111  * Otherwise does nothing.
112  * @return true if the file editor was already opened, false otherwise
113  */
114  bool setCurrent(const openfluid::waresdev::WareSrcManager::PathInfo& Info);
115 
116  openfluid::waresdev::WareSrcContainer& wareSrcContainer();
117 
118  bool isWareModified();
119 
120  void closeAllFileTabs();
121 
122  WareSrcFileEditor* currentEditor();
123 
124  QString getCurrentFilePath();
125 
126  int closeFileTab(const QString& Path);
127 
128  void checkModifiedStatus();
129 
130  void updateEditorsSettings();
131 
132  public slots:
133 
134  void setReleaseMode();
135 
136  void setDebugMode();
137 
138  void setBuildWithInstallMode();
139 
140  void setBuildNoInstallMode();
141 
142  void configure();
143 
144  void build();
145 
146  void saveCurrentEditor();
147 
148  void saveAllFileTabs();
149 
150  int closeCurrentEditor(bool WithConfirm = true);
151 
152  int onCloseFileTabRequested(int Index, bool WithConfirm = true);
153 
154  void newFile();
155 
156  void deleteCurrentFile();
157 
158  void openFile();
159 
160  /**
161  * @param TopDirectory The path to the topmost directory where may be saved the file,
162  * an empty string meaning this ware directory
163  * @return The path where has been saved the file if it's above this ware, an empty string otherwise
164  */
165  QString saveAs(const QString& TopDirectory = "");
166 
167  void copyText();
168 
169  void cutText();
170 
171  void pasteText();
172 
173  void goToLine();
174 
175  private slots:
176 
177  void onEditorTxtModified(WareSrcFileEditor* Editor, bool Modified);
178 
179  void onCurrentTabChanged(int Index);
180 
181  void onProcessFinished();
182 
183  void onMessageClicked(openfluid::waresdev::WareSrcMsgParser::WareSrcMsg& Msg);
184 
185  signals:
186 
187  void wareTextModified(WareSrcWidget* Widget, bool Modified);
188 
189  void editorSaved();
190 
191  void currentTabChanged(const QString& Path);
192 
193  void findReplaceRequested();
194 
195  void openTerminalRequested();
196 
197  void openExplorerRequested();
198 
199  void modifiedStatusChanged(bool CurrentEditorModified, bool WareModified);
200 
201  void openAPIDocRequested();
202 };
203 
204 } } } // namespaces
205 
206 #endif /* __OPENFLUID_UIWARESDEV_WARESRCWIDGET_HPP__ */
Definition: WareSrcToolbar.hpp:49
Definition: WareSrcMsgParser.hpp:61
Header of ...
Definition: WareSrcManager.hpp:62
Definition: TextEditMsgStream.hpp:55
Definition: WareSrcFileEditor.hpp:59
ConfigMode
Definition: WareSrcContainer.hpp:63
BuildMode
Definition: WareSrcContainer.hpp:68
#define OPENFLUID_API
Definition: dllexport.hpp:87
Definition: WareSrcWidget.hpp:61
Header of ...
Definition: WareSrcContainer.hpp:57