All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 enableAutosaveBeforeBuild(bool Enabled);
147 
148  void updateDevConfigPATH();
149 
150  void updateDevConfigGenerator();
151 
152  void updateDevConfigOptions();
153 
154  void updateDevBuildPATH();
155 
156  void updateDevShowPATH(bool Enabled);
157 
158  void updateDevSslNoVerify(bool NoVerify);
159 
160  void detectQtDevToolsMinGW();
161 
162  void applyTextEditorSettings();
163 
164  void restoreDefaultsTextEditorSettings();
165 
166 
167  private:
168 
169  Ui::PreferencesDialog *ui;
170 
171  bool m_RecentsChanged;
172 
173  bool m_SimPathsChanged;
174 
175  bool m_ObsPathsChanged;
176 
177  bool m_WaresWatchingChanged;
178 
179  bool m_TextEditorSettingsChanged;
180 
181  bool m_RestartRequired;
182 
183  int m_OriginalLangIndex;
184 
185  QString m_OriginalActiveWorkspace;
186 
187  DisplayMode m_Mode;
188 
189  QStringList m_Formats {"bold", "italic", "underline", "strike-through"};
190 
191  void initialize();
192 
193  void updateMarketplacesList();
194 
195  void intializeTextEditorSettings();
196 
197  void updateSyntaxElementLabel(QLabel* Label, const QStringList& Decorations, const QString& ColorName);
198 
199  void updateSyntaxElementColorButton(QToolButton* Button, const QString& ColorName);
200 
201  void updateRestartStatus();
202 
203  static QString getLanguageAsPrettyString(const QString& LangCode);
204 
205 
206  signals:
207 
208  void applyTextEditorSettingsAsked();
209 
210 
211  public:
212 
213  PreferencesDialog(QWidget *Parent, DisplayMode Mode = MODE_FULL);
214 
215  virtual ~PreferencesDialog();
216 
217  bool isRecentsChanged() const
218  { return m_RecentsChanged; }
219 
220  bool isSimPathsChanged() const
221  { return m_SimPathsChanged; }
222 
223  bool isObsPathsChanged() const
224  { return m_ObsPathsChanged; }
225 
227  { return m_WaresWatchingChanged; }
228 
230  { return m_TextEditorSettingsChanged; }
231 
233  { return m_RestartRequired; }
234 
235 };
236 
237 
238 } } } // namespaces
239 
240 
241 #endif /* __OPENFLUID_UICOMMON_PREFERENCESDIALOG_HPP__ */
bool isObsPathsChanged() const
Definition: PreferencesDialog.hpp:223
Definition: PreferencesDialog.hpp:71
bool isRestartRequired()
Definition: PreferencesDialog.hpp:232
bool isWaresWatchingChanged() const
Definition: PreferencesDialog.hpp:226
Definition: MessageDialog.hpp:55
Definition: PreferencesDialog.hpp:64
Definition: ApplicationException.hpp:47
bool isTextEditorSettingsChanged() const
Definition: PreferencesDialog.hpp:229
#define OPENFLUID_API
Definition: dllexport.hpp:86
Definition: PreferencesDialog.hpp:70
bool isSimPathsChanged() const
Definition: PreferencesDialog.hpp:220
bool isRecentsChanged() const
Definition: PreferencesDialog.hpp:217
Definition: AboutDialog.hpp:50
DisplayMode
Definition: PreferencesDialog.hpp:70