VirtualBox

Changeset 102937 in vbox


Ignore:
Timestamp:
Jan 17, 2024 6:33:00 PM (13 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10513: VM settings / Storage page: Heavy rework simplifying UIStorageSettingsEditor code to be more abstract; This is necessary to work with proxy/filter model without changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIStorageSettingsEditor.cpp

    r102936 r102937  
    30313031    m_pModelStorage->setConfigurationAccessLevel(enmConfigurationAccessLevel);
    30323032
     3033    /* Acquire model: */
     3034    AssertPtrReturnVoid(m_pTreeViewStorage);
     3035    const QAbstractItemModel *pModel = m_pTreeViewStorage->model();
     3036    AssertPtrReturnVoid(pModel);
     3037
    30333038    /* Acquire various options: */
    30343039    const bool fMachineOffline = m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full;
     
    30383043    const bool fMachineInValidMode = fMachineOffline || fMachinePoweredOff || fMachineSaved || fMachineOnline;
    30393044    const QModelIndex index = m_pTreeViewStorage->currentIndex();
    3040     const KDeviceType enmDeviceType = m_pModelStorage->data(index, StorageModel::R_AttDevice).value<KDeviceType>();
     3045    const KDeviceType enmDeviceType = pModel->data(index, StorageModel::R_AttDevice).value<KDeviceType>();
    30413046
    30423047    /* Polish left pane availability: */
     
    31693174
    31703175    /* Choose first controller as current: */
    3171     if (m_pModelStorage->rowCount(m_pModelStorage->root()) > 0)
    3172         m_pTreeViewStorage->setCurrentIndex(m_pModelStorage->index(0, 0, m_pModelStorage->root()));
     3176    AssertPtrReturnVoid(m_pTreeViewStorage);
     3177    const QAbstractItemModel *pModel = m_pTreeViewStorage->model();
     3178    AssertPtrReturnVoid(pModel);
     3179    const QModelIndex rootIndex = pModel->index(0, 0);
     3180    if (pModel->rowCount(rootIndex) > 0)
     3181        m_pTreeViewStorage->setCurrentIndex(pModel->index(0, 0, rootIndex));
    31733182
    31743183    /* Fetch recent information: */
     
    34443453void UIStorageSettingsEditor::sltRemoveController()
    34453454{
    3446     /* Acquire current index: */
     3455    /* Acquire model and current index: */
    34473456    AssertPtrReturnVoid(m_pTreeViewStorage);
     3457    const QAbstractItemModel *pModel = m_pTreeViewStorage->model();
     3458    AssertPtrReturnVoid(pModel);
    34483459    const QModelIndex index = m_pTreeViewStorage->currentIndex();
     3460    AssertReturnVoid(pModel->data(index, StorageModel::R_IsController).toBool());
     3461
     3462    /* Remove controller: */
    34493463    AssertPtrReturnVoid(m_pModelStorage);
    3450     AssertReturnVoid(m_pModelStorage->data(index, StorageModel::R_IsController).toBool());
    3451 
    3452     /* Remove controller: */
    3453     m_pModelStorage->delController(m_pModelStorage->data(index, StorageModel::R_ItemId).toUuid());
     3464    m_pModelStorage->delController(pModel->data(index, StorageModel::R_ItemId).toUuid());
    34543465
    34553466    /* Notify listeners: */
     
    34593470void UIStorageSettingsEditor::sltAddAttachment()
    34603471{
    3461     /* Acquire current index: */
     3472    /* Acquire model and current index: */
    34623473    AssertPtrReturnVoid(m_pTreeViewStorage);
     3474    const QAbstractItemModel *pModel = m_pTreeViewStorage->model();
     3475    AssertPtrReturnVoid(pModel);
    34633476    const QModelIndex index = m_pTreeViewStorage->currentIndex();
    3464     AssertPtrReturnVoid(m_pModelStorage);
    3465     AssertReturnVoid(m_pModelStorage->data(index, StorageModel::R_IsController).toBool());
     3477    AssertReturnVoid(pModel->data(index, StorageModel::R_IsController).toBool());
    34663478
    34673479    /* Prepare menu: */
    3468     const DeviceTypeList deviceTypeList = m_pModelStorage->data(index, StorageModel::R_CtrDevices).value<DeviceTypeList>();
     3480    const DeviceTypeList deviceTypeList = pModel->data(index, StorageModel::R_CtrDevices).value<DeviceTypeList>();
    34693481    const bool fJustTrigger = deviceTypeList.size() == 1;
    34703482    const bool fShowMenu = deviceTypeList.size() > 1;
     
    35193531    /* Acquire model, current index and it's parent index: */
    35203532    AssertPtrReturnVoid(m_pTreeViewStorage);
     3533    const QAbstractItemModel *pModel = m_pTreeViewStorage->model();
     3534    AssertPtrReturnVoid(pModel);
    35213535    const QModelIndex index = m_pTreeViewStorage->currentIndex();
    3522     AssertPtrReturnVoid(m_pModelStorage);
    3523     AssertReturnVoid(m_pModelStorage->data(index, StorageModel::R_IsAttachment).toBool());
     3536    AssertReturnVoid(pModel->data(index, StorageModel::R_IsAttachment).toBool());
    35243537    const QModelIndex parentIndex = index.parent();
    3525     AssertReturnVoid(m_pModelStorage->data(parentIndex, StorageModel::R_IsController).toBool());
     3538    AssertReturnVoid(pModel->data(parentIndex, StorageModel::R_IsController).toBool());
    35263539
    35273540    /* Check if this would be the last DVD. If so let the user confirm this again. */
    3528     const KDeviceType enmDeviceType = m_pModelStorage->data(index, StorageModel::R_AttDevice).value<KDeviceType>();
     3541    const KDeviceType enmDeviceType = pModel->data(index, StorageModel::R_AttDevice).value<KDeviceType>();
    35293542    if (   enmDeviceType == KDeviceType_DVD
    35303543        && deviceCount(KDeviceType_DVD) == 1
     
    35333546
    35343547    /* Remove attachment: */
    3535     m_pModelStorage->delAttachment(m_pModelStorage->data(parentIndex, StorageModel::R_ItemId).toUuid(),
    3536                                    m_pModelStorage->data(index, StorageModel::R_ItemId).toUuid());
     3548    AssertPtrReturnVoid(m_pModelStorage);
     3549    m_pModelStorage->delAttachment(pModel->data(parentIndex, StorageModel::R_ItemId).toUuid(),
     3550                                   pModel->data(index, StorageModel::R_ItemId).toUuid());
    35373551
    35383552    /* Notify listeners: */
     
    35423556void UIStorageSettingsEditor::sltGetInformation()
    35433557{
     3558    /* Acquire model: */
     3559    AssertPtrReturnVoid(m_pTreeViewStorage);
     3560    const QAbstractItemModel *pModel = m_pTreeViewStorage->model();
     3561    AssertPtrReturnVoid(pModel);
     3562
    35443563    m_fLoadingInProgress = true;
    35453564
    3546     AssertPtrReturnVoid(m_pTreeViewStorage);
    35473565    const QModelIndex index = m_pTreeViewStorage->currentIndex();
    3548     AssertPtrReturnVoid(m_pModelStorage);
    3549     if (!index.isValid() || index == m_pModelStorage->root())
     3566    if (!index.isValid() || index == pModel->index(0, 0))
    35503567    {
    35513568        /* Showing initial page: */
     
    35543571    else
    35553572    {
    3556         switch (m_pModelStorage->data(index, StorageModel::R_ItemType).value<AbstractItem::ItemType>())
     3573        switch (pModel->data(index, StorageModel::R_ItemType).value<AbstractItem::ItemType>())
    35573574        {
    35583575            case AbstractItem::Type_ControllerItem:
    35593576            {
    35603577                /* Getting controller name: */
    3561                 const QString strCtrName = m_pModelStorage->data(index, StorageModel::R_CtrName).toString();
     3578                const QString strCtrName = pModel->data(index, StorageModel::R_CtrName).toString();
    35623579                if (m_pEditorName->text() != strCtrName)
    35633580                    m_pEditorName->setText(strCtrName);
     
    35663583                m_pComboType->clear();
    35673584                /* Getting controller buses: */
    3568                 const ControllerBusList controllerBusList(m_pModelStorage->data(index, StorageModel::R_CtrBusTypes).value<ControllerBusList>());
     3585                const ControllerBusList controllerBusList(pModel->data(index, StorageModel::R_CtrBusTypes).value<ControllerBusList>());
    35693586                foreach (const KStorageBus &enmCurrentBus, controllerBusList)
    35703587                {
    35713588                    /* Getting controller types: */
    3572                     const ControllerTypeList controllerTypeList(m_pModelStorage->data(index, StorageModel::busToRole(enmCurrentBus)).value<ControllerTypeList>());
     3589                    const ControllerTypeList controllerTypeList(pModel->data(index, StorageModel::busToRole(enmCurrentBus)).value<ControllerTypeList>());
    35733590                    foreach (const KStorageControllerType &enmCurrentType, controllerTypeList)
    35743591                    {
     
    35783595                    }
    35793596                }
    3580                 const KStorageControllerType enmType = m_pModelStorage->data(index, StorageModel::R_CtrType).value<KStorageControllerType>();
     3597                const KStorageControllerType enmType = pModel->data(index, StorageModel::R_CtrType).value<KStorageControllerType>();
    35813598                const int iCtrPos = m_pComboType->findData(QVariant::fromValue(enmType), StorageModel::R_CtrType);
    35823599                m_pComboType->setCurrentIndex(iCtrPos == -1 ? 0 : iCtrPos);
    35833600
    3584                 const KStorageBus enmBus = m_pModelStorage->data(index, StorageModel::R_CtrBusType).value<KStorageBus>();
     3601                const KStorageBus enmBus = pModel->data(index, StorageModel::R_CtrBusType).value<KStorageBus>();
    35853602                m_pLabelPortCount->setVisible(enmBus == KStorageBus_SATA || enmBus == KStorageBus_SAS);
    35863603                m_pSpinboxPortCount->setVisible(enmBus == KStorageBus_SATA || enmBus == KStorageBus_SAS);
    3587                 const uint uPortCount = m_pModelStorage->data(index, StorageModel::R_CtrPortCount).toUInt();
    3588                 const uint uMaxPortCount = m_pModelStorage->data(index, StorageModel::R_CtrMaxPortCount).toUInt();
     3604                const uint uPortCount = pModel->data(index, StorageModel::R_CtrPortCount).toUInt();
     3605                const uint uMaxPortCount = pModel->data(index, StorageModel::R_CtrMaxPortCount).toUInt();
    35893606                m_pSpinboxPortCount->setMaximum(uMaxPortCount);
    35903607                m_pSpinboxPortCount->setValue(uPortCount);
    35913608
    3592                 const bool fUseIoCache = m_pModelStorage->data(index, StorageModel::R_CtrIoCache).toBool();
     3609                const bool fUseIoCache = pModel->data(index, StorageModel::R_CtrIoCache).toBool();
    35933610                m_pCheckBoxIoCache->setChecked(fUseIoCache);
    35943611
     
    36013618                /* Getting attachment slot: */
    36023619                m_pComboSlot->clear();
    3603                 const SlotsList slotsList(m_pModelStorage->data(index, StorageModel::R_AttSlots).value<SlotsList>());
     3620                const SlotsList slotsList(pModel->data(index, StorageModel::R_AttSlots).value<SlotsList>());
    36043621                for (int i = 0; i < slotsList.size(); ++i)
    36053622                    m_pComboSlot->insertItem(m_pComboSlot->count(), gpConverter->toString(slotsList[i]));
    3606                 const StorageSlot slt = m_pModelStorage->data(index, StorageModel::R_AttSlot).value<StorageSlot>();
     3623                const StorageSlot slt = pModel->data(index, StorageModel::R_AttSlot).value<StorageSlot>();
    36073624                const int iAttSlotPos = m_pComboSlot->findText(gpConverter->toString(slt));
    36083625                m_pComboSlot->setCurrentIndex(iAttSlotPos == -1 ? 0 : iAttSlotPos);
     
    36103627
    36113628                /* Getting attachment medium: */
    3612                 const KDeviceType enmDeviceType = m_pModelStorage->data(index, StorageModel::R_AttDevice).value<KDeviceType>();
     3629                const KDeviceType enmDeviceType = pModel->data(index, StorageModel::R_AttDevice).value<KDeviceType>();
    36133630                switch (enmDeviceType)
    36143631                {
     
    36403657
    36413658                /* Get hot-pluggable state: */
    3642                 const bool fIsHotPluggable = m_pModelStorage->data(index, StorageModel::R_AttIsHotPluggable).toBool();
     3659                const bool fIsHotPluggable = pModel->data(index, StorageModel::R_AttIsHotPluggable).toBool();
    36433660
    36443661                /* Fetch device-type, medium-id: */
    36453662                m_pMediumIdHolder->setType(mediumTypeToLocal(enmDeviceType));
    3646                 m_pMediumIdHolder->setId(QUuid(m_pModelStorage->data(index, StorageModel::R_AttMediumId).toString()));
     3663                m_pMediumIdHolder->setId(QUuid(pModel->data(index, StorageModel::R_AttMediumId).toString()));
    36473664
    36483665                /* Get/fetch editable state: */
     
    36563673
    36573674                /* Getting passthrough state: */
    3658                 const bool fHostDrive = m_pModelStorage->data(index, StorageModel::R_AttIsHostDrive).toBool();
     3675                const bool fHostDrive = pModel->data(index, StorageModel::R_AttIsHostDrive).toBool();
    36593676                m_pCheckBoxPassthrough->setVisible(enmDeviceType == KDeviceType_DVD && fHostDrive);
    3660                 m_pCheckBoxPassthrough->setChecked(fHostDrive && m_pModelStorage->data(index, StorageModel::R_AttIsPassthrough).toBool());
     3677                m_pCheckBoxPassthrough->setChecked(fHostDrive && pModel->data(index, StorageModel::R_AttIsPassthrough).toBool());
    36613678
    36623679                /* Getting temp-eject state: */
    36633680                m_pCheckBoxTempEject->setVisible(enmDeviceType == KDeviceType_DVD && !fHostDrive);
    3664                 m_pCheckBoxTempEject->setChecked(!fHostDrive && m_pModelStorage->data(index, StorageModel::R_AttIsTempEject).toBool());
     3681                m_pCheckBoxTempEject->setChecked(!fHostDrive && pModel->data(index, StorageModel::R_AttIsTempEject).toBool());
    36653682
    36663683                /* Getting non-rotational state: */
    36673684                m_pCheckBoxNonRotational->setVisible(enmDeviceType == KDeviceType_HardDisk);
    3668                 m_pCheckBoxNonRotational->setChecked(m_pModelStorage->data(index, StorageModel::R_AttIsNonRotational).toBool());
     3685                m_pCheckBoxNonRotational->setChecked(pModel->data(index, StorageModel::R_AttIsNonRotational).toBool());
    36693686
    36703687                /* Fetch hot-pluggable state: */
     
    36893706
    36903707                /* Getting other information: */
    3691                 m_pFieldHDFormat->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttFormat).toString()));
    3692                 m_pFieldCDFDType->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttFormat).toString()));
    3693                 m_pFieldHDVirtualSize->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttLogicalSize).toString()));
    3694                 m_pFieldHDActualSize->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttSize).toString()));
    3695                 m_pFieldCDFDSize->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttSize).toString()));
    3696                 m_pFieldHDDetails->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttDetails).toString()));
    3697                 m_pFieldLocation->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttLocation).toString()));
    3698                 m_pFieldUsage->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttUsage).toString()));
    3699                 m_pFieldEncryption->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttEncryptionPasswordID).toString()));
     3708                m_pFieldHDFormat->setText(compressText(pModel->data(index, StorageModel::R_AttFormat).toString()));
     3709                m_pFieldCDFDType->setText(compressText(pModel->data(index, StorageModel::R_AttFormat).toString()));
     3710                m_pFieldHDVirtualSize->setText(compressText(pModel->data(index, StorageModel::R_AttLogicalSize).toString()));
     3711                m_pFieldHDActualSize->setText(compressText(pModel->data(index, StorageModel::R_AttSize).toString()));
     3712                m_pFieldCDFDSize->setText(compressText(pModel->data(index, StorageModel::R_AttSize).toString()));
     3713                m_pFieldHDDetails->setText(compressText(pModel->data(index, StorageModel::R_AttDetails).toString()));
     3714                m_pFieldLocation->setText(compressText(pModel->data(index, StorageModel::R_AttLocation).toString()));
     3715                m_pFieldUsage->setText(compressText(pModel->data(index, StorageModel::R_AttUsage).toString()));
     3716                m_pFieldEncryption->setText(compressText(pModel->data(index, StorageModel::R_AttEncryptionPasswordID).toString()));
    37003717
    37013718                /* Showing attachment page: */
     
    37163733void UIStorageSettingsEditor::sltSetInformation()
    37173734{
    3718     /* Acquire current index: */
     3735    /* Acquire model and current index: */
    37193736    AssertPtrReturnVoid(m_pTreeViewStorage);
     3737    QAbstractItemModel *pModel = m_pTreeViewStorage->model();
     3738    AssertPtrReturnVoid(pModel);
    37203739    const QModelIndex index = m_pTreeViewStorage->currentIndex();
    3721     AssertPtrReturnVoid(m_pModelStorage);
    3722     if (m_fLoadingInProgress || !index.isValid() || index == m_pModelStorage->root())
     3740    if (m_fLoadingInProgress || !index.isValid() || index == pModel->index(0, 0))
    37233741        return;
    37243742
    37253743    QObject *pSender = sender();
    3726     switch (m_pModelStorage->data(index, StorageModel::R_ItemType).value<AbstractItem::ItemType>())
     3744    switch (pModel->data(index, StorageModel::R_ItemType).value<AbstractItem::ItemType>())
    37273745    {
    37283746        case AbstractItem::Type_ControllerItem:
     
    37303748            /* Setting controller name: */
    37313749            if (pSender == m_pEditorName)
    3732                 m_pModelStorage->setData(index, m_pEditorName->text(), StorageModel::R_CtrName);
     3750                pModel->setData(index, m_pEditorName->text(), StorageModel::R_CtrName);
    37333751            /* Setting controller sub-type: */
    37343752            else if (pSender == m_pComboType)
     
    37373755                const KStorageControllerType enmType = m_pComboType->currentData(StorageModel::R_CtrType).value<KStorageControllerType>();
    37383756                const bool fResult =
    3739                     m_pModelStorage->setData(index, QVariant::fromValue(enmBus), StorageModel::R_CtrBusType);
     3757                    pModel->setData(index, QVariant::fromValue(enmBus), StorageModel::R_CtrBusType);
    37403758                if (fResult)
    3741                     m_pModelStorage->setData(index, QVariant::fromValue(enmType), StorageModel::R_CtrType);
     3759                    pModel->setData(index, QVariant::fromValue(enmType), StorageModel::R_CtrType);
    37423760            }
    37433761            else if (pSender == m_pSpinboxPortCount)
    3744                 m_pModelStorage->setData(index, m_pSpinboxPortCount->value(), StorageModel::R_CtrPortCount);
     3762                pModel->setData(index, m_pSpinboxPortCount->value(), StorageModel::R_CtrPortCount);
    37453763            else if (pSender == m_pCheckBoxIoCache)
    3746                 m_pModelStorage->setData(index, m_pCheckBoxIoCache->isChecked(), StorageModel::R_CtrIoCache);
     3764                pModel->setData(index, m_pCheckBoxIoCache->isChecked(), StorageModel::R_CtrIoCache);
    37473765            break;
    37483766        }
     
    37523770            if (pSender == m_pComboSlot)
    37533771            {
    3754                 QModelIndex controllerIndex = m_pModelStorage->parent(index);
     3772                QModelIndex controllerIndex = pModel->parent(index);
    37553773                StorageSlot attachmentStorageSlot = gpConverter->fromString<StorageSlot>(m_pComboSlot->currentText());
    3756                 m_pModelStorage->setData(index, QVariant::fromValue(attachmentStorageSlot), StorageModel::R_AttSlot);
    3757                 for (int iAttachmentIndex = 0; iAttachmentIndex < m_pModelStorage->rowCount(controllerIndex); ++iAttachmentIndex)
     3774                pModel->setData(index, QVariant::fromValue(attachmentStorageSlot), StorageModel::R_AttSlot);
     3775                for (int iAttachmentIndex = 0; iAttachmentIndex < pModel->rowCount(controllerIndex); ++iAttachmentIndex)
    37583776                {
    3759                     QModelIndex enumeratedIndex = m_pModelStorage->index(iAttachmentIndex, 0, controllerIndex);
    3760                     StorageSlot enumeratedStorageSlot = m_pModelStorage->data(enumeratedIndex, StorageModel::R_AttSlot).value<StorageSlot>();
     3777                    QModelIndex enumeratedIndex = pModel->index(iAttachmentIndex, 0, controllerIndex);
     3778                    StorageSlot enumeratedStorageSlot = pModel->data(enumeratedIndex, StorageModel::R_AttSlot).value<StorageSlot>();
    37613779                    if (enumeratedStorageSlot == attachmentStorageSlot)
    37623780                    {
     
    37683786            /* Setting attachment medium: */
    37693787            else if (pSender == m_pMediumIdHolder)
    3770                 m_pModelStorage->setData(index, m_pMediumIdHolder->id(), StorageModel::R_AttMediumId);
     3788                pModel->setData(index, m_pMediumIdHolder->id(), StorageModel::R_AttMediumId);
    37713789            else if (pSender == m_pCheckBoxPassthrough)
    37723790            {
    3773                 if (m_pModelStorage->data(index, StorageModel::R_AttIsHostDrive).toBool())
    3774                     m_pModelStorage->setData(index, m_pCheckBoxPassthrough->isChecked(), StorageModel::R_AttIsPassthrough);
     3791                if (pModel->data(index, StorageModel::R_AttIsHostDrive).toBool())
     3792                    pModel->setData(index, m_pCheckBoxPassthrough->isChecked(), StorageModel::R_AttIsPassthrough);
    37753793            }
    37763794            else if (pSender == m_pCheckBoxTempEject)
    37773795            {
    3778                 if (!m_pModelStorage->data(index, StorageModel::R_AttIsHostDrive).toBool())
    3779                     m_pModelStorage->setData(index, m_pCheckBoxTempEject->isChecked(), StorageModel::R_AttIsTempEject);
     3796                if (!pModel->data(index, StorageModel::R_AttIsHostDrive).toBool())
     3797                    pModel->setData(index, m_pCheckBoxTempEject->isChecked(), StorageModel::R_AttIsTempEject);
    37803798            }
    37813799            else if (pSender == m_pCheckBoxNonRotational)
    37823800            {
    3783                 m_pModelStorage->setData(index, m_pCheckBoxNonRotational->isChecked(), StorageModel::R_AttIsNonRotational);
     3801                pModel->setData(index, m_pCheckBoxNonRotational->isChecked(), StorageModel::R_AttIsNonRotational);
    37843802            }
    37853803            else if (pSender == m_pCheckBoxHotPluggable)
    37863804            {
    3787                 m_pModelStorage->setData(index, m_pCheckBoxHotPluggable->isChecked(), StorageModel::R_AttIsHotPluggable);
     3805                pModel->setData(index, m_pCheckBoxHotPluggable->isChecked(), StorageModel::R_AttIsHotPluggable);
    37883806            }
    37893807            break;
     
    39283946void UIStorageSettingsEditor::sltUpdateActionStates()
    39293947{
    3930     /* Acquire current index: */
     3948    /* Acquire model and current index: */
    39313949    AssertPtrReturnVoid(m_pTreeViewStorage);
     3950    const QAbstractItemModel *pModel = m_pTreeViewStorage->model();
     3951    AssertPtrReturnVoid(pModel);
    39323952    const QModelIndex index = m_pTreeViewStorage->currentIndex();
    39333953
    39343954    /* Acquire options: */
    3935     AssertPtrReturnVoid(m_pModelStorage);
    3936     const bool fIDEPossible = m_pModelStorage->data(index, StorageModel::R_IsMoreIDEControllersPossible).toBool();
    3937     const bool fSATAPossible = m_pModelStorage->data(index, StorageModel::R_IsMoreSATAControllersPossible).toBool();
    3938     const bool fSCSIPossible = m_pModelStorage->data(index, StorageModel::R_IsMoreSCSIControllersPossible).toBool();
    3939     const bool fFloppyPossible = m_pModelStorage->data(index, StorageModel::R_IsMoreFloppyControllersPossible).toBool();
    3940     const bool fSASPossible = m_pModelStorage->data(index, StorageModel::R_IsMoreSASControllersPossible).toBool();
    3941     const bool fUSBPossible = m_pModelStorage->data(index, StorageModel::R_IsMoreUSBControllersPossible).toBool();
    3942     const bool fNVMePossible = m_pModelStorage->data(index, StorageModel::R_IsMoreNVMeControllersPossible).toBool();
    3943     const bool fVirtioSCSIPossible = m_pModelStorage->data(index, StorageModel::R_IsMoreVirtioSCSIControllersPossible).toBool();
    3944     const bool fController = m_pModelStorage->data(index, StorageModel::R_IsController).toBool();
    3945     const bool fAttachment = m_pModelStorage->data(index, StorageModel::R_IsAttachment).toBool();
    3946     const bool fAttachmentsPossible = m_pModelStorage->data(index, StorageModel::R_IsMoreAttachmentsPossible).toBool();
    3947     const bool fIsAttachmentHotPluggable = m_pModelStorage->data(index, StorageModel::R_AttIsHotPluggable).toBool();
     3955    const bool fIDEPossible = pModel->data(index, StorageModel::R_IsMoreIDEControllersPossible).toBool();
     3956    const bool fSATAPossible = pModel->data(index, StorageModel::R_IsMoreSATAControllersPossible).toBool();
     3957    const bool fSCSIPossible = pModel->data(index, StorageModel::R_IsMoreSCSIControllersPossible).toBool();
     3958    const bool fFloppyPossible = pModel->data(index, StorageModel::R_IsMoreFloppyControllersPossible).toBool();
     3959    const bool fSASPossible = pModel->data(index, StorageModel::R_IsMoreSASControllersPossible).toBool();
     3960    const bool fUSBPossible = pModel->data(index, StorageModel::R_IsMoreUSBControllersPossible).toBool();
     3961    const bool fNVMePossible = pModel->data(index, StorageModel::R_IsMoreNVMeControllersPossible).toBool();
     3962    const bool fVirtioSCSIPossible = pModel->data(index, StorageModel::R_IsMoreVirtioSCSIControllersPossible).toBool();
     3963    const bool fController = pModel->data(index, StorageModel::R_IsController).toBool();
     3964    const bool fAttachment = pModel->data(index, StorageModel::R_IsAttachment).toBool();
     3965    const bool fAttachmentsPossible = pModel->data(index, StorageModel::R_IsMoreAttachmentsPossible).toBool();
     3966    const bool fIsAttachmentHotPluggable = pModel->data(index, StorageModel::R_AttIsHotPluggable).toBool();
    39483967
    39493968    /* Configure "add controller" actions: */
     
    39814000void UIStorageSettingsEditor::sltHandleRowInsertion(const QModelIndex &parentIndex, int iPosition)
    39824001{
    3983     /* Acquire current index: */
     4002    /* Acquire model and current index: */
    39844003    AssertPtrReturnVoid(m_pTreeViewStorage);
    3985     const QModelIndex index = m_pModelStorage->index(iPosition, 0, parentIndex);
    3986 
    3987     switch (m_pModelStorage->data(index, StorageModel::R_ItemType).value<AbstractItem::ItemType>())
     4004    const QAbstractItemModel *pModel = m_pTreeViewStorage->model();
     4005    AssertPtrReturnVoid(pModel);
     4006    const QModelIndex index = pModel->index(iPosition, 0, parentIndex);
     4007
     4008    switch (pModel->data(index, StorageModel::R_ItemType).value<AbstractItem::ItemType>())
    39884009    {
    39894010        case AbstractItem::Type_ControllerItem:
     
    40104031void UIStorageSettingsEditor::sltHandleRowRemoval()
    40114032{
     4033    /* Acquire model: */
     4034    AssertPtrReturnVoid(m_pTreeViewStorage);
     4035    const QAbstractItemModel *pModel = m_pTreeViewStorage->model();
     4036    AssertPtrReturnVoid(pModel);
     4037
    40124038    /* If no items left => just choose the root to be currnt: */
    4013     AssertPtrReturnVoid(m_pModelStorage);
    4014     AssertPtrReturnVoid(m_pTreeViewStorage);
    4015     if (m_pModelStorage->rowCount(m_pModelStorage->root()) == 0)
    4016         m_pTreeViewStorage->setCurrentIndex(m_pModelStorage->root());
     4039    if (pModel->rowCount(pModel->index(0, 0)) == 0)
     4040        m_pTreeViewStorage->setCurrentIndex(pModel->index(0, 0));
    40174041
    40184042    sltUpdateActionStates();
     
    40284052void UIStorageSettingsEditor::sltHandleContextMenuRequest(const QPoint &position)
    40294053{
     4054    /* Acquire model: */
     4055    AssertPtrReturnVoid(m_pTreeViewStorage);
     4056    const QAbstractItemModel *pModel = m_pTreeViewStorage->model();
     4057    AssertPtrReturnVoid(pModel);
     4058
    40304059    /* Forget last mouse press position: */
    40314060    m_mousePressPosition = QPoint();
    40324061
    4033     AssertPtrReturnVoid(m_pTreeViewStorage);
    40344062    const QModelIndex index = m_pTreeViewStorage->indexAt(position);
    40354063    if (!index.isValid())
     
    40374065
    40384066    QMenu menu;
    4039     AssertPtrReturnVoid(m_pModelStorage);
    4040     switch (m_pModelStorage->data(index, StorageModel::R_ItemType).value<AbstractItem::ItemType>())
     4067    switch (pModel->data(index, StorageModel::R_ItemType).value<AbstractItem::ItemType>())
    40414068    {
    40424069        case AbstractItem::Type_ControllerItem:
    40434070        {
    4044             const DeviceTypeList deviceTypeList(m_pModelStorage->data(index, StorageModel::R_CtrDevices).value<DeviceTypeList>());
     4071            const DeviceTypeList deviceTypeList(pModel->data(index, StorageModel::R_CtrDevices).value<DeviceTypeList>());
    40454072            foreach (KDeviceType enmDeviceType, deviceTypeList)
    40464073            {
     
    40774104void UIStorageSettingsEditor::sltHandleDrawItemBranches(QPainter *pPainter, const QRect &rect, const QModelIndex &index)
    40784105{
     4106    /* Acquire model: */
     4107    AssertPtrReturnVoid(m_pTreeViewStorage);
     4108    const QAbstractItemModel *pModel = m_pTreeViewStorage->model();
     4109    AssertPtrReturnVoid(pModel);
     4110
    40794111    /* Make sure we are painting branches for attachments only,
    40804112     * i.e. for items which have parent which have parent as well: */
     
    40844116    pPainter->save();
    40854117    QStyleOption options;
    4086     AssertPtrReturnVoid(m_pTreeViewStorage);
    40874118    options.initFrom(m_pTreeViewStorage);
    40884119    options.rect = rect;
    40894120    options.state |= QStyle::State_Item;
    4090     AssertPtrReturnVoid(m_pModelStorage);
    4091     if (index.row() < m_pModelStorage->rowCount(index.parent()) - 1)
     4121    if (index.row() < pModel->rowCount(index.parent()) - 1)
    40924122        options.state |= QStyle::State_Sibling;
    40934123    /* This pen is commonly used by different
     
    41034133void UIStorageSettingsEditor::sltHandleMouseMove(QMouseEvent *pEvent)
    41044134{
     4135    /* Acquire model: */
     4136    AssertPtrReturnVoid(m_pTreeViewStorage);
     4137    QAbstractItemModel *pModel = m_pTreeViewStorage->model();
     4138    AssertPtrReturnVoid(pModel);
     4139
    41054140    /* Make sure event is valid: */
    41064141    AssertPtrReturnVoid(pEvent);
     
    41084143    const QPoint lPos = pEvent->position().toPoint();
    41094144
    4110     AssertPtrReturnVoid(m_pTreeViewStorage);
    41114145    const QModelIndex index = m_pTreeViewStorage->indexAt(lPos);
    41124146    const QRect indexRect = m_pTreeViewStorage->visualRect(index);
    41134147
    41144148    /* Expander tool-tip: */
    4115     AssertPtrReturnVoid(m_pModelStorage);
    4116     if (m_pModelStorage->data(index, StorageModel::R_IsController).toBool())
    4117     {
    4118         QRect expanderRect = m_pModelStorage->data(index, StorageModel::R_ItemPixmapRect).toRect();
     4149    if (pModel->data(index, StorageModel::R_IsController).toBool())
     4150    {
     4151        QRect expanderRect = pModel->data(index, StorageModel::R_ItemPixmapRect).toRect();
    41194152        expanderRect.translate(indexRect.x(), indexRect.y());
    41204153        if (expanderRect.contains(lPos))
    41214154        {
    41224155            pEvent->setAccepted(true);
    4123             if (m_pModelStorage->data(index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::ToolTipType_Expander)
    4124                 m_pModelStorage->setData(index, QVariant::fromValue(StorageModel::ToolTipType_Expander), StorageModel::R_ToolTipType);
     4156            if (pModel->data(index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::ToolTipType_Expander)
     4157                pModel->setData(index, QVariant::fromValue(StorageModel::ToolTipType_Expander), StorageModel::R_ToolTipType);
    41254158            return;
    41264159        }
     
    41284161
    41294162    /* Adder tool-tip: */
    4130     if (m_pModelStorage->data(index, StorageModel::R_IsController).toBool() &&
     4163    if (pModel->data(index, StorageModel::R_IsController).toBool() &&
    41314164        m_pTreeViewStorage->currentIndex() == index)
    41324165    {
    4133         const DeviceTypeList devicesList(m_pModelStorage->data(index, StorageModel::R_CtrDevices).value<DeviceTypeList>());
     4166        const DeviceTypeList devicesList(pModel->data(index, StorageModel::R_CtrDevices).value<DeviceTypeList>());
    41344167        for (int i = 0; i < devicesList.size(); ++ i)
    41354168        {
     
    41414174                case KDeviceType_HardDisk:
    41424175                {
    4143                     deviceRect = m_pModelStorage->data(index, StorageModel::R_HDPixmapRect).toRect();
     4176                    deviceRect = pModel->data(index, StorageModel::R_HDPixmapRect).toRect();
    41444177                    break;
    41454178                }
    41464179                case KDeviceType_DVD:
    41474180                {
    4148                     deviceRect = m_pModelStorage->data(index, StorageModel::R_CDPixmapRect).toRect();
     4181                    deviceRect = pModel->data(index, StorageModel::R_CDPixmapRect).toRect();
    41494182                    break;
    41504183                }
    41514184                case KDeviceType_Floppy:
    41524185                {
    4153                     deviceRect = m_pModelStorage->data(index, StorageModel::R_FDPixmapRect).toRect();
     4186                    deviceRect = pModel->data(index, StorageModel::R_FDPixmapRect).toRect();
    41544187                    break;
    41554188                }
     
    41664199                    case KDeviceType_HardDisk:
    41674200                    {
    4168                         if (m_pModelStorage->data(index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::ToolTipType_HDAdder)
    4169                             m_pModelStorage->setData(index, QVariant::fromValue(StorageModel::ToolTipType_HDAdder), StorageModel::R_ToolTipType);
     4201                        if (pModel->data(index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::ToolTipType_HDAdder)
     4202                            pModel->setData(index, QVariant::fromValue(StorageModel::ToolTipType_HDAdder), StorageModel::R_ToolTipType);
    41704203                        break;
    41714204                    }
    41724205                    case KDeviceType_DVD:
    41734206                    {
    4174                         if (m_pModelStorage->data(index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::ToolTipType_CDAdder)
    4175                             m_pModelStorage->setData(index, QVariant::fromValue(StorageModel::ToolTipType_CDAdder), StorageModel::R_ToolTipType);
     4207                        if (pModel->data(index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::ToolTipType_CDAdder)
     4208                            pModel->setData(index, QVariant::fromValue(StorageModel::ToolTipType_CDAdder), StorageModel::R_ToolTipType);
    41764209                        break;
    41774210                    }
    41784211                    case KDeviceType_Floppy:
    41794212                    {
    4180                         if (m_pModelStorage->data(index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::ToolTipType_FDAdder)
    4181                             m_pModelStorage->setData(index, QVariant::fromValue(StorageModel::ToolTipType_FDAdder), StorageModel::R_ToolTipType);
     4213                        if (pModel->data(index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::ToolTipType_FDAdder)
     4214                            pModel->setData(index, QVariant::fromValue(StorageModel::ToolTipType_FDAdder), StorageModel::R_ToolTipType);
    41824215                        break;
    41834216                    }
     
    41914224
    41924225    /* Default tool-tip: */
    4193     if (m_pModelStorage->data(index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::ToolTipType_Default)
    4194         m_pModelStorage->setData(index, StorageModel::ToolTipType_Default, StorageModel::R_ToolTipType);
     4226    if (pModel->data(index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::ToolTipType_Default)
     4227        pModel->setData(index, StorageModel::ToolTipType_Default, StorageModel::R_ToolTipType);
    41954228
    41964229    /* Check whether we should initiate dragging: */
     
    42054238        const QModelIndex parentIndex = index.parent();
    42064239        /* And make sure it is attachment, and parent is controller: */
    4207         if (   m_pModelStorage->data(index, StorageModel::R_IsAttachment).toBool()
    4208             && m_pModelStorage->data(parentIndex, StorageModel::R_IsController).toBool())
     4240        if (   pModel->data(index, StorageModel::R_IsAttachment).toBool()
     4241            && pModel->data(parentIndex, StorageModel::R_IsController).toBool())
    42094242        {
    42104243            /* Initialize dragging: */
     
    42144247            {
    42154248                /* Assign pixmap: */
    4216                 pDrag->setPixmap(m_pModelStorage->data(index, StorageModel::R_ItemPixmapDefault).value<QPixmap>());
     4249                pDrag->setPixmap(pModel->data(index, StorageModel::R_ItemPixmapDefault).value<QPixmap>());
    42174250                /* Prepare mime: */
    42184251                QMimeData *pMimeData = new QMimeData;
    42194252                if (pMimeData)
    42204253                {
    4221                     const QString parentId = m_pModelStorage->data(parentIndex, StorageModel::R_ItemId).toString();
    4222                     const QString id = m_pModelStorage->data(index, StorageModel::R_ItemId).toString();
     4254                    const QString parentId = pModel->data(parentIndex, StorageModel::R_ItemId).toString();
     4255                    const QString id = pModel->data(index, StorageModel::R_ItemId).toString();
    42234256                    pMimeData->setData(s_strControllerMimeType, parentId.toLatin1());
    42244257                    pMimeData->setData(s_strAttachmentMimeType, id.toLatin1());
     
    42344267void UIStorageSettingsEditor::sltHandleMouseClick(QMouseEvent *pEvent)
    42354268{
     4269    /* Acquire model: */
     4270    AssertPtrReturnVoid(m_pTreeViewStorage);
     4271    const QAbstractItemModel *pModel = m_pTreeViewStorage->model();
     4272    AssertPtrReturnVoid(pModel);
     4273
    42364274    /* Make sure event is valid: */
    42374275    AssertPtrReturnVoid(pEvent);
     
    42404278
    42414279    /* Acquire indexes: */
    4242     AssertPtrReturnVoid(m_pTreeViewStorage);
    42434280    const QModelIndex currentIndex = m_pTreeViewStorage->currentIndex();
    42444281    const QModelIndex index = m_pTreeViewStorage->indexAt(lPos);
     
    42504287
    42514288    /* Expander icon: */
    4252     AssertPtrReturnVoid(m_pModelStorage);
    4253     if (m_pModelStorage->data(index, StorageModel::R_IsController).toBool())
    4254     {
    4255         QRect expanderRect = m_pModelStorage->data(index, StorageModel::R_ItemPixmapRect).toRect();
     4289    if (pModel->data(index, StorageModel::R_IsController).toBool())
     4290    {
     4291        QRect expanderRect = pModel->data(index, StorageModel::R_ItemPixmapRect).toRect();
    42564292        expanderRect.translate(indexRect.x(), indexRect.y());
    42574293        if (expanderRect.contains(lPos))
     
    42644300
    42654301    /* Adder icons: */
    4266     if (m_pModelStorage->data(index, StorageModel::R_IsController).toBool() &&
     4302    if (pModel->data(index, StorageModel::R_IsController).toBool() &&
    42674303        m_pTreeViewStorage->currentIndex() == index)
    42684304    {
    4269         const DeviceTypeList devicesList(m_pModelStorage->data(index, StorageModel::R_CtrDevices).value<DeviceTypeList>());
     4305        const DeviceTypeList devicesList(pModel->data(index, StorageModel::R_CtrDevices).value<DeviceTypeList>());
    42704306        for (int i = 0; i < devicesList.size(); ++ i)
    42714307        {
     
    42774313                case KDeviceType_HardDisk:
    42784314                {
    4279                     deviceRect = m_pModelStorage->data(index, StorageModel::R_HDPixmapRect).toRect();
     4315                    deviceRect = pModel->data(index, StorageModel::R_HDPixmapRect).toRect();
    42804316                    break;
    42814317                }
    42824318                case KDeviceType_DVD:
    42834319                {
    4284                     deviceRect = m_pModelStorage->data(index, StorageModel::R_CDPixmapRect).toRect();
     4320                    deviceRect = pModel->data(index, StorageModel::R_CDPixmapRect).toRect();
    42854321                    break;
    42864322                }
    42874323                case KDeviceType_Floppy:
    42884324                {
    4289                     deviceRect = m_pModelStorage->data(index, StorageModel::R_FDPixmapRect).toRect();
     4325                    deviceRect = pModel->data(index, StorageModel::R_FDPixmapRect).toRect();
    42904326                    break;
    42914327                }
     
    43234359void UIStorageSettingsEditor::sltHandleDragMove(QDragMoveEvent *pEvent)
    43244360{
     4361    /* Acquire model: */
     4362    AssertPtrReturnVoid(m_pTreeViewStorage);
     4363    const QAbstractItemModel *pModel = m_pTreeViewStorage->model();
     4364    AssertPtrReturnVoid(pModel);
     4365
    43254366    /* Make sure event is valid: */
    43264367    AssertPtrReturnVoid(pEvent);
     
    43394380
    43404381    /* Check what item we are hovering currently: */
    4341     AssertPtrReturnVoid(m_pTreeViewStorage);
    43424382    QModelIndex index = m_pTreeViewStorage->indexAt(pEvent->position().toPoint());
    43434383    /* And make sure this is controller item, we are supporting dropping for this kind only: */
    4344     AssertPtrReturnVoid(m_pModelStorage);
    4345     if (   !m_pModelStorage->data(index, StorageModel::R_IsController).toBool()
    4346         || m_pModelStorage->data(index, StorageModel::R_ItemId).toString() == strControllerId)
     4384    if (   !pModel->data(index, StorageModel::R_IsController).toBool()
     4385        || pModel->data(index, StorageModel::R_ItemId).toString() == strControllerId)
    43474386        return;
    43484387    /* Then make sure we support such attachment device type: */
    4349     const DeviceTypeList devicesList(m_pModelStorage->data(index, StorageModel::R_CtrDevices).value<DeviceTypeList>());
     4388    const DeviceTypeList devicesList(pModel->data(index, StorageModel::R_CtrDevices).value<DeviceTypeList>());
     4389    AssertPtrReturnVoid(m_pModelStorage);
    43504390    if (!devicesList.contains(m_pModelStorage->attachmentDeviceType(QUuid(strControllerId), QUuid(strAttachmentId))))
    43514391        return;
    43524392    /* Also make sure there is enough place for new attachment: */
    4353     const bool fIsMoreAttachmentsPossible = m_pModelStorage->data(index, StorageModel::R_IsMoreAttachmentsPossible).toBool();
     4393    const bool fIsMoreAttachmentsPossible = pModel->data(index, StorageModel::R_IsMoreAttachmentsPossible).toBool();
    43544394    if (!fIsMoreAttachmentsPossible)
    43554395        return;
     
    43614401void UIStorageSettingsEditor::sltHandleDragDrop(QDropEvent *pEvent)
    43624402{
     4403    /* Acquire model: */
     4404    AssertPtrReturnVoid(m_pTreeViewStorage);
     4405    const QAbstractItemModel *pModel = m_pTreeViewStorage->model();
     4406    AssertPtrReturnVoid(pModel);
     4407
    43634408    /* Make sure event is valid: */
    43644409    AssertPtrReturnVoid(pEvent);
     
    43684413
    43694414    /* Check what item we are hovering currently: */
    4370     AssertPtrReturnVoid(m_pTreeViewStorage);
    43714415    QModelIndex index = m_pTreeViewStorage->indexAt(pEvent->position().toPoint());
    43724416    /* And make sure this is controller item, we are supporting dropping for this kind only: */
    4373     AssertPtrReturnVoid(m_pModelStorage);
    4374     if (m_pModelStorage->data(index, StorageModel::R_IsController).toBool())
     4417    if (pModel->data(index, StorageModel::R_IsController).toBool())
    43754418    {
    43764419        /* Get controller/attachment ids: */
    43774420        const QString strControllerId = pMimeData->data(UIStorageSettingsEditor::s_strControllerMimeType);
    43784421        const QString strAttachmentId = pMimeData->data(UIStorageSettingsEditor::s_strAttachmentMimeType);
     4422        AssertPtrReturnVoid(m_pModelStorage);
    43794423        m_pModelStorage->moveAttachment(QUuid(strAttachmentId), QUuid(strControllerId),
    4380                                         m_pModelStorage->data(index, StorageModel::R_ItemId).toUuid());
     4424                                        pModel->data(index, StorageModel::R_ItemId).toUuid());
    43814425    }
    43824426}
     
    50795123{
    50805124#ifdef RT_STRICT
     5125    /* Acquire model: */
    50815126    AssertPtrReturnVoid(m_pTreeViewStorage);
    5082     AssertPtrReturnVoid(m_pModelStorage);
     5127    const QAbstractItemModel *pModel = m_pTreeViewStorage->model();
     5128    AssertPtrReturnVoid(pModel);
     5129
    50835130    const QModelIndex index = m_pTreeViewStorage->currentIndex();
    50845131    switch (enmBus)
    50855132    {
    50865133        case KStorageBus_IDE:
    5087             Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreIDEControllersPossible).toBool());
     5134            Assert(pModel->data(index, StorageModel::R_IsMoreIDEControllersPossible).toBool());
    50885135            break;
    50895136        case KStorageBus_SATA:
    5090             Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreSATAControllersPossible).toBool());
     5137            Assert(pModel->data(index, StorageModel::R_IsMoreSATAControllersPossible).toBool());
    50915138            break;
    50925139        case KStorageBus_SCSI:
    5093             Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreSCSIControllersPossible).toBool());
     5140            Assert(pModel->data(index, StorageModel::R_IsMoreSCSIControllersPossible).toBool());
    50945141            break;
    50955142        case KStorageBus_SAS:
    5096             Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreSASControllersPossible).toBool());
     5143            Assert(pModel->data(index, StorageModel::R_IsMoreSASControllersPossible).toBool());
    50975144            break;
    50985145        case KStorageBus_Floppy:
    5099             Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreFloppyControllersPossible).toBool());
     5146            Assert(pModel->data(index, StorageModel::R_IsMoreFloppyControllersPossible).toBool());
    51005147            break;
    51015148        case KStorageBus_USB:
    5102             Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreUSBControllersPossible).toBool());
     5149            Assert(pModel->data(index, StorageModel::R_IsMoreUSBControllersPossible).toBool());
    51035150            break;
    51045151        case KStorageBus_PCIe:
    5105             Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreNVMeControllersPossible).toBool());
     5152            Assert(pModel->data(index, StorageModel::R_IsMoreNVMeControllersPossible).toBool());
    51065153            break;
    51075154        case KStorageBus_VirtioSCSI:
    5108             Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreVirtioSCSIControllersPossible).toBool());
     5155            Assert(pModel->data(index, StorageModel::R_IsMoreVirtioSCSIControllersPossible).toBool());
    51095156            break;
    51105157        default:
     
    51235170void UIStorageSettingsEditor::addAttachmentWrapper(KDeviceType enmDeviceType)
    51245171{
    5125     /* Acquire current index: */
     5172    /* Acquire model and current index: */
    51265173    AssertPtrReturnVoid(m_pTreeViewStorage);
     5174    const QAbstractItemModel *pModel = m_pTreeViewStorage->model();
     5175    AssertPtrReturnVoid(pModel);
    51275176    const QModelIndex index = m_pTreeViewStorage->currentIndex();
    5128     AssertPtrReturnVoid(m_pModelStorage);
    5129     Assert(m_pModelStorage->data(index, StorageModel::R_IsController).toBool());
    5130     Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreAttachmentsPossible).toBool());
     5177    Assert(pModel->data(index, StorageModel::R_IsController).toBool());
     5178    Assert(pModel->data(index, StorageModel::R_IsMoreAttachmentsPossible).toBool());
    51315179    const QString strMachineFolder(QFileInfo(m_strMachineSettingsFilePath).absolutePath());
    51325180
     
    51515199    /* Add attachment: */
    51525200    AssertPtrReturnVoid(m_pModelStorage);
    5153     m_pModelStorage->addAttachment(m_pModelStorage->data(index, StorageModel::R_ItemId).toUuid(), enmDeviceType, uMediumId);
     5201    m_pModelStorage->addAttachment(pModel->data(index, StorageModel::R_ItemId).toUuid(), enmDeviceType, uMediumId);
    51545202    m_pModelStorage->sort();
    51555203
Note: See TracChangeset for help on using the changeset viewer.

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