VirtualBox

Changeset 64430 in vbox for trunk


Ignore:
Timestamp:
Oct 26, 2016 2:05:53 PM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6899: Accessibility support (step 103): Medium Manager: Move tree-widget stuff onto QITreeWidget rails.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp

    r63567 r64430  
    5757
    5858/** QTreeWidgetItem extension representing Medium Manager item. */
    59 class UIMediumItem : public QTreeWidgetItem
     59class UIMediumItem : public QITreeWidgetItem
    6060{
    6161public:
    6262
    63     /** UIMediumItem type for rtti needs. */
    64     enum { Type = QTreeWidgetItem::UserType + 1 };
    65 
    6663    /** Constructor for top-level item. */
    67     UIMediumItem(const UIMedium &medium, QTreeWidget *pParent)
    68         : QTreeWidgetItem(pParent, Type)
     64    UIMediumItem(const UIMedium &medium, QITreeWidget *pParent)
     65        : QITreeWidgetItem(pParent)
    6966        , m_medium(medium)
    7067    { refresh(); }
     
    7269    /** Constructor for child item. */
    7370    UIMediumItem(const UIMedium &medium, UIMediumItem *pParent)
    74         : QTreeWidgetItem(pParent, Type)
     71        : QITreeWidgetItem(pParent)
    7572        , m_medium(medium)
    7673    { refresh(); }
     
    226223
    227224    /** Constructor for top-level item. */
    228     UIMediumItemHD(const UIMedium &medium, QTreeWidget *pParent)
     225    UIMediumItemHD(const UIMedium &medium, QITreeWidget *pParent)
    229226        : UIMediumItem(medium, pParent)
    230227    {}
     
    401398
    402399    /** Constructor for top-level item. */
    403     UIMediumItemCD(const UIMedium &medium, QTreeWidget *pParent)
     400    UIMediumItemCD(const UIMedium &medium, QITreeWidget *pParent)
    404401        : UIMediumItem(medium, pParent)
    405402    {}
     
    484481
    485482    /** Constructor for top-level item. */
    486     UIMediumItemFD(const UIMedium &medium, QTreeWidget *pParent)
     483    UIMediumItemFD(const UIMedium &medium, QITreeWidget *pParent)
    487484        : UIMediumItem(medium, pParent)
    488485    {}
     
    868865{
    869866    /* Get current tree-widget: */
    870     QTreeWidget *pTreeWidget = currentTreeWidget();
     867    QITreeWidget *pTreeWidget = currentTreeWidget();
    871868    if (pTreeWidget)
    872869    {
    873870        /* If another tree-widget was focused before,
    874871         * move focus to current tree-widget: */
    875         if (qobject_cast<QTreeWidget*>(focusWidget()))
     872        if (qobject_cast<QITreeWidget*>(focusWidget()))
    876873            pTreeWidget->setFocus();
    877874    }
     
    887884{
    888885    /* Get sender() tree-widget: */
    889     QTreeWidget *pTreeWidget = qobject_cast<QTreeWidget*>(sender());
     886    QITreeWidget *pTreeWidget = qobject_cast<QITreeWidget*>(sender());
    890887    AssertMsgReturnVoid(pTreeWidget, ("This slot should be called by tree-widget only!\n"));
    891888
     
    907904{
    908905    /* Get current tree-widget: */
    909     QTreeWidget *pTreeWidget = currentTreeWidget();
     906    QITreeWidget *pTreeWidget = currentTreeWidget();
    910907    AssertPtrReturnVoid(pTreeWidget);
    911908
     
    926923{
    927924    /* Get all the tree-widgets: */
    928     const QList<QTreeWidget*> trees = m_trees.values();
     925    const QList<QITreeWidget*> trees = m_trees.values();
    929926
    930927    /* Calculate deduction for every header: */
    931928    QList<int> deductions;
    932     foreach (QTreeWidget *pTreeWidget, trees)
     929    foreach (QITreeWidget *pTreeWidget, trees)
    933930    {
    934931        int iDeduction = 0;
     
    941938    for (int iTreeIndex = 0; iTreeIndex < trees.size(); ++iTreeIndex)
    942939    {
    943         QTreeWidget *pTreeWidget = trees[iTreeIndex];
     940        QITreeWidget *pTreeWidget = trees[iTreeIndex];
    944941        int iSize0 = pTreeWidget->viewport()->width() - deductions[iTreeIndex];
    945942        if (pTreeWidget->header()->sectionSize(0) != iSize0)
     
    12191216    /* Create tree-widget: */
    12201217    m_trees.insert(tabIndex(type), new QITreeWidget);
    1221     QTreeWidget *pTreeWidget = treeWidget(type);
     1218    QITreeWidget *pTreeWidget = treeWidget(type);
    12221219    AssertPtrReturnVoid(pTreeWidget);
    12231220    {
     
    13531350
    13541351    /* Clear tree-widgets: */
    1355     QTreeWidget *pTreeWidgetHD = treeWidget(UIMediumType_HardDisk);
     1352    QITreeWidget *pTreeWidgetHD = treeWidget(UIMediumType_HardDisk);
    13561353    if (pTreeWidgetHD)
    13571354    {
     
    13591356        pTreeWidgetHD->clear();
    13601357    }
    1361     QTreeWidget *pTreeWidgetCD = treeWidget(UIMediumType_DVD);
     1358    QITreeWidget *pTreeWidgetCD = treeWidget(UIMediumType_DVD);
    13621359    if (pTreeWidgetCD)
    13631360    {
     
    13651362        pTreeWidgetCD->clear();
    13661363    }
    1367     QTreeWidget *pTreeWidgetFD = treeWidget(UIMediumType_Floppy);
     1364    QITreeWidget *pTreeWidgetFD = treeWidget(UIMediumType_Floppy);
    13681365    if (pTreeWidgetFD)
    13691366    {
     
    15641561                CheckIfSuitableByState lookForState(KMediumState_Inaccessible);
    15651562                CheckIfSuitableByID ignoreID(pMediumItem->id());
    1566                 UIMediumItem *pInaccessibleMediumItem = searchItem(pMediumItem->treeWidget(), lookForState, &ignoreID);
     1563                UIMediumItem *pInaccessibleMediumItem = searchItem(pMediumItem->parentTree(), lookForState, &ignoreID);
    15671564                *pfInaccessible = !!pInaccessibleMediumItem;
    15681565            }
     
    17951792
    17961793    /* Translate HD tree-widget: */
    1797     QTreeWidget *pTreeWidgetHD = treeWidget(UIMediumType_HardDisk);
     1794    QITreeWidget *pTreeWidgetHD = treeWidget(UIMediumType_HardDisk);
    17981795    if (pTreeWidgetHD)
    17991796    {
     
    18201817
    18211818    /* Translate CD tree-widget: */
    1822     QTreeWidget *pTreeWidgetCD = treeWidget(UIMediumType_DVD);
     1819    QITreeWidget *pTreeWidgetCD = treeWidget(UIMediumType_DVD);
    18231820    if (pTreeWidgetCD)
    18241821    {
     
    18361833
    18371834    /* Translate FD tree-widget: */
    1838     QTreeWidget *pTreeWidgetFD = treeWidget(UIMediumType_Floppy);
     1835    QITreeWidget *pTreeWidgetFD = treeWidget(UIMediumType_Floppy);
    18391836    if (pTreeWidgetFD)
    18401837    {
     
    18851882        {
    18861883            /* Make sure corresponding tree-widget exists: */
    1887             QTreeWidget *pTreeWidget = treeWidget(UIMediumType_HardDisk);
     1884            QITreeWidget *pTreeWidget = treeWidget(UIMediumType_HardDisk);
    18881885            if (pTreeWidget)
    18891886            {
     
    19051902        {
    19061903            /* Make sure corresponding tree-widget exists: */
    1907             QTreeWidget *pTreeWidget = treeWidget(UIMediumType_DVD);
     1904            QITreeWidget *pTreeWidget = treeWidget(UIMediumType_DVD);
    19081905            if (pTreeWidget)
    19091906            {
     
    19261923        {
    19271924            /* Make sure corresponding tree-widget exists: */
    1928             QTreeWidget *pTreeWidget = treeWidget(UIMediumType_Floppy);
     1925            QITreeWidget *pTreeWidget = treeWidget(UIMediumType_Floppy);
    19291926            if (pTreeWidget)
    19301927            {
     
    19671964
    19681965    /* Make sure corresponding tree-widget exists: */
    1969     QTreeWidget *pTreeWidget = treeWidget(UIMediumType_HardDisk);
     1966    QITreeWidget *pTreeWidget = treeWidget(UIMediumType_HardDisk);
    19701967    if (pTreeWidget)
    19711968    {
     
    20482045    QList<UIMediumType> types;
    20492046    types << UIMediumType_HardDisk << UIMediumType_DVD << UIMediumType_Floppy;
    2050     QTreeWidget *pTreeWidget = 0;
     2047    QITreeWidget *pTreeWidget = 0;
    20512048    UIMediumItem *pMediumItem = 0;
    20522049    foreach (UIMediumType type, types)
     
    20902087}
    20912088
    2092 QTreeWidget* UIMediumManager::treeWidget(UIMediumType type) const
     2089QITreeWidget* UIMediumManager::treeWidget(UIMediumType type) const
    20932090{
    20942091    /* Determine tab index for passed medium type: */
     
    21062103{
    21072104    /* Get corresponding tree-widget: */
    2108     QTreeWidget *pTreeWidget = treeWidget(type);
     2105    QITreeWidget *pTreeWidget = treeWidget(type);
    21092106    /* Return corresponding medium-item: */
    21102107    return pTreeWidget ? toMediumItem(pTreeWidget->currentItem()) : 0;
     
    21602157}
    21612158
    2162 UIMediumType UIMediumManager::mediumType(QTreeWidget *pTreeWidget) const
     2159UIMediumType UIMediumManager::mediumType(QITreeWidget *pTreeWidget) const
    21632160{
    21642161    /* Determine tab index of passed tree-widget: */
     
    21832180}
    21842181
    2185 QTreeWidget* UIMediumManager::currentTreeWidget() const
     2182QITreeWidget* UIMediumManager::currentTreeWidget() const
    21862183{
    21872184    /* Return current tree-widget: */
     
    21952192}
    21962193
    2197 void UIMediumManager::setCurrentItem(QTreeWidget *pTreeWidget, QTreeWidgetItem *pItem)
     2194void UIMediumManager::setCurrentItem(QITreeWidget *pTreeWidget, QTreeWidgetItem *pItem)
    21982195{
    21992196    /* Make sure passed tree-widget is valid: */
     
    22482245
    22492246/* static */
    2250 UIMediumItem* UIMediumManager::searchItem(QTreeWidget *pTreeWidget, const CheckIfSuitableBy &condition, CheckIfSuitableBy *pException)
     2247UIMediumItem* UIMediumManager::searchItem(QITreeWidget *pTreeWidget, const CheckIfSuitableBy &condition, CheckIfSuitableBy *pException)
    22512248{
    22522249    /* Make sure argument is valid: */
     
    23362333{
    23372334    /* Cast passed QTreeWidgetItem to UIMediumItem if possible: */
    2338     return pItem && pItem->type() == UIMediumItem::Type ? static_cast<UIMediumItem*>(pItem) : 0;
     2335    return pItem && pItem->type() == QITreeWidgetItem::ItemType ? static_cast<UIMediumItem*>(pItem) : 0;
    23392336}
    23402337
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h

    r63315 r64430  
    3232class UIEnumerationProgressBar;
    3333class QTabWidget;
    34 class QTreeWidget;
     34class QITreeWidget;
    3535class QTreeWidgetItem;
    3636class QFrame;
     
    182182    QWidget* tab(UIMediumType type) const;
    183183    /** Returns tree-widget for passed medium @a type. */
    184     QTreeWidget* treeWidget(UIMediumType type) const;
     184    QITreeWidget* treeWidget(UIMediumType type) const;
    185185    /** Returns item for passed medium @a type. */
    186186    UIMediumItem* mediumItem(UIMediumType type) const;
     
    193193
    194194    /** Returns medium type for passed @a pTreeWidget. */
    195     UIMediumType mediumType(QTreeWidget *pTreeWidget) const;
     195    UIMediumType mediumType(QITreeWidget *pTreeWidget) const;
    196196
    197197    /** Returns current medium type. */
    198198    UIMediumType currentMediumType() const;
    199199    /** Returns current tree-widget. */
    200     QTreeWidget* currentTreeWidget() const;
     200    QITreeWidget* currentTreeWidget() const;
    201201    /** Returns current item. */
    202202    UIMediumItem* currentMediumItem() const;
    203203
    204204    /** Defines current item for passed @a pTreeWidget as @a pItem. */
    205     void setCurrentItem(QTreeWidget *pTreeWidget, QTreeWidgetItem *pItem);
     205    void setCurrentItem(QITreeWidget *pTreeWidget, QTreeWidgetItem *pItem);
    206206
    207207    /** Returns tab index for passed UIMediumType. */
     
    211211
    212212    /** Performs search for the @a pTree child which corresponds to the @a condition but not @a pException. */
    213     static UIMediumItem* searchItem(QTreeWidget *pTree, const CheckIfSuitableBy &condition, CheckIfSuitableBy *pException = 0);
     213    static UIMediumItem* searchItem(QITreeWidget *pTree, const CheckIfSuitableBy &condition, CheckIfSuitableBy *pException = 0);
    214214    /** Performs search for the @a pParentItem child which corresponds to the @a condition but not @a pException. */
    215215    static UIMediumItem* searchItem(QTreeWidgetItem *pParentItem, const CheckIfSuitableBy &condition, CheckIfSuitableBy *pException = 0);
     
    244244    const int m_iTabCount;
    245245    /** Tree-widgets. */
    246     QMap<int, QTreeWidget*> m_trees;
     246    QMap<int, QITreeWidget*> m_trees;
    247247    /** Information-containers. */
    248248    QMap<int, QFrame*> m_containers;
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