22 #ifndef TULIPSETTINGS_H
23 #define TULIPSETTINGS_H
25 #include <QtCore/QSettings>
26 #include <QtCore/QStringList>
27 #include <tulip/tulipconf.h>
28 #include <tulip/Graph.h>
29 #include <tulip/Color.h>
30 #include <tulip/Size.h>
31 #include <QtNetwork/QNetworkProxy>
38 class TLP_QT_SCOPE TulipSettings:
public QSettings {
40 Q_ENUMS(DisplayProperty)
44 static const QString RemoteLocationsConfigEntry;
45 static const QString RecentDocumentsConfigEntry;
46 static const QString PluginsToRemoveConfigEntry;
47 static const QString DefaultColorConfigEntry;
48 static const QString DefaultLabelColorConfigEntry;
49 static const QString DefaultSizeConfigEntry;
50 static const QString DefaultShapeConfigEntry;
51 static const QString DefaultSelectionColorEntry;
52 static const QString FavoriteAlgorithmsEntry;
53 static const QString FirstRunEntry;
55 static const QString ProxyEnabledEntry;
56 static const QString ProxyTypeEntry;
57 static const QString ProxyHostEntry;
58 static const QString ProxyPortEntry;
59 static const QString ProxyUseAuthEntry;
60 static const QString ProxyUsernameEntry;
61 static const QString ProxyPasswordEntry;
63 static const QString AutomaticPerfectAspectRatioEntry;
64 static const QString AutomaticMapMetricEntry;
66 static TulipSettings &instance();
68 static QString elementKey(const QString& configEntry, tlp::ElementType elem);
73 QStringList recentDocuments() const;
79 void addToRecentDocuments(const QString &);
84 void checkRecentDocuments();
92 void addRemoteLocation(const QString& remoteLocation);
100 void removeRemoteLocation(const QString& remoteLocation);
107 const QStringList remoteLocations() const;
108 const QStringList pluginsToRemove() const;
110 void markPluginForRemoval(const QString& pluginLibrary);
111 void unmarkPluginForRemoval(const QString& pluginLibrary);
113 tlp::Color defaultColor(tlp::ElementType elem);
114 void setDefaultColor(tlp::ElementType elem, const tlp::Color& color);
116 tlp::Color defaultLabelColor();
117 void setDefaultLabelColor(const tlp::Color& color);
119 tlp::Size defaultSize(tlp::ElementType elem);
120 void setDefaultSize(tlp::ElementType elem, const tlp::Size& size);
122 int defaultShape(tlp::ElementType elem);
123 void setDefaultShape(tlp::ElementType elem,
int shape);
125 tlp::Color defaultSelectionColor();
126 void setDefaultSelectionColor(const tlp::Color& color);
128 QSet<QString> favoriteAlgorithms() const;
129 void addFavoriteAlgorithm(const QString&name);
130 void removeFavoriteAlgorithm(const QString&name);
133 bool isProxyEnabled() const;
134 void setProxyEnabled(
bool);
136 QNetworkProxy::ProxyType proxyType() const;
137 void setProxyType(QNetworkProxy::ProxyType);
139 QString proxyHost() const;
140 void setProxyHost(const QString&);
142 unsigned int proxyPort() const;
143 void setProxyPort(
unsigned int);
145 bool isUseProxyAuthentification() const;
146 void setUseProxyAuthentification(
bool);
148 QString proxyUsername() const;
149 void setProxyUsername(const QString&);
151 QString proxyPassword() const;
152 void setProxyPassword(const QString&);
154 void applyProxySettings();
156 bool isFirstRun() const;
157 void setFirstRun(
bool);
159 bool isAutomaticMapMetric() const;
160 void setAutomaticMapMetric(
bool);
162 bool isAutomaticRatio() const;
163 void setAutomaticRatio(
bool);
167 static TulipSettings *_instance;
169 void setFavoriteAlgorithms(const QSet<QString> &lst);
172 #endif // TULIPSETTINGS_H