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