VirtualBox

Ignore:
Timestamp:
Oct 19, 2015 3:55:26 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: Networking cleanup/rework (part 16): Proxy-manager doxygen.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxUtils.h

    r55401 r58311  
    146146};
    147147
     148/** Object containing functionality
     149  * to (de)serialize proxy settings. */
    148150class UIProxyManager
    149151{
    150152public:
    151153
     154    /** Constructs object which parses passed @a strProxySettings. */
    152155    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. */
    174182    QString toString() const
    175183    {
     
    191199    }
    192200
    193     /* Proxy attribute getters: */
     201    /** Returns whether the proxy is enabled. */
    194202    bool proxyEnabled() const { return m_fProxyEnabled; }
     203    /** Returns the proxy host. */
    195204    const QString& proxyHost() const { return m_strProxyHost; }
     205    /** Returns the proxy port. */
    196206    const QString& proxyPort() const { return m_strProxyPort; }
     207
     208    /** Returns whether the proxy auth is enabled. */
    197209    bool authEnabled() const { return m_fAuthEnabled; }
     210    /** Returns the proxy auth login. */
    198211    const QString& authLogin() const { return m_strAuthLogin; }
     212    /** Returns the proxy auth password. */
    199213    const QString& authPassword() const { return m_strAuthPassword; }
    200214
    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; }
    208228
    209229private:
    210230
    211     /* Proxy attribute variables: */
     231    /** Holds whether the proxy is enabled. */
    212232    bool m_fProxyEnabled;
     233    /** Holds the proxy host. */
    213234    QString m_strProxyHost;
     235    /** Holds the proxy port. */
    214236    QString m_strProxyPort;
     237
     238    /** Holds whether the proxy auth is enabled. */
    215239    bool m_fAuthEnabled;
     240    /** Holds the proxy auth login. */
    216241    QString m_strAuthLogin;
     242    /** Holds the proxy auth password. */
    217243    QString m_strAuthPassword;
    218244};
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette