VirtualBox

Ignore:
Timestamp:
Oct 2, 2019 12:50:50 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
133709
Message:

FE/Qt: bugref:9582: VM settings / Storage page: HUGE cleanup related to variable and function renaming.

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

Legend:

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

    r81095 r81098  
    149149    /** Constructs data. */
    150150    UIDataSettingsMachineStorageAttachment()
    151         : m_attachmentType(KDeviceType_Null)
    152         , m_iAttachmentPort(-1)
    153         , m_iAttachmentDevice(-1)
    154         , m_uAttachmentMediumId(QUuid())
    155         , m_fAttachmentPassthrough(false)
    156         , m_fAttachmentTempEject(false)
    157         , m_fAttachmentNonRotational(false)
    158         , m_fAttachmentHotPluggable(false)
     151        : m_enmDeviceType(KDeviceType_Null)
     152        , m_iPort(-1)
     153        , m_iDevice(-1)
     154        , m_uMediumId(QUuid())
     155        , m_fPassthrough(false)
     156        , m_fTempEject(false)
     157        , m_fNonRotational(false)
     158        , m_fHotPluggable(false)
    159159    {}
    160160
    161161    /** Returns whether @a another passed data is equal to this one. */
    162     bool equal(const UIDataSettingsMachineStorageAttachment &other) const
     162    bool equal(const UIDataSettingsMachineStorageAttachment &another) const
    163163    {
    164164        return true
    165                && (m_attachmentType == other.m_attachmentType)
    166                && (m_iAttachmentPort == other.m_iAttachmentPort)
    167                && (m_iAttachmentDevice == other.m_iAttachmentDevice)
    168                && (m_uAttachmentMediumId == other.m_uAttachmentMediumId)
    169                && (m_fAttachmentPassthrough == other.m_fAttachmentPassthrough)
    170                && (m_fAttachmentTempEject == other.m_fAttachmentTempEject)
    171                && (m_fAttachmentNonRotational == other.m_fAttachmentNonRotational)
    172                && (m_fAttachmentHotPluggable == other.m_fAttachmentHotPluggable)
     165               && (m_enmDeviceType == another.m_enmDeviceType)
     166               && (m_iPort == another.m_iPort)
     167               && (m_iDevice == another.m_iDevice)
     168               && (m_uMediumId == another.m_uMediumId)
     169               && (m_fPassthrough == another.m_fPassthrough)
     170               && (m_fTempEject == another.m_fTempEject)
     171               && (m_fNonRotational == another.m_fNonRotational)
     172               && (m_fHotPluggable == another.m_fHotPluggable)
    173173               ;
    174174    }
    175175
    176176    /** Returns whether @a another passed data is equal to this one. */
    177     bool operator==(const UIDataSettingsMachineStorageAttachment &other) const { return equal(other); }
     177    bool operator==(const UIDataSettingsMachineStorageAttachment &another) const { return equal(another); }
    178178    /** Returns whether @a another passed data is different from this one. */
    179     bool operator!=(const UIDataSettingsMachineStorageAttachment &other) const { return !equal(other); }
    180 
    181     /** Holds the attachment type. */
    182     KDeviceType  m_attachmentType;
    183     /** Holds the attachment port. */
    184     LONG         m_iAttachmentPort;
    185     /** Holds the attachment device. */
    186     LONG         m_iAttachmentDevice;
    187     /** Holds the attachment medium ID. */
    188     QUuid        m_uAttachmentMediumId;
     179    bool operator!=(const UIDataSettingsMachineStorageAttachment &another) const { return !equal(another); }
     180
     181    /** Holds the device type. */
     182    KDeviceType  m_enmDeviceType;
     183    /** Holds the port. */
     184    LONG         m_iPort;
     185    /** Holds the device. */
     186    LONG         m_iDevice;
     187    /** Holds the medium ID. */
     188    QUuid        m_uMediumId;
    189189    /** Holds whether the attachment being passed through. */
    190     bool         m_fAttachmentPassthrough;
     190    bool         m_fPassthrough;
    191191    /** Holds whether the attachment being temporarily eject. */
    192     bool         m_fAttachmentTempEject;
     192    bool         m_fTempEject;
    193193    /** Holds whether the attachment is solid-state. */
    194     bool         m_fAttachmentNonRotational;
     194    bool         m_fNonRotational;
    195195    /** Holds whether the attachment is hot-pluggable. */
    196     bool         m_fAttachmentHotPluggable;
     196    bool         m_fHotPluggable;
    197197};
    198198
     
    203203    /** Constructs data. */
    204204    UIDataSettingsMachineStorageController()
    205         : m_strControllerName(QString())
    206         , m_controllerBus(KStorageBus_Null)
    207         , m_controllerType(KStorageControllerType_Null)
     205        : m_strName(QString())
     206        , m_enmBus(KStorageBus_Null)
     207        , m_enmType(KStorageControllerType_Null)
    208208        , m_uPortCount(0)
    209209        , m_fUseHostIOCache(false)
     
    211211
    212212    /** Returns whether @a another passed data is equal to this one. */
    213     bool equal(const UIDataSettingsMachineStorageController &other) const
     213    bool equal(const UIDataSettingsMachineStorageController &another) const
    214214    {
    215215        return true
    216                && (m_strControllerName == other.m_strControllerName)
    217                && (m_controllerBus == other.m_controllerBus)
    218                && (m_controllerType == other.m_controllerType)
    219                && (m_uPortCount == other.m_uPortCount)
    220                && (m_fUseHostIOCache == other.m_fUseHostIOCache)
     216               && (m_strName == another.m_strName)
     217               && (m_enmBus == another.m_enmBus)
     218               && (m_enmType == another.m_enmType)
     219               && (m_uPortCount == another.m_uPortCount)
     220               && (m_fUseHostIOCache == another.m_fUseHostIOCache)
    221221               ;
    222222    }
    223223
    224224    /** Returns whether @a another passed data is equal to this one. */
    225     bool operator==(const UIDataSettingsMachineStorageController &other) const { return equal(other); }
     225    bool operator==(const UIDataSettingsMachineStorageController &another) const { return equal(another); }
    226226    /** Returns whether @a another passed data is different from this one. */
    227     bool operator!=(const UIDataSettingsMachineStorageController &other) const { return !equal(other); }
    228 
    229     /** Holds the controller name. */
    230     QString                 m_strControllerName;
    231     /** Holds the controller bus. */
    232     KStorageBus             m_controllerBus;
    233     /** Holds the controller type. */
    234     KStorageControllerType  m_controllerType;
    235     /** Holds the controller port count. */
     227    bool operator!=(const UIDataSettingsMachineStorageController &another) const { return !equal(another); }
     228
     229    /** Holds the name. */
     230    QString                 m_strName;
     231    /** Holds the bus. */
     232    KStorageBus             m_enmBus;
     233    /** Holds the type. */
     234    KStorageControllerType  m_enmType;
     235    /** Holds the port count. */
    236236    uint                    m_uPortCount;
    237237    /** Holds whether the controller uses host IO cache. */
     
    247247
    248248    /** Returns whether @a another passed data is equal to this one. */
    249     bool operator==(const UIDataSettingsMachineStorage & /* other */) const { return true; }
     249    bool operator==(const UIDataSettingsMachineStorage & /* another */) const { return true; }
    250250    /** Returns whether @a another passed data is different from this one. */
    251     bool operator!=(const UIDataSettingsMachineStorage & /* other */) const { return false; }
     251    bool operator!=(const UIDataSettingsMachineStorage & /* another */) const { return false; }
    252252};
    253253
     
    266266
    267267    /** Returns pixmap corresponding to passed @a enmPixmapType. */
    268     QPixmap pixmap(PixmapType pixmapType) const;
    269     /** Returns icon (probably merged) corresponding to passed @a enmPixmapType and @a pixmapDisabledType. */
    270     QIcon icon(PixmapType pixmapType, PixmapType pixmapDisabledType = InvalidPixmap) const;
     268    QPixmap pixmap(PixmapType enmPixmapType) const;
     269    /** Returns icon (probably merged) corresponding to passed @a enmPixmapType and @a enmPixmapDisabledType. */
     270    QIcon icon(PixmapType enmPixmapType, PixmapType enmPixmapDisabledType = InvalidPixmap) const;
    271271
    272272private:
     
    278278
    279279    /** Icon-pool instance. */
    280     static UIIconPoolStorageSettings *m_spInstance;
     280    static UIIconPoolStorageSettings *s_pInstance;
    281281    /** Icon-pool names cache. */
    282282    QMap<PixmapType, QString> m_names;
     
    303303    };
    304304
    305     /** Constructs top-level item passing @a pParent to the base-class. */
    306     AbstractItem(QITreeView *pParent);
     305    /** Constructs top-level item passing @a pParentTree to the base-class. */
     306    AbstractItem(QITreeView *pParentTree);
    307307    /** Constructs sub-level item passing @a pParentItem to the base-class. */
    308308    AbstractItem(AbstractItem *pParentItem);
     
    317317    /** Returns machine ID. */
    318318    QUuid machineId() const;
    319     /** Defines @a uMchineId. */
    320     void setMachineId (const QUuid &uMchineId);
     319    /** Defines @a uMachineId. */
     320    void setMachineId(const QUuid &uMachineId);
    321321
    322322    /** Returns runtime type information. */
    323323    virtual ItemType rtti() const = 0;
    324324    /** Returns child item with specified @a iIndex. */
    325     virtual AbstractItem* childItem (int aIndex) const = 0;
     325    virtual AbstractItem* childItem (int iIndex) const = 0;
    326326    /** Returns child item with specified @a uId. */
    327327    virtual AbstractItem* childItemById (const QUuid &uId) const = 0;
    328328    /** Returns position of specified child @a pItem. */
    329     virtual int posOfChild (AbstractItem *aItem) const = 0;
     329    virtual int posOfChild (AbstractItem *pItem) const = 0;
    330330    /** Returns tool-tip information. */
    331     virtual QString tip() const = 0;
     331    virtual QString toolTip() const = 0;
    332332    /** Returns pixmap information for specified @a enmState. */
    333     virtual QPixmap pixmap (ItemState aState = State_DefaultItem) = 0;
     333    virtual QPixmap pixmap (ItemState enmState = State_DefaultItem) = 0;
    334334
    335335protected:
    336336
    337337    /** Adds a child @a pItem. */
    338     virtual void addChild (AbstractItem *aItem) = 0;
     338    virtual void addChild (AbstractItem *pItem) = 0;
    339339    /** Removes the child @a pItem. */
    340     virtual void delChild (AbstractItem *aItem) = 0;
     340    virtual void delChild (AbstractItem *pItem) = 0;
    341341
    342342    /** Holds the parent item reference. */
    343343    AbstractItem *m_pParentItem;
    344344    /** Holds the item ID. */
    345     QUuid         mId;
     345    QUuid         m_uId;
    346346    /** Holds the item machine ID. */
    347     QUuid         mMachineId;
     347    QUuid         m_uMachineId;
    348348};
    349349Q_DECLARE_METATYPE (AbstractItem::ItemType);
     
    357357public:
    358358
    359     /** Constructs top-level item passing @a pParent to the base-class. */
    360     RootItem(QITreeView *pParent);
     359    /** Constructs top-level item passing @a pParentTree to the base-class. */
     360    RootItem(QITreeView *pParentTree);
    361361    /** Destructs item. */
    362362   ~RootItem();
    363363
    364     /** Returns a number of shildren of certain @a enmBus type. */
    365     ULONG childCount (KStorageBus aBus) const;
     364    /** Returns a number of children of certain @a enmBus type. */
     365    ULONG childCount (KStorageBus enmBus) const;
    366366
    367367private:
     
    370370    ItemType rtti() const;
    371371    /** Returns child item with specified @a iIndex. */
    372     AbstractItem* childItem (int aIndex) const;
     372    AbstractItem* childItem (int iIndex) const;
    373373    /** Returns child item with specified @a uId. */
    374374    AbstractItem* childItemById (const QUuid &uId) const;
    375375    /** Returns position of specified child @a pItem. */
    376     int posOfChild (AbstractItem *aItem) const;
     376    int posOfChild (AbstractItem *pItem) const;
    377377    /** Returns the number of children. */
    378378    int childCount() const;
     
    380380    QString text() const;
    381381    /** Returns tool-tip information. */
    382     QString tip() const;
     382    QString toolTip() const;
    383383    /** Returns pixmap information for specified @a enmState. */
    384     QPixmap pixmap (ItemState aState);
     384    QPixmap pixmap (ItemState enmState);
    385385    /** Adds a child @a pItem. */
    386     void addChild (AbstractItem *aItem);
     386    void addChild (AbstractItem *pItem);
    387387    /** Removes the child @a pItem. */
    388     void delChild (AbstractItem *aItem);
     388    void delChild (AbstractItem *pItem);
    389389
    390390    /** Holds the list of controller items. */
    391     QList <AbstractItem*> mControllers;
     391    QList <AbstractItem*> m_controllers;
    392392};
    393393
     
    400400public:
    401401
    402     /** Constructs sub-level item passing @a pParent to the base-class.
    403       * @param  strName  Brings the controller name.
    404       * @param  enmBus   Brings the controller bus.
    405       * @param  enmType  Brings the controller type. */
    406     ControllerItem (AbstractItem *aParent, const QString &aName, KStorageBus aBusType,
    407                     KStorageControllerType aControllerType);
     402    /** Constructs sub-level item passing @a pParentItem to the base-class.
     403      * @param  strName  Brings the name.
     404      * @param  enmBus   Brings the bus.
     405      * @param  enmType  Brings the type. */
     406    ControllerItem(AbstractItem *pParentItem, const QString &strName,
     407                   KStorageBus enmBus, KStorageControllerType enmType);
    408408    /** Destructs item. */
    409409   ~ControllerItem();
    410410
    411411    /** Returns bus. */
    412     KStorageBus ctrBusType() const;
     412    KStorageBus bus() const;
    413413    /** Returns possible buses to switch from current one. */
    414     ControllerBusList ctrBusTypes() const;
    415     /** Returns old controller name. */
    416     QString oldCtrName() const;
    417     /** Returns current controller name. */
    418     QString ctrName() const;
     414    ControllerBusList buses() const;
     415    /** Returns old name. */
     416    QString oldName() const;
     417    /** Returns current name. */
     418    QString name() const;
    419419    /** Returns type. */
    420     KStorageControllerType ctrType() const;
     420    KStorageControllerType type() const;
    421421    /** Returns possible types to switch from current one. */
    422     ControllerTypeList ctrTypes() const;
     422    ControllerTypeList types() const;
    423423    /** Returns current port count. */
    424424    uint portCount();
     
    426426    uint maxPortCount();
    427427    /** Returns whether controller uses IO cache. */
    428     bool ctrUseIoCache() const;
     428    bool useIoCache() const;
    429429
    430430    /** Defines @a enmBus. */
    431     void setCtrBusType(KStorageBus enmCtrBusType);
    432     /** Defines @a strName. */
    433     void setCtrName (const QString &aCtrName);
     431    void setBus(KStorageBus enmBus);
     432    /** Defines current @a strName. */
     433    void setName(const QString &strName);
    434434    /** Defines @a enmType. */
    435     void setCtrType (KStorageControllerType aCtrType);
    436     /** Defines @a uPortCount. */
    437     void setPortCount (uint aPortCount);
     435    void setType(KStorageControllerType enmType);
     436    /** Defines current @a uPortCount. */
     437    void setPortCount(uint uPortCount);
    438438    /** Defines whether controller @a fUseIoCache. */
    439     void setCtrUseIoCache (bool aUseIoCache);
     439    void setUseIoCache(bool fUseIoCache);
    440440
    441441    /** Returns possible controller slots. */
    442     SlotsList ctrAllSlots() const;
     442    SlotsList allSlots() const;
    443443    /** Returns used controller slots. */
    444     SlotsList ctrUsedSlots() const;
     444    SlotsList usedSlots() const;
    445445    /** Returns supported device type list. */
    446     DeviceTypeList ctrDeviceTypeList() const;
     446    DeviceTypeList deviceTypeList() const;
    447447
    448448    /** Returns an ID list of attached media of specified @a enmType. */
     
    450450
    451451    /** Returns a list of attachments. */
    452     QList<AbstractItem*> attachments() const { return mAttachments; }
     452    QList<AbstractItem*> attachments() const { return m_attachments; }
    453453    /** Defines a list of @a attachments. */
    454     void setAttachments(const QList<AbstractItem*> &attachments) { mAttachments = attachments; }
     454    void setAttachments(const QList<AbstractItem*> &attachments) { m_attachments = attachments; }
    455455
    456456private:
     
    459459    ItemType rtti() const;
    460460    /** Returns child item with specified @a iIndex. */
    461     AbstractItem* childItem (int aIndex) const;
     461    AbstractItem* childItem (int iIndex) const;
    462462    /** Returns child item with specified @a uId. */
    463463    AbstractItem* childItemById (const QUuid &uId) const;
    464464    /** Returns position of specified child @a pItem. */
    465     int posOfChild (AbstractItem *aItem) const;
     465    int posOfChild (AbstractItem *pItem) const;
    466466    /** Returns the number of children. */
    467467    int childCount() const;
     
    469469    QString text() const;
    470470    /** Returns tool-tip information. */
    471     QString tip() const;
     471    QString toolTip() const;
    472472    /** Returns pixmap information for specified @a enmState. */
    473     QPixmap pixmap (ItemState aState);
     473    QPixmap pixmap (ItemState enmState);
    474474    /** Adds a child @a pItem. */
    475     void addChild (AbstractItem *aItem);
     475    void addChild (AbstractItem *pItem);
    476476    /** Removes the child @a pItem. */
    477     void delChild (AbstractItem *aItem);
     477    void delChild (AbstractItem *pItem);
    478478
    479479    /** Updates possible buses. */
     
    485485
    486486    /** Holds the bus. */
    487     KStorageBus mBusType;
     487    KStorageBus m_enmBus;
    488488    /** Holds the type. */
    489     KStorageControllerType mCtrType;
     489    KStorageControllerType m_enmType;
    490490
    491491    /** Holds the possible buses. */
     
    497497
    498498    /** Holds the old name. */
    499     QString mOldCtrName;
     499    QString m_strOldName;
    500500    /** Holds the current name. */
    501     QString mCtrName;
     501    QString m_strName;
    502502    /** Holds the current port count. */
    503     uint mPortCount;
     503    uint m_uPortCount;
    504504    /** Holds whether controller uses IO cache. */
    505     bool mUseIoCache;
     505    bool m_fUseIoCache;
    506506    /** Holds the list of attachments. */
    507     QList <AbstractItem*> mAttachments;
     507    QList<AbstractItem*> m_attachments;
    508508};
    509509
     
    516516public:
    517517
    518     /** Constructs sub-level item passing @a pParent to the base-class.
     518    /** Constructs sub-level item passing @a pParentItem to the base-class.
    519519      * @param  enmDeviceType  Brings the attachment device type. */
    520     AttachmentItem (AbstractItem *aParent, KDeviceType aDeviceType);
     520    AttachmentItem(AbstractItem *pParentItem, KDeviceType enmDeviceType);
    521521
    522522    /** Returns storage slot. */
    523     StorageSlot attSlot() const;
     523    StorageSlot storageSlot() const;
    524524    /** Returns possible storage slots. */
    525     SlotsList attSlots() const;
     525    SlotsList storageSlots() const;
    526526    /** Returns device type. */
    527     KDeviceType attDeviceType() const;
     527    KDeviceType deviceType() const;
    528528    /** Returns possible device types. */
    529     DeviceTypeList attDeviceTypes() const;
     529    DeviceTypeList deviceTypes() const;
    530530    /** Returns the medium id. */
    531     QUuid attMediumId() const;
     531    QUuid mediumId() const;
    532532    /** Returns whether attachment is a host drive. */
    533     bool attIsHostDrive() const;
     533    bool isHostDrive() const;
    534534    /** Returns whether attachment is passthrough. */
    535     bool attIsPassthrough() const;
     535    bool isPassthrough() const;
    536536    /** Returns whether attachment is temporary ejectable. */
    537     bool attIsTempEject() const;
     537    bool isTempEject() const;
    538538    /** Returns whether attachment is non-rotational. */
    539     bool attIsNonRotational() const;
     539    bool isNonRotational() const;
    540540    /** Returns whether attachment is hot-pluggable. */
    541     bool attIsHotPluggable() const;
     541    bool isHotPluggable() const;
    542542
    543543    /** Defines storage @a slot. */
    544     void setAttSlot (const StorageSlot &aAttSlot);
     544    void setStorageSlot(const StorageSlot &slot);
    545545    /** Defines @a enmDeviceType. */
    546     void setAttDevice (KDeviceType aAttDeviceType);
     546    void setDeviceType(KDeviceType enmDeviceType);
    547547    /** Defines @a uMediumId. */
    548     void setAttMediumId (const QUuid &uAttMediumId);
     548    void setMediumId(const QUuid &uMediumId);
    549549    /** Defines whether attachment is @a fPassthrough. */
    550     void setAttIsPassthrough (bool aPassthrough);
     550    void setPassthrough(bool fPassthrough);
    551551    /** Defines whether attachment is @a fTemporaryEjectable. */
    552     void setAttIsTempEject (bool aTempEject);
     552    void setTempEject(bool fTemporaryEjectable);
    553553    /** Defines whether attachment is @a fNonRotational. */
    554     void setAttIsNonRotational (bool aNonRotational);
     554    void setNonRotational(bool fNonRotational);
    555555    /** Returns whether attachment is @a fIsHotPluggable. */
    556     void setAttIsHotPluggable(bool fIsHotPluggable);
     556    void setHotPluggable(bool fIsHotPluggable);
    557557
    558558    /** Returns medium size. */
    559     QString attSize() const;
     559    QString size() const;
    560560    /** Returns logical medium size. */
    561     QString attLogicalSize() const;
     561    QString logicalSize() const;
    562562    /** Returns medium location. */
    563     QString attLocation() const;
     563    QString location() const;
    564564    /** Returns medium format. */
    565     QString attFormat() const;
     565    QString format() const;
    566566    /** Returns medium details. */
    567     QString attDetails() const;
     567    QString details() const;
    568568    /** Returns medium usage. */
    569     QString attUsage() const;
     569    QString usage() const;
    570570    /** Returns medium encryption password ID. */
    571     QString attEncryptionPasswordID() const;
     571    QString encryptionPasswordId() const;
    572572
    573573private:
     
    579579    ItemType rtti() const;
    580580    /** Returns child item with specified @a iIndex. */
    581     AbstractItem* childItem (int aIndex) const;
     581    AbstractItem* childItem (int iIndex) const;
    582582    /** Returns child item with specified @a uId. */
    583583    AbstractItem* childItemById (const QUuid &uId) const;
    584584    /** Returns position of specified child @a pItem. */
    585     int posOfChild (AbstractItem *aItem) const;
     585    int posOfChild (AbstractItem *pItem) const;
    586586    /** Returns the number of children. */
    587587    int childCount() const;
     
    589589    QString text() const;
    590590    /** Returns tool-tip information. */
    591     QString tip() const;
     591    QString toolTip() const;
    592592    /** Returns pixmap information for specified @a enmState. */
    593     QPixmap pixmap (ItemState aState);
     593    QPixmap pixmap (ItemState enmState);
    594594    /** Adds a child @a pItem. */
    595     void addChild (AbstractItem *aItem);
     595    void addChild (AbstractItem *pItem);
    596596    /** Removes the child @a pItem. */
    597     void delChild (AbstractItem *aItem);
     597    void delChild (AbstractItem *pItem);
    598598
    599599    /** Holds the device type. */
    600     KDeviceType mAttDeviceType;
     600    KDeviceType m_enmDeviceType;
    601601
    602602    /** Holds the storage slot. */
    603     StorageSlot mAttSlot;
     603    StorageSlot m_storageSlot;
    604604    /** Holds the medium ID. */
    605     QUuid mAttMediumId;
     605    QUuid m_uMediumId;
    606606    /** Holds whether attachment is a host drive. */
    607     bool mAttIsHostDrive;
     607    bool m_fHostDrive;
    608608    /** Holds whether attachment is passthrough. */
    609     bool mAttIsPassthrough;
     609    bool m_fPassthrough;
    610610    /** Holds whether attachment is temporary ejectable. */
    611     bool mAttIsTempEject;
     611    bool m_fTempEject;
    612612    /** Holds whether attachment is non-rotational. */
    613     bool mAttIsNonRotational;
     613    bool m_fNonRotational;
    614614    /** Holds whether attachment is hot-pluggable. */
    615     bool m_fIsHotPluggable;
     615    bool m_fHotPluggable;
    616616
    617617    /** Holds the name. */
    618     QString mAttName;
     618    QString m_strName;
    619619    /** Holds the tool-tip. */
    620     QString mAttTip;
     620    QString m_strTip;
    621621    /** Holds the pixmap. */
    622     QPixmap mAttPixmap;
     622    QPixmap m_strPixmap;
    623623
    624624    /** Holds the medium size. */
    625     QString mAttSize;
     625    QString m_strSize;
    626626    /** Holds the logical medium size. */
    627     QString mAttLogicalSize;
     627    QString m_strLogicalSize;
    628628    /** Holds the medium location. */
    629     QString mAttLocation;
     629    QString m_strLocation;
    630630    /** Holds the medium format. */
    631     QString mAttFormat;
     631    QString m_strFormat;
    632632    /** Holds the medium details. */
    633     QString mAttDetails;
     633    QString m_strDetails;
    634634    /** Holds the medium usage. */
    635     QString mAttUsage;
     635    QString m_strUsage;
    636636    /** Holds the medium encryption password ID. */
    637637    QString m_strAttEncryptionPasswordID;
     
    727727    };
    728728
    729     /** Constructs storage model passing @a pParent to the base-class. */
    730     StorageModel(QITreeView *pParent);
     729    /** Constructs storage model passing @a pParentTree to the base-class. */
     730    StorageModel(QITreeView *pParentTree);
    731731    /** Destructs storage model. */
    732732   ~StorageModel();
    733733
    734734    /** Returns row count for the passed @a parentIndex. */
    735     int rowCount (const QModelIndex &aParent = QModelIndex()) const;
     735    int rowCount (const QModelIndex &parentIndex = QModelIndex()) const;
    736736    /** Returns column count for the passed @a parentIndex. */
    737     int columnCount (const QModelIndex &aParent = QModelIndex()) const;
     737    int columnCount (const QModelIndex &parentIndex = QModelIndex()) const;
    738738
    739739    /** Returns root item. */
    740740    QModelIndex root() const;
    741741    /** Returns item specified by @a iRow, @a iColum and @a parentIndex. */
    742     QModelIndex index (int aRow, int aColumn, const QModelIndex &aParent = QModelIndex()) const;
     742    QModelIndex index (int iRow, int iColumn, const QModelIndex &parentIndex = QModelIndex()) const;
    743743    /** Returns parent item of specified @a index item. */
    744     QModelIndex parent (const QModelIndex &aIndex) const;
     744    QModelIndex parent (const QModelIndex &index) const;
    745745
    746746    /** Returns model data for specified @a index and @a iRole. */
    747     QVariant data (const QModelIndex &aIndex, int aRole) const;
     747    QVariant data (const QModelIndex &index, int iRole) const;
    748748    /** Defines model data for specified @a index and @a iRole as @a value. */
    749     bool setData (const QModelIndex &aIndex, const QVariant &aValue, int aRole);
     749    bool setData (const QModelIndex &index, const QVariant &value, int iRole);
    750750
    751751    /** Adds controller with certain @a strCtrName, @a enmBus and @a enmType. */
    752     QModelIndex addController (const QString &aCtrName, KStorageBus aBusType, KStorageControllerType aCtrType);
     752    QModelIndex addController (const QString &strCtrName, KStorageBus enmBus, KStorageControllerType enmType);
    753753    /** Deletes controller with certain @a uCtrId. */
    754754    void delController (const QUuid &uCtrId);
    755755
    756756    /** Adds attachment with certain @a enmDeviceType and @a uMediumId to controller with certain @a uCtrId. */
    757     QModelIndex addAttachment (const QUuid &uCtrId, KDeviceType aDeviceType, const QUuid &uMediumId);
     757    QModelIndex addAttachment (const QUuid &uCtrId, KDeviceType enmDeviceType, const QUuid &uMediumId);
    758758    /** Deletes attachment with certain @a uAttId from controller with certain @a uCtrId. */
    759759    void delAttachment (const QUuid &uCtrId, const QUuid &uAttId);
     
    765765
    766766    /** Sorts the contents of model by @a iColumn and @a enmOrder. */
    767     void sort(int iColumn = 0, Qt::SortOrder order = Qt::AscendingOrder);
     767    void sort(int iColumn = 0, Qt::SortOrder enmOrder = Qt::AscendingOrder);
    768768    /** Returns attachment index by specified @a controllerIndex and @a attachmentStorageSlot. */
    769769    QModelIndex attachmentBySlot(QModelIndex controllerIndex, StorageSlot attachmentStorageSlot);
     
    771771    /** Returns chipset type. */
    772772    KChipsetType chipsetType() const;
    773     /** Defines chipset @a enmType. */
    774     void setChipsetType(KChipsetType type);
    775 
    776     /** Defines @a newConfigurationAccessLevel. */
    777     void setConfigurationAccessLevel(ConfigurationAccessLevel newConfigurationAccessLevel);
     773    /** Defines @a enmChipsetType. */
     774    void setChipsetType(KChipsetType enmChipsetType);
     775
     776    /** Defines @a enmConfigurationAccessLevel. */
     777    void setConfigurationAccessLevel(ConfigurationAccessLevel enmConfigurationAccessLevel);
    778778
    779779    /** Clears model of all contents. */
     
    788788
    789789    /** Returns model flags for specified @a index. */
    790     Qt::ItemFlags flags (const QModelIndex &aIndex) const;
     790    Qt::ItemFlags flags (const QModelIndex &index) const;
    791791
    792792    /** Holds the root item instance. */
    793     AbstractItem *mRootItem;
     793    AbstractItem *m_pRootItem;
    794794
    795795    /** Holds the enabled plus pixmap instance. */
    796     QPixmap mPlusPixmapEn;
     796    QPixmap m_pixmapPlusEn;
    797797    /** Holds the disabled plus pixmap instance. */
    798     QPixmap mPlusPixmapDis;
     798    QPixmap m_pixmapPlusDis;
    799799
    800800    /** Holds the enabled minus pixmap instance. */
    801     QPixmap mMinusPixmapEn;
     801    QPixmap m_pixmapMinusEn;
    802802    /** Holds the disabled minus pixmap instance. */
    803     QPixmap mMinusPixmapDis;
     803    QPixmap m_pixmapMinusDis;
    804804
    805805    /** Holds the tool-tip type. */
    806     ToolTipType mToolTipType;
     806    ToolTipType m_enmToolTipType;
    807807
    808808    /** Holds the chipset type. */
    809     KChipsetType m_chipsetType;
     809    KChipsetType m_enmChipsetType;
    810810
    811811    /** Holds configuration access level. */
    812     ConfigurationAccessLevel m_configurationAccessLevel;
     812    ConfigurationAccessLevel m_enmConfigurationAccessLevel;
    813813};
    814814Q_DECLARE_METATYPE (StorageModel::ToolTipType);
     
    823823
    824824    /** Constructs storage delegate passing @a pParent to the base-class. */
    825     StorageDelegate (QObject *aParent);
     825    StorageDelegate (QObject *pParent);
    826826
    827827private:
    828828
    829829    /** Paints @a index item with specified @a option using specified @a pPainter. */
    830     void paint (QPainter *aPainter, const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const;
     830    void paint (QPainter *pPainter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
    831831};
    832832
     
    850850
    851851    /** Returns medium device type. */
    852     UIMediumDeviceType type() const { return m_type; }
     852    UIMediumDeviceType type() const { return m_enmType; }
    853853    /** Defines medium device @a enmType. */
    854     void setType(UIMediumDeviceType type) { m_type = type; }
     854    void setType(UIMediumDeviceType enmType) { m_enmType = enmType; }
    855855
    856856    /** Returns whether medium ID is null. */
     
    867867    QUuid m_uId;
    868868    /** Holds the medium device type. */
    869     UIMediumDeviceType m_type;
     869    UIMediumDeviceType m_enmType;
    870870};
    871871
    872872
    873 QString compressText (const QString &aText)
    874 {
    875     return QString ("<nobr><compact elipsis=\"end\">%1</compact></nobr>").arg (aText);
     873QString compressText(const QString &strText)
     874{
     875    return QString("<nobr><compact elipsis=\"end\">%1</compact></nobr>").arg(strText);
    876876}
    877877
     
    882882
    883883/* static */
    884 UIIconPoolStorageSettings* UIIconPoolStorageSettings::m_spInstance = 0;
    885 UIIconPoolStorageSettings* UIIconPoolStorageSettings::instance() { return m_spInstance; }
     884UIIconPoolStorageSettings* UIIconPoolStorageSettings::s_pInstance = 0;
     885UIIconPoolStorageSettings* UIIconPoolStorageSettings::instance() { return s_pInstance; }
    886886void UIIconPoolStorageSettings::create() { new UIIconPoolStorageSettings; }
    887 void UIIconPoolStorageSettings::destroy() { delete m_spInstance; }
    888 
    889 QPixmap UIIconPoolStorageSettings::pixmap(PixmapType pixmapType) const
     887void UIIconPoolStorageSettings::destroy() { delete s_pInstance; }
     888
     889QPixmap UIIconPoolStorageSettings::pixmap(PixmapType enmPixmapType) const
    890890{
    891891    /* Prepare fallback pixmap: */
     
    893893
    894894    /* If we do NOT have that 'pixmap type' icon cached already: */
    895     if (!m_icons.contains(pixmapType))
     895    if (!m_icons.contains(enmPixmapType))
    896896    {
    897897        /* Compose proper icon if we have that 'pixmap type' known: */
    898         if (m_names.contains(pixmapType))
    899             m_icons[pixmapType] = iconSet(m_names[pixmapType]);
     898        if (m_names.contains(enmPixmapType))
     899            m_icons[enmPixmapType] = iconSet(m_names[enmPixmapType]);
    900900        /* Assign fallback icon if we do NOT have that 'pixmap type' known: */
    901901        else
    902             m_icons[pixmapType] = iconSet(nullPixmap);
     902            m_icons[enmPixmapType] = iconSet(nullPixmap);
    903903    }
    904904
    905905    /* Retrieve corresponding icon: */
    906     const QIcon &icon = m_icons[pixmapType];
     906    const QIcon &icon = m_icons[enmPixmapType];
    907907    AssertMsgReturn(!icon.isNull(),
    908                     ("Undefined icon for type '%d'.", (int)pixmapType),
     908                    ("Undefined icon for type '%d'.", (int)enmPixmapType),
    909909                    nullPixmap);
    910910
     
    912912    const QList<QSize> availableSizes = icon.availableSizes();
    913913    AssertMsgReturn(!availableSizes.isEmpty(),
    914                     ("Undefined icon for type '%s'.", (int)pixmapType),
     914                    ("Undefined icon for type '%s'.", (int)enmPixmapType),
    915915                    nullPixmap);
    916916
     
    923923}
    924924
    925 QIcon UIIconPoolStorageSettings::icon(PixmapType pixmapType,
    926                                       PixmapType pixmapDisabledType /* = InvalidPixmap */) const
     925QIcon UIIconPoolStorageSettings::icon(PixmapType enmPixmapType,
     926                                      PixmapType enmPixmapDisabledType /* = InvalidPixmap */) const
    927927{
    928928    /* Prepare fallback pixmap: */
     
    932932
    933933    /* If we do NOT have that 'pixmap type' icon cached already: */
    934     if (!m_icons.contains(pixmapType))
     934    if (!m_icons.contains(enmPixmapType))
    935935    {
    936936        /* Compose proper icon if we have that 'pixmap type' known: */
    937         if (m_names.contains(pixmapType))
    938             m_icons[pixmapType] = iconSet(m_names[pixmapType]);
     937        if (m_names.contains(enmPixmapType))
     938            m_icons[enmPixmapType] = iconSet(m_names[enmPixmapType]);
    939939        /* Assign fallback icon if we do NOT have that 'pixmap type' known: */
    940940        else
    941             m_icons[pixmapType] = iconSet(nullPixmap);
     941            m_icons[enmPixmapType] = iconSet(nullPixmap);
    942942    }
    943943
    944944    /* Retrieve normal icon: */
    945     const QIcon &icon = m_icons[pixmapType];
     945    const QIcon &icon = m_icons[enmPixmapType];
    946946    AssertMsgReturn(!icon.isNull(),
    947                     ("Undefined icon for type '%d'.", (int)pixmapType),
     947                    ("Undefined icon for type '%d'.", (int)enmPixmapType),
    948948                    nullIcon);
    949949
    950950    /* If 'disabled' icon is invalid => just return 'normal' icon: */
    951     if (pixmapDisabledType == InvalidPixmap)
     951    if (enmPixmapDisabledType == InvalidPixmap)
    952952        return icon;
    953953
    954954    /* If we do NOT have that 'pixmap disabled type' icon cached already: */
    955     if (!m_icons.contains(pixmapDisabledType))
     955    if (!m_icons.contains(enmPixmapDisabledType))
    956956    {
    957957        /* Compose proper icon if we have that 'pixmap disabled type' known: */
    958         if (m_names.contains(pixmapDisabledType))
    959             m_icons[pixmapDisabledType] = iconSet(m_names[pixmapDisabledType]);
     958        if (m_names.contains(enmPixmapDisabledType))
     959            m_icons[enmPixmapDisabledType] = iconSet(m_names[enmPixmapDisabledType]);
    960960        /* Assign fallback icon if we do NOT have that 'pixmap disabled type' known: */
    961961        else
    962             m_icons[pixmapDisabledType] = iconSet(nullPixmap);
     962            m_icons[enmPixmapDisabledType] = iconSet(nullPixmap);
    963963    }
    964964
    965965    /* Retrieve disabled icon: */
    966     const QIcon &iconDisabled = m_icons[pixmapDisabledType];
     966    const QIcon &iconDisabled = m_icons[enmPixmapDisabledType];
    967967    AssertMsgReturn(!iconDisabled.isNull(),
    968                     ("Undefined icon for type '%d'.", (int)pixmapDisabledType),
     968                    ("Undefined icon for type '%d'.", (int)enmPixmapDisabledType),
    969969                    nullIcon);
    970970
     
    979979{
    980980    /* Connect instance: */
    981     m_spInstance = this;
     981    s_pInstance = this;
    982982
    983983    /* Controller file-names: */
     
    10581058{
    10591059    /* Disconnect instance: */
    1060     m_spInstance = 0;
     1060    s_pInstance = 0;
    10611061}
    10621062
     
    10661066*********************************************************************************************************************************/
    10671067
    1068 AbstractItem::AbstractItem(QITreeView *pParent)
    1069     : QITreeViewItem(pParent)
     1068AbstractItem::AbstractItem(QITreeView *pParentTree)
     1069    : QITreeViewItem(pParentTree)
    10701070    , m_pParentItem(0)
    1071     , mId(QUuid::createUuid())
     1071    , m_uId(QUuid::createUuid())
    10721072{
    10731073    if (m_pParentItem)
     
    10781078    : QITreeViewItem(pParentItem)
    10791079    , m_pParentItem(pParentItem)
    1080     , mId(QUuid::createUuid())
     1080    , m_uId(QUuid::createUuid())
    10811081{
    10821082    if (m_pParentItem)
     
    10971097QUuid AbstractItem::id() const
    10981098{
    1099     return mId;
     1099    return m_uId;
    11001100}
    11011101
    11021102QUuid AbstractItem::machineId() const
    11031103{
    1104     return mMachineId;
     1104    return m_uMachineId;
    11051105}
    11061106
    11071107void AbstractItem::setMachineId (const QUuid &uMachineId)
    11081108{
    1109     mMachineId = uMachineId;
     1109    m_uMachineId = uMachineId;
    11101110}
    11111111
     
    11151115*********************************************************************************************************************************/
    11161116
    1117 RootItem::RootItem(QITreeView *pParent)
    1118     : AbstractItem(pParent)
     1117RootItem::RootItem(QITreeView *pParentTree)
     1118    : AbstractItem(pParentTree)
    11191119{
    11201120}
     
    11221122RootItem::~RootItem()
    11231123{
    1124     while (!mControllers.isEmpty())
    1125         delete mControllers.first();
    1126 }
    1127 
    1128 ULONG RootItem::childCount (KStorageBus aBus) const
    1129 {
    1130     ULONG result = 0;
    1131     foreach (AbstractItem *item, mControllers)
    1132     {
    1133         ControllerItem *ctrItem = qobject_cast<ControllerItem*>(item);
    1134         if (ctrItem->ctrBusType() == aBus)
    1135             ++ result;
    1136     }
    1137     return result;
     1124    while (!m_controllers.isEmpty())
     1125        delete m_controllers.first();
     1126}
     1127
     1128ULONG RootItem::childCount (KStorageBus enmBus) const
     1129{
     1130    ULONG uResult = 0;
     1131    foreach (AbstractItem *pItem, m_controllers)
     1132    {
     1133        ControllerItem *pItemController = qobject_cast<ControllerItem*>(pItem);
     1134        if (pItemController->bus() == enmBus)
     1135            ++ uResult;
     1136    }
     1137    return uResult;
    11381138}
    11391139
     
    11431143}
    11441144
    1145 AbstractItem* RootItem::childItem (int aIndex) const
    1146 {
    1147     return mControllers [aIndex];
     1145AbstractItem* RootItem::childItem (int iIndex) const
     1146{
     1147    return m_controllers [iIndex];
    11481148}
    11491149
     
    11511151{
    11521152    for (int i = 0; i < childCount(); ++ i)
    1153         if (mControllers [i]->id() == uId)
    1154             return mControllers [i];
     1153        if (m_controllers [i]->id() == uId)
     1154            return m_controllers [i];
    11551155    return 0;
    11561156}
    11571157
    1158 int RootItem::posOfChild (AbstractItem *aItem) const
    1159 {
    1160     return mControllers.indexOf (aItem);
     1158int RootItem::posOfChild (AbstractItem *pItem) const
     1159{
     1160    return m_controllers.indexOf (pItem);
    11611161}
    11621162
    11631163int RootItem::childCount() const
    11641164{
    1165     return mControllers.size();
     1165    return m_controllers.size();
    11661166}
    11671167
     
    11711171}
    11721172
    1173 QString RootItem::tip() const
     1173QString RootItem::toolTip() const
    11741174{
    11751175    return QString();
    11761176}
    11771177
    1178 QPixmap RootItem::pixmap (ItemState /* aState */)
     1178QPixmap RootItem::pixmap (ItemState /* enmState */)
    11791179{
    11801180    return QPixmap();
    11811181}
    11821182
    1183 void RootItem::addChild (AbstractItem *aItem)
    1184 {
    1185     mControllers << aItem;
    1186 }
    1187 
    1188 void RootItem::delChild (AbstractItem *aItem)
    1189 {
    1190     mControllers.removeAll (aItem);
     1183void RootItem::addChild (AbstractItem *pItem)
     1184{
     1185    m_controllers << pItem;
     1186}
     1187
     1188void RootItem::delChild (AbstractItem *pItem)
     1189{
     1190    m_controllers.removeAll (pItem);
    11911191}
    11921192
     
    11961196*********************************************************************************************************************************/
    11971197
    1198 ControllerItem::ControllerItem (AbstractItem *aParent, const QString &aName,
    1199                                 KStorageBus aBusType, KStorageControllerType aControllerType)
    1200     : AbstractItem (aParent)
    1201     , mBusType (aBusType)
    1202     , mCtrType (aControllerType)
    1203     , mOldCtrName (aName)
    1204     , mCtrName (aName)
    1205     , mPortCount (0)
    1206     , mUseIoCache (false)
     1198ControllerItem::ControllerItem (AbstractItem *pParentItem, const QString &strName,
     1199                                KStorageBus enmBus, KStorageControllerType enmType)
     1200    : AbstractItem (pParentItem)
     1201    , m_enmBus (enmBus)
     1202    , m_enmType (enmType)
     1203    , m_strOldName (strName)
     1204    , m_strName (strName)
     1205    , m_uPortCount (0)
     1206    , m_fUseIoCache (false)
    12071207{
    12081208    /* Check for proper parent type */
    1209     AssertMsg(m_pParentItem->rtti() == AbstractItem::Type_RootItem, ("Incorrect parent type!\n"));
    1210 
    1211     AssertMsg (mBusType != KStorageBus_Null, ("Wrong Bus Type {%d}!\n", mBusType));
    1212     AssertMsg (mCtrType != KStorageControllerType_Null, ("Wrong Controller Type {%d}!\n", mCtrType));
     1209    AssertMsg(parent()->rtti() == AbstractItem::Type_RootItem, ("Incorrect parent type!\n"));
     1210
     1211    AssertMsg (m_enmBus != KStorageBus_Null, ("Wrong Bus Type {%d}!\n", m_enmBus));
     1212    AssertMsg (m_enmType != KStorageControllerType_Null, ("Wrong Controller Type {%d}!\n", m_enmType));
    12131213
    12141214    updateBusInfo();
     
    12161216    updatePixmaps();
    12171217
    1218     mUseIoCache = uiCommon().virtualBox().GetSystemProperties().GetDefaultIoCacheSettingForStorageController (aControllerType);
     1218    m_fUseIoCache = uiCommon().virtualBox().GetSystemProperties().GetDefaultIoCacheSettingForStorageController (enmType);
    12191219}
    12201220
    12211221ControllerItem::~ControllerItem()
    12221222{
    1223     while (!mAttachments.isEmpty())
    1224         delete mAttachments.first();
    1225 }
    1226 
    1227 KStorageBus ControllerItem::ctrBusType() const
    1228 {
    1229     return mBusType;
    1230 }
    1231 
    1232 ControllerBusList ControllerItem::ctrBusTypes() const
     1223    while (!m_attachments.isEmpty())
     1224        delete m_attachments.first();
     1225}
     1226
     1227KStorageBus ControllerItem::bus() const
     1228{
     1229    return m_enmBus;
     1230}
     1231
     1232ControllerBusList ControllerItem::buses() const
    12331233{
    12341234    return m_buses;
    12351235}
    12361236
    1237 QString ControllerItem::oldCtrName() const
    1238 {
    1239     return mOldCtrName;
    1240 }
    1241 
    1242 QString ControllerItem::ctrName() const
    1243 {
    1244     return mCtrName;
    1245 }
    1246 
    1247 KStorageControllerType ControllerItem::ctrType() const
    1248 {
    1249     return mCtrType;
    1250 }
    1251 
    1252 ControllerTypeList ControllerItem::ctrTypes() const
     1237QString ControllerItem::name() const
     1238{
     1239    return m_strName;
     1240}
     1241
     1242QString ControllerItem::oldName() const
     1243{
     1244    return m_strOldName;
     1245}
     1246
     1247KStorageControllerType ControllerItem::type() const
     1248{
     1249    return m_enmType;
     1250}
     1251
     1252ControllerTypeList ControllerItem::types() const
    12531253{
    12541254    return m_types;
     
    12581258{
    12591259    /* Recalculate actual port count: */
    1260     for (int i = 0; i < mAttachments.size(); ++i)
    1261     {
    1262         AttachmentItem *pItem = qobject_cast<AttachmentItem*>(mAttachments.at(i));
    1263         if (mPortCount < (uint)pItem->attSlot().port + 1)
    1264             mPortCount = (uint)pItem->attSlot().port + 1;
    1265     }
    1266     return mPortCount;
     1260    for (int i = 0; i < m_attachments.size(); ++i)
     1261    {
     1262        AttachmentItem *pItem = qobject_cast<AttachmentItem*>(m_attachments.at(i));
     1263        if (m_uPortCount < (uint)pItem->storageSlot().port + 1)
     1264            m_uPortCount = (uint)pItem->storageSlot().port + 1;
     1265    }
     1266    return m_uPortCount;
    12671267}
    12681268
    12691269uint ControllerItem::maxPortCount()
    12701270{
    1271     return (uint)uiCommon().virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus(ctrBusType());
    1272 }
    1273 
    1274 bool ControllerItem::ctrUseIoCache() const
    1275 {
    1276     return mUseIoCache;
    1277 }
    1278 
    1279 void ControllerItem::setCtrBusType(KStorageBus enmCtrBusType)
    1280 {
    1281     mBusType = enmCtrBusType;
     1271    return (uint)uiCommon().virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus(bus());
     1272}
     1273
     1274bool ControllerItem::useIoCache() const
     1275{
     1276    return m_fUseIoCache;
     1277}
     1278
     1279void ControllerItem::setBus(KStorageBus enmBus)
     1280{
     1281    m_enmBus = enmBus;
    12821282
    12831283    updateBusInfo();
     
    12861286}
    12871287
    1288 void ControllerItem::setCtrName (const QString &aCtrName)
    1289 {
    1290     mCtrName = aCtrName;
    1291 }
    1292 
    1293 void ControllerItem::setCtrType (KStorageControllerType aCtrType)
    1294 {
    1295     mCtrType = aCtrType;
    1296 }
    1297 
    1298 void ControllerItem::setPortCount (uint aPortCount)
     1288void ControllerItem::setName (const QString &strName)
     1289{
     1290    m_strName = strName;
     1291}
     1292
     1293void ControllerItem::setType (KStorageControllerType enmType)
     1294{
     1295    m_enmType = enmType;
     1296}
     1297
     1298void ControllerItem::setPortCount (uint uPortCount)
    12991299{
    13001300    /* Limit maximum port count: */
    1301     mPortCount = qMin(aPortCount, (uint)uiCommon().virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus(ctrBusType()));
    1302 }
    1303 
    1304 void ControllerItem::setCtrUseIoCache (bool aUseIoCache)
    1305 {
    1306     mUseIoCache = aUseIoCache;
    1307 }
    1308 
    1309 SlotsList ControllerItem::ctrAllSlots() const
     1301    m_uPortCount = qMin(uPortCount, (uint)uiCommon().virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus(bus()));
     1302}
     1303
     1304void ControllerItem::setUseIoCache (bool fUseIoCache)
     1305{
     1306    m_fUseIoCache = fUseIoCache;
     1307}
     1308
     1309SlotsList ControllerItem::allSlots() const
    13101310{
    13111311    SlotsList allSlots;
    1312     CSystemProperties sp = uiCommon().virtualBox().GetSystemProperties();
    1313     for (ULONG i = 0; i < sp.GetMaxPortCountForStorageBus (ctrBusType()); ++ i)
    1314         for (ULONG j = 0; j < sp.GetMaxDevicesPerPortForStorageBus (ctrBusType()); ++ j)
    1315             allSlots << StorageSlot (ctrBusType(), i, j);
     1312    CSystemProperties comProps = uiCommon().virtualBox().GetSystemProperties();
     1313    for (ULONG i = 0; i < comProps.GetMaxPortCountForStorageBus (bus()); ++ i)
     1314        for (ULONG j = 0; j < comProps.GetMaxDevicesPerPortForStorageBus (bus()); ++ j)
     1315            allSlots << StorageSlot (bus(), i, j);
    13161316    return allSlots;
    13171317}
    13181318
    1319 SlotsList ControllerItem::ctrUsedSlots() const
     1319SlotsList ControllerItem::usedSlots() const
    13201320{
    13211321    SlotsList usedSlots;
    1322     for (int i = 0; i < mAttachments.size(); ++ i)
    1323         usedSlots << qobject_cast<AttachmentItem*>(mAttachments.at(i))->attSlot();
     1322    for (int i = 0; i < m_attachments.size(); ++ i)
     1323        usedSlots << qobject_cast<AttachmentItem*>(m_attachments.at(i))->storageSlot();
    13241324    return usedSlots;
    13251325}
    13261326
    1327 DeviceTypeList ControllerItem::ctrDeviceTypeList() const
    1328 {
    1329      return uiCommon().virtualBox().GetSystemProperties().GetDeviceTypesForStorageBus (mBusType).toList();
     1327DeviceTypeList ControllerItem::deviceTypeList() const
     1328{
     1329     return uiCommon().virtualBox().GetSystemProperties().GetDeviceTypesForStorageBus (m_enmBus).toList();
    13301330}
    13311331
     
    13331333{
    13341334    QList<QUuid> ids;
    1335     foreach (AbstractItem *pItem, mAttachments)
     1335    foreach (AbstractItem *pItem, m_attachments)
    13361336    {
    13371337        AttachmentItem *pItemAttachment = qobject_cast<AttachmentItem*>(pItem);
    13381338        if (   enmType == KDeviceType_Null
    1339             || pItemAttachment->attDeviceType() == enmType)
     1339            || pItemAttachment->deviceType() == enmType)
    13401340            ids << pItem->id();
    13411341    }
     
    13481348}
    13491349
    1350 AbstractItem* ControllerItem::childItem (int aIndex) const
    1351 {
    1352     return mAttachments [aIndex];
     1350AbstractItem* ControllerItem::childItem (int iIndex) const
     1351{
     1352    return m_attachments [iIndex];
    13531353}
    13541354
     
    13561356{
    13571357    for (int i = 0; i < childCount(); ++ i)
    1358         if (mAttachments [i]->id() == uId)
    1359             return mAttachments [i];
     1358        if (m_attachments [i]->id() == uId)
     1359            return m_attachments [i];
    13601360    return 0;
    13611361}
    13621362
    1363 int ControllerItem::posOfChild (AbstractItem *aItem) const
    1364 {
    1365     return mAttachments.indexOf (aItem);
     1363int ControllerItem::posOfChild (AbstractItem *pItem) const
     1364{
     1365    return m_attachments.indexOf (pItem);
    13661366}
    13671367
    13681368int ControllerItem::childCount() const
    13691369{
    1370     return mAttachments.size();
     1370    return m_attachments.size();
    13711371}
    13721372
    13731373QString ControllerItem::text() const
    13741374{
    1375     return UIMachineSettingsStorage::tr("Controller: %1").arg(ctrName());
    1376 }
    1377 
    1378 QString ControllerItem::tip() const
     1375    return UIMachineSettingsStorage::tr("Controller: %1").arg(name());
     1376}
     1377
     1378QString ControllerItem::toolTip() const
    13791379{
    13801380    return UIMachineSettingsStorage::tr ("<nobr><b>%1</b></nobr><br>"
    13811381                                 "<nobr>Bus:&nbsp;&nbsp;%2</nobr><br>"
    13821382                                 "<nobr>Type:&nbsp;&nbsp;%3</nobr>")
    1383                                  .arg (mCtrName)
    1384                                  .arg (gpConverter->toString (ctrBusType()))
    1385                                  .arg (gpConverter->toString (ctrType()));
    1386 }
    1387 
    1388 QPixmap ControllerItem::pixmap (ItemState aState)
    1389 {
    1390     return iconPool()->pixmap(m_pixmaps.at(aState));
    1391 }
    1392 
    1393 void ControllerItem::addChild (AbstractItem *aItem)
    1394 {
    1395     mAttachments << aItem;
    1396 }
    1397 
    1398 void ControllerItem::delChild (AbstractItem *aItem)
    1399 {
    1400     mAttachments.removeAll (aItem);
     1383                                 .arg (m_strName)
     1384                                 .arg (gpConverter->toString (bus()))
     1385                                 .arg (gpConverter->toString (type()));
     1386}
     1387
     1388QPixmap ControllerItem::pixmap (ItemState enmState)
     1389{
     1390    return iconPool()->pixmap(m_pixmaps.at(enmState));
     1391}
     1392
     1393void ControllerItem::addChild (AbstractItem *pItem)
     1394{
     1395    m_attachments << pItem;
     1396}
     1397
     1398void ControllerItem::delChild (AbstractItem *pItem)
     1399{
     1400    m_attachments.removeAll (pItem);
    14011401}
    14021402
     
    14051405    m_buses.clear();
    14061406
    1407     switch (mBusType)
     1407    switch (m_enmBus)
    14081408    {
    14091409        case KStorageBus_IDE:
     
    14171417            m_buses << KStorageBus_IDE << KStorageBus_SATA << KStorageBus_SCSI << KStorageBus_SAS
    14181418                    << KStorageBus_USB << KStorageBus_PCIe << KStorageBus_VirtioSCSI;
    1419             m_buses.removeAll(mBusType);
     1419            m_buses.removeAll(m_enmBus);
    14201420        }
    14211421        RT_FALL_THRU();
    14221422        default:
    14231423        {
    1424             m_buses.prepend(mBusType);
     1424            m_buses.prepend(m_enmBus);
    14251425            break;
    14261426        }
     
    14331433
    14341434    KStorageControllerType enmFirstType = KStorageControllerType_Null;
    1435     switch (mBusType)
     1435    switch (m_enmBus)
    14361436    {
    14371437        case KStorageBus_IDE:        enmFirstType = KStorageControllerType_PIIX3; break;
     
    14481448
    14491449    uint uTypeAmount = 0;
    1450     switch (mBusType)
     1450    switch (m_enmBus)
    14511451    {
    14521452        case KStorageBus_IDE:        uTypeAmount = 3; break;
     
    14731473    {
    14741474        m_pixmaps << InvalidPixmap;
    1475         switch (mBusType)
     1475        switch (m_enmBus)
    14761476        {
    14771477            case KStorageBus_IDE:        m_pixmaps[i] = static_cast<PixmapType>(IDEControllerNormal + i); break;
     
    14941494*********************************************************************************************************************************/
    14951495
    1496 AttachmentItem::AttachmentItem (AbstractItem *aParent, KDeviceType aDeviceType)
    1497     : AbstractItem (aParent)
    1498     , mAttDeviceType (aDeviceType)
    1499     , mAttIsHostDrive (false)
    1500     , mAttIsPassthrough (false)
    1501     , mAttIsTempEject (false)
    1502     , mAttIsNonRotational (false)
    1503     , m_fIsHotPluggable(false)
     1496AttachmentItem::AttachmentItem (AbstractItem *pParentItem, KDeviceType enmDeviceType)
     1497    : AbstractItem (pParentItem)
     1498    , m_enmDeviceType (enmDeviceType)
     1499    , m_fHostDrive (false)
     1500    , m_fPassthrough (false)
     1501    , m_fTempEject (false)
     1502    , m_fNonRotational (false)
     1503    , m_fHotPluggable(false)
    15041504{
    15051505    /* Check for proper parent type */
    1506     AssertMsg(m_pParentItem->rtti() == AbstractItem::Type_ControllerItem, ("Incorrect parent type!\n"));
     1506    AssertMsg(parent()->rtti() == AbstractItem::Type_ControllerItem, ("Incorrect parent type!\n"));
    15071507
    15081508    /* Select default slot */
    1509     AssertMsg (!attSlots().isEmpty(), ("There should be at least one available slot!\n"));
    1510     mAttSlot = attSlots() [0];
    1511 }
    1512 
    1513 StorageSlot AttachmentItem::attSlot() const
    1514 {
    1515     return mAttSlot;
    1516 }
    1517 
    1518 SlotsList AttachmentItem::attSlots() const
    1519 {
    1520     ControllerItem *ctr = qobject_cast<ControllerItem*>(m_pParentItem);
     1509    AssertMsg (!storageSlots().isEmpty(), ("There should be at least one available slot!\n"));
     1510    m_storageSlot = storageSlots() [0];
     1511}
     1512
     1513StorageSlot AttachmentItem::storageSlot() const
     1514{
     1515    return m_storageSlot;
     1516}
     1517
     1518SlotsList AttachmentItem::storageSlots() const
     1519{
     1520    ControllerItem *pItemController = qobject_cast<ControllerItem*>(parent());
    15211521
    15221522    /* Filter list from used slots */
    1523     SlotsList allSlots (ctr->ctrAllSlots());
    1524     SlotsList usedSlots (ctr->ctrUsedSlots());
     1523    SlotsList allSlots (pItemController->allSlots());
     1524    SlotsList usedSlots (pItemController->usedSlots());
    15251525    foreach (StorageSlot usedSlot, usedSlots)
    1526         if (usedSlot != mAttSlot)
     1526        if (usedSlot != m_storageSlot)
    15271527            allSlots.removeAll (usedSlot);
    15281528
     
    15301530}
    15311531
    1532 KDeviceType AttachmentItem::attDeviceType() const
    1533 {
    1534     return mAttDeviceType;
    1535 }
    1536 
    1537 DeviceTypeList AttachmentItem::attDeviceTypes() const
    1538 {
    1539     return qobject_cast<ControllerItem*>(m_pParentItem)->ctrDeviceTypeList();
    1540 }
    1541 
    1542 QUuid AttachmentItem::attMediumId() const
    1543 {
    1544     return mAttMediumId;
    1545 }
    1546 
    1547 bool AttachmentItem::attIsHostDrive() const
    1548 {
    1549     return mAttIsHostDrive;
    1550 }
    1551 
    1552 bool AttachmentItem::attIsPassthrough() const
    1553 {
    1554     return mAttIsPassthrough;
    1555 }
    1556 
    1557 bool AttachmentItem::attIsTempEject() const
    1558 {
    1559     return mAttIsTempEject;
    1560 }
    1561 
    1562 bool AttachmentItem::attIsNonRotational() const
    1563 {
    1564     return mAttIsNonRotational;
    1565 }
    1566 
    1567 bool AttachmentItem::attIsHotPluggable() const
    1568 {
    1569     return m_fIsHotPluggable;
    1570 }
    1571 
    1572 void AttachmentItem::setAttSlot (const StorageSlot &aAttSlot)
    1573 {
    1574     mAttSlot = aAttSlot;
    1575 }
    1576 
    1577 void AttachmentItem::setAttDevice (KDeviceType aAttDeviceType)
    1578 {
    1579     mAttDeviceType = aAttDeviceType;
    1580 }
    1581 
    1582 void AttachmentItem::setAttMediumId (const QUuid &uAttMediumId)
     1532KDeviceType AttachmentItem::deviceType() const
     1533{
     1534    return m_enmDeviceType;
     1535}
     1536
     1537DeviceTypeList AttachmentItem::deviceTypes() const
     1538{
     1539    return qobject_cast<ControllerItem*>(parent())->deviceTypeList();
     1540}
     1541
     1542QUuid AttachmentItem::mediumId() const
     1543{
     1544    return m_uMediumId;
     1545}
     1546
     1547bool AttachmentItem::isHostDrive() const
     1548{
     1549    return m_fHostDrive;
     1550}
     1551
     1552bool AttachmentItem::isPassthrough() const
     1553{
     1554    return m_fPassthrough;
     1555}
     1556
     1557bool AttachmentItem::isTempEject() const
     1558{
     1559    return m_fTempEject;
     1560}
     1561
     1562bool AttachmentItem::isNonRotational() const
     1563{
     1564    return m_fNonRotational;
     1565}
     1566
     1567bool AttachmentItem::isHotPluggable() const
     1568{
     1569    return m_fHotPluggable;
     1570}
     1571
     1572void AttachmentItem::setStorageSlot (const StorageSlot &storageSlot)
     1573{
     1574    m_storageSlot = storageSlot;
     1575}
     1576
     1577void AttachmentItem::setDeviceType (KDeviceType enmDeviceType)
     1578{
     1579    m_enmDeviceType = enmDeviceType;
     1580}
     1581
     1582void AttachmentItem::setMediumId (const QUuid &uMediumId)
    15831583{
    15841584    /// @todo is this required?
    15851585    //AssertMsg(!aAttMediumId.isNull(), ("Medium ID value can't be null!\n"));
    1586     mAttMediumId = uiCommon().medium(uAttMediumId).id();
     1586    m_uMediumId = uiCommon().medium(uMediumId).id();
    15871587    cache();
    15881588}
    15891589
    1590 void AttachmentItem::setAttIsPassthrough (bool aIsAttPassthrough)
    1591 {
    1592     mAttIsPassthrough = aIsAttPassthrough;
    1593 }
    1594 
    1595 void AttachmentItem::setAttIsTempEject (bool aIsAttTempEject)
    1596 {
    1597     mAttIsTempEject = aIsAttTempEject;
    1598 }
    1599 
    1600 void AttachmentItem::setAttIsNonRotational (bool aIsAttNonRotational)
    1601 {
    1602     mAttIsNonRotational = aIsAttNonRotational;
    1603 }
    1604 
    1605 void AttachmentItem::setAttIsHotPluggable(bool fIsHotPluggable)
    1606 {
    1607     m_fIsHotPluggable = fIsHotPluggable;
    1608 }
    1609 
    1610 QString AttachmentItem::attSize() const
    1611 {
    1612     return mAttSize;
    1613 }
    1614 
    1615 QString AttachmentItem::attLogicalSize() const
    1616 {
    1617     return mAttLogicalSize;
    1618 }
    1619 
    1620 QString AttachmentItem::attLocation() const
    1621 {
    1622     return mAttLocation;
    1623 }
    1624 
    1625 QString AttachmentItem::attFormat() const
    1626 {
    1627     return mAttFormat;
    1628 }
    1629 
    1630 QString AttachmentItem::attDetails() const
    1631 {
    1632     return mAttDetails;
    1633 }
    1634 
    1635 QString AttachmentItem::attUsage() const
    1636 {
    1637     return mAttUsage;
    1638 }
    1639 
    1640 QString AttachmentItem::attEncryptionPasswordID() const
     1590void AttachmentItem::setPassthrough (bool fPassthrough)
     1591{
     1592    m_fPassthrough = fPassthrough;
     1593}
     1594
     1595void AttachmentItem::setTempEject (bool fTempEject)
     1596{
     1597    m_fTempEject = fTempEject;
     1598}
     1599
     1600void AttachmentItem::setNonRotational (bool fNonRotational)
     1601{
     1602    m_fNonRotational = fNonRotational;
     1603}
     1604
     1605void AttachmentItem::setHotPluggable(bool fHotPluggable)
     1606{
     1607    m_fHotPluggable = fHotPluggable;
     1608}
     1609
     1610QString AttachmentItem::size() const
     1611{
     1612    return m_strSize;
     1613}
     1614
     1615QString AttachmentItem::logicalSize() const
     1616{
     1617    return m_strLogicalSize;
     1618}
     1619
     1620QString AttachmentItem::location() const
     1621{
     1622    return m_strLocation;
     1623}
     1624
     1625QString AttachmentItem::format() const
     1626{
     1627    return m_strFormat;
     1628}
     1629
     1630QString AttachmentItem::details() const
     1631{
     1632    return m_strDetails;
     1633}
     1634
     1635QString AttachmentItem::usage() const
     1636{
     1637    return m_strUsage;
     1638}
     1639
     1640QString AttachmentItem::encryptionPasswordId() const
    16411641{
    16421642    return m_strAttEncryptionPasswordID;
     
    16451645void AttachmentItem::cache()
    16461646{
    1647     UIMedium medium = uiCommon().medium(mAttMediumId);
     1647    UIMedium guiMedium = uiCommon().medium(m_uMediumId);
    16481648
    16491649    /* Cache medium information */
    1650     mAttName = medium.name (true);
    1651     mAttTip = medium.toolTipCheckRO (true, mAttDeviceType != KDeviceType_HardDisk);
    1652     mAttPixmap = medium.iconCheckRO (true);
    1653     mAttIsHostDrive = medium.isHostDrive();
     1650    m_strName = guiMedium.name (true);
     1651    m_strTip = guiMedium.toolTipCheckRO (true, m_enmDeviceType != KDeviceType_HardDisk);
     1652    m_strPixmap = guiMedium.iconCheckRO (true);
     1653    m_fHostDrive = guiMedium.isHostDrive();
    16541654
    16551655    /* Cache additional information */
    1656     mAttSize = medium.size (true);
    1657     mAttLogicalSize = medium.logicalSize (true);
    1658     mAttLocation = medium.location (true);
     1656    m_strSize = guiMedium.size (true);
     1657    m_strLogicalSize = guiMedium.logicalSize (true);
     1658    m_strLocation = guiMedium.location (true);
    16591659    m_strAttEncryptionPasswordID = QString("--");
    1660     if (medium.isNull())
    1661     {
    1662         mAttFormat = QString("--");
     1660    if (guiMedium.isNull())
     1661    {
     1662        m_strFormat = QString("--");
    16631663    }
    16641664    else
    16651665    {
    1666         switch (mAttDeviceType)
     1666        switch (m_enmDeviceType)
    16671667        {
    16681668            case KDeviceType_HardDisk:
    16691669            {
    1670                 mAttFormat = QString("%1 (%2)").arg(medium.hardDiskType(true)).arg(medium.hardDiskFormat(true));
    1671                 mAttDetails = medium.storageDetails();
    1672                 const QString strAttEncryptionPasswordID = medium.encryptionPasswordID();
     1670                m_strFormat = QString("%1 (%2)").arg(guiMedium.hardDiskType(true)).arg(guiMedium.hardDiskFormat(true));
     1671                m_strDetails = guiMedium.storageDetails();
     1672                const QString strAttEncryptionPasswordID = guiMedium.encryptionPasswordID();
    16731673                if (!strAttEncryptionPasswordID.isNull())
    16741674                    m_strAttEncryptionPasswordID = strAttEncryptionPasswordID;
     
    16781678            case KDeviceType_Floppy:
    16791679            {
    1680                 mAttFormat = mAttIsHostDrive ? UIMachineSettingsStorage::tr("Host Drive") : UIMachineSettingsStorage::tr("Image", "storage image");
     1680                m_strFormat = m_fHostDrive ? UIMachineSettingsStorage::tr("Host Drive") : UIMachineSettingsStorage::tr("Image", "storage image");
    16811681                break;
    16821682            }
     
    16851685        }
    16861686    }
    1687     mAttUsage = medium.usage (true);
     1687    m_strUsage = guiMedium.usage (true);
    16881688
    16891689    /* Fill empty attributes */
    1690     if (mAttUsage.isEmpty())
    1691         mAttUsage = QString ("--");
     1690    if (m_strUsage.isEmpty())
     1691        m_strUsage = QString ("--");
    16921692}
    16931693
     
    16971697}
    16981698
    1699 AbstractItem* AttachmentItem::childItem (int /* aIndex */) const
     1699AbstractItem* AttachmentItem::childItem (int /* iIndex */) const
    17001700{
    17011701    return 0;
     
    17071707}
    17081708
    1709 int AttachmentItem::posOfChild (AbstractItem* /* aItem */) const
     1709int AttachmentItem::posOfChild (AbstractItem* /* pItem */) const
    17101710{
    17111711    return 0;
     
    17191719QString AttachmentItem::text() const
    17201720{
    1721     return mAttName;
    1722 }
    1723 
    1724 QString AttachmentItem::tip() const
    1725 {
    1726     return mAttTip;
    1727 }
    1728 
    1729 QPixmap AttachmentItem::pixmap (ItemState /* aState */)
    1730 {
    1731     if (mAttPixmap.isNull())
    1732     {
    1733         switch (mAttDeviceType)
     1721    return m_strName;
     1722}
     1723
     1724QString AttachmentItem::toolTip() const
     1725{
     1726    return m_strTip;
     1727}
     1728
     1729QPixmap AttachmentItem::pixmap (ItemState /* enmState */)
     1730{
     1731    if (m_strPixmap.isNull())
     1732    {
     1733        switch (m_enmDeviceType)
    17341734        {
    17351735            case KDeviceType_HardDisk:
    1736                 mAttPixmap = iconPool()->pixmap(HDAttachmentNormal);
     1736                m_strPixmap = iconPool()->pixmap(HDAttachmentNormal);
    17371737                break;
    17381738            case KDeviceType_DVD:
    1739                 mAttPixmap = iconPool()->pixmap(CDAttachmentNormal);
     1739                m_strPixmap = iconPool()->pixmap(CDAttachmentNormal);
    17401740                break;
    17411741            case KDeviceType_Floppy:
    1742                 mAttPixmap = iconPool()->pixmap(FDAttachmentNormal);
     1742                m_strPixmap = iconPool()->pixmap(FDAttachmentNormal);
    17431743                break;
    17441744            default:
     
    17461746        }
    17471747    }
    1748     return mAttPixmap;
    1749 }
    1750 
    1751 void AttachmentItem::addChild (AbstractItem* /* aItem */)
    1752 {
    1753 }
    1754 
    1755 void AttachmentItem::delChild (AbstractItem* /* aItem */)
     1748    return m_strPixmap;
     1749}
     1750
     1751void AttachmentItem::addChild (AbstractItem* /* pItem */)
     1752{
     1753}
     1754
     1755void AttachmentItem::delChild (AbstractItem* /* pItem */)
    17561756{
    17571757}
     
    17621762*********************************************************************************************************************************/
    17631763
    1764 StorageModel::StorageModel(QITreeView *pParent)
    1765     : QAbstractItemModel(pParent)
    1766     , mRootItem(new RootItem(pParent))
    1767     , mToolTipType(DefaultToolTip)
    1768     , m_chipsetType(KChipsetType_PIIX3)
    1769     , m_configurationAccessLevel(ConfigurationAccessLevel_Null)
     1764StorageModel::StorageModel(QITreeView *pParentTree)
     1765    : QAbstractItemModel(pParentTree)
     1766    , m_pRootItem(new RootItem(pParentTree))
     1767    , m_enmToolTipType(DefaultToolTip)
     1768    , m_enmChipsetType(KChipsetType_PIIX3)
     1769    , m_enmConfigurationAccessLevel(ConfigurationAccessLevel_Null)
    17701770{
    17711771}
     
    17731773StorageModel::~StorageModel()
    17741774{
    1775     delete mRootItem;
    1776 }
    1777 
    1778 int StorageModel::rowCount (const QModelIndex &aParent) const
    1779 {
    1780     return !aParent.isValid() ? 1 /* only root item has invalid parent */ :
    1781            static_cast <AbstractItem*> (aParent.internalPointer())->childCount();
    1782 }
    1783 
    1784 int StorageModel::columnCount (const QModelIndex & /* aParent */) const
     1775    delete m_pRootItem;
     1776}
     1777
     1778int StorageModel::rowCount (const QModelIndex &parentIndex) const
     1779{
     1780    return !parentIndex.isValid() ? 1 /* only root item has invalid parent */ :
     1781           static_cast <AbstractItem*> (parentIndex.internalPointer())->childCount();
     1782}
     1783
     1784int StorageModel::columnCount (const QModelIndex & /* parentIndex */) const
    17851785{
    17861786    return 1;
     
    17921792}
    17931793
    1794 QModelIndex StorageModel::index (int aRow, int aColumn, const QModelIndex &aParent) const
    1795 {
    1796     if (!hasIndex (aRow, aColumn, aParent))
     1794QModelIndex StorageModel::index (int iRow, int iColumn, const QModelIndex &parentIndex) const
     1795{
     1796    if (!hasIndex (iRow, iColumn, parentIndex))
    17971797        return QModelIndex();
    17981798
    1799     AbstractItem *item = !aParent.isValid() ? mRootItem :
    1800                          static_cast <AbstractItem*> (aParent.internalPointer())->childItem (aRow);
    1801 
    1802     return item ? createIndex (aRow, aColumn, item) : QModelIndex();
    1803 }
    1804 
    1805 QModelIndex StorageModel::parent (const QModelIndex &aIndex) const
    1806 {
    1807     if (!aIndex.isValid())
     1799    AbstractItem *pItem = !parentIndex.isValid() ? m_pRootItem :
     1800                         static_cast <AbstractItem*> (parentIndex.internalPointer())->childItem (iRow);
     1801
     1802    return pItem ? createIndex (iRow, iColumn, pItem) : QModelIndex();
     1803}
     1804
     1805QModelIndex StorageModel::parent (const QModelIndex &index) const
     1806{
     1807    if (!index.isValid())
    18081808        return QModelIndex();
    18091809
    1810     AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer());
    1811     AbstractItem *parentOfItem = item->parent();
    1812     AbstractItem *parentOfParent = parentOfItem ? parentOfItem->parent() : 0;
    1813     int position = parentOfParent ? parentOfParent->posOfChild (parentOfItem) : 0;
    1814 
    1815     if (parentOfItem)
    1816         return createIndex (position, 0, parentOfItem);
     1810    AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer());
     1811    AbstractItem *pParentOfItem = pItem->parent();
     1812    AbstractItem *pParentOfParent = pParentOfItem ? pParentOfItem->parent() : 0;
     1813    int iPosition = pParentOfParent ? pParentOfParent->posOfChild (pParentOfItem) : 0;
     1814
     1815    if (pParentOfItem)
     1816        return createIndex (iPosition, 0, pParentOfItem);
    18171817    else
    18181818        return QModelIndex();
    18191819}
    18201820
    1821 QVariant StorageModel::data (const QModelIndex &aIndex, int aRole) const
    1822 {
    1823     if (!aIndex.isValid())
     1821QVariant StorageModel::data (const QModelIndex &index, int iRole) const
     1822{
     1823    if (!index.isValid())
    18241824        return QVariant();
    18251825
    1826     switch (aRole)
     1826    switch (iRole)
    18271827    {
    18281828        /* Basic Attributes: */
     
    18331833        case Qt::SizeHintRole:
    18341834        {
    1835             QFontMetrics fm (data (aIndex, Qt::FontRole).value <QFont>());
    1836             int minimumHeight = qMax (fm.height(), data (aIndex, R_IconSize).toInt());
    1837             int margin = data (aIndex, R_Margin).toInt();
    1838             return QSize (1 /* ignoring width */, 2 * margin + minimumHeight);
     1835            QFontMetrics fm (data (index, Qt::FontRole).value <QFont>());
     1836            int iMinimumHeight = qMax (fm.height(), data (index, R_IconSize).toInt());
     1837            int iMargin = data (index, R_Margin).toInt();
     1838            return QSize (1 /* ignoring width */, 2 * iMargin + iMinimumHeight);
    18391839        }
    18401840        case Qt::ToolTipRole:
    18411841        {
    1842             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
     1842            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
    18431843            {
    1844                 if (item->rtti() == AbstractItem::Type_ControllerItem)
     1844                if (pItem->rtti() == AbstractItem::Type_ControllerItem)
    18451845                {
    1846                     QString tip (item->tip());
    1847                     switch (mToolTipType)
     1846                    QString strTip (pItem->toolTip());
     1847                    switch (m_enmToolTipType)
    18481848                    {
    18491849                        case ExpanderToolTip:
    1850                             if (aIndex.child (0, 0).isValid())
    1851                                 tip = UIMachineSettingsStorage::tr("<nobr>Expands/Collapses&nbsp;item.</nobr>");
     1850                            if (index.child (0, 0).isValid())
     1851                                strTip = UIMachineSettingsStorage::tr("<nobr>Expands/Collapses&nbsp;item.</nobr>");
    18521852                            break;
    18531853                        case HDAdderToolTip:
    1854                             tip = UIMachineSettingsStorage::tr("<nobr>Adds&nbsp;hard&nbsp;disk.</nobr>");
     1854                            strTip = UIMachineSettingsStorage::tr("<nobr>Adds&nbsp;hard&nbsp;disk.</nobr>");
    18551855                            break;
    18561856                        case CDAdderToolTip:
    1857                             tip = UIMachineSettingsStorage::tr("<nobr>Adds&nbsp;optical&nbsp;drive.</nobr>");
     1857                            strTip = UIMachineSettingsStorage::tr("<nobr>Adds&nbsp;optical&nbsp;drive.</nobr>");
    18581858                            break;
    18591859                        case FDAdderToolTip:
    1860                             tip = UIMachineSettingsStorage::tr("<nobr>Adds&nbsp;floppy&nbsp;drive.</nobr>");
     1860                            strTip = UIMachineSettingsStorage::tr("<nobr>Adds&nbsp;floppy&nbsp;drive.</nobr>");
    18611861                            break;
    18621862                        default:
    18631863                            break;
    18641864                    }
    1865                     return tip;
     1865                    return strTip;
    18661866                }
    1867                 return item->tip();
     1867                return pItem->toolTip();
    18681868            }
    18691869            return QString();
     
    18731873        case R_ItemId:
    18741874        {
    1875             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    1876                 return item->id();
     1875            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     1876                return pItem->id();
    18771877            return QUuid();
    18781878        }
    18791879        case R_ItemPixmap:
    18801880        {
    1881             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
     1881            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
    18821882            {
    1883                 ItemState state = State_DefaultItem;
    1884                 if (hasChildren (aIndex))
     1883                ItemState enmState = State_DefaultItem;
     1884                if (hasChildren (index))
    18851885                    if (QTreeView *view = qobject_cast<QTreeView*>(QObject::parent()))
    1886                         state = view->isExpanded (aIndex) ? State_ExpandedItem : State_CollapsedItem;
    1887                 return item->pixmap (state);
     1886                        enmState = view->isExpanded (index) ? State_ExpandedItem : State_CollapsedItem;
     1887                return pItem->pixmap (enmState);
    18881888            }
    18891889            return QPixmap();
     
    18911891        case R_ItemPixmapRect:
    18921892        {
    1893             int margin = data (aIndex, R_Margin).toInt();
    1894             int width = data (aIndex, R_IconSize).toInt();
    1895             return QRect (margin, margin, width, width);
     1893            int iMargin = data (index, R_Margin).toInt();
     1894            int iWidth = data (index, R_IconSize).toInt();
     1895            return QRect (iMargin, iMargin, iWidth, iWidth);
    18961896        }
    18971897        case R_ItemName:
    18981898        {
    1899             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    1900                 return item->text();
     1899            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     1900                return pItem->text();
    19011901            return QString();
    19021902        }
    19031903        case R_ItemNamePoint:
    19041904        {
    1905             int margin = data (aIndex, R_Margin).toInt();
    1906             int spacing = data (aIndex, R_Spacing).toInt();
    1907             int width = data (aIndex, R_IconSize).toInt();
    1908             QFontMetrics fm (data (aIndex, Qt::FontRole).value <QFont>());
    1909             QSize sizeHint = data (aIndex, Qt::SizeHintRole).toSize();
    1910             return QPoint (margin + width + 2 * spacing,
     1905            int iMargin = data (index, R_Margin).toInt();
     1906            int iSpacing = data (index, R_Spacing).toInt();
     1907            int iWidth = data (index, R_IconSize).toInt();
     1908            QFontMetrics fm (data (index, Qt::FontRole).value <QFont>());
     1909            QSize sizeHint = data (index, Qt::SizeHintRole).toSize();
     1910            return QPoint (iMargin + iWidth + 2 * iSpacing,
    19111911                           sizeHint.height() / 2 + fm.ascent() / 2 - 1 /* base line */);
    19121912        }
     
    19141914        {
    19151915            QVariant result (QVariant::fromValue (AbstractItem::Type_InvalidItem));
    1916             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    1917                 result.setValue (item->rtti());
     1916            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     1917                result.setValue (pItem->rtti());
    19181918            return result;
    19191919        }
    19201920        case R_IsController:
    19211921        {
    1922             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    1923                 return item->rtti() == AbstractItem::Type_ControllerItem;
     1922            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     1923                return pItem->rtti() == AbstractItem::Type_ControllerItem;
    19241924            return false;
    19251925        }
    19261926        case R_IsAttachment:
    19271927        {
    1928             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    1929                 return item->rtti() == AbstractItem::Type_AttachmentItem;
     1928            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     1929                return pItem->rtti() == AbstractItem::Type_AttachmentItem;
    19301930            return false;
    19311931        }
     
    19331933        case R_ToolTipType:
    19341934        {
    1935             return QVariant::fromValue (mToolTipType);
     1935            return QVariant::fromValue (m_enmToolTipType);
    19361936        }
    19371937        case R_IsMoreIDEControllersPossible:
    19381938        {
    1939             return (m_configurationAccessLevel == ConfigurationAccessLevel_Full) &&
    1940                    (qobject_cast<RootItem*>(mRootItem)->childCount(KStorageBus_IDE) <
     1939            return (m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full) &&
     1940                   (qobject_cast<RootItem*>(m_pRootItem)->childCount(KStorageBus_IDE) <
    19411941                    uiCommon().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_IDE));
    19421942        }
    19431943        case R_IsMoreSATAControllersPossible:
    19441944        {
    1945             return (m_configurationAccessLevel == ConfigurationAccessLevel_Full) &&
    1946                    (qobject_cast<RootItem*>(mRootItem)->childCount(KStorageBus_SATA) <
     1945            return (m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full) &&
     1946                   (qobject_cast<RootItem*>(m_pRootItem)->childCount(KStorageBus_SATA) <
    19471947                    uiCommon().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_SATA));
    19481948        }
    19491949        case R_IsMoreSCSIControllersPossible:
    19501950        {
    1951             return (m_configurationAccessLevel == ConfigurationAccessLevel_Full) &&
    1952                    (qobject_cast<RootItem*>(mRootItem)->childCount(KStorageBus_SCSI) <
     1951            return (m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full) &&
     1952                   (qobject_cast<RootItem*>(m_pRootItem)->childCount(KStorageBus_SCSI) <
    19531953                    uiCommon().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_SCSI));
    19541954        }
    19551955        case R_IsMoreFloppyControllersPossible:
    19561956        {
    1957             return (m_configurationAccessLevel == ConfigurationAccessLevel_Full) &&
    1958                    (qobject_cast<RootItem*>(mRootItem)->childCount(KStorageBus_Floppy) <
     1957            return (m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full) &&
     1958                   (qobject_cast<RootItem*>(m_pRootItem)->childCount(KStorageBus_Floppy) <
    19591959                    uiCommon().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_Floppy));
    19601960        }
    19611961        case R_IsMoreSASControllersPossible:
    19621962        {
    1963             return (m_configurationAccessLevel == ConfigurationAccessLevel_Full) &&
    1964                    (qobject_cast<RootItem*>(mRootItem)->childCount(KStorageBus_SAS) <
     1963            return (m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full) &&
     1964                   (qobject_cast<RootItem*>(m_pRootItem)->childCount(KStorageBus_SAS) <
    19651965                    uiCommon().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_SAS));
    19661966        }
    19671967        case R_IsMoreUSBControllersPossible:
    19681968        {
    1969             return (m_configurationAccessLevel == ConfigurationAccessLevel_Full) &&
    1970                    (qobject_cast<RootItem*>(mRootItem)->childCount(KStorageBus_USB) <
     1969            return (m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full) &&
     1970                   (qobject_cast<RootItem*>(m_pRootItem)->childCount(KStorageBus_USB) <
    19711971                    uiCommon().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_USB));
    19721972        }
    19731973        case R_IsMoreNVMeControllersPossible:
    19741974        {
    1975             return (m_configurationAccessLevel == ConfigurationAccessLevel_Full) &&
    1976                    (qobject_cast<RootItem*>(mRootItem)->childCount(KStorageBus_PCIe) <
     1975            return (m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full) &&
     1976                   (qobject_cast<RootItem*>(m_pRootItem)->childCount(KStorageBus_PCIe) <
    19771977                    uiCommon().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_PCIe));
    19781978        }
    19791979        case R_IsMoreVirtioSCSIControllersPossible:
    19801980        {
    1981             return (m_configurationAccessLevel == ConfigurationAccessLevel_Full) &&
    1982                    (qobject_cast<RootItem*>(mRootItem)->childCount(KStorageBus_VirtioSCSI) <
     1981            return (m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full) &&
     1982                   (qobject_cast<RootItem*>(m_pRootItem)->childCount(KStorageBus_VirtioSCSI) <
    19831983                    uiCommon().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_VirtioSCSI));
    19841984        }
    19851985        case R_IsMoreAttachmentsPossible:
    19861986        {
    1987             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
     1987            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
    19881988            {
    1989                 if (item->rtti() == AbstractItem::Type_ControllerItem)
     1989                if (pItem->rtti() == AbstractItem::Type_ControllerItem)
    19901990                {
    1991                     ControllerItem *ctr = qobject_cast<ControllerItem*>(item);
    1992                     CSystemProperties sp = uiCommon().virtualBox().GetSystemProperties();
    1993                     const bool fIsMoreAttachmentsPossible = (ULONG)rowCount(aIndex) <
    1994                                                             (sp.GetMaxPortCountForStorageBus(ctr->ctrBusType()) *
    1995                                                              sp.GetMaxDevicesPerPortForStorageBus(ctr->ctrBusType()));
     1991                    ControllerItem *pItemController = qobject_cast<ControllerItem*>(pItem);
     1992                    CSystemProperties comProps = uiCommon().virtualBox().GetSystemProperties();
     1993                    const bool fIsMoreAttachmentsPossible = (ULONG)rowCount(index) <
     1994                                                            (comProps.GetMaxPortCountForStorageBus(pItemController->bus()) *
     1995                                                             comProps.GetMaxDevicesPerPortForStorageBus(pItemController->bus()));
    19961996                    if (fIsMoreAttachmentsPossible)
    19971997                    {
    1998                         switch (m_configurationAccessLevel)
     1998                        switch (m_enmConfigurationAccessLevel)
    19991999                        {
    20002000                            case ConfigurationAccessLevel_Full:
     
    20022002                            case ConfigurationAccessLevel_Partial_Running:
    20032003                            {
    2004                                 switch (ctr->ctrBusType())
     2004                                switch (pItemController->bus())
    20052005                                {
    20062006                                    case KStorageBus_USB:
    20072007                                        return true;
    20082008                                    case KStorageBus_SATA:
    2009                                         return (uint)rowCount(aIndex) < ctr->portCount();
     2009                                        return (uint)rowCount(index) < pItemController->portCount();
    20102010                                    default:
    20112011                                        break;
     
    20232023        case R_CtrOldName:
    20242024        {
    2025             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2026                 if (item->rtti() == AbstractItem::Type_ControllerItem)
    2027                     return qobject_cast<ControllerItem*>(item)->oldCtrName();
     2025            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2026                if (pItem->rtti() == AbstractItem::Type_ControllerItem)
     2027                    return qobject_cast<ControllerItem*>(pItem)->oldName();
    20282028            return QString();
    20292029        }
    20302030        case R_CtrName:
    20312031        {
    2032             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2033                 if (item->rtti() == AbstractItem::Type_ControllerItem)
    2034                     return qobject_cast<ControllerItem*>(item)->ctrName();
     2032            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2033                if (pItem->rtti() == AbstractItem::Type_ControllerItem)
     2034                    return qobject_cast<ControllerItem*>(pItem)->name();
    20352035            return QString();
    20362036        }
     
    20382038        {
    20392039            QVariant result (QVariant::fromValue (KStorageControllerType_Null));
    2040             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2041                 if (item->rtti() == AbstractItem::Type_ControllerItem)
    2042                     result.setValue (qobject_cast<ControllerItem*>(item)->ctrType());
     2040            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2041                if (pItem->rtti() == AbstractItem::Type_ControllerItem)
     2042                    result.setValue (qobject_cast<ControllerItem*>(pItem)->type());
    20432043            return result;
    20442044        }
     
    20462046        {
    20472047            QVariant result (QVariant::fromValue (ControllerTypeList()));
    2048             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2049                 if (item->rtti() == AbstractItem::Type_ControllerItem)
    2050                     result.setValue (qobject_cast<ControllerItem*>(item)->ctrTypes());
     2048            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2049                if (pItem->rtti() == AbstractItem::Type_ControllerItem)
     2050                    result.setValue (qobject_cast<ControllerItem*>(pItem)->types());
    20512051            return result;
    20522052        }
     
    20542054        {
    20552055            QVariant result (QVariant::fromValue (DeviceTypeList()));
    2056             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2057                 if (item->rtti() == AbstractItem::Type_ControllerItem)
    2058                     result.setValue (qobject_cast<ControllerItem*>(item)->ctrDeviceTypeList());
     2056            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2057                if (pItem->rtti() == AbstractItem::Type_ControllerItem)
     2058                    result.setValue (qobject_cast<ControllerItem*>(pItem)->deviceTypeList());
    20592059            return result;
    20602060        }
     
    20622062        {
    20632063            QVariant result (QVariant::fromValue (KStorageBus_Null));
    2064             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2065                 if (item->rtti() == AbstractItem::Type_ControllerItem)
    2066                     result.setValue (qobject_cast<ControllerItem*>(item)->ctrBusType());
     2064            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2065                if (pItem->rtti() == AbstractItem::Type_ControllerItem)
     2066                    result.setValue (qobject_cast<ControllerItem*>(pItem)->bus());
    20672067            return result;
    20682068        }
     
    20702070        {
    20712071            QVariant result(QVariant::fromValue(ControllerBusList()));
    2072             if (AbstractItem *pItem = static_cast<AbstractItem*>(aIndex.internalPointer()))
     2072            if (AbstractItem *pItem = static_cast<AbstractItem*>(index.internalPointer()))
    20732073                if (pItem->rtti() == AbstractItem::Type_ControllerItem)
    2074                     result.setValue(qobject_cast<ControllerItem*>(pItem)->ctrBusTypes());
     2074                    result.setValue(qobject_cast<ControllerItem*>(pItem)->buses());
    20752075            return result;
    20762076        }
    20772077        case R_CtrPortCount:
    20782078        {
    2079             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2080                 if (item->rtti() == AbstractItem::Type_ControllerItem)
    2081                     return qobject_cast<ControllerItem*>(item)->portCount();
     2079            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2080                if (pItem->rtti() == AbstractItem::Type_ControllerItem)
     2081                    return qobject_cast<ControllerItem*>(pItem)->portCount();
    20822082            return 0;
    20832083        }
    20842084        case R_CtrMaxPortCount:
    20852085        {
    2086             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2087                 if (item->rtti() == AbstractItem::Type_ControllerItem)
    2088                     return qobject_cast<ControllerItem*>(item)->maxPortCount();
     2086            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2087                if (pItem->rtti() == AbstractItem::Type_ControllerItem)
     2088                    return qobject_cast<ControllerItem*>(pItem)->maxPortCount();
    20892089            return 0;
    20902090        }
    20912091        case R_CtrIoCache:
    20922092        {
    2093             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2094                 if (item->rtti() == AbstractItem::Type_ControllerItem)
    2095                     return qobject_cast<ControllerItem*>(item)->ctrUseIoCache();
     2093            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2094                if (pItem->rtti() == AbstractItem::Type_ControllerItem)
     2095                    return qobject_cast<ControllerItem*>(pItem)->useIoCache();
    20962096            return false;
    20972097        }
     
    21002100        {
    21012101            QVariant result (QVariant::fromValue (StorageSlot()));
    2102             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2103                 if (item->rtti() == AbstractItem::Type_AttachmentItem)
    2104                     result.setValue(qobject_cast<AttachmentItem*>(item)->attSlot());
     2102            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2103                if (pItem->rtti() == AbstractItem::Type_AttachmentItem)
     2104                    result.setValue(qobject_cast<AttachmentItem*>(pItem)->storageSlot());
    21052105            return result;
    21062106        }
     
    21082108        {
    21092109            QVariant result (QVariant::fromValue (SlotsList()));
    2110             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2111                 if (item->rtti() == AbstractItem::Type_AttachmentItem)
    2112                     result.setValue(qobject_cast<AttachmentItem*>(item)->attSlots());
     2110            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2111                if (pItem->rtti() == AbstractItem::Type_AttachmentItem)
     2112                    result.setValue(qobject_cast<AttachmentItem*>(pItem)->storageSlots());
    21132113            return result;
    21142114        }
     
    21162116        {
    21172117            QVariant result (QVariant::fromValue (KDeviceType_Null));
    2118             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2119                 if (item->rtti() == AbstractItem::Type_AttachmentItem)
    2120                     result.setValue(qobject_cast<AttachmentItem*>(item)->attDeviceType());
     2118            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2119                if (pItem->rtti() == AbstractItem::Type_AttachmentItem)
     2120                    result.setValue(qobject_cast<AttachmentItem*>(pItem)->deviceType());
    21212121            return result;
    21222122        }
    21232123        case R_AttMediumId:
    21242124        {
    2125             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2126                 if (item->rtti() == AbstractItem::Type_AttachmentItem)
    2127                     return qobject_cast<AttachmentItem*>(item)->attMediumId();
     2125            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2126                if (pItem->rtti() == AbstractItem::Type_AttachmentItem)
     2127                    return qobject_cast<AttachmentItem*>(pItem)->mediumId();
    21282128            return QUuid();
    21292129        }
    21302130        case R_AttIsHostDrive:
    21312131        {
    2132             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2133                 if (item->rtti() == AbstractItem::Type_AttachmentItem)
    2134                     return qobject_cast<AttachmentItem*>(item)->attIsHostDrive();
     2132            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2133                if (pItem->rtti() == AbstractItem::Type_AttachmentItem)
     2134                    return qobject_cast<AttachmentItem*>(pItem)->isHostDrive();
    21352135            return false;
    21362136        }
    21372137        case R_AttIsPassthrough:
    21382138        {
    2139             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2140                 if (item->rtti() == AbstractItem::Type_AttachmentItem)
    2141                     return qobject_cast<AttachmentItem*>(item)->attIsPassthrough();
     2139            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2140                if (pItem->rtti() == AbstractItem::Type_AttachmentItem)
     2141                    return qobject_cast<AttachmentItem*>(pItem)->isPassthrough();
    21422142            return false;
    21432143        }
    21442144        case R_AttIsTempEject:
    21452145        {
    2146             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2147                 if (item->rtti() == AbstractItem::Type_AttachmentItem)
    2148                     return qobject_cast<AttachmentItem*>(item)->attIsTempEject();
     2146            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2147                if (pItem->rtti() == AbstractItem::Type_AttachmentItem)
     2148                    return qobject_cast<AttachmentItem*>(pItem)->isTempEject();
    21492149            return false;
    21502150        }
    21512151        case R_AttIsNonRotational:
    21522152        {
    2153             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2154                 if (item->rtti() == AbstractItem::Type_AttachmentItem)
    2155                     return qobject_cast<AttachmentItem*>(item)->attIsNonRotational();
     2153            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2154                if (pItem->rtti() == AbstractItem::Type_AttachmentItem)
     2155                    return qobject_cast<AttachmentItem*>(pItem)->isNonRotational();
    21562156            return false;
    21572157        }
    21582158        case R_AttIsHotPluggable:
    21592159        {
    2160             if (AbstractItem *item = static_cast<AbstractItem*>(aIndex.internalPointer()))
    2161                 if (item->rtti() == AbstractItem::Type_AttachmentItem)
    2162                     return qobject_cast<AttachmentItem*>(item)->attIsHotPluggable();
     2160            if (AbstractItem *pItem = static_cast<AbstractItem*>(index.internalPointer()))
     2161                if (pItem->rtti() == AbstractItem::Type_AttachmentItem)
     2162                    return qobject_cast<AttachmentItem*>(pItem)->isHotPluggable();
    21632163            return false;
    21642164        }
    21652165        case R_AttSize:
    21662166        {
    2167             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2168                 if (item->rtti() == AbstractItem::Type_AttachmentItem)
    2169                     return qobject_cast<AttachmentItem*>(item)->attSize();
     2167            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2168                if (pItem->rtti() == AbstractItem::Type_AttachmentItem)
     2169                    return qobject_cast<AttachmentItem*>(pItem)->size();
    21702170            return QString();
    21712171        }
    21722172        case R_AttLogicalSize:
    21732173        {
    2174             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2175                 if (item->rtti() == AbstractItem::Type_AttachmentItem)
    2176                     return qobject_cast<AttachmentItem*>(item)->attLogicalSize();
     2174            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2175                if (pItem->rtti() == AbstractItem::Type_AttachmentItem)
     2176                    return qobject_cast<AttachmentItem*>(pItem)->logicalSize();
    21772177            return QString();
    21782178        }
    21792179        case R_AttLocation:
    21802180        {
    2181             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2182                 if (item->rtti() == AbstractItem::Type_AttachmentItem)
    2183                     return qobject_cast<AttachmentItem*>(item)->attLocation();
     2181            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2182                if (pItem->rtti() == AbstractItem::Type_AttachmentItem)
     2183                    return qobject_cast<AttachmentItem*>(pItem)->location();
    21842184            return QString();
    21852185        }
    21862186        case R_AttFormat:
    21872187        {
    2188             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2189                 if (item->rtti() == AbstractItem::Type_AttachmentItem)
    2190                     return qobject_cast<AttachmentItem*>(item)->attFormat();
     2188            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2189                if (pItem->rtti() == AbstractItem::Type_AttachmentItem)
     2190                    return qobject_cast<AttachmentItem*>(pItem)->format();
    21912191            return QString();
    21922192        }
    21932193        case R_AttDetails:
    21942194        {
    2195             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2196                 if (item->rtti() == AbstractItem::Type_AttachmentItem)
    2197                     return qobject_cast<AttachmentItem*>(item)->attDetails();
     2195            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2196                if (pItem->rtti() == AbstractItem::Type_AttachmentItem)
     2197                    return qobject_cast<AttachmentItem*>(pItem)->details();
    21982198            return QString();
    21992199        }
    22002200        case R_AttUsage:
    22012201        {
    2202             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2203                 if (item->rtti() == AbstractItem::Type_AttachmentItem)
    2204                     return qobject_cast<AttachmentItem*>(item)->attUsage();
     2202            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2203                if (pItem->rtti() == AbstractItem::Type_AttachmentItem)
     2204                    return qobject_cast<AttachmentItem*>(pItem)->usage();
    22052205            return QString();
    22062206        }
    22072207        case R_AttEncryptionPasswordID:
    22082208        {
    2209             if (AbstractItem *pItem = static_cast<AbstractItem*>(aIndex.internalPointer()))
     2209            if (AbstractItem *pItem = static_cast<AbstractItem*>(index.internalPointer()))
    22102210                if (pItem->rtti() == AbstractItem::Type_AttachmentItem)
    2211                     return qobject_cast<AttachmentItem*>(pItem)->attEncryptionPasswordID();
     2211                    return qobject_cast<AttachmentItem*>(pItem)->encryptionPasswordId();
    22122212            return QString();
    22132213        }
     
    22642264        case R_HDPixmapRect:
    22652265        {
    2266             int margin = data (aIndex, R_Margin).toInt();
    2267             int width = data (aIndex, R_IconSize).toInt();
    2268             return QRect (0 - width - margin, margin, width, width);
     2266            int iMargin = data (index, R_Margin).toInt();
     2267            int iWidth = data (index, R_IconSize).toInt();
     2268            return QRect (0 - iWidth - iMargin, iMargin, iWidth, iWidth);
    22692269        }
    22702270        case R_CDPixmapRect:
    22712271        {
    2272             int margin = data (aIndex, R_Margin).toInt();
    2273             int spacing = data (aIndex, R_Spacing).toInt();
    2274             int width = data (aIndex, R_IconSize).toInt();
    2275             return QRect (0 - width - spacing - width - margin, margin, width, width);
     2272            int iMargin = data (index, R_Margin).toInt();
     2273            int iSpacing = data (index, R_Spacing).toInt();
     2274            int iWidth = data (index, R_IconSize).toInt();
     2275            return QRect (0 - iWidth - iSpacing - iWidth - iMargin, iMargin, iWidth, iWidth);
    22762276        }
    22772277        case R_FDPixmapRect:
    22782278        {
    2279             int margin = data (aIndex, R_Margin).toInt();
    2280             int width = data (aIndex, R_IconSize).toInt();
    2281             return QRect (0 - width - margin, margin, width, width);
     2279            int iMargin = data (index, R_Margin).toInt();
     2280            int iWidth = data (index, R_IconSize).toInt();
     2281            return QRect (0 - iWidth - iMargin, iMargin, iWidth, iWidth);
    22822282        }
    22832283
     
    22882288}
    22892289
    2290 bool StorageModel::setData (const QModelIndex &aIndex, const QVariant &aValue, int aRole)
    2291 {
    2292     if (!aIndex.isValid())
    2293         return QAbstractItemModel::setData (aIndex, aValue, aRole);
    2294 
    2295     switch (aRole)
     2290bool StorageModel::setData (const QModelIndex &index, const QVariant &aValue, int iRole)
     2291{
     2292    if (!index.isValid())
     2293        return QAbstractItemModel::setData (index, aValue, iRole);
     2294
     2295    switch (iRole)
    22962296    {
    22972297        case R_ToolTipType:
    22982298        {
    2299             mToolTipType = aValue.value <ToolTipType>();
    2300             emit dataChanged (aIndex, aIndex);
     2299            m_enmToolTipType = aValue.value <ToolTipType>();
     2300            emit dataChanged (index, index);
    23012301            return true;
    23022302        }
    23032303        case R_CtrName:
    23042304        {
    2305             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2306                 if (item->rtti() == AbstractItem::Type_ControllerItem)
     2305            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2306                if (pItem->rtti() == AbstractItem::Type_ControllerItem)
    23072307                {
    2308                     qobject_cast<ControllerItem*>(item)->setCtrName(aValue.toString());
    2309                     emit dataChanged (aIndex, aIndex);
     2308                    qobject_cast<ControllerItem*>(pItem)->setName(aValue.toString());
     2309                    emit dataChanged (index, index);
    23102310                    return true;
    23112311                }
     
    23142314        case R_CtrBusType:
    23152315        {
    2316             if (AbstractItem *pItem = static_cast<AbstractItem*>(aIndex.internalPointer()))
     2316            if (AbstractItem *pItem = static_cast<AbstractItem*>(index.internalPointer()))
    23172317                if (pItem->rtti() == AbstractItem::Type_ControllerItem)
    23182318                {
     
    23502350
    23512351                    /* Push new bus/controller type: */
    2352                     pItemController->setCtrBusType(enmNewCtrBusType);
    2353                     pItemController->setCtrType(pItemController->ctrTypes().first());
    2354                     emit dataChanged(aIndex, aIndex);
     2352                    pItemController->setBus(enmNewCtrBusType);
     2353                    pItemController->setType(pItemController->types().first());
     2354                    emit dataChanged(index, index);
    23552355
    23562356                    /* Make sure each of remaining attachments has valid slot: */
     
    23582358                    {
    23592359                        AttachmentItem *pChildItemAttachment = qobject_cast<AttachmentItem*>(pChildItem);
    2360                         const SlotsList availableSlots = pChildItemAttachment->attSlots();
    2361                         const StorageSlot currentSlot = pChildItemAttachment->attSlot();
     2360                        const SlotsList availableSlots = pChildItemAttachment->storageSlots();
     2361                        const StorageSlot currentSlot = pChildItemAttachment->storageSlot();
    23622362                        if (!availableSlots.isEmpty() && !availableSlots.contains(currentSlot))
    2363                             pChildItemAttachment->setAttSlot(availableSlots.first());
     2363                            pChildItemAttachment->setStorageSlot(availableSlots.first());
    23642364                    }
    23652365
     
    23712371        case R_CtrType:
    23722372        {
    2373             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2374                 if (item->rtti() == AbstractItem::Type_ControllerItem)
     2373            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2374                if (pItem->rtti() == AbstractItem::Type_ControllerItem)
    23752375                {
    2376                     qobject_cast<ControllerItem*>(item)->setCtrType(aValue.value<KStorageControllerType>());
    2377                     emit dataChanged (aIndex, aIndex);
     2376                    qobject_cast<ControllerItem*>(pItem)->setType(aValue.value<KStorageControllerType>());
     2377                    emit dataChanged (index, index);
    23782378                    return true;
    23792379                }
     
    23822382        case R_CtrPortCount:
    23832383        {
    2384             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2385                 if (item->rtti() == AbstractItem::Type_ControllerItem)
     2384            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2385                if (pItem->rtti() == AbstractItem::Type_ControllerItem)
    23862386                {
    2387                     qobject_cast<ControllerItem*>(item)->setPortCount(aValue.toUInt());
    2388                     emit dataChanged (aIndex, aIndex);
     2387                    qobject_cast<ControllerItem*>(pItem)->setPortCount(aValue.toUInt());
     2388                    emit dataChanged (index, index);
    23892389                    return true;
    23902390                }
     
    23932393        case R_CtrIoCache:
    23942394        {
    2395             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2396                 if (item->rtti() == AbstractItem::Type_ControllerItem)
     2395            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2396                if (pItem->rtti() == AbstractItem::Type_ControllerItem)
    23972397                {
    2398                     qobject_cast<ControllerItem*>(item)->setCtrUseIoCache(aValue.toBool());
    2399                     emit dataChanged (aIndex, aIndex);
     2398                    qobject_cast<ControllerItem*>(pItem)->setUseIoCache(aValue.toBool());
     2399                    emit dataChanged (index, index);
    24002400                    return true;
    24012401                }
     
    24042404        case R_AttSlot:
    24052405        {
    2406             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2407                 if (item->rtti() == AbstractItem::Type_AttachmentItem)
     2406            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2407                if (pItem->rtti() == AbstractItem::Type_AttachmentItem)
    24082408                {
    2409                     qobject_cast<AttachmentItem*>(item)->setAttSlot(aValue.value<StorageSlot>());
    2410                     emit dataChanged (aIndex, aIndex);
     2409                    qobject_cast<AttachmentItem*>(pItem)->setStorageSlot(aValue.value<StorageSlot>());
     2410                    emit dataChanged (index, index);
    24112411                    sort();
    24122412                    return true;
     
    24162416        case R_AttDevice:
    24172417        {
    2418             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2419                 if (item->rtti() == AbstractItem::Type_AttachmentItem)
     2418            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2419                if (pItem->rtti() == AbstractItem::Type_AttachmentItem)
    24202420                {
    2421                     qobject_cast<AttachmentItem*>(item)->setAttDevice(aValue.value<KDeviceType>());
    2422                     emit dataChanged (aIndex, aIndex);
     2421                    qobject_cast<AttachmentItem*>(pItem)->setDeviceType(aValue.value<KDeviceType>());
     2422                    emit dataChanged (index, index);
    24232423                    return true;
    24242424                }
     
    24272427        case R_AttMediumId:
    24282428        {
    2429             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2430                 if (item->rtti() == AbstractItem::Type_AttachmentItem)
     2429            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2430                if (pItem->rtti() == AbstractItem::Type_AttachmentItem)
    24312431                {
    2432                     qobject_cast<AttachmentItem*>(item)->setAttMediumId(aValue.toUuid());
    2433                     emit dataChanged (aIndex, aIndex);
     2432                    qobject_cast<AttachmentItem*>(pItem)->setMediumId(aValue.toUuid());
     2433                    emit dataChanged (index, index);
    24342434                    return true;
    24352435                }
     
    24382438        case R_AttIsPassthrough:
    24392439        {
    2440             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2441                 if (item->rtti() == AbstractItem::Type_AttachmentItem)
     2440            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2441                if (pItem->rtti() == AbstractItem::Type_AttachmentItem)
    24422442                {
    2443                     qobject_cast<AttachmentItem*>(item)->setAttIsPassthrough(aValue.toBool());
    2444                     emit dataChanged (aIndex, aIndex);
     2443                    qobject_cast<AttachmentItem*>(pItem)->setPassthrough(aValue.toBool());
     2444                    emit dataChanged (index, index);
    24452445                    return true;
    24462446                }
     
    24492449        case R_AttIsTempEject:
    24502450        {
    2451             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2452                 if (item->rtti() == AbstractItem::Type_AttachmentItem)
     2451            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2452                if (pItem->rtti() == AbstractItem::Type_AttachmentItem)
    24532453                {
    2454                     qobject_cast<AttachmentItem*>(item)->setAttIsTempEject(aValue.toBool());
    2455                     emit dataChanged (aIndex, aIndex);
     2454                    qobject_cast<AttachmentItem*>(pItem)->setTempEject(aValue.toBool());
     2455                    emit dataChanged (index, index);
    24562456                    return true;
    24572457                }
     
    24602460        case R_AttIsNonRotational:
    24612461        {
    2462             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
    2463                 if (item->rtti() == AbstractItem::Type_AttachmentItem)
     2462            if (AbstractItem *pItem = static_cast <AbstractItem*> (index.internalPointer()))
     2463                if (pItem->rtti() == AbstractItem::Type_AttachmentItem)
    24642464                {
    2465                     qobject_cast<AttachmentItem*>(item)->setAttIsNonRotational(aValue.toBool());
    2466                     emit dataChanged (aIndex, aIndex);
     2465                    qobject_cast<AttachmentItem*>(pItem)->setNonRotational(aValue.toBool());
     2466                    emit dataChanged (index, index);
    24672467                    return true;
    24682468                }
     
    24712471        case R_AttIsHotPluggable:
    24722472        {
    2473             if (AbstractItem *item = static_cast<AbstractItem*>(aIndex.internalPointer()))
    2474                 if (item->rtti() == AbstractItem::Type_AttachmentItem)
     2473            if (AbstractItem *pItem = static_cast<AbstractItem*>(index.internalPointer()))
     2474                if (pItem->rtti() == AbstractItem::Type_AttachmentItem)
    24752475                {
    2476                     qobject_cast<AttachmentItem*>(item)->setAttIsHotPluggable(aValue.toBool());
    2477                     emit dataChanged(aIndex, aIndex);
     2476                    qobject_cast<AttachmentItem*>(pItem)->setHotPluggable(aValue.toBool());
     2477                    emit dataChanged(index, index);
    24782478                    return true;
    24792479                }
     
    24872487}
    24882488
    2489 QModelIndex StorageModel::addController (const QString &aCtrName, KStorageBus aBusType, KStorageControllerType aCtrType)
    2490 {
    2491     beginInsertRows (root(), mRootItem->childCount(), mRootItem->childCount());
    2492     new ControllerItem (mRootItem, aCtrName, aBusType, aCtrType);
     2489QModelIndex StorageModel::addController (const QString &aCtrName, KStorageBus enmBus, KStorageControllerType enmType)
     2490{
     2491    beginInsertRows (root(), m_pRootItem->childCount(), m_pRootItem->childCount());
     2492    new ControllerItem (m_pRootItem, aCtrName, enmBus, enmType);
    24932493    endInsertRows();
    2494     return index (mRootItem->childCount() - 1, 0, root());
     2494    return index (m_pRootItem->childCount() - 1, 0, root());
    24952495}
    24962496
    24972497void StorageModel::delController (const QUuid &uCtrId)
    24982498{
    2499     if (AbstractItem *item = mRootItem->childItemById (uCtrId))
    2500     {
    2501         int itemPosition = mRootItem->posOfChild (item);
     2499    if (AbstractItem *pItem = m_pRootItem->childItemById (uCtrId))
     2500    {
     2501        int itemPosition = m_pRootItem->posOfChild (pItem);
    25022502        beginRemoveRows (root(), itemPosition, itemPosition);
    2503         delete item;
     2503        delete pItem;
    25042504        endRemoveRows();
    25052505    }
    25062506}
    25072507
    2508 QModelIndex StorageModel::addAttachment (const QUuid &uCtrId, KDeviceType aDeviceType, const QUuid &uMediumId)
    2509 {
    2510     if (AbstractItem *parent = mRootItem->childItemById (uCtrId))
    2511     {
    2512         int parentPosition = mRootItem->posOfChild (parent);
    2513         QModelIndex parentIndex = index (parentPosition, 0, root());
    2514         beginInsertRows (parentIndex, parent->childCount(), parent->childCount());
    2515         AttachmentItem *pItem = new AttachmentItem (parent, aDeviceType);
    2516         pItem->setAttIsHotPluggable(m_configurationAccessLevel != ConfigurationAccessLevel_Full);
    2517         pItem->setAttMediumId(uMediumId);
     2508QModelIndex StorageModel::addAttachment (const QUuid &uCtrId, KDeviceType enmDeviceType, const QUuid &uMediumId)
     2509{
     2510    if (AbstractItem *pParentItem = m_pRootItem->childItemById (uCtrId))
     2511    {
     2512        int iParentPosition = m_pRootItem->posOfChild (pParentItem);
     2513        QModelIndex parentIndex = index (iParentPosition, 0, root());
     2514        beginInsertRows (parentIndex, pParentItem->childCount(), pParentItem->childCount());
     2515        AttachmentItem *pItem = new AttachmentItem (pParentItem, enmDeviceType);
     2516        pItem->setHotPluggable(m_enmConfigurationAccessLevel != ConfigurationAccessLevel_Full);
     2517        pItem->setMediumId(uMediumId);
    25182518        endInsertRows();
    2519         return index (parent->childCount() - 1, 0, parentIndex);
     2519        return index (pParentItem->childCount() - 1, 0, parentIndex);
    25202520    }
    25212521    return QModelIndex();
     
    25242524void StorageModel::delAttachment (const QUuid &uCtrId, const QUuid &uAttId)
    25252525{
    2526     if (AbstractItem *parent = mRootItem->childItemById (uCtrId))
    2527     {
    2528         int parentPosition = mRootItem->posOfChild (parent);
    2529         if (AbstractItem *item = parent->childItemById (uAttId))
    2530         {
    2531             int itemPosition = parent->posOfChild (item);
    2532             beginRemoveRows (index (parentPosition, 0, root()), itemPosition, itemPosition);
    2533             delete item;
     2526    if (AbstractItem *pParentItem = m_pRootItem->childItemById (uCtrId))
     2527    {
     2528        int iParentPosition = m_pRootItem->posOfChild (pParentItem);
     2529        if (AbstractItem *pItem = pParentItem->childItemById (uAttId))
     2530        {
     2531            int itemPosition = pParentItem->posOfChild (pItem);
     2532            beginRemoveRows (index (iParentPosition, 0, root()), itemPosition, itemPosition);
     2533            delete pItem;
    25342534            endRemoveRows();
    25352535        }
     
    25442544
    25452545    /* First of all we are looking for old controller item: */
    2546     AbstractItem *pOldItem = mRootItem->childItemById(uCtrOldId);
     2546    AbstractItem *pOldItem = m_pRootItem->childItemById(uCtrOldId);
    25472547    if (pOldItem)
    25482548    {
    25492549        /* And acquire controller position: */
    2550         const int iOldCtrPosition = mRootItem->posOfChild(pOldItem);
     2550        const int iOldCtrPosition = m_pRootItem->posOfChild(pOldItem);
    25512551
    25522552        /* Then we are looking for an attachment item: */
     
    25582558            {
    25592559                /* This way we can acquire actual attachment device type and medium ID: */
    2560                 enmDeviceType = pSubItemAttachment->attDeviceType();
    2561                 uMediumId = pSubItemAttachment->attMediumId();
     2560                enmDeviceType = pSubItemAttachment->deviceType();
     2561                uMediumId = pSubItemAttachment->mediumId();
    25622562
    25632563                /* And delete atachment item finally: */
     
    25712571
    25722572    /* As the last step we are looking for new controller item: */
    2573     AbstractItem *pNewItem = mRootItem->childItemById(uCtrNewId);
     2573    AbstractItem *pNewItem = m_pRootItem->childItemById(uCtrNewId);
    25742574    if (pNewItem)
    25752575    {
    25762576        /* And acquire controller position: */
    2577         const int iNewCtrPosition = mRootItem->posOfChild(pNewItem);
     2577        const int iNewCtrPosition = m_pRootItem->posOfChild(pNewItem);
    25782578
    25792579        /* Then we have to make sure moved attachment is valid: */
     
    25842584            beginInsertRows(newCtrIndex, pNewItem->childCount(), pNewItem->childCount());
    25852585            AttachmentItem *pItem = new AttachmentItem(pNewItem, enmDeviceType);
    2586             pItem->setAttIsHotPluggable(m_configurationAccessLevel != ConfigurationAccessLevel_Full);
    2587             pItem->setAttMediumId(uMediumId);
     2586            pItem->setHotPluggable(m_enmConfigurationAccessLevel != ConfigurationAccessLevel_Full);
     2587            pItem->setMediumId(uMediumId);
    25882588            endInsertRows();
    25892589        }
     
    25932593void StorageModel::setMachineId (const QUuid &uMachineId)
    25942594{
    2595     mRootItem->setMachineId (uMachineId);
    2596 }
    2597 
    2598 void StorageModel::sort(int /* iColumn */, Qt::SortOrder order)
     2595    m_pRootItem->setMachineId (uMachineId);
     2596}
     2597
     2598void StorageModel::sort(int /* iColumn */, Qt::SortOrder enmOrder)
    25992599{
    26002600    /* Count of controller items: */
    2601     int iItemLevel1Count = mRootItem->childCount();
     2601    int iItemLevel1Count = m_pRootItem->childCount();
    26022602    /* For each of controller items: */
    26032603    for (int iItemLevel1Pos = 0; iItemLevel1Pos < iItemLevel1Count; ++iItemLevel1Pos)
    26042604    {
    26052605        /* Get iterated controller item: */
    2606         AbstractItem *pItemLevel1 = mRootItem->childItem(iItemLevel1Pos);
     2606        AbstractItem *pItemLevel1 = m_pRootItem->childItem(iItemLevel1Pos);
    26072607        ControllerItem *pControllerItem = qobject_cast<ControllerItem*>(pItemLevel1);
    26082608        /* Count of attachment items: */
     
    26172617            AttachmentItem *pAttachmentItem = qobject_cast<AttachmentItem*>(pItemLevel2);
    26182618            /* Get iterated attachment storage slot: */
    2619             StorageSlot attachmentSlot = pAttachmentItem->attSlot();
     2619            StorageSlot attachmentSlot = pAttachmentItem->storageSlot();
    26202620            int iInsertPosition = 0;
    26212621            for (; iInsertPosition < newAttachments.size(); ++iInsertPosition)
     
    26252625                AttachmentItem *pNewAttachmentItem = qobject_cast<AttachmentItem*>(pNewItemLevel2);
    26262626                /* Get sorted attachment storage slot: */
    2627                 StorageSlot newAttachmentSlot = pNewAttachmentItem->attSlot();
     2627                StorageSlot newAttachmentSlot = pNewAttachmentItem->storageSlot();
    26282628                /* Apply sorting rule: */
    2629                 if (((order == Qt::AscendingOrder) && (attachmentSlot < newAttachmentSlot)) ||
    2630                     ((order == Qt::DescendingOrder) && (attachmentSlot > newAttachmentSlot)))
     2629                if (((enmOrder == Qt::AscendingOrder) && (attachmentSlot < newAttachmentSlot)) ||
     2630                    ((enmOrder == Qt::DescendingOrder) && (attachmentSlot > newAttachmentSlot)))
    26312631                    break;
    26322632            }
     
    26732673KChipsetType StorageModel::chipsetType() const
    26742674{
    2675     return m_chipsetType;
    2676 }
    2677 
    2678 void StorageModel::setChipsetType(KChipsetType type)
    2679 {
    2680     m_chipsetType = type;
    2681 }
    2682 
    2683 void StorageModel::setConfigurationAccessLevel(ConfigurationAccessLevel newConfigurationAccessLevel)
    2684 {
    2685     m_configurationAccessLevel = newConfigurationAccessLevel;
     2675    return m_enmChipsetType;
     2676}
     2677
     2678void StorageModel::setChipsetType(KChipsetType enmChipsetType)
     2679{
     2680    m_enmChipsetType = enmChipsetType;
     2681}
     2682
     2683void StorageModel::setConfigurationAccessLevel(ConfigurationAccessLevel enmConfigurationAccessLevel)
     2684{
     2685    m_enmConfigurationAccessLevel = enmConfigurationAccessLevel;
    26862686}
    26872687
    26882688void StorageModel::clear()
    26892689{
    2690     while (mRootItem->childCount())
     2690    while (m_pRootItem->childCount())
    26912691    {
    26922692        beginRemoveRows(root(), 0, 0);
    2693         delete mRootItem->childItem(0);
     2693        delete m_pRootItem->childItem(0);
    26942694        endRemoveRows();
    26952695    }
     
    27022702    {
    27032703        currentMap.insert((KStorageBus)iStorageBusType,
    2704                           qobject_cast<RootItem*>(mRootItem)->childCount((KStorageBus)iStorageBusType));
     2704                          qobject_cast<RootItem*>(m_pRootItem)->childCount((KStorageBus)iStorageBusType));
    27052705    }
    27062706    return currentMap;
     
    27182718}
    27192719
    2720 Qt::ItemFlags StorageModel::flags (const QModelIndex &aIndex) const
    2721 {
    2722     return !aIndex.isValid() ? QAbstractItemModel::flags (aIndex) :
     2720Qt::ItemFlags StorageModel::flags (const QModelIndex &index) const
     2721{
     2722    return !index.isValid() ? QAbstractItemModel::flags (index) :
    27232723           Qt::ItemIsEnabled | Qt::ItemIsSelectable;
    27242724}
     
    27292729*********************************************************************************************************************************/
    27302730
    2731 StorageDelegate::StorageDelegate (QObject *aParent)
    2732     : QItemDelegate (aParent)
    2733 {
    2734 }
    2735 
    2736 void StorageDelegate::paint (QPainter *aPainter, const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const
    2737 {
    2738     if (!aIndex.isValid()) return;
     2731StorageDelegate::StorageDelegate (QObject *pParent)
     2732    : QItemDelegate (pParent)
     2733{
     2734}
     2735
     2736void StorageDelegate::paint (QPainter *pPainter, const QStyleOptionViewItem &option, const QModelIndex &index) const
     2737{
     2738    if (!index.isValid()) return;
    27392739
    27402740    /* Initialize variables */
    2741     QStyle::State state = aOption.state;
    2742     QRect rect = aOption.rect;
    2743     const StorageModel *model = qobject_cast<const StorageModel*>(aIndex.model());
    2744     Assert (model);
    2745 
    2746     aPainter->save();
     2741    QStyle::State enmState = option.state;
     2742    QRect rect = option.rect;
     2743    const StorageModel *pModel = qobject_cast<const StorageModel*>(index.model());
     2744    Assert (pModel);
     2745
     2746    pPainter->save();
    27472747
    27482748    /* Draw item background */
    2749     QItemDelegate::drawBackground (aPainter, aOption, aIndex);
     2749    QItemDelegate::drawBackground (pPainter, option, index);
    27502750
    27512751    /* Setup foreground settings */
    2752     QPalette::ColorGroup cg = state & QStyle::State_Active ? QPalette::Active : QPalette::Inactive;
    2753     bool isSelected = state & QStyle::State_Selected;
    2754     bool isFocused = state & QStyle::State_HasFocus;
    2755     bool isGrayOnLoosingFocus = QApplication::style()->styleHint (QStyle::SH_ItemView_ChangeHighlightOnFocus, &aOption) != 0;
    2756     aPainter->setPen (aOption.palette.color (cg, isSelected && (isFocused || !isGrayOnLoosingFocus) ?
     2752    QPalette::ColorGroup cg = enmState & QStyle::State_Active ? QPalette::Active : QPalette::Inactive;
     2753    bool fSelected = enmState & QStyle::State_Selected;
     2754    bool fFocused = enmState & QStyle::State_HasFocus;
     2755    bool fGrayOnLoosingFocus = QApplication::style()->styleHint (QStyle::SH_ItemView_ChangeHighlightOnFocus, &option) != 0;
     2756    pPainter->setPen (option.palette.color (cg, fSelected && (fFocused || !fGrayOnLoosingFocus) ?
    27572757                                             QPalette::HighlightedText : QPalette::Text));
    27582758
    2759     aPainter->translate (rect.x(), rect.y());
     2759    pPainter->translate (rect.x(), rect.y());
    27602760
    27612761    /* Draw Item Pixmap */
    2762     aPainter->drawPixmap (model->data (aIndex, StorageModel::R_ItemPixmapRect).toRect().topLeft(),
    2763                           model->data (aIndex, StorageModel::R_ItemPixmap).value <QPixmap>());
     2762    pPainter->drawPixmap (pModel->data (index, StorageModel::R_ItemPixmapRect).toRect().topLeft(),
     2763                          pModel->data (index, StorageModel::R_ItemPixmap).value <QPixmap>());
    27642764
    27652765    /* Draw compressed item name */
    2766     int margin = model->data (aIndex, StorageModel::R_Margin).toInt();
    2767     int iconWidth = model->data (aIndex, StorageModel::R_IconSize).toInt();
    2768     int spacing = model->data (aIndex, StorageModel::R_Spacing).toInt();
    2769     QPoint textPosition = model->data (aIndex, StorageModel::R_ItemNamePoint).toPoint();
    2770     int textWidth = rect.width() - textPosition.x();
    2771     if (model->data (aIndex, StorageModel::R_IsController).toBool() && state & QStyle::State_Selected)
    2772     {
    2773         textWidth -= (2 * spacing + iconWidth + margin);
    2774         if (model->data (aIndex, StorageModel::R_CtrBusType).value <KStorageBus>() != KStorageBus_Floppy)
    2775             textWidth -= (spacing + iconWidth);
    2776     }
    2777     QString text (model->data (aIndex, StorageModel::R_ItemName).toString());
    2778     QString shortText (text);
    2779     QFont font = model->data (aIndex, Qt::FontRole).value <QFont>();
     2766    int iMargin = pModel->data (index, StorageModel::R_Margin).toInt();
     2767    int iIconWidth = pModel->data (index, StorageModel::R_IconSize).toInt();
     2768    int iSpacing = pModel->data (index, StorageModel::R_Spacing).toInt();
     2769    QPoint textPosition = pModel->data (index, StorageModel::R_ItemNamePoint).toPoint();
     2770    int iTextWidth = rect.width() - textPosition.x();
     2771    if (pModel->data (index, StorageModel::R_IsController).toBool() && enmState & QStyle::State_Selected)
     2772    {
     2773        iTextWidth -= (2 * iSpacing + iIconWidth + iMargin);
     2774        if (pModel->data (index, StorageModel::R_CtrBusType).value <KStorageBus>() != KStorageBus_Floppy)
     2775            iTextWidth -= (iSpacing + iIconWidth);
     2776    }
     2777    QString strText (pModel->data (index, StorageModel::R_ItemName).toString());
     2778    QString strShortText (strText);
     2779    QFont font = pModel->data (index, Qt::FontRole).value <QFont>();
    27802780    QFontMetrics fm (font);
    2781     while ((shortText.size() > 1) && (fm.width (shortText) + fm.width ("...") > textWidth))
    2782         shortText.truncate (shortText.size() - 1);
    2783     if (shortText != text)
    2784         shortText += "...";
    2785     aPainter->setFont (font);
    2786     aPainter->drawText (textPosition, shortText);
     2781    while ((strShortText.size() > 1) && (fm.width (strShortText) + fm.width ("...") > iTextWidth))
     2782        strShortText.truncate (strShortText.size() - 1);
     2783    if (strShortText != strText)
     2784        strShortText += "...";
     2785    pPainter->setFont (font);
     2786    pPainter->drawText (textPosition, strShortText);
    27872787
    27882788    /* Draw Controller Additions */
    2789     if (model->data (aIndex, StorageModel::R_IsController).toBool() && state & QStyle::State_Selected)
    2790     {
    2791         DeviceTypeList devicesList (model->data (aIndex, StorageModel::R_CtrDevices).value <DeviceTypeList>());
     2789    if (pModel->data (index, StorageModel::R_IsController).toBool() && enmState & QStyle::State_Selected)
     2790    {
     2791        DeviceTypeList devicesList (pModel->data (index, StorageModel::R_CtrDevices).value <DeviceTypeList>());
    27922792        for (int i = 0; i < devicesList.size(); ++ i)
    27932793        {
    2794             KDeviceType deviceType = devicesList [i];
     2794            KDeviceType enmDeviceType = devicesList [i];
    27952795
    27962796            QRect deviceRect;
    27972797            QPixmap devicePixmap;
    2798             switch (deviceType)
     2798            switch (enmDeviceType)
    27992799            {
    28002800                case KDeviceType_HardDisk:
    28012801                {
    2802                     deviceRect = model->data (aIndex, StorageModel::R_HDPixmapRect).value <QRect>();
    2803                     devicePixmap = model->data (aIndex, StorageModel::R_IsMoreAttachmentsPossible).toBool() ?
    2804                                    model->data (aIndex, StorageModel::R_HDPixmapAddEn).value <QPixmap>() :
    2805                                    model->data (aIndex, StorageModel::R_HDPixmapAddDis).value <QPixmap>();
     2802                    deviceRect = pModel->data (index, StorageModel::R_HDPixmapRect).value <QRect>();
     2803                    devicePixmap = pModel->data (index, StorageModel::R_IsMoreAttachmentsPossible).toBool() ?
     2804                                   pModel->data (index, StorageModel::R_HDPixmapAddEn).value <QPixmap>() :
     2805                                   pModel->data (index, StorageModel::R_HDPixmapAddDis).value <QPixmap>();
    28062806                    break;
    28072807                }
    28082808                case KDeviceType_DVD:
    28092809                {
    2810                     deviceRect = model->data (aIndex, StorageModel::R_CDPixmapRect).value <QRect>();
    2811                     devicePixmap = model->data (aIndex, StorageModel::R_IsMoreAttachmentsPossible).toBool() ?
    2812                                    model->data (aIndex, StorageModel::R_CDPixmapAddEn).value <QPixmap>() :
    2813                                    model->data (aIndex, StorageModel::R_CDPixmapAddDis).value <QPixmap>();
     2810                    deviceRect = pModel->data (index, StorageModel::R_CDPixmapRect).value <QRect>();
     2811                    devicePixmap = pModel->data (index, StorageModel::R_IsMoreAttachmentsPossible).toBool() ?
     2812                                   pModel->data (index, StorageModel::R_CDPixmapAddEn).value <QPixmap>() :
     2813                                   pModel->data (index, StorageModel::R_CDPixmapAddDis).value <QPixmap>();
    28142814                    break;
    28152815                }
    28162816                case KDeviceType_Floppy:
    28172817                {
    2818                     deviceRect = model->data (aIndex, StorageModel::R_FDPixmapRect).value <QRect>();
    2819                     devicePixmap = model->data (aIndex, StorageModel::R_IsMoreAttachmentsPossible).toBool() ?
    2820                                    model->data (aIndex, StorageModel::R_FDPixmapAddEn).value <QPixmap>() :
    2821                                    model->data (aIndex, StorageModel::R_FDPixmapAddDis).value <QPixmap>();
     2818                    deviceRect = pModel->data (index, StorageModel::R_FDPixmapRect).value <QRect>();
     2819                    devicePixmap = pModel->data (index, StorageModel::R_IsMoreAttachmentsPossible).toBool() ?
     2820                                   pModel->data (index, StorageModel::R_FDPixmapAddEn).value <QPixmap>() :
     2821                                   pModel->data (index, StorageModel::R_FDPixmapAddDis).value <QPixmap>();
    28222822                    break;
    28232823                }
     
    28262826            }
    28272827
    2828             aPainter->drawPixmap (QPoint (rect.width() + deviceRect.x(), deviceRect.y()), devicePixmap);
    2829         }
    2830     }
    2831 
    2832     aPainter->restore();
    2833 
    2834     drawFocus (aPainter, aOption, rect);
     2828            pPainter->drawPixmap (QPoint (rect.width() + deviceRect.x(), deviceRect.y()), devicePixmap);
     2829        }
     2830    }
     2831
     2832    pPainter->restore();
     2833
     2834    drawFocus (pPainter, option, rect);
    28352835}
    28362836
     
    28412841
    28422842/* static */
    2843 const QString UIMachineSettingsStorage::ControllerMimeType = QString("application/virtualbox;value=StorageControllerID");
    2844 const QString UIMachineSettingsStorage::AttachmentMimeType = QString("application/virtualbox;value=StorageAttachmentID");
     2843const QString UIMachineSettingsStorage::s_strControllerMimeType = QString("application/virtualbox;value=StorageControllerID");
     2844const QString UIMachineSettingsStorage::s_strAttachmentMimeType = QString("application/virtualbox;value=StorageAttachmentID");
    28452845
    28462846UIMachineSettingsStorage::UIMachineSettingsStorage()
     
    29142914        {
    29152915            /* Gather old controller data: */
    2916             oldControllerData.m_strControllerName = comController.GetName();
    2917             oldControllerData.m_controllerBus = comController.GetBus();
    2918             oldControllerData.m_controllerType = comController.GetControllerType();
     2916            oldControllerData.m_strName = comController.GetName();
     2917            oldControllerData.m_enmBus = comController.GetBus();
     2918            oldControllerData.m_enmType = comController.GetControllerType();
    29192919            oldControllerData.m_uPortCount = comController.GetPortCount();
    29202920            oldControllerData.m_fUseHostIOCache = comController.GetUseHostIOCache();
    29212921            /* Override controller cache key: */
    2922             strControllerKey = oldControllerData.m_strControllerName;
     2922            strControllerKey = oldControllerData.m_strName;
    29232923
    29242924            /* Sort attachments before caching/fetching: */
    29252925            const CMediumAttachmentVector &attachmentVector =
    2926                 m_machine.GetMediumAttachmentsOfController(oldControllerData.m_strControllerName);
     2926                m_machine.GetMediumAttachmentsOfController(oldControllerData.m_strName);
    29272927            QMap<StorageSlot, CMediumAttachment> attachmentMap;
    29282928            foreach (const CMediumAttachment &comAttachment, attachmentVector)
    29292929            {
    2930                 const StorageSlot storageSlot(oldControllerData.m_controllerBus,
     2930                const StorageSlot storageSlot(oldControllerData.m_enmBus,
    29312931                                              comAttachment.GetPort(), comAttachment.GetDevice());
    29322932                attachmentMap.insert(storageSlot, comAttachment);
     
    29462946                {
    29472947                    /* Gather old attachment data: */
    2948                     oldAttachmentData.m_attachmentType = comAttachment.GetType();
    2949                     oldAttachmentData.m_iAttachmentPort = comAttachment.GetPort();
    2950                     oldAttachmentData.m_iAttachmentDevice = comAttachment.GetDevice();
    2951                     oldAttachmentData.m_fAttachmentPassthrough = comAttachment.GetPassthrough();
    2952                     oldAttachmentData.m_fAttachmentTempEject = comAttachment.GetTemporaryEject();
    2953                     oldAttachmentData.m_fAttachmentNonRotational = comAttachment.GetNonRotational();
    2954                     oldAttachmentData.m_fAttachmentHotPluggable = comAttachment.GetHotPluggable();
     2948                    oldAttachmentData.m_enmDeviceType = comAttachment.GetType();
     2949                    oldAttachmentData.m_iPort = comAttachment.GetPort();
     2950                    oldAttachmentData.m_iDevice = comAttachment.GetDevice();
     2951                    oldAttachmentData.m_fPassthrough = comAttachment.GetPassthrough();
     2952                    oldAttachmentData.m_fTempEject = comAttachment.GetTemporaryEject();
     2953                    oldAttachmentData.m_fNonRotational = comAttachment.GetNonRotational();
     2954                    oldAttachmentData.m_fHotPluggable = comAttachment.GetHotPluggable();
    29552955                    const CMedium comMedium = comAttachment.GetMedium();
    2956                     oldAttachmentData.m_uAttachmentMediumId = comMedium.isNull() ? UIMedium::nullID() : comMedium.GetId();
     2956                    oldAttachmentData.m_uMediumId = comMedium.isNull() ? UIMedium::nullID() : comMedium.GetId();
    29572957                    /* Override controller cache key: */
    2958                     strAttachmentKey = QString("%1:%2").arg(oldAttachmentData.m_iAttachmentPort).arg(oldAttachmentData.m_iAttachmentDevice);
     2958                    strAttachmentKey = QString("%1:%2").arg(oldAttachmentData.m_iPort).arg(oldAttachmentData.m_iDevice);
    29592959                }
    29602960
     
    29922992
    29932993        /* Load old controller data from the cache: */
    2994         const QModelIndex controllerIndex = m_pModelStorage->addController(oldControllerData.m_strControllerName,
    2995                                                                            oldControllerData.m_controllerBus,
    2996                                                                            oldControllerData.m_controllerType);
     2994        const QModelIndex controllerIndex = m_pModelStorage->addController(oldControllerData.m_strName,
     2995                                                                           oldControllerData.m_enmBus,
     2996                                                                           oldControllerData.m_enmType);
    29972997        const QUuid controllerId = QUuid(m_pModelStorage->data(controllerIndex, StorageModel::R_ItemId).toString());
    29982998        m_pModelStorage->setData(controllerIndex, oldControllerData.m_uPortCount, StorageModel::R_CtrPortCount);
     
    30093009            /* Load old attachment data from the cache: */
    30103010            const QModelIndex attachmentIndex = m_pModelStorage->addAttachment(controllerId,
    3011                                                                                oldAttachmentData.m_attachmentType,
    3012                                                                                oldAttachmentData.m_uAttachmentMediumId);
    3013             const StorageSlot attachmentStorageSlot(oldControllerData.m_controllerBus,
    3014                                                     oldAttachmentData.m_iAttachmentPort,
    3015                                                     oldAttachmentData.m_iAttachmentDevice);
     3011                                                                               oldAttachmentData.m_enmDeviceType,
     3012                                                                               oldAttachmentData.m_uMediumId);
     3013            const StorageSlot attachmentStorageSlot(oldControllerData.m_enmBus,
     3014                                                    oldAttachmentData.m_iPort,
     3015                                                    oldAttachmentData.m_iDevice);
    30163016            m_pModelStorage->setData(attachmentIndex, QVariant::fromValue(attachmentStorageSlot), StorageModel::R_AttSlot);
    3017             m_pModelStorage->setData(attachmentIndex, oldAttachmentData.m_fAttachmentPassthrough, StorageModel::R_AttIsPassthrough);
    3018             m_pModelStorage->setData(attachmentIndex, oldAttachmentData.m_fAttachmentTempEject, StorageModel::R_AttIsTempEject);
    3019             m_pModelStorage->setData(attachmentIndex, oldAttachmentData.m_fAttachmentNonRotational, StorageModel::R_AttIsNonRotational);
    3020             m_pModelStorage->setData(attachmentIndex, oldAttachmentData.m_fAttachmentHotPluggable, StorageModel::R_AttIsHotPluggable);
     3017            m_pModelStorage->setData(attachmentIndex, oldAttachmentData.m_fPassthrough, StorageModel::R_AttIsPassthrough);
     3018            m_pModelStorage->setData(attachmentIndex, oldAttachmentData.m_fTempEject, StorageModel::R_AttIsTempEject);
     3019            m_pModelStorage->setData(attachmentIndex, oldAttachmentData.m_fNonRotational, StorageModel::R_AttIsNonRotational);
     3020            m_pModelStorage->setData(attachmentIndex, oldAttachmentData.m_fHotPluggable, StorageModel::R_AttIsHotPluggable);
    30213021        }
    30223022    }
     
    30503050        /* Gather new controller data & cache key from model: */
    30513051        const QModelIndex controllerIndex = m_pModelStorage->index(iControllerIndex, 0, rootIndex);
    3052         newControllerData.m_strControllerName = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrName).toString();
    3053         newControllerData.m_controllerBus = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrBusType).value<KStorageBus>();
    3054         newControllerData.m_controllerType = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrType).value<KStorageControllerType>();
     3052        newControllerData.m_strName = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrName).toString();
     3053        newControllerData.m_enmBus = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrBusType).value<KStorageBus>();
     3054        newControllerData.m_enmType = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrType).value<KStorageControllerType>();
    30553055        newControllerData.m_uPortCount = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrPortCount).toUInt();
    30563056        newControllerData.m_fUseHostIOCache = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrIoCache).toBool();
     
    30653065            /* Gather new attachment data & cache key from model: */
    30663066            const QModelIndex attachmentIndex = m_pModelStorage->index(iAttachmentIndex, 0, controllerIndex);
    3067             newAttachmentData.m_attachmentType = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttDevice).value<KDeviceType>();
     3067            newAttachmentData.m_enmDeviceType = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttDevice).value<KDeviceType>();
    30683068            const StorageSlot attachmentSlot = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttSlot).value<StorageSlot>();
    3069             newAttachmentData.m_iAttachmentPort = attachmentSlot.port;
    3070             newAttachmentData.m_iAttachmentDevice = attachmentSlot.device;
    3071             newAttachmentData.m_fAttachmentPassthrough = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttIsPassthrough).toBool();
    3072             newAttachmentData.m_fAttachmentTempEject = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttIsTempEject).toBool();
    3073             newAttachmentData.m_fAttachmentNonRotational = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttIsNonRotational).toBool();
    3074             newAttachmentData.m_fAttachmentHotPluggable = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttIsHotPluggable).toBool();
    3075             newAttachmentData.m_uAttachmentMediumId = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttMediumId).toString();
    3076             const QString strAttachmentKey = QString("%1:%2").arg(newAttachmentData.m_iAttachmentPort).arg(newAttachmentData.m_iAttachmentDevice);
     3069            newAttachmentData.m_iPort = attachmentSlot.port;
     3070            newAttachmentData.m_iDevice = attachmentSlot.device;
     3071            newAttachmentData.m_fPassthrough = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttIsPassthrough).toBool();
     3072            newAttachmentData.m_fTempEject = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttIsTempEject).toBool();
     3073            newAttachmentData.m_fNonRotational = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttIsNonRotational).toBool();
     3074            newAttachmentData.m_fHotPluggable = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttIsHotPluggable).toBool();
     3075            newAttachmentData.m_uMediumId = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttMediumId).toString();
     3076            const QString strAttachmentKey = QString("%1:%2").arg(newAttachmentData.m_iPort).arg(newAttachmentData.m_iDevice);
    30773077
    30783078            /* Cache new attachment data: */
     
    31163116    for (int i = 0; i < m_pModelStorage->rowCount(rootIndex); ++i)
    31173117    {
    3118         const QModelIndex ctrIndex = rootIndex.child(i, 0);
    3119         const QString ctrName = m_pModelStorage->data(ctrIndex, StorageModel::R_CtrName).toString();
     3118        const QModelIndex controllerIndex = rootIndex.child(i, 0);
     3119        const QString ctrName = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrName).toString();
    31203120
    31213121        /* Check for name emptiness: */
     
    31363136
    31373137        /* For each attachment: */
    3138         for (int j = 0; j < m_pModelStorage->rowCount(ctrIndex); ++j)
    3139         {
    3140             const QModelIndex attIndex = ctrIndex.child(j, 0);
    3141             const StorageSlot attSlot = m_pModelStorage->data(attIndex, StorageModel::R_AttSlot).value <StorageSlot>();
    3142             const KDeviceType enmAttDevice = m_pModelStorage->data(attIndex, StorageModel::R_AttDevice).value <KDeviceType>();
    3143             const QString key(m_pModelStorage->data(attIndex, StorageModel::R_AttMediumId).toString());
     3138        for (int j = 0; j < m_pModelStorage->rowCount(controllerIndex); ++j)
     3139        {
     3140            const QModelIndex attachmentIndex = controllerIndex.child(j, 0);
     3141            const StorageSlot attSlot = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttSlot).value <StorageSlot>();
     3142            const KDeviceType enmDeviceType = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttDevice).value <KDeviceType>();
     3143            const QString key(m_pModelStorage->data(attachmentIndex, StorageModel::R_AttMediumId).toString());
    31443144            const QString value(QString("%1 (%2)").arg(ctrName, gpConverter->toString(attSlot)));
    31453145            /* Check for emptiness: */
    3146             if (uiCommon().medium(key).isNull() && enmAttDevice == KDeviceType_HardDisk)
     3146            if (uiCommon().medium(key).isNull() && enmDeviceType == KDeviceType_HardDisk)
    31473147            {
    31483148                message.second << tr("No hard disk is selected for <i>%1</i>.").arg(value);
     
    32493249    /* Declare required variables: */
    32503250    const QModelIndex index = m_pTreeStorage->currentIndex();
    3251     const KDeviceType enmDevice = m_pModelStorage->data(index, StorageModel::R_AttDevice).value<KDeviceType>();
     3251    const KDeviceType enmDeviceType = m_pModelStorage->data(index, StorageModel::R_AttDevice).value<KDeviceType>();
    32523252
    32533253    /* Polish left pane availability: */
     
    32733273    /* Polish attachments pane availability: */
    32743274    mLsAttributes->setEnabled(isMachineInValidMode());
    3275     mLbMedium->setEnabled(isMachineOffline() || (isMachineOnline() && enmDevice != KDeviceType_HardDisk));
     3275    mLbMedium->setEnabled(isMachineOffline() || (isMachineOnline() && enmDeviceType != KDeviceType_HardDisk));
    32763276    mCbSlot->setEnabled(isMachineOffline());
    3277     mTbOpen->setEnabled(isMachineOffline() || (isMachineOnline() && enmDevice != KDeviceType_HardDisk));
     3277    mTbOpen->setEnabled(isMachineOffline() || (isMachineOnline() && enmDeviceType != KDeviceType_HardDisk));
    32783278    mCbPassthrough->setEnabled(isMachineOffline());
    32793279    mCbTempEject->setEnabled(isMachineInValidMode());
     
    33243324        foreach (QLabel *label, labelsList)
    33253325        {
    3326             int width = metrics.width(label->text());
    3327             maxWidth = width > maxWidth ? width : maxWidth;
     3326            int iWidth = metrics.width(label->text());
     3327            maxWidth = iWidth > maxWidth ? iWidth : maxWidth;
    33283328        }
    33293329        mLtAttachment->setColumnMinimumWidth(1, maxWidth);
     
    33433343    for (int i = 0; i < m_pModelStorage->rowCount(rootIndex); ++i)
    33443344    {
    3345         const QModelIndex ctrIndex = rootIndex.child(i, 0);
    3346         for (int j = 0; j < m_pModelStorage->rowCount(ctrIndex); ++j)
    3347         {
    3348             const QModelIndex attIndex = ctrIndex.child(j, 0);
    3349             const QUuid attMediumId = m_pModelStorage->data(attIndex, StorageModel::R_AttMediumId).toString();
     3345        const QModelIndex controllerIndex = rootIndex.child(i, 0);
     3346        for (int j = 0; j < m_pModelStorage->rowCount(controllerIndex); ++j)
     3347        {
     3348            const QModelIndex attachmentIndex = controllerIndex.child(j, 0);
     3349            const QUuid attMediumId = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttMediumId).toString();
    33503350            if (attMediumId == medium.id())
    33513351            {
    3352                 m_pModelStorage->setData(attIndex, attMediumId, StorageModel::R_AttMediumId);
     3352                m_pModelStorage->setData(attachmentIndex, attMediumId, StorageModel::R_AttMediumId);
    33533353
    33543354                /* Revalidate: */
     
    33643364    for (int i = 0; i < m_pModelStorage->rowCount(rootIndex); ++i)
    33653365    {
    3366         QModelIndex ctrIndex = rootIndex.child(i, 0);
    3367         for (int j = 0; j < m_pModelStorage->rowCount(ctrIndex); ++j)
    3368         {
    3369             QModelIndex attIndex = ctrIndex.child(j, 0);
    3370             QUuid attMediumId = m_pModelStorage->data(attIndex, StorageModel::R_AttMediumId).toString();
     3366        QModelIndex controllerIndex = rootIndex.child(i, 0);
     3367        for (int j = 0; j < m_pModelStorage->rowCount(controllerIndex); ++j)
     3368        {
     3369            QModelIndex attachmentIndex = controllerIndex.child(j, 0);
     3370            QUuid attMediumId = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttMediumId).toString();
    33713371            if (attMediumId == uMediumId)
    33723372            {
    3373                 m_pModelStorage->setData(attIndex, UIMedium().id(), StorageModel::R_AttMediumId);
     3373                m_pModelStorage->setData(attachmentIndex, UIMedium().id(), StorageModel::R_AttMediumId);
    33743374
    33753375                /* Revalidate: */
     
    34563456    const bool fShowMenu = deviceTypeList.size() > 1;
    34573457    QMenu menu;
    3458     foreach (const KDeviceType &deviceType, deviceTypeList)
    3459     {
    3460         switch (deviceType)
     3458    foreach (const KDeviceType &enmDeviceType, deviceTypeList)
     3459    {
     3460        switch (enmDeviceType)
    34613461        {
    34623462            case KDeviceType_HardDisk:
     
    35053505    const QModelIndex index = m_pTreeStorage->currentIndex();
    35063506
    3507     const KDeviceType enmDevice = m_pModelStorage->data(index, StorageModel::R_AttDevice).value <KDeviceType>();
     3507    const KDeviceType enmDeviceType = m_pModelStorage->data(index, StorageModel::R_AttDevice).value <KDeviceType>();
    35083508    /* Check if this would be the last DVD. If so let the user confirm this again. */
    3509     if (   enmDevice == KDeviceType_DVD
     3509    if (   enmDeviceType == KDeviceType_DVD
    35103510        && deviceCount(KDeviceType_DVD) == 1)
    35113511    {
     
    35143514    }
    35153515
    3516     const QModelIndex parent = index.parent();
    3517     if (!index.isValid() || !parent.isValid() ||
     3516    const QModelIndex parentIndex = index.parent();
     3517    if (!index.isValid() || !parentIndex.isValid() ||
    35183518        !m_pModelStorage->data(index, StorageModel::R_IsAttachment).toBool() ||
    3519         !m_pModelStorage->data(parent, StorageModel::R_IsController).toBool())
     3519        !m_pModelStorage->data(parentIndex, StorageModel::R_IsController).toBool())
    35203520        return;
    35213521
    3522     m_pModelStorage->delAttachment(QUuid(m_pModelStorage->data(parent, StorageModel::R_ItemId).toString()),
     3522    m_pModelStorage->delAttachment(QUuid(m_pModelStorage->data(parentIndex, StorageModel::R_ItemId).toString()),
    35233523                                   QUuid(m_pModelStorage->data(index, StorageModel::R_ItemId).toString()));
    35243524    emit sigStorageChanged();
     
    35943594
    35953595                /* Getting Attachment Medium: */
    3596                 const KDeviceType enmDevice = m_pModelStorage->data(index, StorageModel::R_AttDevice).value <KDeviceType>();
    3597                 switch (enmDevice)
     3596                const KDeviceType enmDeviceType = m_pModelStorage->data(index, StorageModel::R_AttDevice).value <KDeviceType>();
     3597                switch (enmDeviceType)
    35983598                {
    35993599                    case KDeviceType_HardDisk:
     
    36253625
    36263626                /* Fetch device-type, medium-id: */
    3627                 m_pMediumIdHolder->setType(mediumTypeToLocal(enmDevice));
     3627                m_pMediumIdHolder->setType(mediumTypeToLocal(enmDeviceType));
    36283628                m_pMediumIdHolder->setId(m_pModelStorage->data(index, StorageModel::R_AttMediumId).toString());
    36293629
    36303630                /* Get/fetch editable state: */
    36313631                const bool fIsEditable =    (isMachineOffline())
    3632                                          || (isMachineOnline() && enmDevice != KDeviceType_HardDisk)
    3633                                          || (isMachineOnline() && enmDevice == KDeviceType_HardDisk && fIsHotPluggable);
     3632                                         || (isMachineOnline() && enmDeviceType != KDeviceType_HardDisk)
     3633                                         || (isMachineOnline() && enmDeviceType == KDeviceType_HardDisk && fIsHotPluggable);
    36343634                mLbMedium->setEnabled(fIsEditable);
    36353635                mTbOpen->setEnabled(fIsEditable);
    36363636
    36373637                /* Getting Passthrough state */
    3638                 const bool isHostDrive = m_pModelStorage->data(index, StorageModel::R_AttIsHostDrive).toBool();
    3639                 mCbPassthrough->setVisible(enmDevice == KDeviceType_DVD && isHostDrive);
    3640                 mCbPassthrough->setChecked(isHostDrive && m_pModelStorage->data(index, StorageModel::R_AttIsPassthrough).toBool());
     3638                const bool fHostDrive = m_pModelStorage->data(index, StorageModel::R_AttIsHostDrive).toBool();
     3639                mCbPassthrough->setVisible(enmDeviceType == KDeviceType_DVD && fHostDrive);
     3640                mCbPassthrough->setChecked(fHostDrive && m_pModelStorage->data(index, StorageModel::R_AttIsPassthrough).toBool());
    36413641
    36423642                /* Getting TempEject state */
    3643                 mCbTempEject->setVisible(enmDevice == KDeviceType_DVD && !isHostDrive);
    3644                 mCbTempEject->setChecked(!isHostDrive && m_pModelStorage->data(index, StorageModel::R_AttIsTempEject).toBool());
     3643                mCbTempEject->setVisible(enmDeviceType == KDeviceType_DVD && !fHostDrive);
     3644                mCbTempEject->setChecked(!fHostDrive && m_pModelStorage->data(index, StorageModel::R_AttIsTempEject).toBool());
    36453645
    36463646                /* Getting NonRotational state */
    3647                 mCbNonRotational->setVisible(enmDevice == KDeviceType_HardDisk);
     3647                mCbNonRotational->setVisible(enmDeviceType == KDeviceType_HardDisk);
    36483648                mCbNonRotational->setChecked(m_pModelStorage->data(index, StorageModel::R_AttIsNonRotational).toBool());
    36493649
     
    36533653
    36543654                /* Update optional widgets visibility */
    3655                 updateAdditionalDetails(enmDevice);
     3655                updateAdditionalDetails(enmDeviceType);
    36563656
    36573657                /* Getting Other Information */
     
    36873687        return;
    36883688
    3689     QObject *pSdr = sender();
     3689    QObject *pSender = sender();
    36903690    switch (m_pModelStorage->data(index, StorageModel::R_ItemType).value <AbstractItem::ItemType>())
    36913691    {
     
    36933693        {
    36943694            /* Setting Controller Name: */
    3695             if (pSdr == mLeName)
     3695            if (pSender == mLeName)
    36963696                m_pModelStorage->setData(index, mLeName->text(), StorageModel::R_CtrName);
    36973697            /* Setting Controller Bus-Type: */
    3698             else if (pSdr == mCbBus)
     3698            else if (pSender == mCbBus)
    36993699                m_pModelStorage->setData(index, QVariant::fromValue(gpConverter->fromString<KStorageBus>(mCbBus->currentText())),
    37003700                                         StorageModel::R_CtrBusType);
    37013701            /* Setting Controller Sub-Type: */
    3702             else if (pSdr == mCbType)
     3702            else if (pSender == mCbType)
    37033703                m_pModelStorage->setData(index, QVariant::fromValue(gpConverter->fromString<KStorageControllerType>(mCbType->currentText())),
    37043704                                        StorageModel::R_CtrType);
    3705             else if (pSdr == mSbPortCount)
     3705            else if (pSender == mSbPortCount)
    37063706                m_pModelStorage->setData(index, mSbPortCount->value(), StorageModel::R_CtrPortCount);
    3707             else if (pSdr == mCbIoCache)
     3707            else if (pSender == mCbIoCache)
    37083708                m_pModelStorage->setData(index, mCbIoCache->isChecked(), StorageModel::R_CtrIoCache);
    37093709            break;
     
    37123712        {
    37133713            /* Setting Attachment Slot: */
    3714             if (pSdr == mCbSlot)
     3714            if (pSender == mCbSlot)
    37153715            {
    37163716                QModelIndex controllerIndex = m_pModelStorage->parent(index);
     
    37223722            }
    37233723            /* Setting Attachment Medium: */
    3724             else if (pSdr == m_pMediumIdHolder)
     3724            else if (pSender == m_pMediumIdHolder)
    37253725                m_pModelStorage->setData(index, m_pMediumIdHolder->id(), StorageModel::R_AttMediumId);
    3726             else if (pSdr == mCbPassthrough)
     3726            else if (pSender == mCbPassthrough)
    37273727            {
    37283728                if (m_pModelStorage->data(index, StorageModel::R_AttIsHostDrive).toBool())
    37293729                    m_pModelStorage->setData(index, mCbPassthrough->isChecked(), StorageModel::R_AttIsPassthrough);
    37303730            }
    3731             else if (pSdr == mCbTempEject)
     3731            else if (pSender == mCbTempEject)
    37323732            {
    37333733                if (!m_pModelStorage->data(index, StorageModel::R_AttIsHostDrive).toBool())
    37343734                    m_pModelStorage->setData(index, mCbTempEject->isChecked(), StorageModel::R_AttIsTempEject);
    37353735            }
    3736             else if (pSdr == mCbNonRotational)
     3736            else if (pSender == mCbNonRotational)
    37373737            {
    37383738                m_pModelStorage->setData(index, mCbNonRotational->isChecked(), StorageModel::R_AttIsNonRotational);
    37393739            }
    3740             else if (pSdr == m_pCheckBoxHotPluggable)
     3740            else if (pSender == m_pCheckBoxHotPluggable)
    37413741            {
    37423742                m_pModelStorage->setData(index, m_pCheckBoxHotPluggable->isChecked(), StorageModel::R_AttIsHotPluggable);
     
    39193919}
    39203920
    3921 void UIMachineSettingsStorage::sltHandleRowInsertion(const QModelIndex &parent, int iPosition)
    3922 {
    3923     const QModelIndex index = m_pModelStorage->index(iPosition, 0, parent);
     3921void UIMachineSettingsStorage::sltHandleRowInsertion(const QModelIndex &parentIndex, int iPosition)
     3922{
     3923    const QModelIndex index = m_pModelStorage->index(iPosition, 0, parentIndex);
    39243924
    39253925    switch (m_pModelStorage->data(index, StorageModel::R_ItemType).value<AbstractItem::ItemType>())
     
    39343934        {
    39353935            /* Expand parent if it is not expanded yet: */
    3936             if (!m_pTreeStorage->isExpanded(parent))
    3937                 m_pTreeStorage->setExpanded(parent, true);
     3936            if (!m_pTreeStorage->isExpanded(parentIndex))
     3937                m_pTreeStorage->setExpanded(parentIndex, true);
    39383938            break;
    39393939        }
     
    39733973        {
    39743974            const DeviceTypeList deviceTypeList(m_pModelStorage->data(index, StorageModel::R_CtrDevices).value<DeviceTypeList>());
    3975             foreach (KDeviceType deviceType, deviceTypeList)
     3975            foreach (KDeviceType enmDeviceType, deviceTypeList)
    39763976            {
    3977                 switch (deviceType)
     3977                switch (enmDeviceType)
    39783978                {
    39793979                    case KDeviceType_HardDisk:
     
    41404140                if (pMimeData)
    41414141                {
    4142                     pMimeData->setData(ControllerMimeType, pItemAttachment->parent()->id().toString().toLatin1());
    4143                     pMimeData->setData(AttachmentMimeType, pItemAttachment->id().toString().toLatin1());
     4142                    pMimeData->setData(s_strControllerMimeType, pItemAttachment->parent()->id().toString().toLatin1());
     4143                    pMimeData->setData(s_strAttachmentMimeType, pItemAttachment->id().toString().toLatin1());
    41444144                    pDrag->setMimeData(pMimeData);
    41454145                }
     
    42424242
    42434243    /* Make sure mime-data format is valid: */
    4244     if (   !pMimeData->hasFormat(UIMachineSettingsStorage::ControllerMimeType)
    4245         || !pMimeData->hasFormat(UIMachineSettingsStorage::AttachmentMimeType))
     4244    if (   !pMimeData->hasFormat(UIMachineSettingsStorage::s_strControllerMimeType)
     4245        || !pMimeData->hasFormat(UIMachineSettingsStorage::s_strAttachmentMimeType))
    42464246        return;
    42474247
    42484248    /* Get controller id: */
    4249     const QString strControllerId = pMimeData->data(UIMachineSettingsStorage::ControllerMimeType);
     4249    const QString strControllerId = pMimeData->data(UIMachineSettingsStorage::s_strControllerMimeType);
    42504250
    42514251    /* Check what item we are hovering currently: */
     
    42814281    {
    42824282        /* Get controller/attachment ids: */
    4283         const QString strControllerId = pMimeData->data(UIMachineSettingsStorage::ControllerMimeType);
    4284         const QString strAttachmentId = pMimeData->data(UIMachineSettingsStorage::AttachmentMimeType);
     4283        const QString strControllerId = pMimeData->data(UIMachineSettingsStorage::s_strControllerMimeType);
     4284        const QString strAttachmentId = pMimeData->data(UIMachineSettingsStorage::s_strAttachmentMimeType);
    42854285        m_pModelStorage->moveAttachment(strAttachmentId, strControllerId, pItemController->id());
    42864286    }
     
    47464746    for (int i = 0; i < m_pModelStorage->rowCount(rootIndex); ++i)
    47474747    {
    4748         const QModelIndex ctrIndex = rootIndex.child(i, 0);
    4749         const QString ctrName = m_pModelStorage->data(ctrIndex, StorageModel::R_CtrName).toString();
    4750         if (ctrName.startsWith(strTemplate))
    4751         {
    4752             const QString stringNumber(ctrName.right(ctrName.size() - strTemplate.size()));
     4748        const QModelIndex controllerIndex = rootIndex.child(i, 0);
     4749        const QString strName = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrName).toString();
     4750        if (strName.startsWith(strTemplate))
     4751        {
     4752            const QString strNumber(strName.right(strName.size() - strTemplate.size()));
    47534753            bool fConverted = false;
    4754             const int iNumber = stringNumber.toInt(&fConverted);
     4754            const int iNumber = strNumber.toInt(&fConverted);
    47554755            iMaxNumber = fConverted && (iNumber > iMaxNumber) ? iNumber : 1;
    47564756        }
     
    47654765    for (int i = 0; i < m_pModelStorage->rowCount(rootIndex); ++i)
    47664766    {
    4767         const QModelIndex ctrIndex = rootIndex.child(i, 0);
    4768         for (int j = 0; j < m_pModelStorage->rowCount(ctrIndex); ++j)
    4769         {
    4770             const QModelIndex attIndex = ctrIndex.child(j, 0);
    4771             const KDeviceType enmAttDevice = m_pModelStorage->data(attIndex, StorageModel::R_AttDevice).value<KDeviceType>();
    4772             if (enmAttDevice == enmType)
     4767        const QModelIndex controllerIndex = rootIndex.child(i, 0);
     4768        for (int j = 0; j < m_pModelStorage->rowCount(controllerIndex); ++j)
     4769        {
     4770            const QModelIndex attachmentIndex = controllerIndex.child(j, 0);
     4771            const KDeviceType enmDeviceType = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttDevice).value<KDeviceType>();
     4772            if (enmDeviceType == enmType)
    47734773                ++cDevices;
    47744774        }
     
    47894789    foreach (const QUuid &uMediumId, uiCommon().mediumIDs())
    47904790    {
    4791         const UIMedium medium = uiCommon().medium(uMediumId);
    4792         if (medium.isHostDrive() && m_pMediumIdHolder->type() == medium.type())
    4793         {
    4794             QAction *pHostDriveAction = pOpenMediumMenu->addAction(medium.name());
    4795             pHostDriveAction->setData(medium.id());
     4791        const UIMedium guiMedium = uiCommon().medium(uMediumId);
     4792        if (guiMedium.isHostDrive() && m_pMediumIdHolder->type() == guiMedium.type())
     4793        {
     4794            QAction *pHostDriveAction = pOpenMediumMenu->addAction(guiMedium.name());
     4795            pHostDriveAction->setData(guiMedium.id());
    47964796            connect(pHostDriveAction, &QAction::triggered, this, &UIMachineSettingsStorage::sltChooseHostDrive);
    47974797        }
     
    48944894
    48954895        /* Search for a controller with the same name: */
    4896         const CStorageController &comController = m_machine.GetStorageControllerByName(oldControllerData.m_strControllerName);
     4896        const CStorageController &comController = m_machine.GetStorageControllerByName(oldControllerData.m_strName);
    48974897        fSuccess = m_machine.isOk() && comController.isNotNull();
    48984898
     
    49014901        {
    49024902            /* Remove controller with all the attachments at one shot: */
    4903             m_machine.RemoveStorageController(oldControllerData.m_strControllerName);
     4903            m_machine.RemoveStorageController(oldControllerData.m_strName);
    49044904            fSuccess = m_machine.isOk();
    49054905        }
     
    49254925        /* Search for a controller with the same name: */
    49264926        const CMachine comMachine(m_machine);
    4927         CStorageController comController = comMachine.GetStorageControllerByName(newControllerData.m_strControllerName);
     4927        CStorageController comController = comMachine.GetStorageControllerByName(newControllerData.m_strName);
    49284928        fSuccess = !comMachine.isOk() && comController.isNull();
    49294929        AssertReturn(fSuccess, false);
     
    49334933        {
    49344934            /* Create controller: */
    4935             comController = m_machine.AddStorageController(newControllerData.m_strControllerName, newControllerData.m_controllerBus);
     4935            comController = m_machine.AddStorageController(newControllerData.m_strName, newControllerData.m_enmBus);
    49364936            fSuccess = m_machine.isOk() && comController.isNotNull();
    49374937        }
     
    49454945            if (fSuccess)
    49464946            {
    4947                 comController.SetControllerType(newControllerData.m_controllerType);
     4947                comController.SetControllerType(newControllerData.m_enmType);
    49484948                fSuccess = comController.isOk();
    49494949            }
     
    49564956            /* Save controller port number: */
    49574957            if (   fSuccess
    4958                 && (   newControllerData.m_controllerBus == KStorageBus_SATA
    4959                     || newControllerData.m_controllerBus == KStorageBus_SAS
    4960                     || newControllerData.m_controllerBus == KStorageBus_PCIe
    4961                     || newControllerData.m_controllerBus == KStorageBus_VirtioSCSI))
     4958                && (   newControllerData.m_enmBus == KStorageBus_SATA
     4959                    || newControllerData.m_enmBus == KStorageBus_SAS
     4960                    || newControllerData.m_enmBus == KStorageBus_PCIe
     4961                    || newControllerData.m_enmBus == KStorageBus_VirtioSCSI))
    49624962            {
    49634963                ULONG uNewPortCount = newControllerData.m_uPortCount;
     
    50135013
    50145014        /* Search for a controller with the same name: */
    5015         CStorageController comController = m_machine.GetStorageControllerByName(oldControllerData.m_strControllerName);
     5015        CStorageController comController = m_machine.GetStorageControllerByName(oldControllerData.m_strName);
    50165016        fSuccess = m_machine.isOk() && comController.isNotNull();
    50175017
     
    50225022        {
    50235023            /* Save controller type: */
    5024             if (fSuccess && newControllerData.m_controllerType != oldControllerData.m_controllerType)
     5024            if (fSuccess && newControllerData.m_enmType != oldControllerData.m_enmType)
    50255025            {
    5026                 comController.SetControllerType(newControllerData.m_controllerType);
     5026                comController.SetControllerType(newControllerData.m_enmType);
    50275027                fSuccess = comController.isOk();
    50285028            }
     
    50365036            if (   fSuccess
    50375037                && newControllerData.m_uPortCount != oldControllerData.m_uPortCount
    5038                 && (   newControllerData.m_controllerBus == KStorageBus_SATA
    5039                     || newControllerData.m_controllerBus == KStorageBus_SAS
    5040                     || newControllerData.m_controllerBus == KStorageBus_PCIe
    5041                     || newControllerData.m_controllerBus == KStorageBus_VirtioSCSI))
     5038                && (   newControllerData.m_enmBus == KStorageBus_SATA
     5039                    || newControllerData.m_enmBus == KStorageBus_SAS
     5040                    || newControllerData.m_enmBus == KStorageBus_PCIe
     5041                    || newControllerData.m_enmBus == KStorageBus_VirtioSCSI))
    50425042            {
    50435043                ULONG uNewPortCount = newControllerData.m_uPortCount;
     
    51175117
    51185118        /* Search for an attachment with the same parameters: */
    5119         const CMediumAttachment &comAttachment = m_machine.GetMediumAttachment(oldControllerData.m_strControllerName,
    5120                                                                                oldAttachmentData.m_iAttachmentPort,
    5121                                                                                oldAttachmentData.m_iAttachmentDevice);
     5119        const CMediumAttachment &comAttachment = m_machine.GetMediumAttachment(oldControllerData.m_strName,
     5120                                                                               oldAttachmentData.m_iPort,
     5121                                                                               oldAttachmentData.m_iDevice);
    51225122        fSuccess = m_machine.isOk() && comAttachment.isNotNull();
    51235123
     
    51265126        {
    51275127            /* Remove attachment: */
    5128             m_machine.DetachDevice(oldControllerData.m_strControllerName,
    5129                                    oldAttachmentData.m_iAttachmentPort,
    5130                                    oldAttachmentData.m_iAttachmentDevice);
     5128            m_machine.DetachDevice(oldControllerData.m_strName,
     5129                                   oldAttachmentData.m_iPort,
     5130                                   oldAttachmentData.m_iDevice);
    51315131            fSuccess = m_machine.isOk();
    51325132        }
     
    51555155        /* Search for an attachment with the same parameters: */
    51565156        const CMachine comMachine(m_machine);
    5157         const CMediumAttachment &comAttachment = comMachine.GetMediumAttachment(newControllerData.m_strControllerName,
    5158                                                                                 newAttachmentData.m_iAttachmentPort,
    5159                                                                                 newAttachmentData.m_iAttachmentDevice);
     5157        const CMediumAttachment &comAttachment = comMachine.GetMediumAttachment(newControllerData.m_strName,
     5158                                                                                newAttachmentData.m_iPort,
     5159                                                                                newAttachmentData.m_iDevice);
    51605160        fSuccess = !comMachine.isOk() && comAttachment.isNull();
    51615161        AssertReturn(fSuccess, false);
     
    51655165        {
    51665166            /* Create attachment: */
    5167             const UIMedium vboxMedium = uiCommon().medium(newAttachmentData.m_uAttachmentMediumId);
     5167            const UIMedium vboxMedium = uiCommon().medium(newAttachmentData.m_uMediumId);
    51685168            const CMedium comMedium = vboxMedium.medium();
    5169             m_machine.AttachDevice(newControllerData.m_strControllerName,
    5170                                    newAttachmentData.m_iAttachmentPort,
    5171                                    newAttachmentData.m_iAttachmentDevice,
    5172                                    newAttachmentData.m_attachmentType,
     5169            m_machine.AttachDevice(newControllerData.m_strName,
     5170                                   newAttachmentData.m_iPort,
     5171                                   newAttachmentData.m_iDevice,
     5172                                   newAttachmentData.m_enmDeviceType,
    51735173                                   comMedium);
    51745174            fSuccess = m_machine.isOk();
    51755175        }
    51765176
    5177         if (newAttachmentData.m_attachmentType == KDeviceType_DVD)
     5177        if (newAttachmentData.m_enmDeviceType == KDeviceType_DVD)
    51785178        {
    51795179            /* Save whether this is a passthrough device: */
    51805180            if (fSuccess && isMachineOffline())
    51815181            {
    5182                 m_machine.PassthroughDevice(newControllerData.m_strControllerName,
    5183                                             newAttachmentData.m_iAttachmentPort,
    5184                                             newAttachmentData.m_iAttachmentDevice,
    5185                                             newAttachmentData.m_fAttachmentPassthrough);
     5182                m_machine.PassthroughDevice(newControllerData.m_strName,
     5183                                            newAttachmentData.m_iPort,
     5184                                            newAttachmentData.m_iDevice,
     5185                                            newAttachmentData.m_fPassthrough);
    51865186                fSuccess = m_machine.isOk();
    51875187            }
     
    51895189            if (fSuccess)
    51905190            {
    5191                 m_machine.TemporaryEjectDevice(newControllerData.m_strControllerName,
    5192                                                newAttachmentData.m_iAttachmentPort,
    5193                                                newAttachmentData.m_iAttachmentDevice,
    5194                                                newAttachmentData.m_fAttachmentTempEject);
     5191                m_machine.TemporaryEjectDevice(newControllerData.m_strName,
     5192                                               newAttachmentData.m_iPort,
     5193                                               newAttachmentData.m_iDevice,
     5194                                               newAttachmentData.m_fTempEject);
    51955195                fSuccess = m_machine.isOk();
    51965196            }
    51975197        }
    5198         else if (newAttachmentData.m_attachmentType == KDeviceType_HardDisk)
     5198        else if (newAttachmentData.m_enmDeviceType == KDeviceType_HardDisk)
    51995199        {
    52005200            /* Save whether this is a ssd device: */
    52015201            if (fSuccess && isMachineOffline())
    52025202            {
    5203                 m_machine.NonRotationalDevice(newControllerData.m_strControllerName,
    5204                                               newAttachmentData.m_iAttachmentPort,
    5205                                               newAttachmentData.m_iAttachmentDevice,
    5206                                               newAttachmentData.m_fAttachmentNonRotational);
     5203                m_machine.NonRotationalDevice(newControllerData.m_strName,
     5204                                              newAttachmentData.m_iPort,
     5205                                              newAttachmentData.m_iDevice,
     5206                                              newAttachmentData.m_fNonRotational);
    52075207                fSuccess = m_machine.isOk();
    52085208            }
    52095209        }
    52105210
    5211         if (newControllerData.m_controllerBus == KStorageBus_SATA || newControllerData.m_controllerBus == KStorageBus_USB)
     5211        if (newControllerData.m_enmBus == KStorageBus_SATA || newControllerData.m_enmBus == KStorageBus_USB)
    52125212        {
    52135213            /* Save whether this device is hot-pluggable: */
    52145214            if (fSuccess && isMachineOffline())
    52155215            {
    5216                 m_machine.SetHotPluggableForDevice(newControllerData.m_strControllerName,
    5217                                                    newAttachmentData.m_iAttachmentPort,
    5218                                                    newAttachmentData.m_iAttachmentDevice,
    5219                                                    newAttachmentData.m_fAttachmentHotPluggable);
     5216                m_machine.SetHotPluggableForDevice(newControllerData.m_strName,
     5217                                                   newAttachmentData.m_iPort,
     5218                                                   newAttachmentData.m_iDevice,
     5219                                                   newAttachmentData.m_fHotPluggable);
    52205220                fSuccess = m_machine.isOk();
    52215221            }
     
    52445244
    52455245        /* Search for an attachment with the same parameters: */
    5246         const CMediumAttachment &comAttachment = m_machine.GetMediumAttachment(newControllerData.m_strControllerName,
    5247                                                                                newAttachmentData.m_iAttachmentPort,
    5248                                                                                newAttachmentData.m_iAttachmentDevice);
     5246        const CMediumAttachment &comAttachment = m_machine.GetMediumAttachment(newControllerData.m_strName,
     5247                                                                               newAttachmentData.m_iPort,
     5248                                                                               newAttachmentData.m_iDevice);
    52495249        fSuccess = m_machine.isOk() && comAttachment.isNotNull();
    52505250
     
    52535253        {
    52545254            /* Remount attachment: */
    5255             const UIMedium vboxMedium = uiCommon().medium(newAttachmentData.m_uAttachmentMediumId);
     5255            const UIMedium vboxMedium = uiCommon().medium(newAttachmentData.m_uMediumId);
    52565256            const CMedium comMedium = vboxMedium.medium();
    5257             m_machine.MountMedium(newControllerData.m_strControllerName,
    5258                                   newAttachmentData.m_iAttachmentPort,
    5259                                   newAttachmentData.m_iAttachmentDevice,
     5257            m_machine.MountMedium(newControllerData.m_strName,
     5258                                  newAttachmentData.m_iPort,
     5259                                  newAttachmentData.m_iDevice,
    52605260                                  comMedium,
    52615261                                  true /* force? */);
     
    52635263        }
    52645264
    5265         if (newAttachmentData.m_attachmentType == KDeviceType_DVD)
     5265        if (newAttachmentData.m_enmDeviceType == KDeviceType_DVD)
    52665266        {
    52675267            /* Save whether this is a passthrough device: */
    52685268            if (fSuccess && isMachineOffline())
    52695269            {
    5270                 m_machine.PassthroughDevice(newControllerData.m_strControllerName,
    5271                                             newAttachmentData.m_iAttachmentPort,
    5272                                             newAttachmentData.m_iAttachmentDevice,
    5273                                             newAttachmentData.m_fAttachmentPassthrough);
     5270                m_machine.PassthroughDevice(newControllerData.m_strName,
     5271                                            newAttachmentData.m_iPort,
     5272                                            newAttachmentData.m_iDevice,
     5273                                            newAttachmentData.m_fPassthrough);
    52745274                fSuccess = m_machine.isOk();
    52755275            }
     
    52775277            if (fSuccess)
    52785278            {
    5279                 m_machine.TemporaryEjectDevice(newControllerData.m_strControllerName,
    5280                                                newAttachmentData.m_iAttachmentPort,
    5281                                                newAttachmentData.m_iAttachmentDevice,
    5282                                                newAttachmentData.m_fAttachmentTempEject);
     5279                m_machine.TemporaryEjectDevice(newControllerData.m_strName,
     5280                                               newAttachmentData.m_iPort,
     5281                                               newAttachmentData.m_iDevice,
     5282                                               newAttachmentData.m_fTempEject);
    52835283                fSuccess = m_machine.isOk();
    52845284            }
    52855285        }
    5286         else if (newAttachmentData.m_attachmentType == KDeviceType_HardDisk)
     5286        else if (newAttachmentData.m_enmDeviceType == KDeviceType_HardDisk)
    52875287        {
    52885288            /* Save whether this is a ssd device: */
    52895289            if (fSuccess && isMachineOffline())
    52905290            {
    5291                 m_machine.NonRotationalDevice(newControllerData.m_strControllerName,
    5292                                               newAttachmentData.m_iAttachmentPort,
    5293                                               newAttachmentData.m_iAttachmentDevice,
    5294                                               newAttachmentData.m_fAttachmentNonRotational);
     5291                m_machine.NonRotationalDevice(newControllerData.m_strName,
     5292                                              newAttachmentData.m_iPort,
     5293                                              newAttachmentData.m_iDevice,
     5294                                              newAttachmentData.m_fNonRotational);
    52955295                fSuccess = m_machine.isOk();
    52965296            }
    52975297        }
    52985298
    5299         if (newControllerData.m_controllerBus == KStorageBus_SATA || newControllerData.m_controllerBus == KStorageBus_USB)
     5299        if (newControllerData.m_enmBus == KStorageBus_SATA || newControllerData.m_enmBus == KStorageBus_USB)
    53005300        {
    53015301            /* Save whether this device is hot-pluggable: */
    53025302            if (fSuccess && isMachineOffline())
    53035303            {
    5304                 m_machine.SetHotPluggableForDevice(newControllerData.m_strControllerName,
    5305                                                    newAttachmentData.m_iAttachmentPort,
    5306                                                    newAttachmentData.m_iAttachmentDevice,
    5307                                                    newAttachmentData.m_fAttachmentHotPluggable);
     5304                m_machine.SetHotPluggableForDevice(newControllerData.m_strName,
     5305                                                   newAttachmentData.m_iPort,
     5306                                                   newAttachmentData.m_iDevice,
     5307                                                   newAttachmentData.m_fHotPluggable);
    53085308                fSuccess = m_machine.isOk();
    53095309            }
     
    53285328    const UIDataSettingsMachineStorageController &newControllerData = controllerCache.data();
    53295329    return true
    5330            && (newControllerData.m_strControllerName == oldControllerData.m_strControllerName)
    5331            && (newControllerData.m_controllerBus == oldControllerData.m_controllerBus)
     5330           && (newControllerData.m_strName == oldControllerData.m_strName)
     5331           && (newControllerData.m_enmBus == oldControllerData.m_enmBus)
    53325332           ;
    53335333}
     
    53425342    const UIDataSettingsMachineStorageAttachment &newAttachmentData = attachmentCache.data();
    53435343    return true
    5344            && (newAttachmentData.m_attachmentType == oldAttachmentData.m_attachmentType)
    5345            && (newAttachmentData.m_iAttachmentPort == oldAttachmentData.m_iAttachmentPort)
    5346            && (newAttachmentData.m_iAttachmentDevice == oldAttachmentData.m_iAttachmentDevice)
    5347            && (newAttachmentData.m_attachmentType == KDeviceType_Floppy || newAttachmentData.m_attachmentType == KDeviceType_DVD)
     5344           && (newAttachmentData.m_enmDeviceType == oldAttachmentData.m_enmDeviceType)
     5345           && (newAttachmentData.m_iPort == oldAttachmentData.m_iPort)
     5346           && (newAttachmentData.m_iDevice == oldAttachmentData.m_iDevice)
     5347           && (newAttachmentData.m_enmDeviceType == KDeviceType_Floppy || newAttachmentData.m_enmDeviceType == KDeviceType_DVD)
    53485348           ;
    53495349}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h

    r81095 r81098  
    5252
    5353    /** Holds the controller mime-type for the D&D system. */
    54     static const QString ControllerMimeType;
     54    static const QString s_strControllerMimeType;
    5555    /** Holds the attachment mime-type for the D&D system. */
    56     static const QString AttachmentMimeType;
     56    static const QString s_strAttachmentMimeType;
    5757
    5858    /** Constructs Storage settings page. */
     
    158158    void sltUpdateActionStates();
    159159
    160     /** Handles row insertion into @a parent on @a iPosition. */
    161     void sltHandleRowInsertion(const QModelIndex &parent, int iPosition);
     160    /** Handles row insertion into @a parentIndex on @a iPosition. */
     161    void sltHandleRowInsertion(const QModelIndex &parentIndex, int iPosition);
    162162    /** Handles row removal. */
    163163    void sltHandleRowRemoval();
Note: See TracChangeset for help on using the changeset viewer.

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