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