VirtualBox

Changeset 64688 in vbox


Ignore:
Timestamp:
Nov 17, 2016 1:16:10 PM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6899: Accessibility support (step 131): UIApplianceEditorWidget doxy.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/widgets
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.cpp

    r64686 r64688  
    4848
    4949
    50 /* This & the following derived classes represent the data items of a Virtual
    51    System. All access/manipulation is done with the help of virtual functions
    52    to keep the interface clean. ModelItem is able to handle tree structures
    53    with a parent & several children's. */
     50/** Describes the interface of Virtual System item.
     51  * Represented as a tree structure with a parent & multiple children. */
    5452class ModelItem
    5553{
    5654public:
    5755
     56    /** Constructs item with specified @a number, @a type and @a pParent. */
    5857    ModelItem(int number, ApplianceModelItemType type, ModelItem *pParent = NULL);
    59 
     58    /** Destructs item. */
    6059    virtual ~ModelItem();
    6160
     61    /** Returns the parent of the item. */
    6262    ModelItem *parent() const { return m_pParentItem; }
    6363
     64    /** Appends the passed @a pChild to the item's list of children. */
    6465    void appendChild(ModelItem *pChild);
     66    /** Returns the child specified by the @a row. */
    6567    ModelItem *child(int row) const;
    6668
     69    /** Returns the row of the item in the parent. */
    6770    int row() const;
    6871
     72    /** Returns the number of children. */
    6973    int childCount() const;
     74    /** Returns the number of columns. */
    7075    int columnCount() const { return 3; }
    7176
     77    /** Returns the item flags for the given @a column. */
    7278    virtual Qt::ItemFlags itemFlags(int /* column */) const { return 0; }
     79    /** Defines the @a role data for the item at @a column to @a value. */
    7380    virtual bool setData(int /* column */, const QVariant & /* value */, int /* role */) { return false; }
     81    /** Returns the data stored under the given @a role for the item referred to by the @a column. */
    7482    virtual QVariant data(int /* column */, int /* role */) const { return QVariant(); }
     83    /** Returns the widget used to edit the item specified by @a idx for editing.
     84      * @param  pParent      Brings the parent to be assigned for newly created editor.
     85      * @param  styleOption  Bring the style option set for the newly created editor. */
    7586    virtual QWidget *createEditor(QWidget * /* pParent */, const QStyleOptionViewItem & /* styleOption */, const QModelIndex & /* idx */) const { return NULL; }
     87    /** Defines the contents of the given @a pEditor to the data for the item at the given @a idx. */
    7688    virtual bool setEditorData(QWidget * /* pEditor */, const QModelIndex & /* idx */) const { return false; }
     89    /** Defines the data for the item at the given @a idx in the @a pModel to the contents of the given @a pEditor. */
    7790    virtual bool setModelData(QWidget * /* pEditor */, QAbstractItemModel * /* pModel */, const QModelIndex & /* idx */) { return false; }
    7891
     92    /** Restores the default values. */
    7993    virtual void restoreDefaults() {}
     94    /** Cache currently stored values, such as @a finalStates, @a finalValues and @a finalExtraValues. */
    8095    virtual void putBack(QVector<BOOL>& finalStates, QVector<QString>& finalValues, QVector<QString>& finalExtraValues);
    8196
     97    /** Returns the item type. */
    8298    ApplianceModelItemType type() const { return m_type; }
    8399
    84100protected:
    85101
    86     /* Protected member vars */
     102    /** Holds the item number. */
    87103    int                     m_number;
     104    /** Holds the item type. */
    88105    ApplianceModelItemType  m_type;
    89106
     107    /** Holds the parent item reference. */
    90108    ModelItem              *m_pParentItem;
     109    /** Holds the list of children item instances. */
    91110    QList<ModelItem*>       m_childItems;
    92111};
    93112
    94113
    95 /* This class represent a Virtual System with an index. */
    96 class VirtualSystemItem: public ModelItem
     114/** ModelItem subclass representing Virtual System. */
     115class VirtualSystemItem : public ModelItem
    97116{
    98117public:
     118
     119    /** Constructs item passing @a number and @a pParent to the base-class.
     120      * @param  aDesc  Brings the Virtual System Description. */
    99121    VirtualSystemItem(int number, CVirtualSystemDescription aDesc, ModelItem *pParent);
    100122
     123    /** Returns the data stored under the given @a role for the item referred to by the @a column. */
    101124    virtual QVariant data(int column, int role) const;
    102125
     126    /** Cache currently stored values, such as @a finalStates, @a finalValues and @a finalExtraValues. */
    103127    virtual void putBack(QVector<BOOL>& finalStates, QVector<QString>& finalValues, QVector<QString>& finalExtraValues);
    104128
    105129private:
     130
     131    /** Holds the Virtual System Description. */
    106132    CVirtualSystemDescription m_desc;
    107133};
    108134
    109135
    110 /* This class represent an hardware item of a Virtual System. All values of
    111    KVirtualSystemDescriptionType are supported & handled differently. */
    112 class HardwareItem: public ModelItem
     136/** ModelItem subclass representing Virtual System item. */
     137class HardwareItem : public ModelItem
    113138{
    114139    friend class VirtualSystemSortProxyModel;
     140
    115141public:
    116142
     143    /** Data roles. */
    117144    enum
    118145    {
     
    121148    };
    122149
     150    /** Constructs item passing @a number and @a pParent to the base-class.
     151      * @param  type                 Brings the Virtual System Description type.
     152      * @param  strRef               Brings something totally useless.
     153      * @param  strOrigValue         Brings the original value.
     154      * @param  strConfigValue       Brings the configuration value.
     155      * @param  strExtraConfigValue  Brings the extra configuration value. */
    123156    HardwareItem(int number,
    124157                 KVirtualSystemDescriptionType type,
     
    129162                 ModelItem *pParent);
    130163
     164    /** Cache currently stored values, such as @a finalStates, @a finalValues and @a finalExtraValues. */
    131165    virtual void putBack(QVector<BOOL>& finalStates, QVector<QString>& finalValues, QVector<QString>& finalExtraValues);
    132166
     167    /** Defines the @a role data for the item at @a column to @a value. */
    133168    virtual bool setData(int column, const QVariant &value, int role);
     169    /** Returns the data stored under the given @a role for the item referred to by the @a column. */
    134170    virtual QVariant data(int column, int role) const;
    135171
     172    /** Returns the item flags for the given @a column. */
    136173    virtual Qt::ItemFlags itemFlags(int column) const;
    137174
     175    /** Returns the widget used to edit the item specified by @a idx for editing.
     176      * @param  pParent      Brings the parent to be assigned for newly created editor.
     177      * @param  styleOption  Bring the style option set for the newly created editor. */
    138178    virtual QWidget *createEditor(QWidget *pParent, const QStyleOptionViewItem &styleOption, const QModelIndex &idx) const;
     179    /** Defines the contents of the given @a pEditor to the data for the item at the given @a idx. */
    139180    virtual bool setEditorData(QWidget *pEditor, const QModelIndex &idx) const;
    140 
     181    /** Defines the data for the item at the given @a idx in the @a pModel to the contents of the given @a pEditor. */
    141182    virtual bool setModelData(QWidget *pEditor, QAbstractItemModel *pModel, const QModelIndex &idx);
    142183
     184    /** Restores the default values. */
    143185    virtual void restoreDefaults()
    144186    {
     
    149191private:
    150192
    151     /* Private member vars */
     193    /** Holds the Virtual System description type. */
    152194    KVirtualSystemDescriptionType m_type;
     195    /** Holds something totally useless. */
    153196    QString                       m_strRef;
     197    /** Holds the original value. */
    154198    QString                       m_strOrigValue;
     199    /** Holds the configuration value. */
    155200    QString                       m_strConfigValue;
     201    /** Holds the default configuration value. */
    156202    QString                       m_strConfigDefaultValue;
     203    /** Holds the extra configuration value. */
    157204    QString                       m_strExtraConfigValue;
     205    /** Holds the item check state. */
    158206    Qt::CheckState                m_checkState;
     207    /** Holds whether item was modified. */
    159208    bool                          m_fModified;
    160209};
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.h

    r64686 r64688  
    5757
    5858
     59/** QAbstractItemModel subclass used as Virtual System model. */
    5960class VirtualSystemModel : public QAbstractItemModel
    6061{
    6162public:
    6263
     64    /** Constructs the Virtual System model passing @a pParent to the base-class.
     65      * @param  aVSDs  Brings the Virtual System descriptions. */
    6366    VirtualSystemModel(QVector<CVirtualSystemDescription>& aVSDs, QObject *pParent = NULL);
     67    /** Destructs the Virtual System model. */
    6468    ~VirtualSystemModel();
    6569
     70    /** Returns the index of the item in the model specified by the given @a row, @a column and @a parentIdx. */
    6671    QModelIndex index(int row, int column, const QModelIndex &parentIdx = QModelIndex()) const;
     72    /** Returns the parent of the model item with the given @a idx. */
    6773    QModelIndex parent(const QModelIndex &idx) const;
     74    /** Returns the number of rows for the children of the given @a parentIdx. */
    6875    int rowCount(const QModelIndex &parentIdx = QModelIndex()) const;
     76    /** Returns the number of columns for the children of the given @a parentIdx. */
    6977    int columnCount(const QModelIndex &parentIdx = QModelIndex()) const;
     78    /** Defines the @a role data for the item at @a idx to @a value. */
    7079    bool setData(const QModelIndex &idx, const QVariant &value, int role);
     80    /** Returns the data stored under the given @a role for the item referred to by the @a idx. */
    7181    QVariant data(const QModelIndex &idx, int role = Qt::DisplayRole) const;
     82    /** Returns the item flags for the given @a idx. */
    7283    Qt::ItemFlags flags(const QModelIndex &idx) const;
     84    /** Returns the data for the given @a role and @a section in the header with the specified @a orientation. */
    7385    QVariant headerData(int section, Qt::Orientation orientation, int role) const;
    7486
     87    /** Returns a model index for the buddy of the item represented by @a idx. */
    7588    QModelIndex buddy(const QModelIndex &idx) const;
    7689
     90    /** Restores the default values for the item with the given @a parentIdx. */
    7791    void restoreDefaults(const QModelIndex &parentIdx = QModelIndex());
     92    /** Cache currently stored values. */
    7893    void putBack();
    7994
    8095private:
    8196
    82     /* Private member vars */
     97    /** Holds the root item reference. */
    8398    ModelItem *m_pRootItem;
    8499};
    85100
    86101
    87 /* The delegate is used for creating/handling the different editors for the
    88    various types we support. This class forward the requests to the virtual
    89    methods of our different ModelItems. If this is not possible the default
    90    methods of QItemDelegate are used to get some standard behavior. Note: We
    91    have to handle the proxy model ourself. I really don't understand why Qt is
    92    not doing this for us. */
     102/** QItemDelegate subclass used to create various Virtual System model editors. */
    93103class VirtualSystemDelegate : public QItemDelegate
    94104{
    95105public:
    96106
     107    /** Constructs the Virtual System Delegate passing @a pParent to the base-class.
     108      * @param  pProxy  Brings the proxy model reference used to redirect requests to. */
    97109    VirtualSystemDelegate(QAbstractProxyModel *pProxy, QObject *pParent = NULL);
    98110
     111    /** Returns the widget used to edit the item specified by @a idx for editing.
     112      * @param  pParent      Brings the parent to be assigned for newly created editor.
     113      * @param  styleOption  Bring the style option set for the newly created editor. */
    99114    QWidget *createEditor(QWidget *pParent, const QStyleOptionViewItem &styleOption, const QModelIndex &idx) const;
     115    /** Defines the contents of the given @a pEditor to the data for the item at the given @a idx. */
    100116    void setEditorData(QWidget *pEditor, const QModelIndex &idx) const;
     117    /** Defines the data for the item at the given @a idx in the @a pModel to the contents of the given @a pEditor. */
    101118    void setModelData(QWidget *pEditor, QAbstractItemModel *pModel, const QModelIndex &idx) const;
     119    /** Updates the geometry of the @a pEditor for the item with the given @a idx, according to the rectangle specified in the @a styleOption. */
    102120    void updateEditorGeometry(QWidget *pEditor, const QStyleOptionViewItem &styleOption, const QModelIndex &idx) const;
    103121
     122    /** Returns the size hint for the item at the given @a idx and specified @a styleOption. */
    104123    QSize sizeHint(const QStyleOptionViewItem &styleOption, const QModelIndex &idx) const
    105124    {
     
    117136
    118137#ifdef VBOX_WS_MAC
     138    /** Filters @a pEvent if this object has been installed as an event filter for the watched @a pObject. */
    119139    bool eventFilter(QObject *pObject, QEvent *pEvent);
    120140#endif /* VBOX_WS_MAC */
     
    122142private:
    123143
    124     /* Private member vars */
     144    /** Holds the proxy model reference used to redirect requests to. */
    125145    QAbstractProxyModel *mProxy;
    126146};
    127147
    128148
     149/** QSortFilterProxyModel subclass used as the Virtual System Sorting model. */
    129150class VirtualSystemSortProxyModel : public QSortFilterProxyModel
    130151{
    131152public:
    132153
     154    /** Constructs the Virtual System Sorting model passing @a pParent to the base-class. */
    133155    VirtualSystemSortProxyModel(QObject *pParent = NULL);
    134156
    135157protected:
    136158
     159    /** Returns whether item in the row indicated by the given @a srcRow and @a srcParenIdx should be included in the model. */
    137160    bool filterAcceptsRow(int srcRow, const QModelIndex & srcParenIdx) const;
     161    /** Returns whether value of the item referred to by the given index @a leftIdx is less
     162      * than the value of the item referred to by the given index @a rightIdx. */
    138163    bool lessThan(const QModelIndex &leftIdx, const QModelIndex &rightIdx) const;
    139164
     165    /** Holds the array of sorted Virtual System Description types. */
    140166    static KVirtualSystemDescriptionType m_sortList[];
    141167
     168    /** Holds the filtered list of Virtual System Description types. */
    142169    QList<KVirtualSystemDescriptionType> m_filterList;
    143170};
    144171
    145172
     173/** QWidget subclass used as the Appliance Editor widget. */
    146174class UIApplianceEditorWidget : public QIWithRetranslateUI<QWidget>
    147175{
     
    150178public:
    151179
     180    /** Constructs the Appliance Editor widget passing @a pParent to the base-class. */
    152181    UIApplianceEditorWidget(QWidget *pParent = NULL);
    153182
     183    /** Returns whether the Appliance Editor has valid state. */
    154184    bool isValid() const          { return m_pAppliance != NULL; }
     185    /** Returns the currently set appliance reference. */
    155186    CAppliance* appliance() const { return m_pAppliance; }
    156187
     188    /** Returns the minimum guest RAM. */
    157189    static int minGuestRAM()      { return m_minGuestRAM; }
     190    /** Returns the maximum guest RAM. */
    158191    static int maxGuestRAM()      { return m_maxGuestRAM; }
     192    /** Returns the minimum guest CPU count. */
    159193    static int minGuestCPUCount() { return m_minGuestCPUCount; }
     194    /** Returns the maximum guest CPU count. */
    160195    static int maxGuestCPUCount() { return m_maxGuestCPUCount; }
    161196
    162197public slots:
    163198
     199    /** Restores the default values. */
    164200    void restoreDefaults();
    165201
    166202protected:
    167203
     204    /** Handles translation event. */
    168205    virtual void retranslateUi();
    169206
    170     /* Protected member vars */
     207    /** Holds the currently set appliance reference. */
    171208    CAppliance         *m_pAppliance;
     209    /** Holds the Virtual System model reference. */
    172210    VirtualSystemModel *m_pModel;
    173211
     
    188226private:
    189227
     228    /** Performs Virtual System settings initialization. */
    190229    static void initSystemSettings();
    191230
    192     /* Private member vars */
     231    /** Holds the minimum guest RAM. */
    193232    static int m_minGuestRAM;
     233    /** Holds the maximum guest RAM. */
    194234    static int m_maxGuestRAM;
     235    /** Holds the minimum guest CPU count. */
    195236    static int m_minGuestCPUCount;
     237    /** Holds the maximum guest CPU count. */
    196238    static int m_maxGuestCPUCount;
    197239};
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