VirtualBox

Changeset 64058 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Sep 27, 2016 5:56:30 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
110986
Message:

FE/Qt: bugref:6899: Accessibility support (step 57): Settings selector doxy.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSelector.cpp

    r63978 r64058  
    2020#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
    2121
    22 /* Global includes */
     22/* Qt includes: */
    2323# include <QHeaderView>
    2424# include <QTabWidget>
     
    2626# include <QAction>
    2727
    28 /* Local includes */
     28/* GUI includes: */
    2929# include "UISettingsSelector.h"
    3030# include "UISettingsPage.h"
     
    3737
    3838
     39/** Tree-widget column categories. */
    3940enum
    4041{
    41     /* mTwSelector column numbers */
    4242    treeWidget_Category = 0,
    4343    treeWidget_Id,
     
    4545};
    4646
     47
     48/** Simple container of all the selector item data. */
    4749class SelectorItem
    4850{
    4951public:
     52
    5053    SelectorItem (const QIcon &aIcon, const QString &aText, int aId, const QString &aLink, UISettingsPage* aPage, int aParentId)
    5154        : mIcon (aIcon)
     
    7578};
    7679
     80
     81/*********************************************************************************************************************************
     82*   Class UISettingsSelector implementation.                                                                                     *
     83*********************************************************************************************************************************/
     84
    7785UISettingsSelector::UISettingsSelector (QWidget *aParent /* = NULL */)
    7886    :QObject (aParent)
     
    126134}
    127135
    128 
    129136SelectorItem *UISettingsSelector::findItem (int aId) const
    130137{
     
    163170}
    164171
    165 /* UISettingsSelectorTreeView */
    166 
    167 /* Returns the path to the item in the form of 'grandparent > parent > item'
    168  * using the text of the first column of every item. */
     172
     173/*********************************************************************************************************************************
     174*   Class UISettingsSelectorTreeView implementation.                                                                             *
     175*********************************************************************************************************************************/
     176
    169177static QString path (QTreeWidgetItem *aItem)
    170178{
     
    275283}
    276284
    277 
    278285void UISettingsSelectorTreeView::selectById (int aId)
    279286{
     
    331338}
    332339
    333 /**
    334  *  Returns a path to the given page of this settings window. See ::path() for
    335  *  details.
    336  */
    337340QString UISettingsSelectorTreeView::pagePath (const QString &aMatch) const
    338341{
     
    344347}
    345348
    346 /* Returns first item of 'aView' matching required 'aMatch' value
    347  * searching the 'aColumn' column. */
    348349QTreeWidgetItem* UISettingsSelectorTreeView::findItem (QTreeWidget *aView,
    349350                                                         const QString &aMatch,
     
    361362}
    362363
    363 /* UISettingsSelectorToolBar */
    364 
    365 
     364
     365/*********************************************************************************************************************************
     366*   Class UISettingsSelectorToolBar implementation.                                                                              *
     367*********************************************************************************************************************************/
     368
     369/** SelectorItem subclass providing GUI
     370  * with the tab-widget selector item. */
    366371class SelectorActionItem: public SelectorItem
    367372{
    368373public:
     374
    369375    SelectorActionItem (const QIcon &aIcon, const QString &aText, int aId, const QString &aLink, UISettingsPage* aPage, int aParentId, QObject *aParent)
    370376        : SelectorItem (aIcon, aText, aId, aLink, aPage, aParentId)
     
    385391    QTabWidget *mTabWidget;
    386392};
     393
    387394
    388395UISettingsSelectorToolBar::UISettingsSelectorToolBar (QWidget *aParent /* = NULL */)
     
    556563    }
    557564}
    558 
    559565
    560566void UISettingsSelectorToolBar::setVisibleById (int aId, bool aShow)
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSelector.h

    r63978 r64058  
    1616 */
    1717
    18 #ifndef __UISettingsSelector_h__
    19 #define __UISettingsSelector_h__
    20 
    21 /* Qt includes */
     18#ifndef ___UISettingsSelector_h___
     19#define ___UISettingsSelector_h___
     20
     21/* Qt includes: */
    2222#include <QObject>
    2323
     24/* Forward declarations: */
    2425class QITreeWidget;
    2526class UIToolBar;
     
    2728class SelectorItem;
    2829class SelectorActionItem;
    29 
    3030class QTreeWidget;
    3131class QTreeWidgetItem;
     
    3636class QTabWidget;
    3737
     38
     39/** QObject subclass providing settings dialog
     40  * with the means to switch between settings pages. */
    3841class UISettingsSelector: public QObject
    3942{
     
    4245public:
    4346
     47    /** Constructs settings selector passing @a aParent to the base-class. */
    4448    UISettingsSelector (QWidget *aParent = NULL);
     49    /** Destructs settings selector. */
    4550    ~UISettingsSelector();
    4651
     52    /** Returns the widget selector operates on. */
    4753    virtual QWidget *widget() const = 0;
    4854
     55    /** Adds a new selector item.
     56      * @param  strBigIcon     Brings the big icon reference.
     57      * @param  strMediumIcon  Brings the medium icon reference.
     58      * @param  strSmallIcon   Brings the small icon reference.
     59      * @param  aId            Brings the selector section ID.
     60      * @param  aLink          Brings the selector section link.
     61      * @param  aPage          Brings the selector section page reference.
     62      * @param  aParentId      Brings the parent section ID or -1 if there is no parent. */
    4963    virtual QWidget *addItem (const QString &strBigIcon, const QString &strMediumIcon, const QString &strSmallIcon,
    5064                              int aId, const QString &aLink, UISettingsPage* aPage = NULL, int aParentId = -1) = 0;
    5165
     66    /** Defines the @a aText for section with @a aId. */
    5267    virtual void setItemText (int aId, const QString &aText);
     68    /** Returns the text for section with @a aId. */
    5369    virtual QString itemText (int aId) const = 0;
     70    /** Returns the text for section with @a aPage. */
    5471    virtual QString itemTextByPage (UISettingsPage *aPage) const;
    5572
     73    /** Returns the current selector ID. */
    5674    virtual int currentId () const = 0;
     75
     76    /** Returns the section ID for passed @a aLink. */
    5777    virtual int linkToId (const QString &aLink) const = 0;
    5878
     79    /** Returns the section page for passed @a aId. */
    5980    virtual QWidget *idToPage (int aId) const;
     81    /** Returns the section root-page for passed @a aId. */
    6082    virtual QWidget *rootPage (int aId) const { return idToPage (aId); }
    6183
     84    /** Make the section with @a aId current. */
    6285    virtual void selectById (int aId) = 0;
     86    /** Make the section with @a aLink current. */
    6387    virtual void selectByLink (const QString &aLink) { selectById (linkToId (aLink)); }
    6488
     89    /** Make the section with @a aId @a aShow. */
    6590    virtual void setVisibleById (int aId, bool aShow) = 0;
    6691
     92    /** Returns the list of all selector pages. */
    6793    virtual QList<UISettingsPage*> settingPages() const;
     94    /** Returns the list of all root pages. */
    6895    virtual QList<QWidget*> rootPages() const;
    6996
     97    /** Performs selector polishing. */
    7098    virtual void polish() {};
    7199
     100    /** Returns minimum selector width. */
    72101    virtual int minWidth () const { return 0; }
    73102
    74103signals:
    75104
     105    /** Notifies listeners about selector section changed. */
    76106    void categoryChanged (int);
    77107
    78108protected:
    79109
     110    /** Clears selector of all the items. */
    80111    virtual void clear() = 0;
    81112
     113    /** Searches for item with passed @a aId. */
    82114    SelectorItem* findItem (int aId) const;
     115    /** Searches for item with passed @a aLink. */
    83116    SelectorItem* findItemByLink (const QString &aLink) const;
     117    /** Searches for item with passed @a aPage. */
    84118    SelectorItem* findItemByPage (UISettingsPage* aPage) const;
    85119
     120    /** Holds the selector item instances. */
    86121    QList<SelectorItem*> mItemList;
    87122};
    88123
     124
     125/** UISettingsSelector subclass providing settings dialog
     126  * with the means to switch between settings pages.
     127  * This one represented as tree-widget. */
    89128class UISettingsSelectorTreeView: public UISettingsSelector
    90129{
     
    93132public:
    94133
     134    /** Constructs settings selector passing @a aParent to the base-class. */
    95135    UISettingsSelectorTreeView (QWidget *aParent = NULL);
    96136
     137    /** Returns the widget selector operates on. */
    97138    virtual QWidget *widget() const;
    98139
     140    /** Adds a new selector item.
     141      * @param  strBigIcon     Brings the big icon reference.
     142      * @param  strMediumIcon  Brings the medium icon reference.
     143      * @param  strSmallIcon   Brings the small icon reference.
     144      * @param  aId            Brings the selector section ID.
     145      * @param  aLink          Brings the selector section link.
     146      * @param  aPage          Brings the selector section page reference.
     147      * @param  aParentId      Brings the parent section ID or -1 if there is no parent. */
    99148    virtual QWidget *addItem (const QString &strBigIcon, const QString &strMediumIcon, const QString &strSmallIcon,
    100149                              int aId, const QString &aLink, UISettingsPage* aPage = NULL, int aParentId = -1);
     150
     151    /** Defines the @a aText for section with @a aId. */
    101152    virtual void setItemText (int aId, const QString &aText);
     153    /** Returns the text for section with @a aId. */
    102154    virtual QString itemText (int aId) const;
    103155
     156    /** Returns the current selector ID. */
    104157    virtual int currentId() const;
     158
     159    /** Returns the section ID for passed @a aLink. */
    105160    virtual int linkToId (const QString &aLink) const;
    106161
     162    /** Make the section with @a aId current. */
    107163    virtual void selectById (int aId);
    108164
     165    /** Make the section with @a aId @a aShow. */
    109166    virtual void setVisibleById (int aId, bool aShow);
    110167
     168    /** Performs selector polishing. */
    111169    virtual void polish();
    112170
    113171private slots:
    114172
     173    /** Handles selector section change from @a aPrevItem to @a aItem. */
    115174    void settingsGroupChanged (QTreeWidgetItem *aItem, QTreeWidgetItem *aPrevItem);
    116175
    117176private:
    118177
     178    /** Clears selector of all the items. */
    119179    virtual void clear();
    120180
     181    /** Returns page path for passed @a aMatch. */
    121182    QString pagePath (const QString &aMatch) const;
     183    /** Find item within the passed @a aView and @a aColumn matching @a aMatch. */
    122184    QTreeWidgetItem* findItem (QTreeWidget *aView, const QString &aMatch, int aColumn) const;
     185    /** Performs @a aId to QString serialization. */
    123186    QString idToString (int aId) const;
    124187
    125     /* Private member vars */
     188    /** Holds the tree-widget selector instance. */
    126189    QITreeWidget *mTwSelector;
    127190};
    128191
     192
     193/** UISettingsSelector subclass providing settings dialog
     194  * with the means to switch between settings pages.
     195  * This one represented as tab-widget. */
    129196class UISettingsSelectorToolBar: public UISettingsSelector
    130197{
     
    133200public:
    134201
     202    /** Constructs settings selector passing @a aParent to the base-class. */
    135203    UISettingsSelectorToolBar (QWidget *aParent = NULL);
    136204    ~UISettingsSelectorToolBar();
    137205
     206    /** Returns the widget selector operates on. */
    138207    virtual QWidget *widget() const;
    139208
     209    /** Adds a new selector item.
     210      * @param  strBigIcon     Brings the big icon reference.
     211      * @param  strMediumIcon  Brings the medium icon reference.
     212      * @param  strSmallIcon   Brings the small icon reference.
     213      * @param  aId            Brings the selector section ID.
     214      * @param  aLink          Brings the selector section link.
     215      * @param  aPage          Brings the selector section page reference.
     216      * @param  aParentId      Brings the parent section ID or -1 if there is no parent. */
    140217    virtual QWidget *addItem (const QString &strBigIcon, const QString &strMediumIcon, const QString &strSmallIcon,
    141218                              int aId, const QString &aLink, UISettingsPage* aPage = NULL, int aParentId = -1);
     219
     220    /** Defines the @a aText for section with @a aId. */
    142221    virtual void setItemText (int aId, const QString &aText);
     222    /** Returns the text for section with @a aId. */
    143223    virtual QString itemText (int aId) const;
    144224
     225    /** Returns the current selector ID. */
    145226    virtual int currentId() const;
     227
     228    /** Returns the section ID for passed @a aLink. */
    146229    virtual int linkToId (const QString &aLink) const;
    147230
     231    /** Returns the section page for passed @a aId. */
    148232    virtual QWidget *idToPage (int aId) const;
     233    /** Returns the section root-page for passed @a aId. */
    149234    virtual QWidget *rootPage (int aId) const;
    150235
     236    /** Make the section with @a aId current. */
    151237    virtual void selectById (int aId);
    152238
     239    /** Make the section with @a aId @a aShow. */
    153240    virtual void setVisibleById (int aId, bool aShow);
    154241
     242    /** Returns minimum selector width. */
    155243    virtual int minWidth() const;
    156244
     245    /** Returns the list of all root pages. */
    157246    virtual QList<QWidget*> rootPages() const;
     247
    158248private slots:
    159249
     250    /** Handles selector section change to @a aAction . */
    160251    void settingsGroupChanged (QAction *aAction);
     252    /** Handles selector section change to @a aIndex . */
    161253    void settingsGroupChanged (int aIndex);
    162254
    163255private:
    164256
     257    /** Clears selector of all the items. */
    165258    virtual void clear();
    166259
     260    /** Searches for action item with passed @a aId. */
    167261    SelectorActionItem *findActionItem (int aId) const;
     262    /** Searches for action item with passed @a aAction. */
    168263    SelectorActionItem *findActionItemByAction (QAction *aAction) const;
     264    /** Searches for action item with passed @a aTabWidget and @a aIndex. */
    169265    SelectorActionItem *findActionItemByTabWidget (QTabWidget* aTabWidget, int aIndex) const;
    170266
    171     /* Private member vars */
     267    /** Holds the toolbar instance. */
    172268    UIToolBar *mTbSelector;
     269    /** Holds the action group instance. */
    173270    QActionGroup *mActionGroup;
    174271};
    175272
    176 #endif /* __UISettingsSelector_h__ */
    177 
     273#endif /* !___UISettingsSelector_h___ */
     274
Note: See TracChangeset for help on using the changeset viewer.

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