VirtualBox

Changeset 64691 in vbox


Ignore:
Timestamp:
Nov 17, 2016 2:58:03 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
111967
Message:

FE/Qt: bugref:6899: Accessibility support (step 133): UIApplianceEditorWidget refactoring.

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

Legend:

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

    r64689 r64691  
    5252public:
    5353
    54     /** Constructs item with specified @a number, @a type and @a pParent. */
    55     ModelItem(int number, ApplianceModelItemType type, ModelItem *pParent = NULL);
     54    /** Constructs item with specified @a iNumber, @a enmType and @a pParentItem. */
     55    ModelItem(int iNumber, ApplianceModelItemType enmType, ModelItem *pParentItem = 0);
    5656    /** Destructs item. */
    5757    virtual ~ModelItem();
    5858
    5959    /** Returns the item type. */
    60     ApplianceModelItemType type() const { return m_type; }
     60    ApplianceModelItemType type() const { return m_enmType; }
    6161
    6262    /** Returns the parent of the item. */
    6363    ModelItem *parent() const { return m_pParentItem; }
    6464
    65     /** Appends the passed @a pChild to the item's list of children. */
    66     void appendChild(ModelItem *pChild);
    67     /** Returns the child specified by the @a row. */
    68     ModelItem *child(int row) const;
     65    /** Appends the passed @a pChildItem to the item's list of children. */
     66    void appendChild(ModelItem *pChildItem);
     67    /** Returns the child specified by the @a iRow. */
     68    ModelItem *child(int iRow) const;
    6969
    7070    /** Returns the row of the item in the parent. */
     
    7676    int columnCount() const { return 3; }
    7777
    78     /** Returns the item flags for the given @a column. */
    79     virtual Qt::ItemFlags itemFlags(int /* column */) const { return 0; }
    80 
    81     /** Defines the @a role data for the item at @a column to @a value. */
    82     virtual bool setData(int /* column */, const QVariant & /* value */, int /* role */) { return false; }
    83     /** Returns the data stored under the given @a role for the item referred to by the @a column. */
    84     virtual QVariant data(int /* column */, int /* role */) const { return QVariant(); }
     78    /** Returns the item flags for the given @a iColumn. */
     79    virtual Qt::ItemFlags itemFlags(int /* iColumn */) const { return 0; }
     80
     81    /** Defines the @a iRole data for the item at @a iColumn to @a value. */
     82    virtual bool setData(int /* iColumn */, const QVariant & /* value */, int /* iRole */) { return false; }
     83    /** Returns the data stored under the given @a iRole for the item referred to by the @a iColumn. */
     84    virtual QVariant data(int /* iColumn */, int /* iRole */) const { return QVariant(); }
    8585
    8686    /** Returns the widget used to edit the item specified by @a idx for editing.
    8787      * @param  pParent      Brings the parent to be assigned for newly created editor.
    8888      * @param  styleOption  Bring the style option set for the newly created editor. */
    89     virtual QWidget *createEditor(QWidget * /* pParent */, const QStyleOptionViewItem & /* styleOption */, const QModelIndex & /* idx */) const { return NULL; }
     89    virtual QWidget *createEditor(QWidget * /* pParent */, const QStyleOptionViewItem & /* styleOption */, const QModelIndex & /* idx */) const { return 0; }
    9090
    9191    /** Defines the contents of the given @a pEditor to the data for the item at the given @a idx. */
     
    9898
    9999    /** Cache currently stored values, such as @a finalStates, @a finalValues and @a finalExtraValues. */
    100     virtual void putBack(QVector<BOOL>& finalStates, QVector<QString>& finalValues, QVector<QString>& finalExtraValues);
     100    virtual void putBack(QVector<BOOL> &finalStates, QVector<QString> &finalValues, QVector<QString> &finalExtraValues);
    101101
    102102protected:
    103103
    104104    /** Holds the item number. */
    105     int                     m_number;
     105    int                     m_iNumber;
    106106    /** Holds the item type. */
    107     ApplianceModelItemType  m_type;
     107    ApplianceModelItemType  m_enmType;
    108108
    109109    /** Holds the parent item reference. */
     
    119119public:
    120120
    121     /** Constructs item passing @a number and @a pParent to the base-class.
    122       * @param  aDesc  Brings the Virtual System Description. */
    123     VirtualSystemItem(int number, CVirtualSystemDescription aDesc, ModelItem *pParent);
    124 
    125     /** Returns the data stored under the given @a role for the item referred to by the @a column. */
    126     virtual QVariant data(int column, int role) const;
     121    /** Constructs item passing @a iNumber and @a pParentItem to the base-class.
     122      * @param  enmDescription  Brings the Virtual System Description. */
     123    VirtualSystemItem(int iNumber, CVirtualSystemDescription enmDescription, ModelItem *pParentItem);
     124
     125    /** Returns the data stored under the given @a iRole for the item referred to by the @a iColumn. */
     126    virtual QVariant data(int iColumn, int iRole) const;
    127127
    128128    /** Cache currently stored values, such as @a finalStates, @a finalValues and @a finalExtraValues. */
    129     virtual void putBack(QVector<BOOL>& finalStates, QVector<QString>& finalValues, QVector<QString>& finalExtraValues);
     129    virtual void putBack(QVector<BOOL> &finalStates, QVector<QString> &finalValues, QVector<QString> &finalExtraValues);
    130130
    131131private:
    132132
    133133    /** Holds the Virtual System Description. */
    134     CVirtualSystemDescription m_desc;
     134    CVirtualSystemDescription m_enmDescription;
    135135};
    136136
     
    150150public:
    151151
    152     /** Constructs item passing @a number and @a pParent to the base-class.
    153       * @param  type                 Brings the Virtual System Description type.
     152    /** Constructs item passing @a iNumber and @a pParentItem to the base-class.
     153      * @param  enmType              Brings the Virtual System Description type.
    154154      * @param  strRef               Brings something totally useless.
    155155      * @param  strOrigValue         Brings the original value.
    156156      * @param  strConfigValue       Brings the configuration value.
    157157      * @param  strExtraConfigValue  Brings the extra configuration value. */
    158     HardwareItem(int number,
    159                  KVirtualSystemDescriptionType type,
     158    HardwareItem(int iNumber,
     159                 KVirtualSystemDescriptionType enmType,
    160160                 const QString &strRef,
    161161                 const QString &strOrigValue,
    162162                 const QString &strConfigValue,
    163163                 const QString &strExtraConfigValue,
    164                  ModelItem *pParent);
    165 
    166     /** Returns the item flags for the given @a column. */
    167     virtual Qt::ItemFlags itemFlags(int column) const;
    168 
    169     /** Defines the @a role data for the item at @a column to @a value. */
    170     virtual bool setData(int column, const QVariant &value, int role);
    171     /** Returns the data stored under the given @a role for the item referred to by the @a column. */
    172     virtual QVariant data(int column, int role) const;
     164                 ModelItem *pParentItem);
     165
     166    /** Returns the item flags for the given @a iColumn. */
     167    virtual Qt::ItemFlags itemFlags(int iColumn) const;
     168
     169    /** Defines the @a iRole data for the item at @a iColumn to @a value. */
     170    virtual bool setData(int iColumn, const QVariant &value, int iRole);
     171    /** Returns the data stored under the given @a iRole for the item referred to by the @a iColumn. */
     172    virtual QVariant data(int iColumn, int iRole) const;
    173173
    174174    /** Returns the widget used to edit the item specified by @a idx for editing.
     
    186186
    187187    /** Cache currently stored values, such as @a finalStates, @a finalValues and @a finalExtraValues. */
    188     virtual void putBack(QVector<BOOL>& finalStates, QVector<QString>& finalValues, QVector<QString>& finalExtraValues);
     188    virtual void putBack(QVector<BOOL> &finalStates, QVector<QString> &finalValues, QVector<QString> &finalExtraValues);
    189189
    190190private:
    191191
    192192    /** Holds the Virtual System description type. */
    193     KVirtualSystemDescriptionType m_type;
     193    KVirtualSystemDescriptionType m_enmType;
    194194    /** Holds something totally useless. */
    195195    QString                       m_strRef;
     
    213213*********************************************************************************************************************************/
    214214
    215 /* This & the following derived classes represent the data items of a Virtual
    216    System. All access/manipulation is done with the help of virtual functions
    217    to keep the interface clean. ModelItem is able to handle tree structures
    218    with a parent & several children's. */
    219 ModelItem::ModelItem(int number, ApplianceModelItemType type, ModelItem *pParent /* = NULL */)
    220   : m_number(number)
    221   , m_type(type)
    222   , m_pParentItem(pParent)
    223 {}
     215ModelItem::ModelItem(int iNumber, ApplianceModelItemType enmType, ModelItem *pParentItem /* = 0 */)
     216    : m_iNumber(iNumber)
     217    , m_enmType(enmType)
     218    , m_pParentItem(pParentItem)
     219{
     220}
    224221
    225222ModelItem::~ModelItem()
     
    228225}
    229226
    230 void ModelItem::appendChild(ModelItem *pChild)
    231 {
    232     AssertPtr(pChild);
    233     m_childItems << pChild;
    234 }
    235 
    236 ModelItem *ModelItem::child(int row) const
    237 {
    238     return m_childItems.value(row);
     227void ModelItem::appendChild(ModelItem *pChildItem)
     228{
     229    AssertPtr(pChildItem);
     230    m_childItems << pChildItem;
     231}
     232
     233ModelItem *ModelItem::child(int iRow) const
     234{
     235    return m_childItems.value(iRow);
    239236}
    240237
     
    252249}
    253250
    254 void ModelItem::putBack(QVector<BOOL>& finalStates, QVector<QString>& finalValues, QVector<QString>& finalExtraValues)
     251void ModelItem::putBack(QVector<BOOL> &finalStates, QVector<QString> &finalValues, QVector<QString> &finalExtraValues)
    255252{
    256253    for (int i = 0; i < childCount(); ++i)
     
    263260*********************************************************************************************************************************/
    264261
    265 VirtualSystemItem::VirtualSystemItem(int number, CVirtualSystemDescription aDesc, ModelItem *pParent)
    266   : ModelItem(number, ApplianceModelItemType_VirtualSystem, pParent)
    267   , m_desc(aDesc)
    268 {}
    269 
    270 QVariant VirtualSystemItem::data(int column, int role) const
    271 {
    272     QVariant v;
    273     if (column == ApplianceViewSection_Description &&
    274         role == Qt::DisplayRole)
    275         v = UIApplianceEditorWidget::tr("Virtual System %1").arg(m_number + 1);
    276     return v;
    277 }
    278 
    279 void VirtualSystemItem::putBack(QVector<BOOL>& finalStates, QVector<QString>& finalValues, QVector<QString>& finalExtraValues)
     262VirtualSystemItem::VirtualSystemItem(int iNumber, CVirtualSystemDescription enmDescription, ModelItem *pParentItem)
     263    : ModelItem(iNumber, ApplianceModelItemType_VirtualSystem, pParentItem)
     264    , m_enmDescription(enmDescription)
     265{
     266}
     267
     268QVariant VirtualSystemItem::data(int iColumn, int iRole) const
     269{
     270    QVariant value;
     271    if (iColumn == ApplianceViewSection_Description &&
     272        iRole == Qt::DisplayRole)
     273        value = UIApplianceEditorWidget::tr("Virtual System %1").arg(m_iNumber + 1);
     274    return value;
     275}
     276
     277void VirtualSystemItem::putBack(QVector<BOOL> &finalStates, QVector<QString> &finalValues, QVector<QString> &finalExtraValues)
    280278{
    281279    /* Resize the vectors */
    282     unsigned long count = m_desc.GetCount();
    283     finalStates.resize(count);
    284     finalValues.resize(count);
    285     finalExtraValues.resize(count);
     280    unsigned long iCount = m_enmDescription.GetCount();
     281    finalStates.resize(iCount);
     282    finalValues.resize(iCount);
     283    finalExtraValues.resize(iCount);
    286284    /* Recursively fill the vectors */
    287285    ModelItem::putBack(finalStates, finalValues, finalExtraValues);
    288286    /* Set all final values at once */
    289     m_desc.SetFinalValues(finalStates, finalValues, finalExtraValues);
     287    m_enmDescription.SetFinalValues(finalStates, finalValues, finalExtraValues);
    290288}
    291289
     
    295293*********************************************************************************************************************************/
    296294
    297 HardwareItem::HardwareItem(int number,
    298                            KVirtualSystemDescriptionType type,
     295HardwareItem::HardwareItem(int iNumber,
     296                           KVirtualSystemDescriptionType enmType,
    299297                           const QString &strRef,
    300298                           const QString &aOrigValue,
    301299                           const QString &strConfigValue,
    302300                           const QString &strExtraConfigValue,
    303                            ModelItem *pParent)
    304   : ModelItem(number, ApplianceModelItemType_Hardware, pParent)
    305   , m_type(type)
    306   , m_strRef(strRef)
    307   , m_strOrigValue(aOrigValue)
    308   , m_strConfigValue(strConfigValue)
    309   , m_strConfigDefaultValue(strConfigValue)
    310   , m_strExtraConfigValue(strExtraConfigValue)
    311   , m_checkState(Qt::Checked)
    312   , m_fModified(false)
    313 {
    314 }
    315 
    316 Qt::ItemFlags HardwareItem::itemFlags(int column) const
    317 {
    318     Qt::ItemFlags flags = 0;
    319     if (column == ApplianceViewSection_ConfigValue)
     301                           ModelItem *pParentItem)
     302    : ModelItem(iNumber, ApplianceModelItemType_Hardware, pParentItem)
     303    , m_enmType(enmType)
     304    , m_strRef(strRef)
     305    , m_strOrigValue(aOrigValue)
     306    , m_strConfigValue(strConfigValue)
     307    , m_strConfigDefaultValue(strConfigValue)
     308    , m_strExtraConfigValue(strExtraConfigValue)
     309    , m_checkState(Qt::Checked)
     310    , m_fModified(false)
     311{
     312}
     313
     314Qt::ItemFlags HardwareItem::itemFlags(int iColumn) const
     315{
     316    Qt::ItemFlags enmFlags = 0;
     317    if (iColumn == ApplianceViewSection_ConfigValue)
    320318    {
    321319        /* Some items are checkable */
    322         if (m_type == KVirtualSystemDescriptionType_Floppy ||
    323             m_type == KVirtualSystemDescriptionType_CDROM ||
    324             m_type == KVirtualSystemDescriptionType_USBController ||
    325             m_type == KVirtualSystemDescriptionType_SoundCard ||
    326             m_type == KVirtualSystemDescriptionType_NetworkAdapter)
    327             flags |= Qt::ItemIsUserCheckable;
     320        if (m_enmType == KVirtualSystemDescriptionType_Floppy ||
     321            m_enmType == KVirtualSystemDescriptionType_CDROM ||
     322            m_enmType == KVirtualSystemDescriptionType_USBController ||
     323            m_enmType == KVirtualSystemDescriptionType_SoundCard ||
     324            m_enmType == KVirtualSystemDescriptionType_NetworkAdapter)
     325            enmFlags |= Qt::ItemIsUserCheckable;
    328326        /* Some items are editable */
    329         if ((m_type == KVirtualSystemDescriptionType_Name ||
    330              m_type == KVirtualSystemDescriptionType_Product ||
    331              m_type == KVirtualSystemDescriptionType_ProductUrl ||
    332              m_type == KVirtualSystemDescriptionType_Vendor ||
    333              m_type == KVirtualSystemDescriptionType_VendorUrl ||
    334              m_type == KVirtualSystemDescriptionType_Version ||
    335              m_type == KVirtualSystemDescriptionType_Description ||
    336              m_type == KVirtualSystemDescriptionType_License ||
    337              m_type == KVirtualSystemDescriptionType_OS ||
    338              m_type == KVirtualSystemDescriptionType_CPU ||
    339              m_type == KVirtualSystemDescriptionType_Memory ||
    340              m_type == KVirtualSystemDescriptionType_SoundCard ||
    341              m_type == KVirtualSystemDescriptionType_NetworkAdapter ||
    342              m_type == KVirtualSystemDescriptionType_HardDiskControllerIDE ||
    343              m_type == KVirtualSystemDescriptionType_HardDiskImage) &&
     327        if ((m_enmType == KVirtualSystemDescriptionType_Name ||
     328             m_enmType == KVirtualSystemDescriptionType_Product ||
     329             m_enmType == KVirtualSystemDescriptionType_ProductUrl ||
     330             m_enmType == KVirtualSystemDescriptionType_Vendor ||
     331             m_enmType == KVirtualSystemDescriptionType_VendorUrl ||
     332             m_enmType == KVirtualSystemDescriptionType_Version ||
     333             m_enmType == KVirtualSystemDescriptionType_Description ||
     334             m_enmType == KVirtualSystemDescriptionType_License ||
     335             m_enmType == KVirtualSystemDescriptionType_OS ||
     336             m_enmType == KVirtualSystemDescriptionType_CPU ||
     337             m_enmType == KVirtualSystemDescriptionType_Memory ||
     338             m_enmType == KVirtualSystemDescriptionType_SoundCard ||
     339             m_enmType == KVirtualSystemDescriptionType_NetworkAdapter ||
     340             m_enmType == KVirtualSystemDescriptionType_HardDiskControllerIDE ||
     341             m_enmType == KVirtualSystemDescriptionType_HardDiskImage) &&
    344342            m_checkState == Qt::Checked) /* Item has to be enabled */
    345             flags |= Qt::ItemIsEditable;
     343            enmFlags |= Qt::ItemIsEditable;
    346344    }
    347     return flags;
    348 }
    349 
    350 bool HardwareItem::setData(int column, const QVariant &value, int role)
     345    return enmFlags;
     346}
     347
     348bool HardwareItem::setData(int iColumn, const QVariant &value, int iRole)
    351349{
    352350    bool fDone = false;
    353     switch (role)
     351    switch (iRole)
    354352    {
    355353        case Qt::CheckStateRole:
    356354        {
    357             if (column == ApplianceViewSection_ConfigValue &&
    358                 (m_type == KVirtualSystemDescriptionType_Floppy ||
    359                  m_type == KVirtualSystemDescriptionType_CDROM ||
    360                  m_type == KVirtualSystemDescriptionType_USBController ||
    361                  m_type == KVirtualSystemDescriptionType_SoundCard ||
    362                  m_type == KVirtualSystemDescriptionType_NetworkAdapter))
     355            if (iColumn == ApplianceViewSection_ConfigValue &&
     356                (m_enmType == KVirtualSystemDescriptionType_Floppy ||
     357                 m_enmType == KVirtualSystemDescriptionType_CDROM ||
     358                 m_enmType == KVirtualSystemDescriptionType_USBController ||
     359                 m_enmType == KVirtualSystemDescriptionType_SoundCard ||
     360                 m_enmType == KVirtualSystemDescriptionType_NetworkAdapter))
    363361            {
    364362                m_checkState = static_cast<Qt::CheckState>(value.toInt());
     
    369367        case Qt::EditRole:
    370368        {
    371             if (column == ApplianceViewSection_OriginalValue)
     369            if (iColumn == ApplianceViewSection_OriginalValue)
    372370                m_strOrigValue = value.toString();
    373             else if (column == ApplianceViewSection_ConfigValue)
     371            else if (iColumn == ApplianceViewSection_ConfigValue)
    374372                m_strConfigValue = value.toString();
    375373            break;
     
    380378}
    381379
    382 QVariant HardwareItem::data(int column, int role) const
    383 {
    384     QVariant v;
    385     switch (role)
     380QVariant HardwareItem::data(int iColumn, int iRole) const
     381{
     382    QVariant value;
     383    switch (iRole)
    386384    {
    387385        case Qt::EditRole:
    388386        {
    389             if (column == ApplianceViewSection_OriginalValue)
    390                 v = m_strOrigValue;
    391             else if (column == ApplianceViewSection_ConfigValue)
    392                 v = m_strConfigValue;
     387            if (iColumn == ApplianceViewSection_OriginalValue)
     388                value = m_strOrigValue;
     389            else if (iColumn == ApplianceViewSection_ConfigValue)
     390                value = m_strConfigValue;
    393391            break;
    394392        }
    395393        case Qt::DisplayRole:
    396394        {
    397             if (column == ApplianceViewSection_Description)
    398             {
    399                 switch (m_type)
     395            if (iColumn == ApplianceViewSection_Description)
     396            {
     397                switch (m_enmType)
    400398                {
    401                     case KVirtualSystemDescriptionType_Name:                   v = UIApplianceEditorWidget::tr("Name"); break;
    402                     case KVirtualSystemDescriptionType_Product:                v = UIApplianceEditorWidget::tr("Product"); break;
    403                     case KVirtualSystemDescriptionType_ProductUrl:             v = UIApplianceEditorWidget::tr("Product-URL"); break;
    404                     case KVirtualSystemDescriptionType_Vendor:                 v = UIApplianceEditorWidget::tr("Vendor"); break;
    405                     case KVirtualSystemDescriptionType_VendorUrl:              v = UIApplianceEditorWidget::tr("Vendor-URL"); break;
    406                     case KVirtualSystemDescriptionType_Version:                v = UIApplianceEditorWidget::tr("Version"); break;
    407                     case KVirtualSystemDescriptionType_Description:            v = UIApplianceEditorWidget::tr("Description"); break;
    408                     case KVirtualSystemDescriptionType_License:                v = UIApplianceEditorWidget::tr("License"); break;
    409                     case KVirtualSystemDescriptionType_OS:                     v = UIApplianceEditorWidget::tr("Guest OS Type"); break;
    410                     case KVirtualSystemDescriptionType_CPU:                    v = UIApplianceEditorWidget::tr("CPU"); break;
    411                     case KVirtualSystemDescriptionType_Memory:                 v = UIApplianceEditorWidget::tr("RAM"); break;
    412                     case KVirtualSystemDescriptionType_HardDiskControllerIDE:  v = UIApplianceEditorWidget::tr("Storage Controller (IDE)"); break;
    413                     case KVirtualSystemDescriptionType_HardDiskControllerSATA: v = UIApplianceEditorWidget::tr("Storage Controller (SATA)"); break;
    414                     case KVirtualSystemDescriptionType_HardDiskControllerSCSI: v = UIApplianceEditorWidget::tr("Storage Controller (SCSI)"); break;
    415                     case KVirtualSystemDescriptionType_HardDiskControllerSAS:  v = UIApplianceEditorWidget::tr("Storage Controller (SAS)"); break;
    416                     case KVirtualSystemDescriptionType_CDROM:                  v = UIApplianceEditorWidget::tr("DVD"); break;
    417                     case KVirtualSystemDescriptionType_Floppy:                 v = UIApplianceEditorWidget::tr("Floppy"); break;
    418                     case KVirtualSystemDescriptionType_NetworkAdapter:         v = UIApplianceEditorWidget::tr("Network Adapter"); break;
    419                     case KVirtualSystemDescriptionType_USBController:          v = UIApplianceEditorWidget::tr("USB Controller"); break;
    420                     case KVirtualSystemDescriptionType_SoundCard:              v = UIApplianceEditorWidget::tr("Sound Card"); break;
    421                     case KVirtualSystemDescriptionType_HardDiskImage:          v = UIApplianceEditorWidget::tr("Virtual Disk Image"); break;
    422                     default:                                                   v = UIApplianceEditorWidget::tr("Unknown Hardware Item"); break;
     399                    case KVirtualSystemDescriptionType_Name:                   value = UIApplianceEditorWidget::tr("Name"); break;
     400                    case KVirtualSystemDescriptionType_Product:                value = UIApplianceEditorWidget::tr("Product"); break;
     401                    case KVirtualSystemDescriptionType_ProductUrl:             value = UIApplianceEditorWidget::tr("Product-URL"); break;
     402                    case KVirtualSystemDescriptionType_Vendor:                 value = UIApplianceEditorWidget::tr("Vendor"); break;
     403                    case KVirtualSystemDescriptionType_VendorUrl:              value = UIApplianceEditorWidget::tr("Vendor-URL"); break;
     404                    case KVirtualSystemDescriptionType_Version:                value = UIApplianceEditorWidget::tr("Version"); break;
     405                    case KVirtualSystemDescriptionType_Description:            value = UIApplianceEditorWidget::tr("Description"); break;
     406                    case KVirtualSystemDescriptionType_License:                value = UIApplianceEditorWidget::tr("License"); break;
     407                    case KVirtualSystemDescriptionType_OS:                     value = UIApplianceEditorWidget::tr("Guest OS Type"); break;
     408                    case KVirtualSystemDescriptionType_CPU:                    value = UIApplianceEditorWidget::tr("CPU"); break;
     409                    case KVirtualSystemDescriptionType_Memory:                 value = UIApplianceEditorWidget::tr("RAM"); break;
     410                    case KVirtualSystemDescriptionType_HardDiskControllerIDE:  value = UIApplianceEditorWidget::tr("Storage Controller (IDE)"); break;
     411                    case KVirtualSystemDescriptionType_HardDiskControllerSATA: value = UIApplianceEditorWidget::tr("Storage Controller (SATA)"); break;
     412                    case KVirtualSystemDescriptionType_HardDiskControllerSCSI: value = UIApplianceEditorWidget::tr("Storage Controller (SCSI)"); break;
     413                    case KVirtualSystemDescriptionType_HardDiskControllerSAS:  value = UIApplianceEditorWidget::tr("Storage Controller (SAS)"); break;
     414                    case KVirtualSystemDescriptionType_CDROM:                  value = UIApplianceEditorWidget::tr("DVD"); break;
     415                    case KVirtualSystemDescriptionType_Floppy:                 value = UIApplianceEditorWidget::tr("Floppy"); break;
     416                    case KVirtualSystemDescriptionType_NetworkAdapter:         value = UIApplianceEditorWidget::tr("Network Adapter"); break;
     417                    case KVirtualSystemDescriptionType_USBController:          value = UIApplianceEditorWidget::tr("USB Controller"); break;
     418                    case KVirtualSystemDescriptionType_SoundCard:              value = UIApplianceEditorWidget::tr("Sound Card"); break;
     419                    case KVirtualSystemDescriptionType_HardDiskImage:          value = UIApplianceEditorWidget::tr("Virtual Disk Image"); break;
     420                    default:                                                   value = UIApplianceEditorWidget::tr("Unknown Hardware Item"); break;
    423421                }
    424422            }
    425             else if (column == ApplianceViewSection_OriginalValue)
    426                 v = m_strOrigValue;
    427             else if (column == ApplianceViewSection_ConfigValue)
    428             {
    429                 switch (m_type)
     423            else if (iColumn == ApplianceViewSection_OriginalValue)
     424                value = m_strOrigValue;
     425            else if (iColumn == ApplianceViewSection_ConfigValue)
     426            {
     427                switch (m_enmType)
    430428                {
    431429                    case KVirtualSystemDescriptionType_Description:
     
    434432                        /* Shorten the big text if there is more than
    435433                         * one line */
    436                         QString tmp(m_strConfigValue);
    437                         int i = tmp.indexOf('\n');
     434                        QString strTmp(m_strConfigValue);
     435                        int i = strTmp.indexOf('\n');
    438436                        if (i > -1)
    439                             tmp.replace(i, tmp.length(), "...");
    440                         v = tmp; break;
     437                            strTmp.replace(i, strTmp.length(), "...");
     438                        value = strTmp; break;
    441439                    }
    442                     case KVirtualSystemDescriptionType_OS:             v = vboxGlobal().vmGuestOSTypeDescription(m_strConfigValue); break;
    443                     case KVirtualSystemDescriptionType_Memory:         v = m_strConfigValue + " " + VBoxGlobal::tr("MB", "size suffix MBytes=1024 KBytes"); break;
    444                     case KVirtualSystemDescriptionType_SoundCard:      v = gpConverter->toString(static_cast<KAudioControllerType>(m_strConfigValue.toInt())); break;
    445                     case KVirtualSystemDescriptionType_NetworkAdapter: v = gpConverter->toString(static_cast<KNetworkAdapterType>(m_strConfigValue.toInt())); break;
    446                     default:                                           v = m_strConfigValue; break;
     440                    case KVirtualSystemDescriptionType_OS:             value = vboxGlobal().vmGuestOSTypeDescription(m_strConfigValue); break;
     441                    case KVirtualSystemDescriptionType_Memory:         value = m_strConfigValue + " " + VBoxGlobal::tr("MB", "size suffix MBytes=1024 KBytes"); break;
     442                    case KVirtualSystemDescriptionType_SoundCard:      value = gpConverter->toString(static_cast<KAudioControllerType>(m_strConfigValue.toInt())); break;
     443                    case KVirtualSystemDescriptionType_NetworkAdapter: value = gpConverter->toString(static_cast<KNetworkAdapterType>(m_strConfigValue.toInt())); break;
     444                    default:                                           value = m_strConfigValue; break;
    447445                }
    448446            }
     
    451449        case Qt::ToolTipRole:
    452450        {
    453             if (column == ApplianceViewSection_ConfigValue)
     451            if (iColumn == ApplianceViewSection_ConfigValue)
    454452            {
    455453                if (!m_strOrigValue.isEmpty())
    456                     v = UIApplianceEditorWidget::tr("<b>Original Value:</b> %1").arg(m_strOrigValue);
     454                    value = UIApplianceEditorWidget::tr("<b>Original Value:</b> %1").arg(m_strOrigValue);
    457455            }
    458456            break;
     
    460458        case Qt::DecorationRole:
    461459        {
    462             if (column == ApplianceViewSection_Description)
    463             {
    464                 switch (m_type)
     460            if (iColumn == ApplianceViewSection_Description)
     461            {
     462                switch (m_enmType)
    465463                {
    466                     case KVirtualSystemDescriptionType_Name:                   v = UIIconPool::iconSet(":/name_16px.png"); break;
     464                    case KVirtualSystemDescriptionType_Name:                   value = UIIconPool::iconSet(":/name_16px.png"); break;
    467465                    case KVirtualSystemDescriptionType_Product:
    468466                    case KVirtualSystemDescriptionType_ProductUrl:
     
    471469                    case KVirtualSystemDescriptionType_Version:
    472470                    case KVirtualSystemDescriptionType_Description:
    473                     case KVirtualSystemDescriptionType_License:                v = UIIconPool::iconSet(":/description_16px.png"); break;
    474                     case KVirtualSystemDescriptionType_OS:                     v = UIIconPool::iconSet(":/os_type_16px.png"); break;
    475                     case KVirtualSystemDescriptionType_CPU:                    v = UIIconPool::iconSet(":/cpu_16px.png"); break;
    476                     case KVirtualSystemDescriptionType_Memory:                 v = UIIconPool::iconSet(":/ram_16px.png"); break;
    477                     case KVirtualSystemDescriptionType_HardDiskControllerIDE:  v = UIIconPool::iconSet(":/ide_16px.png"); break;
    478                     case KVirtualSystemDescriptionType_HardDiskControllerSATA: v = UIIconPool::iconSet(":/sata_16px.png"); break;
    479                     case KVirtualSystemDescriptionType_HardDiskControllerSCSI: v = UIIconPool::iconSet(":/scsi_16px.png"); break;
    480                     case KVirtualSystemDescriptionType_HardDiskControllerSAS:  v = UIIconPool::iconSet(":/scsi_16px.png"); break;
    481                     case KVirtualSystemDescriptionType_HardDiskImage:          v = UIIconPool::iconSet(":/hd_16px.png"); break;
    482                     case KVirtualSystemDescriptionType_CDROM:                  v = UIIconPool::iconSet(":/cd_16px.png"); break;
    483                     case KVirtualSystemDescriptionType_Floppy:                 v = UIIconPool::iconSet(":/fd_16px.png"); break;
    484                     case KVirtualSystemDescriptionType_NetworkAdapter:         v = UIIconPool::iconSet(":/nw_16px.png"); break;
    485                     case KVirtualSystemDescriptionType_USBController:          v = UIIconPool::iconSet(":/usb_16px.png"); break;
    486                     case KVirtualSystemDescriptionType_SoundCard:              v = UIIconPool::iconSet(":/sound_16px.png"); break;
     471                    case KVirtualSystemDescriptionType_License:                value = UIIconPool::iconSet(":/description_16px.png"); break;
     472                    case KVirtualSystemDescriptionType_OS:                     value = UIIconPool::iconSet(":/os_type_16px.png"); break;
     473                    case KVirtualSystemDescriptionType_CPU:                    value = UIIconPool::iconSet(":/cpu_16px.png"); break;
     474                    case KVirtualSystemDescriptionType_Memory:                 value = UIIconPool::iconSet(":/ram_16px.png"); break;
     475                    case KVirtualSystemDescriptionType_HardDiskControllerIDE:  value = UIIconPool::iconSet(":/ide_16px.png"); break;
     476                    case KVirtualSystemDescriptionType_HardDiskControllerSATA: value = UIIconPool::iconSet(":/sata_16px.png"); break;
     477                    case KVirtualSystemDescriptionType_HardDiskControllerSCSI: value = UIIconPool::iconSet(":/scsi_16px.png"); break;
     478                    case KVirtualSystemDescriptionType_HardDiskControllerSAS:  value = UIIconPool::iconSet(":/scsi_16px.png"); break;
     479                    case KVirtualSystemDescriptionType_HardDiskImage:          value = UIIconPool::iconSet(":/hd_16px.png"); break;
     480                    case KVirtualSystemDescriptionType_CDROM:                  value = UIIconPool::iconSet(":/cd_16px.png"); break;
     481                    case KVirtualSystemDescriptionType_Floppy:                 value = UIIconPool::iconSet(":/fd_16px.png"); break;
     482                    case KVirtualSystemDescriptionType_NetworkAdapter:         value = UIIconPool::iconSet(":/nw_16px.png"); break;
     483                    case KVirtualSystemDescriptionType_USBController:          value = UIIconPool::iconSet(":/usb_16px.png"); break;
     484                    case KVirtualSystemDescriptionType_SoundCard:              value = UIIconPool::iconSet(":/sound_16px.png"); break;
    487485                    default: break;
    488486                }
    489487            }
    490             else if (column == ApplianceViewSection_ConfigValue &&
    491                      m_type == KVirtualSystemDescriptionType_OS)
     488            else if (iColumn == ApplianceViewSection_ConfigValue &&
     489                     m_enmType == KVirtualSystemDescriptionType_OS)
    492490            {
    493491                const QStyle *pStyle = QApplication::style();
    494492                const int iIconMetric = pStyle->pixelMetric(QStyle::PM_SmallIconSize);
    495                 v = vboxGlobal().vmGuestOSTypeIcon(m_strConfigValue).scaledToHeight(iIconMetric, Qt::SmoothTransformation);
     493                value = vboxGlobal().vmGuestOSTypeIcon(m_strConfigValue).scaledToHeight(iIconMetric, Qt::SmoothTransformation);
    496494            }
    497495            break;
     
    500498        {
    501499            /* If the item is unchecked mark it with italic text. */
    502             if (column == ApplianceViewSection_ConfigValue &&
     500            if (iColumn == ApplianceViewSection_ConfigValue &&
    503501                m_checkState == Qt::Unchecked)
    504502            {
    505503                QFont font = qApp->font();
    506504                font.setItalic(true);
    507                 v = font;
     505                value = font;
    508506            }
    509507            break;
     
    512510        {
    513511            /* If the item is unchecked mark it with gray text. */
    514             if (column == ApplianceViewSection_ConfigValue &&
     512            if (iColumn == ApplianceViewSection_ConfigValue &&
    515513                m_checkState == Qt::Unchecked)
    516514            {
    517515                QPalette pal = qApp->palette();
    518                 v = pal.brush(QPalette::Disabled, QPalette::WindowText);
     516                value = pal.brush(QPalette::Disabled, QPalette::WindowText);
    519517            }
    520518            break;
     
    522520        case Qt::CheckStateRole:
    523521        {
    524             if (column == ApplianceViewSection_ConfigValue &&
    525                 (m_type == KVirtualSystemDescriptionType_Floppy ||
    526                  m_type == KVirtualSystemDescriptionType_CDROM ||
    527                  m_type == KVirtualSystemDescriptionType_USBController ||
    528                  m_type == KVirtualSystemDescriptionType_SoundCard ||
    529                  m_type == KVirtualSystemDescriptionType_NetworkAdapter))
    530                 v = m_checkState;
     522            if (iColumn == ApplianceViewSection_ConfigValue &&
     523                (m_enmType == KVirtualSystemDescriptionType_Floppy ||
     524                 m_enmType == KVirtualSystemDescriptionType_CDROM ||
     525                 m_enmType == KVirtualSystemDescriptionType_USBController ||
     526                 m_enmType == KVirtualSystemDescriptionType_SoundCard ||
     527                 m_enmType == KVirtualSystemDescriptionType_NetworkAdapter))
     528                value = m_checkState;
    531529            break;
    532530        }
    533531        case HardwareItem::TypeRole:
    534532        {
    535             v = m_type;
     533            value = m_enmType;
    536534            break;
    537535        }
    538536        case HardwareItem::ModifiedRole:
    539537        {
    540             if (column == ApplianceViewSection_ConfigValue)
    541                 v = m_fModified;
     538            if (iColumn == ApplianceViewSection_ConfigValue)
     539                value = m_fModified;
    542540            break;
    543541        }
    544542    }
    545     return v;
     543    return value;
    546544}
    547545
    548546QWidget *HardwareItem::createEditor(QWidget *pParent, const QStyleOptionViewItem & /* styleOption */, const QModelIndex &idx) const
    549547{
    550     QWidget *editor = NULL;
     548    QWidget *pEditor = 0;
    551549    if (idx.column() == ApplianceViewSection_ConfigValue)
    552550    {
    553         switch (m_type)
     551        switch (m_enmType)
    554552        {
    555553            case KVirtualSystemDescriptionType_OS:
    556554            {
    557                 VBoxOSTypeSelectorButton *e = new VBoxOSTypeSelectorButton(pParent);
     555                VBoxOSTypeSelectorButton *pButton = new VBoxOSTypeSelectorButton(pParent);
    558556                /* Fill the background with the highlight color in the case
    559557                 * the button hasn't a rectangle shape. This prevents the
     
    562560                /* Use the palette from the tree view, not the one from the
    563561                 * editor. */
    564                 QPalette p = e->palette();
     562                QPalette p = pButton->palette();
    565563                p.setBrush(QPalette::Highlight, pParent->palette().brush(QPalette::Highlight));
    566                 e->setPalette(p);
     564                pButton->setPalette(p);
    567565#endif /* VBOX_WS_MAC */
    568                 e->setAutoFillBackground(true);
    569                 e->setBackgroundRole(QPalette::Highlight);
    570                 editor = e;
     566                pButton->setAutoFillBackground(true);
     567                pButton->setBackgroundRole(QPalette::Highlight);
     568                pEditor = pButton;
    571569                break;
    572570            }
     
    578576            case KVirtualSystemDescriptionType_Version:
    579577            {
    580                 QLineEdit *e = new QLineEdit(pParent);
    581                 editor = e;
     578                QLineEdit *pLineEdit = new QLineEdit(pParent);
     579                pEditor = pLineEdit;
    582580                break;
    583581            }
     
    585583            case KVirtualSystemDescriptionType_License:
    586584            {
    587                 UILineTextEdit *e = new UILineTextEdit(pParent);
    588                 editor = e;
     585                UILineTextEdit *pLineTextEdit = new UILineTextEdit(pParent);
     586                pEditor = pLineTextEdit;
    589587                break;
    590588            }
    591589            case KVirtualSystemDescriptionType_CPU:
    592590            {
    593                 QSpinBox *e = new QSpinBox(pParent);
    594                 e->setRange(UIApplianceEditorWidget::minGuestCPUCount(), UIApplianceEditorWidget::maxGuestCPUCount());
    595                 editor = e;
     591                QSpinBox *pSpinBox = new QSpinBox(pParent);
     592                pSpinBox->setRange(UIApplianceEditorWidget::minGuestCPUCount(), UIApplianceEditorWidget::maxGuestCPUCount());
     593                pEditor = pSpinBox;
    596594                break;
    597595            }
    598596            case KVirtualSystemDescriptionType_Memory:
    599597            {
    600                 QSpinBox *e = new QSpinBox(pParent);
    601                 e->setRange(UIApplianceEditorWidget::minGuestRAM(), UIApplianceEditorWidget::maxGuestRAM());
    602                 e->setSuffix(" " + VBoxGlobal::tr("MB", "size suffix MBytes=1024 KBytes"));
    603                 editor = e;
     598                QSpinBox *pSpinBox = new QSpinBox(pParent);
     599                pSpinBox->setRange(UIApplianceEditorWidget::minGuestRAM(), UIApplianceEditorWidget::maxGuestRAM());
     600                pSpinBox->setSuffix(" " + VBoxGlobal::tr("MB", "size suffix MBytes=1024 KBytes"));
     601                pEditor = pSpinBox;
    604602                break;
    605603            }
    606604            case KVirtualSystemDescriptionType_SoundCard:
    607605            {
    608                 QComboBox *e = new QComboBox(pParent);
    609                 e->addItem(gpConverter->toString(KAudioControllerType_AC97), KAudioControllerType_AC97);
    610                 e->addItem(gpConverter->toString(KAudioControllerType_SB16), KAudioControllerType_SB16);
    611                 e->addItem(gpConverter->toString(KAudioControllerType_HDA),  KAudioControllerType_HDA);
    612                 editor = e;
     606                QComboBox *pComboBox = new QComboBox(pParent);
     607                pComboBox->addItem(gpConverter->toString(KAudioControllerType_AC97), KAudioControllerType_AC97);
     608                pComboBox->addItem(gpConverter->toString(KAudioControllerType_SB16), KAudioControllerType_SB16);
     609                pComboBox->addItem(gpConverter->toString(KAudioControllerType_HDA),  KAudioControllerType_HDA);
     610                pEditor = pComboBox;
    613611                break;
    614612            }
    615613            case KVirtualSystemDescriptionType_NetworkAdapter:
    616614            {
    617                 QComboBox *e = new QComboBox(pParent);
    618                 e->addItem(gpConverter->toString(KNetworkAdapterType_Am79C970A), KNetworkAdapterType_Am79C970A);
    619                 e->addItem(gpConverter->toString(KNetworkAdapterType_Am79C973), KNetworkAdapterType_Am79C973);
     615                QComboBox *pComboBox = new QComboBox(pParent);
     616                pComboBox->addItem(gpConverter->toString(KNetworkAdapterType_Am79C970A), KNetworkAdapterType_Am79C970A);
     617                pComboBox->addItem(gpConverter->toString(KNetworkAdapterType_Am79C973), KNetworkAdapterType_Am79C973);
    620618#ifdef VBOX_WITH_E1000
    621                 e->addItem(gpConverter->toString(KNetworkAdapterType_I82540EM), KNetworkAdapterType_I82540EM);
    622                 e->addItem(gpConverter->toString(KNetworkAdapterType_I82543GC), KNetworkAdapterType_I82543GC);
    623                 e->addItem(gpConverter->toString(KNetworkAdapterType_I82545EM), KNetworkAdapterType_I82545EM);
     619                pComboBox->addItem(gpConverter->toString(KNetworkAdapterType_I82540EM), KNetworkAdapterType_I82540EM);
     620                pComboBox->addItem(gpConverter->toString(KNetworkAdapterType_I82543GC), KNetworkAdapterType_I82543GC);
     621                pComboBox->addItem(gpConverter->toString(KNetworkAdapterType_I82545EM), KNetworkAdapterType_I82545EM);
    624622#endif /* VBOX_WITH_E1000 */
    625623#ifdef VBOX_WITH_VIRTIO
    626                 e->addItem(gpConverter->toString(KNetworkAdapterType_Virtio), KNetworkAdapterType_Virtio);
     624                pComboBox->addItem(gpConverter->toString(KNetworkAdapterType_Virtio), KNetworkAdapterType_Virtio);
    627625#endif /* VBOX_WITH_VIRTIO */
    628                 editor = e;
     626                pEditor = pComboBox;
    629627                break;
    630628            }
    631629            case KVirtualSystemDescriptionType_HardDiskControllerIDE:
    632630            {
    633                 QComboBox *e = new QComboBox(pParent);
    634                 e->addItem(gpConverter->toString(KStorageControllerType_PIIX3), "PIIX3");
    635                 e->addItem(gpConverter->toString(KStorageControllerType_PIIX4), "PIIX4");
    636                 e->addItem(gpConverter->toString(KStorageControllerType_ICH6),  "ICH6");
    637                 editor = e;
     631                QComboBox *pComboBox = new QComboBox(pParent);
     632                pComboBox->addItem(gpConverter->toString(KStorageControllerType_PIIX3), "PIIX3");
     633                pComboBox->addItem(gpConverter->toString(KStorageControllerType_PIIX4), "PIIX4");
     634                pComboBox->addItem(gpConverter->toString(KStorageControllerType_ICH6),  "ICH6");
     635                pEditor = pComboBox;
    638636                break;
    639637            }
     
    641639            {
    642640                /* disabled for now
    643                    UIFilePathSelector *e = new UIFilePathSelector(pParent);
    644                    e->setMode(UIFilePathSelector::Mode_File);
    645                    e->setResetEnabled(false);
     641                   UIFilePathSelector *pFileChooser = new UIFilePathSelector(pParent);
     642                   pFileChooser->setMode(UIFilePathSelector::Mode_File);
     643                   pFileChooser->setResetEnabled(false);
    646644                   */
    647                 QLineEdit *e = new QLineEdit(pParent);
    648                 editor = e;
     645                QLineEdit *pLineEdit = new QLineEdit(pParent);
     646                pEditor = pLineEdit;
    649647                break;
    650648            }
     
    652650        }
    653651    }
    654     return editor;
     652    return pEditor;
    655653}
    656654
     
    658656{
    659657    bool fDone = false;
    660     switch (m_type)
     658    switch (m_enmType)
    661659    {
    662660        case KVirtualSystemDescriptionType_OS:
    663661        {
    664             if (VBoxOSTypeSelectorButton *e = qobject_cast<VBoxOSTypeSelectorButton*>(pEditor))
    665             {
    666                 e->setOSTypeId(m_strConfigValue);
     662            if (VBoxOSTypeSelectorButton *pButton = qobject_cast<VBoxOSTypeSelectorButton*>(pEditor))
     663            {
     664                pButton->setOSTypeId(m_strConfigValue);
    667665                fDone = true;
    668666            }
     
    671669        case KVirtualSystemDescriptionType_HardDiskControllerIDE:
    672670        {
    673             if (QComboBox *e = qobject_cast<QComboBox*>(pEditor))
    674             {
    675                 int i = e->findData(m_strConfigValue);
     671            if (QComboBox *pComboBox = qobject_cast<QComboBox*>(pEditor))
     672            {
     673                int i = pComboBox->findData(m_strConfigValue);
    676674                if (i != -1)
    677                     e->setCurrentIndex(i);
     675                    pComboBox->setCurrentIndex(i);
    678676                fDone = true;
    679677            }
     
    683681        case KVirtualSystemDescriptionType_Memory:
    684682        {
    685             if (QSpinBox *e = qobject_cast<QSpinBox*>(pEditor))
    686             {
    687                 e->setValue(m_strConfigValue.toInt());
     683            if (QSpinBox *pSpinBox = qobject_cast<QSpinBox*>(pEditor))
     684            {
     685                pSpinBox->setValue(m_strConfigValue.toInt());
    688686                fDone = true;
    689687            }
     
    697695        case KVirtualSystemDescriptionType_Version:
    698696        {
    699             if (QLineEdit *e = qobject_cast<QLineEdit*>(pEditor))
    700             {
    701                 e->setText(m_strConfigValue);
     697            if (QLineEdit *pLineEdit = qobject_cast<QLineEdit*>(pEditor))
     698            {
     699                pLineEdit->setText(m_strConfigValue);
    702700                fDone = true;
    703701            }
     
    707705        case KVirtualSystemDescriptionType_License:
    708706        {
    709             if (UILineTextEdit *e = qobject_cast<UILineTextEdit*>(pEditor))
    710             {
    711                 e->setText(m_strConfigValue);
     707            if (UILineTextEdit *pLineTextEdit = qobject_cast<UILineTextEdit*>(pEditor))
     708            {
     709                pLineTextEdit->setText(m_strConfigValue);
    712710                fDone = true;
    713711            }
     
    717715        case KVirtualSystemDescriptionType_NetworkAdapter:
    718716        {
    719             if (QComboBox *e = qobject_cast<QComboBox*>(pEditor))
    720             {
    721                 int i = e->findData(m_strConfigValue.toInt());
     717            if (QComboBox *pComboBox = qobject_cast<QComboBox*>(pEditor))
     718            {
     719                int i = pComboBox->findData(m_strConfigValue.toInt());
    722720                if (i != -1)
    723                     e->setCurrentIndex(i);
     721                    pComboBox->setCurrentIndex(i);
    724722                fDone = true;
    725723            }
     
    729727        {
    730728            /* disabled for now
    731                if (UIFilePathSelector *e = qobject_cast<UIFilePathSelector*>(pEditor))
     729               if (UIFilePathSelector *pFileChooser = qobject_cast<UIFilePathSelector*>(pEditor))
    732730               {
    733                e->setPath(m_strConfigValue);
     731               pFileChooser->setPath(m_strConfigValue);
    734732               }
    735733               */
    736             if (QLineEdit *e = qobject_cast<QLineEdit*>(pEditor))
    737             {
    738                 e->setText(m_strConfigValue);
     734            if (QLineEdit *pLineEdit = qobject_cast<QLineEdit*>(pEditor))
     735            {
     736                pLineEdit->setText(m_strConfigValue);
    739737                fDone = true;
    740738            }
     
    749747{
    750748    bool fDone = false;
    751     switch (m_type)
     749    switch (m_enmType)
    752750    {
    753751        case KVirtualSystemDescriptionType_OS:
    754752        {
    755             if (VBoxOSTypeSelectorButton *e = qobject_cast<VBoxOSTypeSelectorButton*>(pEditor))
    756             {
    757                 m_strConfigValue = e->osTypeId();
     753            if (VBoxOSTypeSelectorButton *pButton = qobject_cast<VBoxOSTypeSelectorButton*>(pEditor))
     754            {
     755                m_strConfigValue = pButton->osTypeId();
    758756                fDone = true;
    759757            }
     
    762760        case KVirtualSystemDescriptionType_HardDiskControllerIDE:
    763761        {
    764             if (QComboBox *e = qobject_cast<QComboBox*>(pEditor))
    765             {
    766                 m_strConfigValue = e->itemData(e->currentIndex()).toString();
     762            if (QComboBox *pComboBox = qobject_cast<QComboBox*>(pEditor))
     763            {
     764                m_strConfigValue = pComboBox->itemData(pComboBox->currentIndex()).toString();
    767765                fDone = true;
    768766            }
     
    772770        case KVirtualSystemDescriptionType_Memory:
    773771        {
    774             if (QSpinBox *e = qobject_cast<QSpinBox*>(pEditor))
    775             {
    776                 m_strConfigValue = QString::number(e->value());
     772            if (QSpinBox *pSpinBox = qobject_cast<QSpinBox*>(pEditor))
     773            {
     774                m_strConfigValue = QString::number(pSpinBox->value());
    777775                fDone = true;
    778776            }
     
    781779        case KVirtualSystemDescriptionType_Name:
    782780        {
    783             if (QLineEdit *e = qobject_cast<QLineEdit*>(pEditor))
     781            if (QLineEdit *pLineEdit = qobject_cast<QLineEdit*>(pEditor))
    784782            {
    785783                /* When the VM name is changed the path of the disk images
     
    811809                        foreach (QString a, splittedOriginalPath)
    812810                        {
    813                             (a.compare(m_strConfigValue) == 0) ? splittedNewPath << e->text() : splittedNewPath << a;
     811                            (a.compare(m_strConfigValue) == 0) ? splittedNewPath << pLineEdit->text() : splittedNewPath << a;
    814812                        }
    815813
     
    821819                    }
    822820                }
    823                 m_strConfigValue = e->text();
     821                m_strConfigValue = pLineEdit->text();
    824822                fDone = true;
    825823            }
     
    832830        case KVirtualSystemDescriptionType_Version:
    833831        {
    834             if (QLineEdit *e = qobject_cast<QLineEdit*>(pEditor))
    835             {
    836                 m_strConfigValue = e->text();
     832            if (QLineEdit *pLineEdit = qobject_cast<QLineEdit*>(pEditor))
     833            {
     834                m_strConfigValue = pLineEdit->text();
    837835                fDone = true;
    838836            }
     
    842840        case KVirtualSystemDescriptionType_License:
    843841        {
    844             if (UILineTextEdit *e = qobject_cast<UILineTextEdit*>(pEditor))
    845             {
    846                 m_strConfigValue = e->text();
     842            if (UILineTextEdit *pLineTextEdit = qobject_cast<UILineTextEdit*>(pEditor))
     843            {
     844                m_strConfigValue = pLineTextEdit->text();
    847845                fDone = true;
    848846            }
     
    852850        case KVirtualSystemDescriptionType_NetworkAdapter:
    853851        {
    854             if (QComboBox *e = qobject_cast<QComboBox*>(pEditor))
    855             {
    856                 m_strConfigValue = e->itemData(e->currentIndex()).toString();
     852            if (QComboBox *pComboBox = qobject_cast<QComboBox*>(pEditor))
     853            {
     854                m_strConfigValue = pComboBox->itemData(pComboBox->currentIndex()).toString();
    857855                fDone = true;
    858856            }
     
    862860        {
    863861            /* disabled for now
    864                if (UIFilePathSelector *e = qobject_cast<UIFilePathSelector*>(pEditor))
     862               if (UIFilePathSelector *pFileChooser = qobject_cast<UIFilePathSelector*>(pEditor))
    865863               {
    866                m_strConfigValue = e->path();
     864               m_strConfigValue = pFileChooser->path();
    867865               }
    868866               */
    869             if (QLineEdit *e = qobject_cast<QLineEdit*>(pEditor))
    870             {
    871                 m_strConfigValue = e->text();
     867            if (QLineEdit *pLineEdit = qobject_cast<QLineEdit*>(pEditor))
     868            {
     869                m_strConfigValue = pLineEdit->text();
    872870                fDone = true;
    873871            }
     
    888886}
    889887
    890 void HardwareItem::putBack(QVector<BOOL>& finalStates, QVector<QString>& finalValues, QVector<QString>& finalExtraValues)
    891 {
    892     finalStates[m_number]      = m_checkState == Qt::Checked;
    893     finalValues[m_number]      = m_strConfigValue;
    894     finalExtraValues[m_number] = m_strExtraConfigValue;
     888void HardwareItem::putBack(QVector<BOOL> &finalStates, QVector<QString> &finalValues, QVector<QString> &finalExtraValues)
     889{
     890    finalStates[m_iNumber] = m_checkState == Qt::Checked;
     891    finalValues[m_iNumber] = m_strConfigValue;
     892    finalExtraValues[m_iNumber] = m_strExtraConfigValue;
    895893    ModelItem::putBack(finalStates, finalValues, finalExtraValues);
    896894}
     
    901899*********************************************************************************************************************************/
    902900
    903 /* This class is a wrapper model for our ModelItem. It could be used with any
    904    TreeView & forward mostly all calls to the methods of ModelItem. The
    905    ModelItems itself are stored as internal pointers in the QModelIndex class. */
    906 VirtualSystemModel::VirtualSystemModel(QVector<CVirtualSystemDescription>& aVSDs, QObject *pParent /* = NULL */)
    907    : QAbstractItemModel(pParent)
     901VirtualSystemModel::VirtualSystemModel(QVector<CVirtualSystemDescription>& aVSDs, QObject *pParent /* = 0 */)
     902    : QAbstractItemModel(pParent)
    908903{
    909904    m_pRootItem = new ModelItem(0, ApplianceModelItemType_Root);
    910     for (int a = 0; a < aVSDs.size(); ++a)
     905    for (int iVSDIndex = 0; iVSDIndex < aVSDs.size(); ++iVSDIndex)
    911906    {
    912         CVirtualSystemDescription vs = aVSDs[a];
    913 
    914         VirtualSystemItem *vi = new VirtualSystemItem(a, vs, m_pRootItem);
    915         m_pRootItem->appendChild(vi);
     907        CVirtualSystemDescription vsd = aVSDs[iVSDIndex];
     908
     909        VirtualSystemItem *pVirtualSystemItem = new VirtualSystemItem(iVSDIndex, vsd, m_pRootItem);
     910        m_pRootItem->appendChild(pVirtualSystemItem);
    916911
    917912        /** @todo ask Dmitry about include/COMDefs.h:232 */
     
    922917        QVector<QString> extraConfigValues;
    923918
    924         QList<int> hdIndizies;
     919        QList<int> hdIndexes;
    925920        QMap<int, HardwareItem*> controllerMap;
    926         vs.GetDescription(types, refs, origValues, configValues, extraConfigValues);
     921        vsd.GetDescription(types, refs, origValues, configValues, extraConfigValues);
    927922        for (int i = 0; i < types.size(); ++i)
    928923        {
     
    930925               reference to them. */
    931926            if (types[i] == KVirtualSystemDescriptionType_HardDiskImage)
    932                 hdIndizies << i;
     927                hdIndexes << i;
    933928            else
    934929            {
    935                 HardwareItem *hi = new HardwareItem(i, types[i], refs[i], origValues[i], configValues[i], extraConfigValues[i], vi);
    936                 vi->appendChild(hi);
     930                HardwareItem *pHardwareItem = new HardwareItem(i, types[i], refs[i], origValues[i], configValues[i], extraConfigValues[i], pVirtualSystemItem);
     931                pVirtualSystemItem->appendChild(pHardwareItem);
    937932                /* Save the hard disk controller types in an extra map */
    938933                if (types[i] == KVirtualSystemDescriptionType_HardDiskControllerIDE ||
     
    940935                    types[i] == KVirtualSystemDescriptionType_HardDiskControllerSCSI ||
    941936                    types[i] == KVirtualSystemDescriptionType_HardDiskControllerSAS)
    942                     controllerMap[i] = hi;
     937                    controllerMap[i] = pHardwareItem;
    943938            }
    944939        }
    945940        QRegExp rx("controller=(\\d+);?");
    946941        /* Now process the hard disk images */
    947         for (int a = 0; a < hdIndizies.size(); ++a)
    948         {
    949             int i = hdIndizies[a];
     942        for (int iHDIndex = 0; iHDIndex < hdIndexes.size(); ++iHDIndex)
     943        {
     944            int i = hdIndexes[iHDIndex];
    950945            QString ecnf = extraConfigValues[i];
    951946            if (rx.indexIn(ecnf) != -1)
    952947            {
    953948                /* Get the controller */
    954                 HardwareItem *ci = controllerMap[rx.cap(1).toInt()];
    955                 if (ci)
     949                HardwareItem *pControllerItem = controllerMap[rx.cap(1).toInt()];
     950                if (pControllerItem)
    956951                {
    957952                    /* New hardware item as child of the controller */
    958                     HardwareItem *hi = new HardwareItem(i, types[i], refs[i], origValues[i], configValues[i], extraConfigValues[i], ci);
    959                     ci->appendChild(hi);
     953                    HardwareItem *pStorageItem = new HardwareItem(i, types[i], refs[i], origValues[i], configValues[i], extraConfigValues[i], pControllerItem);
     954                    pControllerItem->appendChild(pStorageItem);
    960955                }
    961956            }
     
    970965}
    971966
    972 QModelIndex VirtualSystemModel::index(int row, int column, const QModelIndex &parentIdx /* = QModelIndex() */) const
    973 {
    974     if (!hasIndex(row, column, parentIdx))
     967QModelIndex VirtualSystemModel::index(int iRow, int iColumn, const QModelIndex &parentIdx /* = QModelIndex() */) const
     968{
     969    if (!hasIndex(iRow, iColumn, parentIdx))
    975970        return QModelIndex();
    976971
    977     ModelItem *parentItem;
     972    ModelItem *pParentItem;
    978973
    979974    if (!parentIdx.isValid())
    980         parentItem = m_pRootItem;
     975        pParentItem = m_pRootItem;
    981976    else
    982         parentItem = static_cast<ModelItem*>(parentIdx.internalPointer());
    983 
    984     ModelItem *childItem = parentItem->child(row);
    985     if (childItem)
    986         return createIndex(row, column, childItem);
     977        pParentItem = static_cast<ModelItem*>(parentIdx.internalPointer());
     978
     979    ModelItem *pChildItem = pParentItem->child(iRow);
     980    if (pChildItem)
     981        return createIndex(iRow, iColumn, pChildItem);
    987982    else
    988983        return QModelIndex();
     
    994989        return QModelIndex();
    995990
    996     ModelItem *childItem = static_cast<ModelItem*>(idx.internalPointer());
    997     ModelItem *parentItem = childItem->parent();
    998 
    999     if (parentItem == m_pRootItem)
     991    ModelItem *pChildItem = static_cast<ModelItem*>(idx.internalPointer());
     992    ModelItem *pParentItem = pChildItem->parent();
     993
     994    if (pParentItem == m_pRootItem)
    1000995        return QModelIndex();
    1001996
    1002     return createIndex(parentItem->row(), 0, parentItem);
     997    return createIndex(pParentItem->row(), 0, pParentItem);
    1003998}
    1004999
    10051000int VirtualSystemModel::rowCount(const QModelIndex &parentIdx /* = QModelIndex() */) const
    10061001{
    1007     ModelItem *parentItem;
     1002    ModelItem *pParentItem;
    10081003    if (parentIdx.column() > 0)
    10091004        return 0;
    10101005
    10111006    if (!parentIdx.isValid())
    1012         parentItem = m_pRootItem;
     1007        pParentItem = m_pRootItem;
    10131008    else
    1014         parentItem = static_cast<ModelItem*>(parentIdx.internalPointer());
    1015 
    1016     return parentItem->childCount();
     1009        pParentItem = static_cast<ModelItem*>(parentIdx.internalPointer());
     1010
     1011    return pParentItem->childCount();
    10171012}
    10181013
     
    10301025        return 0;
    10311026
    1032     ModelItem *item = static_cast<ModelItem*>(idx.internalPointer());
    1033 
    1034     return Qt::ItemIsEnabled | Qt::ItemIsSelectable | item->itemFlags(idx.column());
    1035 }
    1036 
    1037 QVariant VirtualSystemModel::headerData(int section, Qt::Orientation orientation, int role) const
    1038 {
    1039     if (role != Qt::DisplayRole ||
    1040         orientation != Qt::Horizontal)
     1027    ModelItem *pItem = static_cast<ModelItem*>(idx.internalPointer());
     1028
     1029    return Qt::ItemIsEnabled | Qt::ItemIsSelectable | pItem->itemFlags(idx.column());
     1030}
     1031
     1032QVariant VirtualSystemModel::headerData(int iSection, Qt::Orientation enmOrientation, int iRole) const
     1033{
     1034    if (iRole != Qt::DisplayRole ||
     1035        enmOrientation != Qt::Horizontal)
    10411036        return QVariant();
    10421037
    1043     QString title;
    1044     switch (section)
     1038    QString strTitle;
     1039    switch (iSection)
    10451040    {
    1046         case ApplianceViewSection_Description: title = UIApplianceEditorWidget::tr("Description"); break;
    1047         case ApplianceViewSection_ConfigValue: title = UIApplianceEditorWidget::tr("Configuration"); break;
     1041        case ApplianceViewSection_Description: strTitle = UIApplianceEditorWidget::tr("Description"); break;
     1042        case ApplianceViewSection_ConfigValue: strTitle = UIApplianceEditorWidget::tr("Configuration"); break;
    10481043    }
    1049     return title;
    1050 }
    1051 
    1052 bool VirtualSystemModel::setData(const QModelIndex &idx, const QVariant &value, int role)
     1044    return strTitle;
     1045}
     1046
     1047bool VirtualSystemModel::setData(const QModelIndex &idx, const QVariant &value, int iRole)
    10531048{
    10541049    if (!idx.isValid())
    10551050        return false;
    10561051
    1057     ModelItem *item = static_cast<ModelItem*>(idx.internalPointer());
    1058 
    1059     return item->setData(idx.column(), value, role);
    1060 }
    1061 
    1062 QVariant VirtualSystemModel::data(const QModelIndex &idx, int role /* = Qt::DisplayRole */) const
     1052    ModelItem *pTtem = static_cast<ModelItem*>(idx.internalPointer());
     1053
     1054    return pTtem->setData(idx.column(), value, iRole);
     1055}
     1056
     1057QVariant VirtualSystemModel::data(const QModelIndex &idx, int iRole /* = Qt::DisplayRole */) const
    10631058{
    10641059    if (!idx.isValid())
    10651060        return QVariant();
    10661061
    1067     ModelItem *item = static_cast<ModelItem*>(idx.internalPointer());
    1068 
    1069     return item->data(idx.column(), role);
     1062    ModelItem *pTtem = static_cast<ModelItem*>(idx.internalPointer());
     1063
     1064    return pTtem->data(idx.column(), iRole);
    10701065}
    10711066
     
    10831078void VirtualSystemModel::restoreDefaults(const QModelIndex &parentIdx /* = QModelIndex() */)
    10841079{
    1085     ModelItem *parentItem;
     1080    ModelItem *pParentItem;
    10861081
    10871082    if (!parentIdx.isValid())
    1088         parentItem = m_pRootItem;
     1083        pParentItem = m_pRootItem;
    10891084    else
    1090         parentItem = static_cast<ModelItem*>(parentIdx.internalPointer());
    1091 
    1092     for (int i = 0; i < parentItem->childCount(); ++i)
     1085        pParentItem = static_cast<ModelItem*>(parentIdx.internalPointer());
     1086
     1087    for (int i = 0; i < pParentItem->childCount(); ++i)
    10931088    {
    1094         parentItem->child(i)->restoreDefaults();
     1089        pParentItem->child(i)->restoreDefaults();
    10951090        restoreDefaults(index(i, 0, parentIdx));
    10961091    }
    1097     emit dataChanged(index(0, 0, parentIdx), index(parentItem->childCount()-1, 0, parentIdx));
     1092    emit dataChanged(index(0, 0, parentIdx), index(pParentItem->childCount()-1, 0, parentIdx));
    10981093}
    10991094
     
    11111106*********************************************************************************************************************************/
    11121107
    1113 /* The delegate is used for creating/handling the different editors for the
    1114    various types we support. This class forward the requests to the virtual
    1115    methods of our different ModelItems. If this is not possible the default
    1116    methods of QItemDelegate are used to get some standard behavior. Note: We
    1117    have to handle the proxy model ourself. I really don't understand why Qt is
    1118    not doing this for us. */
    1119 VirtualSystemDelegate::VirtualSystemDelegate(QAbstractProxyModel *pProxy, QObject *pParent /* = NULL */)
    1120   : QItemDelegate(pParent)
    1121   , mProxy(pProxy)
    1122 {}
     1108VirtualSystemDelegate::VirtualSystemDelegate(QAbstractProxyModel *pProxy, QObject *pParent /* = 0 */)
     1109    : QItemDelegate(pParent)
     1110    , m_pProxy(pProxy)
     1111{
     1112}
    11231113
    11241114QWidget *VirtualSystemDelegate::createEditor(QWidget *pParent, const QStyleOptionViewItem &styleOption, const QModelIndex &idx) const
     
    11281118
    11291119    QModelIndex index(idx);
    1130     if (mProxy)
    1131         index = mProxy->mapToSource(idx);
    1132 
    1133     ModelItem *item = static_cast<ModelItem*>(index.internalPointer());
    1134     QWidget *editor = item->createEditor(pParent, styleOption, index);
     1120    if (m_pProxy)
     1121        index = m_pProxy->mapToSource(idx);
     1122
     1123    ModelItem *pItem = static_cast<ModelItem*>(index.internalPointer());
     1124    QWidget *pEditor = pItem->createEditor(pParent, styleOption, index);
    11351125
    11361126    /* Allow UILineTextEdit to commit data early: */
    1137     if (editor && qobject_cast<UILineTextEdit*>(editor))
    1138         connect(editor, SIGNAL(sigFinished(QWidget*)), this, SIGNAL(commitData(QWidget*)));
    1139 
    1140     if (editor == NULL)
     1127    if (pEditor && qobject_cast<UILineTextEdit*>(pEditor))
     1128        connect(pEditor, SIGNAL(sigFinished(QWidget*)), this, SIGNAL(commitData(QWidget*)));
     1129
     1130    if (pEditor == 0)
    11411131        return QItemDelegate::createEditor(pParent, styleOption, index);
    11421132    else
    1143         return editor;
     1133        return pEditor;
    11441134}
    11451135
     
    11501140
    11511141    QModelIndex index(idx);
    1152     if (mProxy)
    1153         index = mProxy->mapToSource(idx);
    1154 
    1155     ModelItem *item = static_cast<ModelItem*>(index.internalPointer());
    1156 
    1157     if (!item->setEditorData(pEditor, index))
     1142    if (m_pProxy)
     1143        index = m_pProxy->mapToSource(idx);
     1144
     1145    ModelItem *pItem = static_cast<ModelItem*>(index.internalPointer());
     1146
     1147    if (!pItem->setEditorData(pEditor, index))
    11581148        QItemDelegate::setEditorData(pEditor, index);
    11591149}
     
    11651155
    11661156    QModelIndex index = pModel->index(idx.row(), idx.column());
    1167     if (mProxy)
    1168         index = mProxy->mapToSource(idx);
    1169 
    1170     ModelItem *item = static_cast<ModelItem*>(index.internalPointer());
    1171     if (!item->setModelData(pEditor, pModel, idx))
     1157    if (m_pProxy)
     1158        index = m_pProxy->mapToSource(idx);
     1159
     1160    ModelItem *pItem = static_cast<ModelItem*>(index.internalPointer());
     1161    if (!pItem->setModelData(pEditor, pModel, idx))
    11721162        QItemDelegate::setModelData(pEditor, pModel, idx);
    11731163}
     
    12181208
    12191209/* static */
    1220 KVirtualSystemDescriptionType VirtualSystemSortProxyModel::m_sortList[] =
     1210KVirtualSystemDescriptionType VirtualSystemSortProxyModel::s_aSortList[] =
    12211211{
    12221212    KVirtualSystemDescriptionType_Name,
     
    12441234VirtualSystemSortProxyModel::VirtualSystemSortProxyModel(QObject *pParent)
    12451235    : QSortFilterProxyModel(pParent)
    1246 {}
    1247 
    1248 bool VirtualSystemSortProxyModel::filterAcceptsRow(int srcRow, const QModelIndex & srcParenIdx) const
     1236{
     1237}
     1238
     1239bool VirtualSystemSortProxyModel::filterAcceptsRow(int iSourceRow, const QModelIndex &srcParenIdx) const
    12491240{
    12501241    /* By default enable all, we will explicitly filter out below */
    12511242    if (srcParenIdx.isValid())
    12521243    {
    1253         QModelIndex i = srcParenIdx.child(srcRow, 0);
     1244        QModelIndex i = srcParenIdx.child(iSourceRow, 0);
    12541245        if (i.isValid())
    12551246        {
    1256             ModelItem *item = static_cast<ModelItem*>(i.internalPointer());
     1247            ModelItem *pItem = static_cast<ModelItem*>(i.internalPointer());
    12571248            /* We filter hardware types only */
    1258             if (item->type() == ApplianceModelItemType_Hardware)
    1259             {
    1260                 HardwareItem *hwItem = static_cast<HardwareItem*>(item);
     1249            if (pItem->type() == ApplianceModelItemType_Hardware)
     1250            {
     1251                HardwareItem *hwItem = static_cast<HardwareItem*>(pItem);
    12611252                /* The license type shouldn't be displayed */
    1262                 if (m_filterList.contains(hwItem->m_type))
     1253                if (m_aFilteredList.contains(hwItem->m_enmType))
    12631254                    return false;
    12641255            }
     
    12851276    HardwareItem *pHwRight = static_cast<HardwareItem*>(pRightItem);
    12861277
    1287     for (unsigned int i = 0; i < RT_ELEMENTS(m_sortList); ++i)
    1288         if (pHwLeft->m_type == m_sortList[i])
     1278    for (unsigned int i = 0; i < RT_ELEMENTS(s_aSortList); ++i)
     1279        if (pHwLeft->m_enmType == s_aSortList[i])
    12891280        {
    12901281            for (unsigned int a = 0; a <= i; ++a)
    1291                 if (pHwRight->m_type == m_sortList[a])
     1282                if (pHwRight->m_enmType == s_aSortList[a])
    12921283                    return true;
    12931284            return false;
     
    13081299int UIApplianceEditorWidget::m_maxGuestCPUCount = -1;
    13091300
    1310 UIApplianceEditorWidget::UIApplianceEditorWidget(QWidget *pParent /* = NULL */)
     1301UIApplianceEditorWidget::UIApplianceEditorWidget(QWidget *pParent /* = 0 */)
    13111302    : QIWithRetranslateUI<QWidget>(pParent)
    1312     , m_pAppliance(NULL)
    1313     , m_pModel(NULL)
     1303    , m_pAppliance(0)
     1304    , m_pModel(0)
    13141305{
    13151306    /* Make sure all static content is properly initialized */
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.h

    r64689 r64691  
    6565    /** Constructs the Virtual System model passing @a pParent to the base-class.
    6666      * @param  aVSDs  Brings the Virtual System descriptions. */
    67     VirtualSystemModel(QVector<CVirtualSystemDescription>& aVSDs, QObject *pParent = NULL);
     67    VirtualSystemModel(QVector<CVirtualSystemDescription>& aVSDs, QObject *pParent = 0);
    6868    /** Destructs the Virtual System model. */
    6969    ~VirtualSystemModel();
    7070
    71     /** Returns the index of the item in the model specified by the given @a row, @a column and @a parentIdx. */
    72     QModelIndex index(int row, int column, const QModelIndex &parentIdx = QModelIndex()) const;
     71    /** Returns the index of the item in the model specified by the given @a iRow, @a iColumn and @a parentIdx. */
     72    QModelIndex index(int iRow, int iColumn, const QModelIndex &parentIdx = QModelIndex()) const;
    7373    /** Returns the parent of the model item with the given @a idx. */
    7474    QModelIndex parent(const QModelIndex &idx) const;
     
    8181    /** Returns the item flags for the given @a idx. */
    8282    Qt::ItemFlags flags(const QModelIndex &idx) const;
    83     /** Returns the data for the given @a role and @a section in the header with the specified @a orientation. */
    84     QVariant headerData(int section, Qt::Orientation orientation, int role) const;
    85 
    86     /** Defines the @a role data for the item at @a idx to @a value. */
    87     bool setData(const QModelIndex &idx, const QVariant &value, int role);
    88     /** Returns the data stored under the given @a role for the item referred to by the @a idx. */
    89     QVariant data(const QModelIndex &idx, int role = Qt::DisplayRole) const;
     83    /** Returns the data for the given @a iRole and @a iSection in the header with the specified @a enmOrientation. */
     84    QVariant headerData(int iSection, Qt::Orientation enmOrientation, int iRole) const;
     85
     86    /** Defines the @a iRole data for the item at @a idx to @a value. */
     87    bool setData(const QModelIndex &idx, const QVariant &value, int iRole);
     88    /** Returns the data stored under the given @a iRole for the item referred to by the @a idx. */
     89    QVariant data(const QModelIndex &idx, int iRole = Qt::DisplayRole) const;
    9090
    9191    /** Returns a model index for the buddy of the item represented by @a idx. */
     
    112112    /** Constructs the Virtual System Delegate passing @a pParent to the base-class.
    113113      * @param  pProxy  Brings the proxy model reference used to redirect requests to. */
    114     VirtualSystemDelegate(QAbstractProxyModel *pProxy, QObject *pParent = NULL);
     114    VirtualSystemDelegate(QAbstractProxyModel *pProxy, QObject *pParent = 0);
    115115
    116116    /** Returns the widget used to edit the item specified by @a idx for editing.
     
    140140
    141141    /** Holds the proxy model reference used to redirect requests to. */
    142     QAbstractProxyModel *mProxy;
     142    QAbstractProxyModel *m_pProxy;
    143143};
    144144
     
    150150
    151151    /** Constructs the Virtual System Sorting model passing @a pParent to the base-class. */
    152     VirtualSystemSortProxyModel(QObject *pParent = NULL);
     152    VirtualSystemSortProxyModel(QObject *pParent = 0);
    153153
    154154protected:
    155155
    156     /** Returns whether item in the row indicated by the given @a srcRow and @a srcParenIdx should be included in the model. */
    157     bool filterAcceptsRow(int srcRow, const QModelIndex & srcParenIdx) const;
     156    /** Returns whether item in the row indicated by the given @a iSourceRow and @a srcParenIdx should be included in the model. */
     157    bool filterAcceptsRow(int iSourceRow, const QModelIndex &srcParenIdx) const;
    158158
    159159    /** Returns whether value of the item referred to by the given index @a leftIdx is less
     
    162162
    163163    /** Holds the array of sorted Virtual System Description types. */
    164     static KVirtualSystemDescriptionType m_sortList[];
     164    static KVirtualSystemDescriptionType s_aSortList[];
    165165
    166166    /** Holds the filtered list of Virtual System Description types. */
    167     QList<KVirtualSystemDescriptionType> m_filterList;
     167    QList<KVirtualSystemDescriptionType> m_aFilteredList;
    168168};
    169169
     
    177177
    178178    /** Constructs the Appliance Editor widget passing @a pParent to the base-class. */
    179     UIApplianceEditorWidget(QWidget *pParent = NULL);
     179    UIApplianceEditorWidget(QWidget *pParent = 0);
    180180
    181181    /** Returns whether the Appliance Editor has valid state. */
    182     bool isValid() const { return m_pAppliance != NULL; }
     182    bool isValid() const { return m_pAppliance != 0; }
    183183    /** Returns the currently set appliance reference. */
    184     CAppliance* appliance() const { return m_pAppliance; }
     184    CAppliance *appliance() const { return m_pAppliance; }
    185185
    186186    /** Returns the minimum guest RAM. */
     
    209209
    210210    /** Holds the information pane instance. */
    211     QWidget *m_pPaneInformation;
     211    QWidget   *m_pPaneInformation;
    212212    /** Holds the settings tree-view instance. */
    213213    QTreeView *m_pTreeViewSettings;
     
    216216
    217217    /** Holds the warning pane instance. */
    218     QWidget *m_pPaneWarning;
     218    QWidget   *m_pPaneWarning;
    219219    /** Holds the warning label instance. */
    220     QLabel *m_pLabelWarning;
     220    QLabel    *m_pLabelWarning;
    221221    /** Holds the warning browser instance. */
    222222    QTextEdit *m_pTextEditWarning;
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceExportEditorWidget.cpp

    r64685 r64691  
    4444      : VirtualSystemSortProxyModel(pParent)
    4545    {
    46         m_filterList
     46        m_aFilteredList
    4747            << KVirtualSystemDescriptionType_OS
    4848            << KVirtualSystemDescriptionType_CPU
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceImportEditorWidget.cpp

    r64685 r64691  
    4545      : VirtualSystemSortProxyModel(pParent)
    4646    {
    47         m_filterList << KVirtualSystemDescriptionType_License;
     47        m_aFilteredList << KVirtualSystemDescriptionType_License;
    4848    }
    4949};
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