Documentation for OpenFLUID 2.2.0
PreferencesDialog.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 PreferencesDialog.hpp
35 
36  @author Jean-Christophe FABRE <jean-christophe.fabre@inra.fr>
37  @author Dorian GERARDIN <dorian.gerardin@inrae.fr>
38  */
39 
40 
41 #ifndef __OPENFLUID_UICOMMON_PREFERENCESDIALOG_HPP__
42 #define __OPENFLUID_UICOMMON_PREFERENCESDIALOG_HPP__
43 
44 
45 #include <QDateTime>
46 #include <QToolButton>
47 #include <QLabel>
48 
52 #include <openfluid/dllexport.hpp>
53 
54 
55 namespace Ui
56 {
57  class PreferencesDialog;
58 }
59 
60 
61 class QTreeWidgetItem;
62 class WaresSearchPathsWidget;
63 
64 
65 namespace openfluid { namespace ui { namespace common {
66 
67 
69 {
70  Q_OBJECT;
71 
72  public:
73 
74  enum class DisplayMode { FULL,
75  BUILDER,
76  DEVSTUDIO
77  };
78 
79 
80  private:
81 
82  enum class PagesIndexes {
83  GENERAL_PAGE = 0,
84  WORKSPACES_PAGE = 1,
85  BUILDER_PAGE = 2,
86  SIMULATION_PAGE = 3,
87  DEVENV_PAGE = 4,
88  DEVEDITOR_PAGE = 5
89  };
90 
91  private slots:
92 
93  void changePage(QTreeWidgetItem* Current, QTreeWidgetItem* Previous);
94 
95  void updateLanguage(int Index);
96 
97  void clearRecentsList();
98 
99  void confirmItemRemoval(bool Confirm);
100 
101  void confirmParamRemoval(bool Confirm);
102 
103  void confirmUnitsRemoval(bool Confirm);
104 
105  void confirmConnectionsRemoval(bool Confirm);
106 
107  void confirmAttributesRemoval(bool Confirm);
108 
109  void skipGhostMigration(bool Skip);
110 
111  void enableWatchers(bool Active);
112 
113  void enableAutoSaveBeforeRun(bool AutoSave);
114 
115  void updateDeltaT(int Val);
116 
117  void updatePeriodDates(const QDateTime& BeginDT, const QDateTime& EndDT);
118 
119  void enableSyntaxHighlighting(bool Enable);
120 
121  void changeSyntaxElementDecoration(int ElementRow);
122 
123  void enableCurrentLineHighlighting(bool Enable);
124 
125  void changeCurrentLineColor();
126 
127  void changeCurrentFont(const QFont& Font);
128 
129  void enableLineWrapping(bool Enable);
130 
131  void changeIndentSpaceNumber(int SpaceNb);
132 
133  void enableInvisibleCharsDisplay(bool Enable);
134 
135  void enableCarriageReturnDisplay(bool Enable);
136 
137  void changeSyntaxElementColor(int ElementRow);
138 
139  void processSimUserPathsUpdate();
140 
141  void processObsUserPathsUpdate();
142 
143  void processBextUserPathsUpdate();
144 
145  void processWorkspacesPathsUpdate();
146 
147  void processExtToolsUpdate();
148 
149  void enableAutosaveBeforeBuild(bool Enabled);
150 
151  void updateDevConfigPATH();
152 
153  void updateDevConfigGenerator();
154 
155  void updateDevConfigOptions();
156 
157  void updateDevBuildPATH();
158 
159  void updateDevShowPATH(bool Enabled);
160 
161  void updateDevSslNoVerify(bool NoVerify);
162 
163  void updateDevCheckoutCurrentOpenFLUIDVersion(bool CheckoutCurrentVersion);
164 
165  void detectQtDevToolsMinGW();
166 
167  void applyTextEditorSettings();
168 
169  void restoreDefaultsTextEditorSettings();
170 
171 
172  private:
173 
174  Ui::PreferencesDialog* ui;
175 
178 
179  bool m_RecentsChanged;
180 
181  bool m_SimPathsChanged;
182 
183  bool m_ObsPathsChanged;
184 
185  bool m_WaresWatchingChanged;
186 
187  bool m_TextEditorSettingsChanged;
188 
189  bool m_RestartRequired;
190 
191  int m_OriginalLangIndex;
192 
193  QString m_OriginalActiveWorkspace;
194 
195  DisplayMode m_Mode;
196 
197  QStringList m_Formats {"bold", "italic", "underline", "strike-through"};
198 
199  void initialize();
200 
201  void intializeTextEditorSettings();
202 
203  void updateSyntaxElementLabel(QLabel* Label, const QStringList& Decorations, const QString& ColorName);
204 
205  void updateSyntaxElementColorButton(QToolButton* Button, const QString& ColorName);
206 
207  void updateRestartStatus();
208 
209  static QString getLanguageAsPrettyString(const QString& LangCode);
210 
211 
212  signals:
213 
215 
216 
217  public:
218 
219  PreferencesDialog(QWidget *Parent, DisplayMode Mode = DisplayMode::FULL);
220 
222 
223  bool isRecentsChanged() const
224  { return m_RecentsChanged; }
225 
226  bool isSimPathsChanged() const
227  { return m_SimPathsChanged; }
228 
229  bool isObsPathsChanged() const
230  { return m_ObsPathsChanged; }
231 
233  { return m_WaresWatchingChanged; }
234 
236  { return m_TextEditorSettingsChanged; }
237 
239  { return m_RestartRequired; }
240 
241 };
242 
243 
244 } } } // namespaces
245 
246 
247 #endif /* __OPENFLUID_UICOMMON_PREFERENCESDIALOG_HPP__ */
Definition: PreferencesManager.hpp:62
Definition: WorkspaceManager.hpp:55
Definition: MessageDialog.hpp:56
Definition: PreferencesDialog.hpp:69
bool isTextEditorSettingsChanged() const
Definition: PreferencesDialog.hpp:235
bool isRecentsChanged() const
Definition: PreferencesDialog.hpp:223
bool isObsPathsChanged() const
Definition: PreferencesDialog.hpp:229
bool isSimPathsChanged() const
Definition: PreferencesDialog.hpp:226
bool isRestartRequired()
Definition: PreferencesDialog.hpp:238
bool isWaresWatchingChanged() const
Definition: PreferencesDialog.hpp:232
PreferencesDialog(QWidget *Parent, DisplayMode Mode=DisplayMode::FULL)
DisplayMode
Definition: PreferencesDialog.hpp:74
#define OPENFLUID_API
Definition: dllexport.hpp:86
Definition: AboutDialog.hpp:51
Definition: ApplicationException.hpp:47