VirtualBox

Changeset 71551 in vbox


Ignore:
Timestamp:
Mar 28, 2018 4:24:48 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9049: Full and heavy cleanup for VBoxUtils stuff.

File:
1 edited

Legend:

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

    r69500 r71551  
    55
    66/*
    7  * Copyright (C) 2006-2017 Oracle Corporation
     7 * Copyright (C) 2006-2018 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1919#define ___VBoxUtils_h___
    2020
    21 #include <iprt/types.h>
    22 
    23 /* Qt includes */
     21/* Qt includes: */
    2422#include <QMouseEvent>
    2523#include <QWidget>
    2624#include <QTextBrowser>
    2725
    28 /** QObject reimplementation,
    29   * providing passed QObject with property assignation routine. */
     26/* GUI includes: */
     27#ifdef VBOX_WS_MAC
     28# include "VBoxUtils-darwin.h"
     29#endif
     30
     31/* Other VBox includes: */
     32#include <iprt/types.h>
     33
     34
     35/** QObject subclass,
     36  * allowing to apply string-property value for a certain QObject. */
    3037class QObjectPropertySetter : public QObject
    3138{
     
    3441public:
    3542
    36     /** Constructor. */
     43    /** Constructs setter for a property with certain @a strName, passing @a pParent to the base-class. */
    3744    QObjectPropertySetter(QObject *pParent, const QString &strName)
    38         : QObject(pParent), m_strName(strName) {}
     45        : QObject(pParent), m_strName(strName)
     46    {}
    3947
    4048public slots:
    4149
    42     /** Assigns property value. */
     50    /** Assigns string property @a strValue. */
    4351    void sltAssignProperty(const QString &strValue)
    44         { parent()->setProperty(m_strName.toLatin1().constData(), strValue); }
     52    {
     53        parent()->setProperty(m_strName.toLatin1().constData(), strValue);
     54    }
    4555
    4656private:
    4757
    48     /** Holds property name. */
     58    /** Holds the property name. */
    4959    const QString m_strName;
    5060};
    5161
    52 /**
    53  *  Simple class which simulates focus-proxy rule redirecting widget
    54  *  assigned shortcut to desired widget.
    55  */
    56 class QIFocusProxy : protected QObject
    57 {
    58     Q_OBJECT;
    5962
    60 public:
    61 
    62     QIFocusProxy (QWidget *aFrom, QWidget *aTo)
    63         : QObject (aFrom), mFrom (aFrom), mTo (aTo)
    64     {
    65         mFrom->installEventFilter (this);
    66     }
    67 
    68 protected:
    69 
    70     bool eventFilter (QObject *aObject, QEvent *aEvent)
    71     {
    72         if (aObject == mFrom && aEvent->type() == QEvent::Shortcut)
    73         {
    74             mTo->setFocus();
    75             return true;
    76         }
    77         return QObject::eventFilter (aObject, aEvent);
    78     }
    79 
    80     QWidget *mFrom;
    81     QWidget *mTo;
    82 };
    83 
    84 /**
    85  *  QTextEdit reimplementation to feat some extended requirements.
    86  */
    87 class QRichTextEdit : public QTextEdit
    88 {
    89     Q_OBJECT;
    90 
    91 public:
    92 
    93     QRichTextEdit (QWidget *aParent = 0) : QTextEdit (aParent) {}
    94 
    95     void setViewportMargins (int aLeft, int aTop, int aRight, int aBottom)
    96     {
    97         QTextEdit::setViewportMargins (aLeft, aTop, aRight, aBottom);
    98     }
    99 };
    100 
    101 /**
    102  *  QTextBrowser reimplementation to feat some extended requirements.
    103  */
    104 class QRichTextBrowser : public QTextBrowser
    105 {
    106     Q_OBJECT;
    107 
    108 public:
    109 
    110     QRichTextBrowser (QWidget *aParent) : QTextBrowser (aParent) {}
    111 
    112     void setViewportMargins (int aLeft, int aTop, int aRight, int aBottom)
    113     {
    114         QTextBrowser::setViewportMargins (aLeft, aTop, aRight, aBottom);
    115     }
    116 };
    117 
    118 /** Object containing functionality
    119   * to (de)serialize proxy settings. */
     63/** Simple class,
     64  * containing functionality to (de)serialize proxy settings. */
    12065class UIProxyManager
    12166{
     
    13075    };
    13176
    132     /** Constructs object which parses passed @a strProxySettings. */
     77    /** Constructs proxy-manager which parses @a strProxySettings. */
    13378    UIProxyManager(const QString &strProxySettings = QString())
    13479        : m_enmProxyState(ProxyState_Auto)
     
    180125    ProxyState proxyState() const { return m_enmProxyState; }
    181126    /** Returns the proxy host. */
    182     const QString& proxyHost() const { return m_strProxyHost; }
     127    const QString &proxyHost() const { return m_strProxyHost; }
    183128    /** Returns the proxy port. */
    184     const QString& proxyPort() const { return m_strProxyPort; }
     129    const QString &proxyPort() const { return m_strProxyPort; }
    185130
    186131    /** Returns whether the proxy auth is enabled. */
    187132    bool authEnabled() const { return m_fAuthEnabled; }
    188133    /** Returns the proxy auth login. */
    189     const QString& authLogin() const { return m_strAuthLogin; }
     134    const QString &authLogin() const { return m_strAuthLogin; }
    190135    /** Returns the proxy auth password. */
    191     const QString& authPassword() const { return m_strAuthPassword; }
     136    const QString &authPassword() const { return m_strAuthPassword; }
    192137
    193138    /** Defines the proxy @a enmState. */
     
    207152private:
    208153
    209     /** Converts passed @a state to corresponding #QString. */
    210     static QString proxyStateToString(ProxyState state)
     154    /** Converts passed @a enmState to corresponding #QString. */
     155    static QString proxyStateToString(ProxyState enmState)
    211156    {
    212         switch (state)
     157        switch (enmState)
    213158        {
    214159            case ProxyState_Disabled: return QString("ProxyDisabled");
     
    232177
    233178    /** Holds the proxy state. */
    234     ProxyState m_enmProxyState;
     179    ProxyState  m_enmProxyState;
    235180    /** Holds the proxy host. */
    236     QString m_strProxyHost;
     181    QString     m_strProxyHost;
    237182    /** Holds the proxy port. */
    238     QString m_strProxyPort;
     183    QString     m_strProxyPort;
    239184
    240185    /** Holds whether the proxy auth is enabled. */
    241     bool m_fAuthEnabled;
     186    bool     m_fAuthEnabled;
    242187    /** Holds the proxy auth login. */
    243     QString m_strAuthLogin;
     188    QString  m_strAuthLogin;
    244189    /** Holds the proxy auth password. */
    245     QString m_strAuthPassword;
     190    QString  m_strAuthPassword;
    246191};
    247192
    248 #ifdef VBOX_WS_MAC
    249 # include "VBoxUtils-darwin.h"
    250 #endif /* VBOX_WS_MAC */
    251193
    252 #endif // !___VBoxUtils_h___
     194#endif /* !___VBoxUtils_h___ */
    253195
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