Changeset 58311 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Oct 19, 2015 3:55:26 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxUtils.h
r55401 r58311 146 146 }; 147 147 148 /** Object containing functionality 149 * to (de)serialize proxy settings. */ 148 150 class UIProxyManager 149 151 { 150 152 public: 151 153 154 /** Constructs object which parses passed @a strProxySettings. */ 152 155 UIProxyManager(const QString &strProxySettings = QString()) 153 : m_fProxyEnabled(false), m_fAuthEnabled(false) 154 { 155 /* Parse settings: */ 156 if (!strProxySettings.isEmpty()) 157 { 158 QStringList proxySettings = strProxySettings.split(","); 159 if (proxySettings.size() > 0) 160 m_fProxyEnabled = proxySettings[0] == "proxyEnabled"; 161 if (proxySettings.size() > 1) 162 m_strProxyHost = proxySettings[1]; 163 if (proxySettings.size() > 2) 164 m_strProxyPort = proxySettings[2]; 165 if (proxySettings.size() > 3) 166 m_fAuthEnabled = proxySettings[3] == "authEnabled"; 167 if (proxySettings.size() > 4) 168 m_strAuthLogin = proxySettings[4]; 169 if (proxySettings.size() > 5) 170 m_strAuthPassword = proxySettings[5]; 171 } 172 } 173 156 : m_fProxyEnabled(false) 157 , m_fAuthEnabled(false) 158 { 159 /* Parse proxy settings: */ 160 if (strProxySettings.isEmpty()) 161 return; 162 QStringList proxySettings = strProxySettings.split(","); 163 164 /* Parse proxy state, host and port: */ 165 if (proxySettings.size() > 0) 166 m_fProxyEnabled = proxySettings[0] == "proxyEnabled"; 167 if (proxySettings.size() > 1) 168 m_strProxyHost = proxySettings[1]; 169 if (proxySettings.size() > 2) 170 m_strProxyPort = proxySettings[2]; 171 172 /* Parse whether proxy auth enabled and has login/password: */ 173 if (proxySettings.size() > 3) 174 m_fAuthEnabled = proxySettings[3] == "authEnabled"; 175 if (proxySettings.size() > 4) 176 m_strAuthLogin = proxySettings[4]; 177 if (proxySettings.size() > 5) 178 m_strAuthPassword = proxySettings[5]; 179 } 180 181 /** Serializes proxy settings. */ 174 182 QString toString() const 175 183 { … … 191 199 } 192 200 193 /* Proxy attribute getters:*/201 /** Returns whether the proxy is enabled. */ 194 202 bool proxyEnabled() const { return m_fProxyEnabled; } 203 /** Returns the proxy host. */ 195 204 const QString& proxyHost() const { return m_strProxyHost; } 205 /** Returns the proxy port. */ 196 206 const QString& proxyPort() const { return m_strProxyPort; } 207 208 /** Returns whether the proxy auth is enabled. */ 197 209 bool authEnabled() const { return m_fAuthEnabled; } 210 /** Returns the proxy auth login. */ 198 211 const QString& authLogin() const { return m_strAuthLogin; } 212 /** Returns the proxy auth password. */ 199 213 const QString& authPassword() const { return m_strAuthPassword; } 200 214 201 /* Proxy attribute setters: */ 202 void setProxyEnabled(bool fProxyEnabled) { m_fProxyEnabled = fProxyEnabled; } 203 void setProxyHost(const QString &strProxyHost) { m_strProxyHost = strProxyHost; } 204 void setProxyPort(const QString &strProxyPort) { m_strProxyPort = strProxyPort; } 205 void setAuthEnabled(bool fAuthEnabled) { m_fAuthEnabled = fAuthEnabled; } 206 void setAuthLogin(const QString &strAuthLogin) { m_strAuthLogin = strAuthLogin; } 207 void setAuthPassword(const QString &strAuthPassword) { m_strAuthPassword = strAuthPassword; } 215 /** Defines whether the proxy is @a fEnabled. */ 216 void setProxyEnabled(bool fEnabled) { m_fProxyEnabled = fEnabled; } 217 /** Defines the proxy @a strHost. */ 218 void setProxyHost(const QString &strHost) { m_strProxyHost = strHost; } 219 /** Defines the proxy @a strPort. */ 220 void setProxyPort(const QString &strPort) { m_strProxyPort = strPort; } 221 222 /** Defines whether the proxy auth is @a fEnabled. */ 223 void setAuthEnabled(bool fEnabled) { m_fAuthEnabled = fEnabled; } 224 /** Defines the proxy auth @a strLogin. */ 225 void setAuthLogin(const QString &strLogin) { m_strAuthLogin = strLogin; } 226 /** Defines the proxy auth @a strPassword. */ 227 void setAuthPassword(const QString &strPassword) { m_strAuthPassword = strPassword; } 208 228 209 229 private: 210 230 211 /* Proxy attribute variables:*/231 /** Holds whether the proxy is enabled. */ 212 232 bool m_fProxyEnabled; 233 /** Holds the proxy host. */ 213 234 QString m_strProxyHost; 235 /** Holds the proxy port. */ 214 236 QString m_strProxyPort; 237 238 /** Holds whether the proxy auth is enabled. */ 215 239 bool m_fAuthEnabled; 240 /** Holds the proxy auth login. */ 216 241 QString m_strAuthLogin; 242 /** Holds the proxy auth password. */ 217 243 QString m_strAuthPassword; 218 244 };
Note:
See TracChangeset
for help on using the changeset viewer.