Tulip 5.7.1
Large graphs analysis and drawing
Loading...
Searching...
No Matches
TulipSettings.h
1/*
2 *
3 * This file is part of Tulip (https://tulip.labri.fr)
4 *
5 * Authors: David Auber and the Tulip development Team
6 * from LaBRI, University of Bordeaux
7 *
8 * Tulip is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation, either version 3
11 * of the License, or (at your option) any later version.
12 *
13 * Tulip is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 * See the GNU General Public License for more details.
17 *
18 */
19///@cond DOXYGEN_HIDDEN
20
21#ifndef TULIPSETTINGS_H
22#define TULIPSETTINGS_H
23
24#include <QSettings>
25#include <QNetworkProxy>
26#include <QString>
27
28#include <tulip/GlGraphRenderingParameters.h>
29#include <tulip/Size.h>
30#include <tulip/Graph.h>
31
32namespace tlp {
33
34/**
35 * @brief This class provides convenience functions to access the Tulip settings file (using
36 * QSettings)
37 * TulipSettings is a wrapper for QSettings providing quick access to common keys provided in the
38 * tulip configuration file.
39 * This object does not mask any method from the QSettings class, which mean that the user can
40 * still access custom keys by invoking the QSettings::value method.
41 */
42class TLP_QT_SCOPE TulipSettings : public QSettings, GlDefaultSelectionColorManager, Observable {
43 Q_OBJECT
44 Q_ENUMS(DisplayProperty)
45
46public:
47 static TulipSettings &instance();
48
49 static QString elementKey(const QString &configEntry, tlp::ElementType elem);
50
51 static void synchronizeSettings();
52
53 static void synchronizeViewSettings();
54
55 /**
56 @brief Retrieves the list of documents recently opened with tulip.
57 */
58 static QStringList recentDocuments();
59
60 /**
61 @brief Registers a file in the list of recently opened documents.
62 If the list already contains 5 elements, the last one (in chronological order) will be removed.
63 */
64 static void addToRecentDocuments(const QString &);
65
66 /**
67 @brief Check recently opened documents list and remove non-existing ones
68 */
69 static void checkRecentDocuments();
70
71 /**
72 * @brief Adds a remote location from which to list plugins.
73 *
74 * @param remoteLocation The URL of the plugin server.
75 * @return void
76 **/
77 static void addRemoteLocation(const QString &remoteLocation);
78
79 /**
80 * @brief Removes a location from which to list plugins.
81 *
82 * @param remoteLocation The URL of the plugin server.
83 * @return void
84 **/
85 static void removeRemoteLocation(const QString &remoteLocation);
86
87 /**
88 * @brief Retrieves the list of locations from which to list plugins.
89 *
90 * @return const QStringList
91 **/
92 static const QStringList remoteLocations();
93 static const QStringList pluginsToRemove();
94
95 static void markPluginForRemoval(const QString &pluginLibrary);
96 static void unmarkPluginForRemoval(const QString &pluginLibrary);
97
98 static tlp::Color defaultColor(tlp::ElementType elem, bool tulipDefault = false);
99 static void setDefaultColor(tlp::ElementType elem, const tlp::Color &color);
100
101 static tlp::Color defaultLabelColor(bool tulipDefault = false);
102 static void setDefaultLabelColor(const tlp::Color &color);
103
104 static tlp::Size defaultSize(tlp::ElementType elem, bool tulipDefault = false);
105 static void setDefaultSize(tlp::ElementType elem, const tlp::Size &size);
106
107 static int defaultShape(tlp::ElementType elem, bool tulipDefault = false);
108 static void setDefaultShape(tlp::ElementType elem, int shape);
109
110 // in GlDefaultSelectionColorManager interface
111 tlp::Color defaultSelectionColor(bool tulipDefault = false) override;
112
113 static tlp::Color getDefaultSelectionColor(bool tulipDefault = false);
114 static void setDefaultSelectionColor(const tlp::Color &color);
115
116 static QSet<QString> favoriteAlgorithms();
117 static void addFavoriteAlgorithm(const QString &name);
118 static void removeFavoriteAlgorithm(const QString &name);
119
120 // Proxy settings
121 static bool isProxyEnabled();
122 static void setProxyEnabled(bool);
123
124 static QNetworkProxy::ProxyType proxyType();
125 static void setProxyType(QNetworkProxy::ProxyType);
126
127 static QString proxyHost();
128 static void setProxyHost(const QString &);
129
130 static unsigned int proxyPort();
131 static void setProxyPort(unsigned int);
132
133 static bool isUseProxyAuthentification();
134 static void setUseProxyAuthentification(bool);
135
136 static QString proxyUsername();
137 static void setProxyUsername(const QString &);
138
139 static QString proxyPassword();
140 static void setProxyPassword(const QString &);
141
142 static void applyProxySettings();
143
144 static bool isFirstRun();
145 static void setFirstRun(bool);
146
147 static bool isFirstTulipMMRun();
148 static bool userHasLaunchedTulipMM(const std::string &mmVersion);
149 static void setFirstTulipMMRun(bool);
150
151 static bool displayDefaultViews();
152 static void setDisplayDefaultViews(bool);
153
154 static bool isAutomaticMapMetric();
155 static void setAutomaticMapMetric(bool);
156
157 static bool isAutomaticCentering();
158 static void setAutomaticCentering(bool);
159
160 static bool isAutomaticRatio();
161 static void setAutomaticRatio(bool);
162
163 static bool isViewOrtho();
164 static void setViewOrtho(bool);
165
166 static bool isResultPropertyStored();
167 static void setResultPropertyStored(bool);
168
169 enum LogPluginCall { NoLog = 0, LogCall = 1, LogCallWithExecutionTime = 2 };
170 static unsigned int logPluginCall();
171 static void setLogPluginCall(unsigned int);
172
173 static bool isUseTlpbFileFormat();
174 static void setUseTlpbFileFormat(bool);
175
176 static unsigned int seedOfRandomSequence();
177 static void setSeedOfRandomSequence(unsigned int);
178 static void initSeedOfRandomSequence();
179
180 static bool warnUserAboutGraphicsCard();
181 static void setWarnUserAboutGraphicsCard(bool);
182
183 static bool isDisplayInDarkMode();
184 static void setDisplayInDarkMode(bool);
185
186 // no longer used
187 _DEPRECATED static bool showStatusBar();
188 _DEPRECATED static void setShowStatusBar(bool);
189
190 static bool loggerAnchored();
191 static void setLoggerAnchored(bool);
192
193 static QStringList recentPerspectiveFiles();
194 static void setRecentPerspectiveFiles(QStringList &doc);
195
196 void treatEvent(const Event &message) override;
197
198private:
199 TulipSettings();
200 static TulipSettings *_instance;
201
202 void setFavoriteAlgorithms(const QSet<QString> &lst);
203};
204} // namespace tlp
205#endif // TULIPSETTINGS_H
206///@endcond
ElementType
Definition: Graph.h:50
void setSeedOfRandomSequence(unsigned int seed=UINT_MAX)
Gives the value of the seed used for further initialization of a random sequence (with further calls ...