VirtualBox

Changeset 63852 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Sep 15, 2016 11:08:19 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
110702
Message:

FE/Qt: bugref:6899: Accessibility support (step 34): Selector UI: UISnapshotPane: Rename SnapshotWgtItem => UISnapshotItem.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.cpp

    r63851 r63852  
    5555
    5656/** QTreeWidgetItem subclass for snapshots items. */
    57 class SnapshotWgtItem : public QTreeWidgetItem
     57class UISnapshotItem : public QTreeWidgetItem
    5858{
    5959public:
    6060
    61     /** Item type for SnapshotWgtItem. */
     61    /** Item type for UISnapshotItem. */
    6262    enum { ItemType = QTreeWidgetItem::UserType + 1 };
    6363
    6464    /** Constructs normal snapshot item (child of tree-widget). */
    65     SnapshotWgtItem(UISnapshotPane *pSnapshotWidget, QTreeWidget *pTreeWidget, const CSnapshot &comSnapshot);
     65    UISnapshotItem(UISnapshotPane *pSnapshotWidget, QTreeWidget *pTreeWidget, const CSnapshot &comSnapshot);
    6666    /** Constructs normal snapshot item (child of tree-widget-item). */
    67     SnapshotWgtItem(UISnapshotPane *pSnapshotWidget, QTreeWidgetItem *pRootItem, const CSnapshot &comSnapshot);
     67    UISnapshotItem(UISnapshotPane *pSnapshotWidget, QTreeWidgetItem *pRootItem, const CSnapshot &comSnapshot);
    6868
    6969    /** Constructs "current state" item (child of tree-widget). */
    70     SnapshotWgtItem(UISnapshotPane *pSnapshotWidget, QTreeWidget *pTreeWidget, const CMachine &comMachine);
     70    UISnapshotItem(UISnapshotPane *pSnapshotWidget, QTreeWidget *pTreeWidget, const CMachine &comMachine);
    7171    /** Constructs "current state" item (child of tree-widget-item). */
    72     SnapshotWgtItem(UISnapshotPane *pSnapshotWidget, QTreeWidgetItem *pRootItem, const CMachine &comMachine);
     72    UISnapshotItem(UISnapshotPane *pSnapshotWidget, QTreeWidgetItem *pRootItem, const CMachine &comMachine);
    7373
    7474    /** Returns item machine. */
     
    164164
    165165/*********************************************************************************************************************************
    166 *   Class SnapshotWgtItem implementation.                                                                                        *
     166*   Class UISnapshotItem implementation.                                                                                         *
    167167*********************************************************************************************************************************/
    168168
    169 SnapshotWgtItem::SnapshotWgtItem(UISnapshotPane *pSnapshotWidget, QTreeWidget *pTreeWidget, const CSnapshot &comSnapshot)
     169UISnapshotItem::UISnapshotItem(UISnapshotPane *pSnapshotWidget, QTreeWidget *pTreeWidget, const CSnapshot &comSnapshot)
    170170    : QTreeWidgetItem(pTreeWidget, ItemType)
    171171    , m_pSnapshotWidget(pSnapshotWidget)
     
    175175}
    176176
    177 SnapshotWgtItem::SnapshotWgtItem(UISnapshotPane *pSnapshotWidget, QTreeWidgetItem *pRootItem, const CSnapshot &comSnapshot)
     177UISnapshotItem::UISnapshotItem(UISnapshotPane *pSnapshotWidget, QTreeWidgetItem *pRootItem, const CSnapshot &comSnapshot)
    178178    : QTreeWidgetItem(pRootItem, ItemType)
    179179    , m_pSnapshotWidget(pSnapshotWidget)
     
    183183}
    184184
    185 SnapshotWgtItem::SnapshotWgtItem(UISnapshotPane *pSnapshotWidget, QTreeWidget *pTreeWidget, const CMachine &comMachine)
     185UISnapshotItem::UISnapshotItem(UISnapshotPane *pSnapshotWidget, QTreeWidget *pTreeWidget, const CMachine &comMachine)
    186186    : QTreeWidgetItem(pTreeWidget, ItemType)
    187187    , m_pSnapshotWidget(pSnapshotWidget)
     
    193193}
    194194
    195 SnapshotWgtItem::SnapshotWgtItem(UISnapshotPane *pSnapshotWidget, QTreeWidgetItem *pRootItem, const CMachine &comMachine)
     195UISnapshotItem::UISnapshotItem(UISnapshotPane *pSnapshotWidget, QTreeWidgetItem *pRootItem, const CMachine &comMachine)
    196196    : QTreeWidgetItem(pRootItem, ItemType)
    197197    , m_pSnapshotWidget(pSnapshotWidget)
     
    203203}
    204204
    205 QVariant SnapshotWgtItem::data(int iColumn, int iRole) const
     205QVariant UISnapshotItem::data(int iColumn, int iRole) const
    206206{
    207207    switch (iRole)
     
    236236}
    237237
    238 QString SnapshotWgtItem::text(int iColumn) const
     238QString UISnapshotItem::text(int iColumn) const
    239239{
    240240    return QTreeWidgetItem::data(iColumn, Qt::DisplayRole).toString();
    241241}
    242242
    243 bool SnapshotWgtItem::isCurrentStateItem() const
     243bool UISnapshotItem::isCurrentStateItem() const
    244244{
    245245    return m_comSnapshot.isNull();
    246246}
    247247
    248 int SnapshotWgtItem::level() const
     248int UISnapshotItem::level() const
    249249{
    250250    const QTreeWidgetItem *pItem = this;
     
    258258}
    259259
    260 bool SnapshotWgtItem::bold() const
     260bool UISnapshotItem::bold() const
    261261{
    262262    return font(0).bold();
    263263}
    264264
    265 void SnapshotWgtItem::setBold(bool fBold)
     265void UISnapshotItem::setBold(bool fBold)
    266266{
    267267    /* Update font: */
     
    274274}
    275275
    276 bool SnapshotWgtItem::italic() const
     276bool UISnapshotItem::italic() const
    277277{
    278278    return font(0).italic();
    279279}
    280280
    281 void SnapshotWgtItem::setItalic(bool fItalic)
     281void UISnapshotItem::setItalic(bool fItalic)
    282282{
    283283    /* Update font: */
     
    290290}
    291291
    292 void SnapshotWgtItem::recache()
     292void UISnapshotItem::recache()
    293293{
    294294    /* For "current state" item: */
     
    327327}
    328328
    329 KMachineState SnapshotWgtItem::getCurrentState() const
     329KMachineState UISnapshotItem::getCurrentState() const
    330330{
    331331    /* Make sure machine is valid: */
     
    337337}
    338338
    339 void SnapshotWgtItem::updateCurrentState(KMachineState enmState)
     339void UISnapshotItem::updateCurrentState(KMachineState enmState)
    340340{
    341341    /* Make sure machine is valid: */
     
    351351}
    352352
    353 SnapshotAgeFormat SnapshotWgtItem::updateAge()
     353SnapshotAgeFormat UISnapshotItem::updateAge()
    354354{
    355355    /* Prepare age: */
     
    395395}
    396396
    397 void SnapshotWgtItem::adjustText()
     397void UISnapshotItem::adjustText()
    398398{
    399399    /* Make sure item is initialised: */
     
    414414}
    415415
    416 void SnapshotWgtItem::recacheToolTip()
     416void UISnapshotItem::recacheToolTip()
    417417{
    418418    /* Is the saved date today? */
     
    644644{
    645645    /* Acquire corresponding snapshot item: */
    646     const SnapshotWgtItem *pSnapshotItem = toSnapshotItem(pItem);
     646    const UISnapshotItem *pSnapshotItem = toSnapshotItem(pItem);
    647647
    648648    /* Make the selected item visible: */
     
    712712
    713713    /* Acquire corresponding snapshot item: */
    714     const SnapshotWgtItem *pSnapshotItem = toSnapshotItem(pItem);
     714    const UISnapshotItem *pSnapshotItem = toSnapshotItem(pItem);
    715715    AssertReturnVoid(pSnapshotItem);
    716716
     
    745745
    746746    /* Acquire corresponding snapshot item: */
    747     const SnapshotWgtItem *pSnapshotItem = toSnapshotItem(pItem);
     747    const UISnapshotItem *pSnapshotItem = toSnapshotItem(pItem);
    748748    AssertReturnVoid(pSnapshotItem);
    749749
     
    760760{
    761761    /* Acquire corresponding snapshot item: */
    762     const SnapshotWgtItem *pSnapshotItem = toSnapshotItem(pItem);
     762    const UISnapshotItem *pSnapshotItem = toSnapshotItem(pItem);
    763763    AssertReturnVoid(pSnapshotItem);
    764764
     
    870870            while (*iterator)
    871871            {
    872                 QString strSnapshot = static_cast<SnapshotWgtItem*>(*iterator)->text(0);
     872                QString strSnapshot = static_cast<UISnapshotItem*>(*iterator)->text(0);
    873873                int iPos = regExp.indexIn(strSnapshot);
    874874                if (iPos != -1)
     
    933933    {
    934934        /* Acquire currently chosen snapshot item: */
    935         const SnapshotWgtItem *pSnapshotItem = toSnapshotItem(m_pSnapshotTree->currentItem());
     935        const UISnapshotItem *pSnapshotItem = toSnapshotItem(m_pSnapshotTree->currentItem());
    936936        AssertPtr(pSnapshotItem);
    937937        if (!pSnapshotItem)
     
    10081008    {
    10091009        /* Acquire currently chosen snapshot item: */
    1010         const SnapshotWgtItem *pSnapshotItem = toSnapshotItem(m_pSnapshotTree->currentItem());
     1010        const UISnapshotItem *pSnapshotItem = toSnapshotItem(m_pSnapshotTree->currentItem());
    10111011        AssertPtr(pSnapshotItem);
    10121012        if (!pSnapshotItem)
     
    10781078{
    10791079    /* Acquire currently chosen snapshot item: */
    1080     const SnapshotWgtItem *pSnapshotItem = toSnapshotItem(m_pSnapshotTree->currentItem());
     1080    const UISnapshotItem *pSnapshotItem = toSnapshotItem(m_pSnapshotTree->currentItem());
    10811081    AssertReturnVoid(pSnapshotItem);
    10821082
     
    10971097{
    10981098    /* Acquire currently chosen snapshot item: */
    1099     const SnapshotWgtItem *pSnapshotItem = toSnapshotItem(m_pSnapshotTree->currentItem());
     1099    const UISnapshotItem *pSnapshotItem = toSnapshotItem(m_pSnapshotTree->currentItem());
    11001100    AssertReturnVoid(pSnapshotItem);
    11011101
     
    11351135    /* Remember the selected item and it's first child: */
    11361136    QString strSelectedItem, strFirstChildOfSelectedItem;
    1137     const SnapshotWgtItem *pSnapshotItem = toSnapshotItem(m_pSnapshotTree->currentItem());
     1137    const UISnapshotItem *pSnapshotItem = toSnapshotItem(m_pSnapshotTree->currentItem());
    11381138    if (pSnapshotItem)
    11391139    {
     
    11581158
    11591159        /* Add the "current state" item as a child to current snapshot item: */
    1160         SnapshotWgtItem *pCsi = new SnapshotWgtItem(this, m_pCurrentSnapshotItem, m_comMachine);
     1160        UISnapshotItem *pCsi = new UISnapshotItem(this, m_pCurrentSnapshotItem, m_comMachine);
    11611161        pCsi->setBold(true);
    11621162        pCsi->recache();
    11631163
    11641164        /* Search for a previously selected item: */
    1165         SnapshotWgtItem *pCurrentItem = findItem(strSelectedItem);
     1165        UISnapshotItem *pCurrentItem = findItem(strSelectedItem);
    11661166        if (pCurrentItem == 0)
    11671167            pCurrentItem = findItem(strFirstChildOfSelectedItem);
     
    11811181
    11821182        /* Add the "current state" item as a child of snapshot tree: */
    1183         SnapshotWgtItem *pCsi = new SnapshotWgtItem(this, m_pSnapshotTree, m_comMachine);
     1183        UISnapshotItem *pCsi = new UISnapshotItem(this, m_pSnapshotTree, m_comMachine);
    11841184        pCsi->setBold(true);
    11851185        pCsi->recache();
     
    12001200{
    12011201    /* Create a child of passed item: */
    1202     SnapshotWgtItem *pSnapshotItem = pItem ? new SnapshotWgtItem(this, pItem, comSnapshot) :
    1203                                              new SnapshotWgtItem(this, m_pSnapshotTree, comSnapshot);
     1202    UISnapshotItem *pSnapshotItem = pItem ? new UISnapshotItem(this, pItem, comSnapshot) :
     1203                                            new UISnapshotItem(this, m_pSnapshotTree, comSnapshot);
    12041204    /* And recache it's content: */
    12051205    pSnapshotItem->recache();
     
    12231223}
    12241224
    1225 SnapshotWgtItem *UISnapshotPane::findItem(const QString &strSnapshotID) const
     1225UISnapshotItem *UISnapshotPane::findItem(const QString &strSnapshotID) const
    12261226{
    12271227    /* Search for the first item with required ID: */
     
    12291229    while (*it)
    12301230    {
    1231         SnapshotWgtItem *pSnapshotItem = toSnapshotItem(*it);
     1231        UISnapshotItem *pSnapshotItem = toSnapshotItem(*it);
    12321232        if (pSnapshotItem->snapshotID() == strSnapshotID)
    12331233            return pSnapshotItem;
     
    12391239}
    12401240
    1241 SnapshotWgtItem *UISnapshotPane::currentStateItem() const
     1241UISnapshotItem *UISnapshotPane::currentStateItem() const
    12421242{
    12431243    /* Last child of the current snapshot item if any or first child of invisible root item otherwise: */
     
    12451245                            m_pCurrentSnapshotItem->child(m_pCurrentSnapshotItem->childCount() - 1) :
    12461246                            m_pSnapshotTree->invisibleRootItem()->child(0);
    1247     return static_cast<SnapshotWgtItem*>(pCsi);
     1247    return static_cast<UISnapshotItem*>(pCsi);
    12481248}
    12491249
     
    12511251{
    12521252    /* Acquire corresponding snapshot item: */
    1253     SnapshotWgtItem *pSnapshotItem = toSnapshotItem(pItem);
     1253    UISnapshotItem *pSnapshotItem = toSnapshotItem(pItem);
    12541254
    12551255    /* Fetch the snapshot age of the root if it's valid: */
     
    12701270
    12711271/* static  */
    1272 SnapshotWgtItem *UISnapshotPane::toSnapshotItem(QTreeWidgetItem *pItem)
    1273 {
    1274     /* Make sure alive SnapshotWgtItem passed: */
    1275     if (!pItem || pItem->type() != SnapshotWgtItem::ItemType)
     1272UISnapshotItem *UISnapshotPane::toSnapshotItem(QTreeWidgetItem *pItem)
     1273{
     1274    /* Make sure alive UISnapshotItem passed: */
     1275    if (!pItem || pItem->type() != UISnapshotItem::ItemType)
    12761276        return 0;
    12771277
    1278     /* Return casted SnapshotWgtItem then: */
    1279     return static_cast<SnapshotWgtItem*>(pItem);
     1278    /* Return casted UISnapshotItem then: */
     1279    return static_cast<UISnapshotItem*>(pItem);
    12801280}
    12811281
    12821282/* static */
    1283 const SnapshotWgtItem *UISnapshotPane::toSnapshotItem(const QTreeWidgetItem *pItem)
    1284 {
    1285     /* Make sure alive SnapshotWgtItem passed: */
    1286     if (!pItem || pItem->type() != SnapshotWgtItem::ItemType)
     1283const UISnapshotItem *UISnapshotPane::toSnapshotItem(const QTreeWidgetItem *pItem)
     1284{
     1285    /* Make sure alive UISnapshotItem passed: */
     1286    if (!pItem || pItem->type() != UISnapshotItem::ItemType)
    12871287        return 0;
    12881288
    1289     /* Return casted SnapshotWgtItem then: */
    1290     return static_cast<const SnapshotWgtItem*>(pItem);
     1289    /* Return casted UISnapshotItem then: */
     1290    return static_cast<const UISnapshotItem*>(pItem);
    12911291}
    12921292
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.h

    r63851 r63852  
    3333/* Forward declarations: */
    3434class UISnapshotTree;
     35class UISnapshotItem;
    3536class QTreeWidgetItem;
    36 class SnapshotWgtItem;
    3737
    3838
     
    135135
    136136    /** Searches for an item with corresponding @a strSnapshotID. */
    137     SnapshotWgtItem *findItem(const QString &strSnapshotID) const;
     137    UISnapshotItem *findItem(const QString &strSnapshotID) const;
    138138    /** Returns the "current state" item. */
    139     SnapshotWgtItem *currentStateItem() const;
     139    UISnapshotItem *currentStateItem() const;
    140140
    141141    /** Searches for smallest snapshot age starting with @a pItem as parent. */
    142142    SnapshotAgeFormat traverseSnapshotAge(QTreeWidgetItem *pItem) const;
    143143
    144     /** Casts QTreeWidgetItem to SnapshotWgtItem if possible. */
    145     static SnapshotWgtItem *toSnapshotItem(QTreeWidgetItem *pItem);
    146     /** Casts const QTreeWidgetItem to const SnapshotWgtItem if possible. */
    147     static const SnapshotWgtItem *toSnapshotItem(const QTreeWidgetItem *pItem);
     144    /** Casts QTreeWidgetItem to UISnapshotItem if possible. */
     145    static UISnapshotItem *toSnapshotItem(QTreeWidgetItem *pItem);
     146    /** Casts const QTreeWidgetItem to const UISnapshotItem if possible. */
     147    static const UISnapshotItem *toSnapshotItem(const QTreeWidgetItem *pItem);
    148148
    149149    /** Holds the machine COM wrapper. */
     
    154154    KSessionState    m_enmSessionState;
    155155    /** Holds the current snapshot item reference. */
    156     SnapshotWgtItem *m_pCurrentSnapshotItem;
     156    UISnapshotItem *m_pCurrentSnapshotItem;
    157157    /** Holds the snapshot item editing protector. */
    158158    QReadWriteLock   m_lockReadWrite;
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