VirtualBox

Ignore:
Timestamp:
Nov 16, 2016 3:42:15 PM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6899: Accessibility support (step 129): UIApplianceEditorWidget refactoring: Renaming enums.

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

Legend:

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

    r64683 r64685  
    5555   to keep the interface clean. ModelItem is able to handle tree structures
    5656   with a parent & several children's. */
    57 ModelItem::ModelItem(int number, ModelItem_type type, ModelItem *pParent /* = NULL */)
     57ModelItem::ModelItem(int number, ApplianceModelItemType type, ModelItem *pParent /* = NULL */)
    5858  : m_number(number)
    5959  , m_type(type)
     
    100100
    101101VirtualSystemItem::VirtualSystemItem(int number, CVirtualSystemDescription aDesc, ModelItem *pParent)
    102   : ModelItem(number, VirtualSystem_type, pParent)
     102  : ModelItem(number, ApplianceModelItemType_VirtualSystem, pParent)
    103103  , m_desc(aDesc)
    104104{}
     
    107107{
    108108    QVariant v;
    109     if (column == DescriptionSection &&
     109    if (column == ApplianceViewSection_Description &&
    110110        role == Qt::DisplayRole)
    111111        v = UIApplianceEditorWidget::tr("Virtual System %1").arg(m_number + 1);
     
    136136                           const QString &strExtraConfigValue,
    137137                           ModelItem *pParent)
    138   : ModelItem(number, HardwareType, pParent)
     138  : ModelItem(number, ApplianceModelItemType_Hardware, pParent)
    139139  , m_type(type)
    140140  , m_strRef(strRef)
     
    162162        case Qt::CheckStateRole:
    163163        {
    164             if (column == ConfigValueSection &&
     164            if (column == ApplianceViewSection_ConfigValue &&
    165165                (m_type == KVirtualSystemDescriptionType_Floppy ||
    166166                 m_type == KVirtualSystemDescriptionType_CDROM ||
     
    176176        case Qt::EditRole:
    177177        {
    178             if (column == OriginalValueSection)
     178            if (column == ApplianceViewSection_OriginalValue)
    179179                m_strOrigValue = value.toString();
    180             else if (column == ConfigValueSection)
     180            else if (column == ApplianceViewSection_ConfigValue)
    181181                m_strConfigValue = value.toString();
    182182            break;
     
    194194        case Qt::EditRole:
    195195        {
    196             if (column == OriginalValueSection)
     196            if (column == ApplianceViewSection_OriginalValue)
    197197                v = m_strOrigValue;
    198             else if (column == ConfigValueSection)
     198            else if (column == ApplianceViewSection_ConfigValue)
    199199                v = m_strConfigValue;
    200200            break;
     
    202202        case Qt::DisplayRole:
    203203        {
    204             if (column == DescriptionSection)
     204            if (column == ApplianceViewSection_Description)
    205205            {
    206206                switch (m_type)
     
    230230                }
    231231            }
    232             else if (column == OriginalValueSection)
     232            else if (column == ApplianceViewSection_OriginalValue)
    233233                v = m_strOrigValue;
    234             else if (column == ConfigValueSection)
     234            else if (column == ApplianceViewSection_ConfigValue)
    235235            {
    236236                switch (m_type)
     
    258258        case Qt::ToolTipRole:
    259259        {
    260             if (column == ConfigValueSection)
     260            if (column == ApplianceViewSection_ConfigValue)
    261261            {
    262262                if (!m_strOrigValue.isEmpty())
     
    267267        case Qt::DecorationRole:
    268268        {
    269             if (column == DescriptionSection)
     269            if (column == ApplianceViewSection_Description)
    270270            {
    271271                switch (m_type)
     
    295295                }
    296296            }
    297             else if (column == ConfigValueSection &&
     297            else if (column == ApplianceViewSection_ConfigValue &&
    298298                     m_type == KVirtualSystemDescriptionType_OS)
    299299            {
     
    307307        {
    308308            /* If the item is unchecked mark it with italic text. */
    309             if (column == ConfigValueSection &&
     309            if (column == ApplianceViewSection_ConfigValue &&
    310310                m_checkState == Qt::Unchecked)
    311311            {
     
    319319        {
    320320            /* If the item is unchecked mark it with gray text. */
    321             if (column == ConfigValueSection &&
     321            if (column == ApplianceViewSection_ConfigValue &&
    322322                m_checkState == Qt::Unchecked)
    323323            {
     
    329329        case Qt::CheckStateRole:
    330330        {
    331             if (column == ConfigValueSection &&
     331            if (column == ApplianceViewSection_ConfigValue &&
    332332                (m_type == KVirtualSystemDescriptionType_Floppy ||
    333333                 m_type == KVirtualSystemDescriptionType_CDROM ||
     
    345345        case HardwareItem::ModifiedRole:
    346346        {
    347             if (column == ConfigValueSection)
     347            if (column == ApplianceViewSection_ConfigValue)
    348348                v = m_fModified;
    349349            break;
     
    356356{
    357357    Qt::ItemFlags flags = 0;
    358     if (column == ConfigValueSection)
     358    if (column == ApplianceViewSection_ConfigValue)
    359359    {
    360360        /* Some items are checkable */
     
    390390{
    391391    QWidget *editor = NULL;
    392     if (idx.column() == ConfigValueSection)
     392    if (idx.column() == ApplianceViewSection_ConfigValue)
    393393    {
    394394        switch (m_type)
     
    641641                {
    642642                    /* Get the index for the config value column. */
    643                     QModelIndex hdIndex = pModel->index(list.at(i).row(), ConfigValueSection, list.at(i).parent());
     643                    QModelIndex hdIndex = pModel->index(list.at(i).row(), ApplianceViewSection_ConfigValue, list.at(i).parent());
    644644                    /* Ignore it if was already modified by the user. */
    645645                    if (!hdIndex.data(ModifiedRole).toBool())
     
    732732   : QAbstractItemModel(pParent)
    733733{
    734     m_pRootItem = new ModelItem(0, RootType);
     734    m_pRootItem = new ModelItem(0, ApplianceModelItemType_Root);
    735735    for (int a = 0; a < aVSDs.size(); ++a)
    736736    {
     
    889889    switch (section)
    890890    {
    891         case DescriptionSection: title = UIApplianceEditorWidget::tr("Description"); break;
    892         case ConfigValueSection: title = UIApplianceEditorWidget::tr("Configuration"); break;
     891        case ApplianceViewSection_Description: title = UIApplianceEditorWidget::tr("Description"); break;
     892        case ApplianceViewSection_ConfigValue: title = UIApplianceEditorWidget::tr("Configuration"); break;
    893893    }
    894894    return title;
     
    900900        return QModelIndex();
    901901
    902     if (idx.column() == ConfigValueSection)
     902    if (idx.column() == ApplianceViewSection_ConfigValue)
    903903        return idx;
    904904    else
    905         return index(idx.row(), ConfigValueSection, idx.parent());
     905        return index(idx.row(), ApplianceViewSection_ConfigValue, idx.parent());
    906906}
    907907
     
    10651065            ModelItem *item = static_cast<ModelItem*>(i.internalPointer());
    10661066            /* We filter hardware types only */
    1067             if (item->type() == HardwareType)
     1067            if (item->type() == ApplianceModelItemType_Hardware)
    10681068            {
    10691069                HardwareItem *hwItem = static_cast<HardwareItem*>(item);
     
    10871087
    10881088    /* We sort hardware types only */
    1089     if (!(pLeftItem->type() == HardwareType &&
    1090           pRightItem->type() == HardwareType))
     1089    if (!(pLeftItem->type() == ApplianceModelItemType_Hardware &&
     1090          pRightItem->type() == ApplianceModelItemType_Hardware))
    10911091        return false;
    10921092
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.h

    r64683 r64685  
    3838class QTextEdit;
    3939
    40 ////////////////////////////////////////////////////////////////////////////////
    41 // Globals
    42 
    43 enum TreeViewSection { DescriptionSection = 0, OriginalValueSection, ConfigValueSection };
    44 
    45 ////////////////////////////////////////////////////////////////////////////////
    46 // ModelItem
    47 
    48 enum ModelItem_type { RootType, VirtualSystem_type, HardwareType };
     40
     41/** Appliance tree-view section types. */
     42enum ApplianceViewSection
     43{
     44    ApplianceViewSection_Description = 0,
     45    ApplianceViewSection_OriginalValue,
     46    ApplianceViewSection_ConfigValue
     47};
     48
     49/** Appliance model item types. */
     50enum ApplianceModelItemType
     51{
     52    ApplianceModelItemType_Root,
     53    ApplianceModelItemType_VirtualSystem,
     54    ApplianceModelItemType_Hardware
     55};
     56
    4957
    5058/* This & the following derived classes represent the data items of a Virtual
     
    5563{
    5664public:
    57     ModelItem(int number, ModelItem_type type, ModelItem *pParent = NULL);
     65    ModelItem(int number, ApplianceModelItemType type, ModelItem *pParent = NULL);
    5866
    5967    virtual ~ModelItem();
     
    7987    virtual void putBack(QVector<BOOL>& finalStates, QVector<QString>& finalValues, QVector<QString>& finalExtraValues);
    8088
    81     ModelItem_type type() const { return m_type; }
     89    ApplianceModelItemType type() const { return m_type; }
    8290
    8391protected:
    8492    /* Protected member vars */
    85     int                m_number;
    86     ModelItem_type     m_type;
    87 
    88     ModelItem         *m_pParentItem;
    89     QList<ModelItem*>  m_childItems;
     93    int                     m_number;
     94    ApplianceModelItemType  m_type;
     95
     96    ModelItem              *m_pParentItem;
     97    QList<ModelItem*>       m_childItems;
    9098};
    9199
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceExportEditorWidget.cpp

    r64683 r64685  
    9090    ExportSortProxyModel *pProxy = new ExportSortProxyModel(this);
    9191    pProxy->setSourceModel(m_pModel);
    92     pProxy->sort(DescriptionSection, Qt::DescendingOrder);
     92    pProxy->sort(ApplianceViewSection_Description, Qt::DescendingOrder);
    9393
    9494    VirtualSystemDelegate *pDelegate = new VirtualSystemDelegate(pProxy, this);
     
    100100    /* For now we hide the original column. This data is displayed as tooltip
    101101       also. */
    102     m_pTreeViewSettings->setColumnHidden(OriginalValueSection, true);
     102    m_pTreeViewSettings->setColumnHidden(ApplianceViewSection_OriginalValue, true);
    103103    m_pTreeViewSettings->expandAll();
    104104
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceImportEditorWidget.cpp

    r64683 r64685  
    9696                        ImportSortProxyModel *pProxy = new ImportSortProxyModel(this);
    9797                        pProxy->setSourceModel(m_pModel);
    98                         pProxy->sort(DescriptionSection, Qt::DescendingOrder);
     98                        pProxy->sort(ApplianceViewSection_Description, Qt::DescendingOrder);
    9999
    100100                        VirtualSystemDelegate *pDelegate = new VirtualSystemDelegate(pProxy, this);
     
    106106                        /* For now we hide the original column. This data is displayed as tooltip
    107107                           also. */
    108                         m_pTreeViewSettings->setColumnHidden(OriginalValueSection, true);
     108                        m_pTreeViewSettings->setColumnHidden(ApplianceViewSection_OriginalValue, true);
    109109                        m_pTreeViewSettings->expandAll();
    110110
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