![]() |
Tulip
4.6.0
Better Visualization Through Research
|
00001 /* 00002 * 00003 * This file is part of Tulip (www.tulip-software.org) 00004 * 00005 * Authors: David Auber and the Tulip development Team 00006 * from LaBRI, University of Bordeaux 00007 * 00008 * Tulip is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License 00010 * as published by the Free Software Foundation, either version 3 00011 * of the License, or (at your option) any later version. 00012 * 00013 * Tulip is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 * See the GNU General Public License for more details. 00017 * 00018 */ 00019 ///@cond DOXYGEN_HIDDEN 00020 00021 #ifndef TULIPSETTINGS_H 00022 #define TULIPSETTINGS_H 00023 00024 #include <QSettings> 00025 #include <QNetworkProxy> 00026 #include <QString> 00027 00028 #include <tulip/GlGraphRenderingParameters.h> 00029 #include <tulip/Size.h> 00030 #include <tulip/Graph.h> 00031 00032 namespace tlp { 00033 00034 /** 00035 * @brief This class provides convenience functions to access the Tulip settings file (using QSettings) 00036 * TulipSettings is a wrapper for QSettings providing quick access to common keys provided in the tulip configuration file. 00037 * This object does not mask any method from the QSettings class, which mean that the user can still access custom keys by invoking the QSettings::value method. 00038 */ 00039 class TLP_QT_SCOPE TulipSettings: public QSettings, GlDefaultSelectionColorManager, Observable { 00040 Q_OBJECT 00041 Q_ENUMS(DisplayProperty) 00042 00043 public: 00044 00045 static const QString RemoteLocationsConfigEntry; 00046 static const QString RecentDocumentsConfigEntry; 00047 static const QString PluginsToRemoveConfigEntry; 00048 static const QString DefaultColorConfigEntry; 00049 static const QString DefaultLabelColorConfigEntry; 00050 static const QString DefaultSizeConfigEntry; 00051 static const QString DefaultShapeConfigEntry; 00052 static const QString DefaultSelectionColorEntry; 00053 static const QString FavoriteAlgorithmsEntry; 00054 static const QString FirstRunEntry; 00055 00056 static const QString ProxyEnabledEntry; 00057 static const QString ProxyTypeEntry; 00058 static const QString ProxyHostEntry; 00059 static const QString ProxyPortEntry; 00060 static const QString ProxyUseAuthEntry; 00061 static const QString ProxyUsernameEntry; 00062 static const QString ProxyPasswordEntry; 00063 00064 static const QString AutomaticDisplayDefaultViews; 00065 static const QString AutomaticPerfectAspectRatioEntry; 00066 static const QString ViewOrthoEntry; 00067 static const QString AutomaticMapMetricEntry; 00068 static const QString ResultPropertyStoredEntry; 00069 static const QString RunningTimeComputedEntry; 00070 static const QString SeedForRandomSequenceEntry; 00071 00072 static const QString WarnUserAboutGraphicsCardEntry; 00073 00074 static TulipSettings &instance(); 00075 00076 static QString elementKey(const QString& configEntry, tlp::ElementType elem); 00077 00078 void synchronizeViewSettings(); 00079 00080 /** 00081 @brief Retrieves the list of documents recently opened with tulip. 00082 */ 00083 QStringList recentDocuments() const; 00084 00085 /** 00086 @brief Registers a file in the list of recently opened documents. 00087 If the list already contains 5 elements, the last one (in chronological order) will be removed. 00088 */ 00089 void addToRecentDocuments(const QString &); 00090 00091 /** 00092 @brief Check recently opened documents list and remove non-existing ones 00093 */ 00094 void checkRecentDocuments(); 00095 00096 /** 00097 * @brief Adds a remote location from which to list plugins. 00098 * 00099 * @param remoteLocation The URL of the plugin server. 00100 * @return void 00101 **/ 00102 void addRemoteLocation(const QString& remoteLocation); 00103 00104 /** 00105 * @brief Removes a location from which to list plugins. 00106 * 00107 * @param remoteLocation The URL of the plugin server. 00108 * @return void 00109 **/ 00110 void removeRemoteLocation(const QString& remoteLocation); 00111 00112 /** 00113 * @brief Retrieves the list of locations from which to list plugins. 00114 * 00115 * @return const QStringList 00116 **/ 00117 const QStringList remoteLocations() const; 00118 const QStringList pluginsToRemove() const; 00119 00120 void markPluginForRemoval(const QString& pluginLibrary); 00121 void unmarkPluginForRemoval(const QString& pluginLibrary); 00122 00123 tlp::Color defaultColor(tlp::ElementType elem); 00124 void setDefaultColor(tlp::ElementType elem, const tlp::Color& color); 00125 00126 tlp::Color defaultLabelColor(); 00127 void setDefaultLabelColor(const tlp::Color& color); 00128 00129 tlp::Size defaultSize(tlp::ElementType elem); 00130 void setDefaultSize(tlp::ElementType elem, const tlp::Size& size); 00131 00132 int defaultShape(tlp::ElementType elem); 00133 void setDefaultShape(tlp::ElementType elem, int shape); 00134 00135 // in GlDefaultSelectionColorManager interface 00136 tlp::Color defaultSelectionColor(); 00137 00138 void setDefaultSelectionColor(const tlp::Color& color); 00139 00140 QSet<QString> favoriteAlgorithms() const; 00141 void addFavoriteAlgorithm(const QString&name); 00142 void removeFavoriteAlgorithm(const QString&name); 00143 00144 // Proxy settings 00145 bool isProxyEnabled() const; 00146 void setProxyEnabled(bool); 00147 00148 QNetworkProxy::ProxyType proxyType() const; 00149 void setProxyType(QNetworkProxy::ProxyType); 00150 00151 QString proxyHost() const; 00152 void setProxyHost(const QString&); 00153 00154 unsigned int proxyPort() const; 00155 void setProxyPort(unsigned int); 00156 00157 bool isUseProxyAuthentification() const; 00158 void setUseProxyAuthentification(bool); 00159 00160 QString proxyUsername() const; 00161 void setProxyUsername(const QString&); 00162 00163 QString proxyPassword() const; 00164 void setProxyPassword(const QString&); 00165 00166 void applyProxySettings(); 00167 00168 bool isFirstRun() const; 00169 void setFirstRun(bool); 00170 00171 bool displayDefaultViews() const; 00172 void setDisplayDefaultViews(bool); 00173 00174 bool isAutomaticMapMetric() const; 00175 void setAutomaticMapMetric(bool); 00176 00177 bool isAutomaticRatio() const; 00178 void setAutomaticRatio(bool); 00179 00180 bool isViewOrtho() const; 00181 void setViewOrtho(bool); 00182 00183 bool isResultPropertyStored() const; 00184 void setResultPropertyStored(bool); 00185 00186 bool isRunningTimeComputed() const; 00187 void setRunningTimeComputed(bool); 00188 00189 unsigned int seedOfRandomSequence() const; 00190 void setSeedOfRandomSequence(unsigned int); 00191 void initSeedOfRandomSequence(); 00192 00193 bool warnUserAboutGraphicsCard() const; 00194 void setWarnUserAboutGraphicsCard(bool); 00195 00196 void treatEvent(const Event &message); 00197 00198 private: 00199 TulipSettings(); 00200 static TulipSettings *_instance; 00201 00202 void setFavoriteAlgorithms(const QSet<QString> &lst); 00203 }; 00204 } 00205 #endif // TULIPSETTINGS_H 00206 ///@endcond