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@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(const QString& Lang);
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 detectQtDevToolsMinGW();
156 
157  void applyTextEditorSettings();
158 
159  void restoreDefaultsTextEditorSettings();
160 
161  private:
162 
163  Ui::PreferencesDialog *ui;
164 
165  bool m_RecentsChanged;
166 
167  bool m_SimPathsChanged;
168 
169  bool m_ObsPathsChanged;
170 
171  bool m_WaresWatchingChanged;
172 
173  bool m_TextEditorSettingsChanged;
174 
175  int m_OriginalLangIndex;
176 
177  DisplayMode m_Mode;
178 
179  QStringList m_Formats {"bold", "italic", "underline", "strike-through"};
180 
181  void initialize(const QStringList& ExtsPaths);
182 
183  void updateMarketplacesList();
184 
185  void intializeTextEditorSettings();
186 
187  void updateSyntaxElementLabel(QLabel* Label, const QStringList& Decorations, const QString& ColorName);
188 
189  void updateSyntaxElementColorButton(QToolButton* Button, const QString& ColorName);
190 
191  public:
192 
193  PreferencesDialog(QWidget *Parent, DisplayMode Mode = MODE_FULL, const QStringList& ExtsPaths = QStringList());
194 
195  virtual ~PreferencesDialog();
196 
197  bool isRecentsChanged() const
198  { return m_RecentsChanged; }
199 
200  bool isSimPathsChanged() const
201  { return m_SimPathsChanged; }
202 
203  bool isObsPathsChanged() const
204  { return m_ObsPathsChanged; }
205 
207  { return m_WaresWatchingChanged; }
208 
210  { return m_TextEditorSettingsChanged; }
211 
212  signals:
213 
214  void applyTextEditorSettingsAsked();
215 
216 };
217 
218 
219 } } } // namespaces
220 
221 
222 #endif /* __OPENFLUID_UICOMMON_PREFERENCESDIALOG_HPP__ */
bool isSimPathsChanged() const
Definition: PreferencesDialog.hpp:200
bool isRecentsChanged() const
Definition: PreferencesDialog.hpp:197
Definition: PreferencesDialog.hpp:70
Definition: OpenFLUIDDialog.hpp:50
DisplayMode
Definition: PreferencesDialog.hpp:69
Definition: PreferencesDialog.hpp:63
bool isObsPathsChanged() const
Definition: PreferencesDialog.hpp:203
bool isWaresWatchingChanged() const
Definition: PreferencesDialog.hpp:206
Definition: PreferencesDialog.hpp:69
#define OPENFLUID_API
Definition: dllexport.hpp:87
bool isTextEditorSettingsChanged() const
Definition: PreferencesDialog.hpp:209