Changeset 102937 in vbox
- Timestamp:
- Jan 17, 2024 6:33:00 PM (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIStorageSettingsEditor.cpp
r102936 r102937 3031 3031 m_pModelStorage->setConfigurationAccessLevel(enmConfigurationAccessLevel); 3032 3032 3033 /* Acquire model: */ 3034 AssertPtrReturnVoid(m_pTreeViewStorage); 3035 const QAbstractItemModel *pModel = m_pTreeViewStorage->model(); 3036 AssertPtrReturnVoid(pModel); 3037 3033 3038 /* Acquire various options: */ 3034 3039 const bool fMachineOffline = m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full; … … 3038 3043 const bool fMachineInValidMode = fMachineOffline || fMachinePoweredOff || fMachineSaved || fMachineOnline; 3039 3044 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>(); 3041 3046 3042 3047 /* Polish left pane availability: */ … … 3169 3174 3170 3175 /* 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)); 3173 3182 3174 3183 /* Fetch recent information: */ … … 3444 3453 void UIStorageSettingsEditor::sltRemoveController() 3445 3454 { 3446 /* Acquire current index: */3455 /* Acquire model and current index: */ 3447 3456 AssertPtrReturnVoid(m_pTreeViewStorage); 3457 const QAbstractItemModel *pModel = m_pTreeViewStorage->model(); 3458 AssertPtrReturnVoid(pModel); 3448 3459 const QModelIndex index = m_pTreeViewStorage->currentIndex(); 3460 AssertReturnVoid(pModel->data(index, StorageModel::R_IsController).toBool()); 3461 3462 /* Remove controller: */ 3449 3463 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()); 3454 3465 3455 3466 /* Notify listeners: */ … … 3459 3470 void UIStorageSettingsEditor::sltAddAttachment() 3460 3471 { 3461 /* Acquire current index: */3472 /* Acquire model and current index: */ 3462 3473 AssertPtrReturnVoid(m_pTreeViewStorage); 3474 const QAbstractItemModel *pModel = m_pTreeViewStorage->model(); 3475 AssertPtrReturnVoid(pModel); 3463 3476 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()); 3466 3478 3467 3479 /* 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>(); 3469 3481 const bool fJustTrigger = deviceTypeList.size() == 1; 3470 3482 const bool fShowMenu = deviceTypeList.size() > 1; … … 3519 3531 /* Acquire model, current index and it's parent index: */ 3520 3532 AssertPtrReturnVoid(m_pTreeViewStorage); 3533 const QAbstractItemModel *pModel = m_pTreeViewStorage->model(); 3534 AssertPtrReturnVoid(pModel); 3521 3535 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()); 3524 3537 const QModelIndex parentIndex = index.parent(); 3525 AssertReturnVoid( m_pModelStorage->data(parentIndex, StorageModel::R_IsController).toBool());3538 AssertReturnVoid(pModel->data(parentIndex, StorageModel::R_IsController).toBool()); 3526 3539 3527 3540 /* 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>(); 3529 3542 if ( enmDeviceType == KDeviceType_DVD 3530 3543 && deviceCount(KDeviceType_DVD) == 1 … … 3533 3546 3534 3547 /* 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()); 3537 3551 3538 3552 /* Notify listeners: */ … … 3542 3556 void UIStorageSettingsEditor::sltGetInformation() 3543 3557 { 3558 /* Acquire model: */ 3559 AssertPtrReturnVoid(m_pTreeViewStorage); 3560 const QAbstractItemModel *pModel = m_pTreeViewStorage->model(); 3561 AssertPtrReturnVoid(pModel); 3562 3544 3563 m_fLoadingInProgress = true; 3545 3564 3546 AssertPtrReturnVoid(m_pTreeViewStorage);3547 3565 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)) 3550 3567 { 3551 3568 /* Showing initial page: */ … … 3554 3571 else 3555 3572 { 3556 switch ( m_pModelStorage->data(index, StorageModel::R_ItemType).value<AbstractItem::ItemType>())3573 switch (pModel->data(index, StorageModel::R_ItemType).value<AbstractItem::ItemType>()) 3557 3574 { 3558 3575 case AbstractItem::Type_ControllerItem: 3559 3576 { 3560 3577 /* 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(); 3562 3579 if (m_pEditorName->text() != strCtrName) 3563 3580 m_pEditorName->setText(strCtrName); … … 3566 3583 m_pComboType->clear(); 3567 3584 /* 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>()); 3569 3586 foreach (const KStorageBus &enmCurrentBus, controllerBusList) 3570 3587 { 3571 3588 /* 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>()); 3573 3590 foreach (const KStorageControllerType &enmCurrentType, controllerTypeList) 3574 3591 { … … 3578 3595 } 3579 3596 } 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>(); 3581 3598 const int iCtrPos = m_pComboType->findData(QVariant::fromValue(enmType), StorageModel::R_CtrType); 3582 3599 m_pComboType->setCurrentIndex(iCtrPos == -1 ? 0 : iCtrPos); 3583 3600 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>(); 3585 3602 m_pLabelPortCount->setVisible(enmBus == KStorageBus_SATA || enmBus == KStorageBus_SAS); 3586 3603 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(); 3589 3606 m_pSpinboxPortCount->setMaximum(uMaxPortCount); 3590 3607 m_pSpinboxPortCount->setValue(uPortCount); 3591 3608 3592 const bool fUseIoCache = m_pModelStorage->data(index, StorageModel::R_CtrIoCache).toBool();3609 const bool fUseIoCache = pModel->data(index, StorageModel::R_CtrIoCache).toBool(); 3593 3610 m_pCheckBoxIoCache->setChecked(fUseIoCache); 3594 3611 … … 3601 3618 /* Getting attachment slot: */ 3602 3619 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>()); 3604 3621 for (int i = 0; i < slotsList.size(); ++i) 3605 3622 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>(); 3607 3624 const int iAttSlotPos = m_pComboSlot->findText(gpConverter->toString(slt)); 3608 3625 m_pComboSlot->setCurrentIndex(iAttSlotPos == -1 ? 0 : iAttSlotPos); … … 3610 3627 3611 3628 /* 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>(); 3613 3630 switch (enmDeviceType) 3614 3631 { … … 3640 3657 3641 3658 /* 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(); 3643 3660 3644 3661 /* Fetch device-type, medium-id: */ 3645 3662 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())); 3647 3664 3648 3665 /* Get/fetch editable state: */ … … 3656 3673 3657 3674 /* 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(); 3659 3676 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()); 3661 3678 3662 3679 /* Getting temp-eject state: */ 3663 3680 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()); 3665 3682 3666 3683 /* Getting non-rotational state: */ 3667 3684 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()); 3669 3686 3670 3687 /* Fetch hot-pluggable state: */ … … 3689 3706 3690 3707 /* 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())); 3700 3717 3701 3718 /* Showing attachment page: */ … … 3716 3733 void UIStorageSettingsEditor::sltSetInformation() 3717 3734 { 3718 /* Acquire current index: */3735 /* Acquire model and current index: */ 3719 3736 AssertPtrReturnVoid(m_pTreeViewStorage); 3737 QAbstractItemModel *pModel = m_pTreeViewStorage->model(); 3738 AssertPtrReturnVoid(pModel); 3720 3739 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)) 3723 3741 return; 3724 3742 3725 3743 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>()) 3727 3745 { 3728 3746 case AbstractItem::Type_ControllerItem: … … 3730 3748 /* Setting controller name: */ 3731 3749 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); 3733 3751 /* Setting controller sub-type: */ 3734 3752 else if (pSender == m_pComboType) … … 3737 3755 const KStorageControllerType enmType = m_pComboType->currentData(StorageModel::R_CtrType).value<KStorageControllerType>(); 3738 3756 const bool fResult = 3739 m_pModelStorage->setData(index, QVariant::fromValue(enmBus), StorageModel::R_CtrBusType);3757 pModel->setData(index, QVariant::fromValue(enmBus), StorageModel::R_CtrBusType); 3740 3758 if (fResult) 3741 m_pModelStorage->setData(index, QVariant::fromValue(enmType), StorageModel::R_CtrType);3759 pModel->setData(index, QVariant::fromValue(enmType), StorageModel::R_CtrType); 3742 3760 } 3743 3761 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); 3745 3763 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); 3747 3765 break; 3748 3766 } … … 3752 3770 if (pSender == m_pComboSlot) 3753 3771 { 3754 QModelIndex controllerIndex = m_pModelStorage->parent(index);3772 QModelIndex controllerIndex = pModel->parent(index); 3755 3773 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) 3758 3776 { 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>(); 3761 3779 if (enumeratedStorageSlot == attachmentStorageSlot) 3762 3780 { … … 3768 3786 /* Setting attachment medium: */ 3769 3787 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); 3771 3789 else if (pSender == m_pCheckBoxPassthrough) 3772 3790 { 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); 3775 3793 } 3776 3794 else if (pSender == m_pCheckBoxTempEject) 3777 3795 { 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); 3780 3798 } 3781 3799 else if (pSender == m_pCheckBoxNonRotational) 3782 3800 { 3783 m_pModelStorage->setData(index, m_pCheckBoxNonRotational->isChecked(), StorageModel::R_AttIsNonRotational);3801 pModel->setData(index, m_pCheckBoxNonRotational->isChecked(), StorageModel::R_AttIsNonRotational); 3784 3802 } 3785 3803 else if (pSender == m_pCheckBoxHotPluggable) 3786 3804 { 3787 m_pModelStorage->setData(index, m_pCheckBoxHotPluggable->isChecked(), StorageModel::R_AttIsHotPluggable);3805 pModel->setData(index, m_pCheckBoxHotPluggable->isChecked(), StorageModel::R_AttIsHotPluggable); 3788 3806 } 3789 3807 break; … … 3928 3946 void UIStorageSettingsEditor::sltUpdateActionStates() 3929 3947 { 3930 /* Acquire current index: */3948 /* Acquire model and current index: */ 3931 3949 AssertPtrReturnVoid(m_pTreeViewStorage); 3950 const QAbstractItemModel *pModel = m_pTreeViewStorage->model(); 3951 AssertPtrReturnVoid(pModel); 3932 3952 const QModelIndex index = m_pTreeViewStorage->currentIndex(); 3933 3953 3934 3954 /* 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(); 3948 3967 3949 3968 /* Configure "add controller" actions: */ … … 3981 4000 void UIStorageSettingsEditor::sltHandleRowInsertion(const QModelIndex &parentIndex, int iPosition) 3982 4001 { 3983 /* Acquire current index: */4002 /* Acquire model and current index: */ 3984 4003 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>()) 3988 4009 { 3989 4010 case AbstractItem::Type_ControllerItem: … … 4010 4031 void UIStorageSettingsEditor::sltHandleRowRemoval() 4011 4032 { 4033 /* Acquire model: */ 4034 AssertPtrReturnVoid(m_pTreeViewStorage); 4035 const QAbstractItemModel *pModel = m_pTreeViewStorage->model(); 4036 AssertPtrReturnVoid(pModel); 4037 4012 4038 /* 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)); 4017 4041 4018 4042 sltUpdateActionStates(); … … 4028 4052 void UIStorageSettingsEditor::sltHandleContextMenuRequest(const QPoint &position) 4029 4053 { 4054 /* Acquire model: */ 4055 AssertPtrReturnVoid(m_pTreeViewStorage); 4056 const QAbstractItemModel *pModel = m_pTreeViewStorage->model(); 4057 AssertPtrReturnVoid(pModel); 4058 4030 4059 /* Forget last mouse press position: */ 4031 4060 m_mousePressPosition = QPoint(); 4032 4061 4033 AssertPtrReturnVoid(m_pTreeViewStorage);4034 4062 const QModelIndex index = m_pTreeViewStorage->indexAt(position); 4035 4063 if (!index.isValid()) … … 4037 4065 4038 4066 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>()) 4041 4068 { 4042 4069 case AbstractItem::Type_ControllerItem: 4043 4070 { 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>()); 4045 4072 foreach (KDeviceType enmDeviceType, deviceTypeList) 4046 4073 { … … 4077 4104 void UIStorageSettingsEditor::sltHandleDrawItemBranches(QPainter *pPainter, const QRect &rect, const QModelIndex &index) 4078 4105 { 4106 /* Acquire model: */ 4107 AssertPtrReturnVoid(m_pTreeViewStorage); 4108 const QAbstractItemModel *pModel = m_pTreeViewStorage->model(); 4109 AssertPtrReturnVoid(pModel); 4110 4079 4111 /* Make sure we are painting branches for attachments only, 4080 4112 * i.e. for items which have parent which have parent as well: */ … … 4084 4116 pPainter->save(); 4085 4117 QStyleOption options; 4086 AssertPtrReturnVoid(m_pTreeViewStorage);4087 4118 options.initFrom(m_pTreeViewStorage); 4088 4119 options.rect = rect; 4089 4120 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) 4092 4122 options.state |= QStyle::State_Sibling; 4093 4123 /* This pen is commonly used by different … … 4103 4133 void UIStorageSettingsEditor::sltHandleMouseMove(QMouseEvent *pEvent) 4104 4134 { 4135 /* Acquire model: */ 4136 AssertPtrReturnVoid(m_pTreeViewStorage); 4137 QAbstractItemModel *pModel = m_pTreeViewStorage->model(); 4138 AssertPtrReturnVoid(pModel); 4139 4105 4140 /* Make sure event is valid: */ 4106 4141 AssertPtrReturnVoid(pEvent); … … 4108 4143 const QPoint lPos = pEvent->position().toPoint(); 4109 4144 4110 AssertPtrReturnVoid(m_pTreeViewStorage);4111 4145 const QModelIndex index = m_pTreeViewStorage->indexAt(lPos); 4112 4146 const QRect indexRect = m_pTreeViewStorage->visualRect(index); 4113 4147 4114 4148 /* 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(); 4119 4152 expanderRect.translate(indexRect.x(), indexRect.y()); 4120 4153 if (expanderRect.contains(lPos)) 4121 4154 { 4122 4155 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); 4125 4158 return; 4126 4159 } … … 4128 4161 4129 4162 /* Adder tool-tip: */ 4130 if ( m_pModelStorage->data(index, StorageModel::R_IsController).toBool() &&4163 if (pModel->data(index, StorageModel::R_IsController).toBool() && 4131 4164 m_pTreeViewStorage->currentIndex() == index) 4132 4165 { 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>()); 4134 4167 for (int i = 0; i < devicesList.size(); ++ i) 4135 4168 { … … 4141 4174 case KDeviceType_HardDisk: 4142 4175 { 4143 deviceRect = m_pModelStorage->data(index, StorageModel::R_HDPixmapRect).toRect();4176 deviceRect = pModel->data(index, StorageModel::R_HDPixmapRect).toRect(); 4144 4177 break; 4145 4178 } 4146 4179 case KDeviceType_DVD: 4147 4180 { 4148 deviceRect = m_pModelStorage->data(index, StorageModel::R_CDPixmapRect).toRect();4181 deviceRect = pModel->data(index, StorageModel::R_CDPixmapRect).toRect(); 4149 4182 break; 4150 4183 } 4151 4184 case KDeviceType_Floppy: 4152 4185 { 4153 deviceRect = m_pModelStorage->data(index, StorageModel::R_FDPixmapRect).toRect();4186 deviceRect = pModel->data(index, StorageModel::R_FDPixmapRect).toRect(); 4154 4187 break; 4155 4188 } … … 4166 4199 case KDeviceType_HardDisk: 4167 4200 { 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); 4170 4203 break; 4171 4204 } 4172 4205 case KDeviceType_DVD: 4173 4206 { 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); 4176 4209 break; 4177 4210 } 4178 4211 case KDeviceType_Floppy: 4179 4212 { 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); 4182 4215 break; 4183 4216 } … … 4191 4224 4192 4225 /* 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); 4195 4228 4196 4229 /* Check whether we should initiate dragging: */ … … 4205 4238 const QModelIndex parentIndex = index.parent(); 4206 4239 /* 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()) 4209 4242 { 4210 4243 /* Initialize dragging: */ … … 4214 4247 { 4215 4248 /* 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>()); 4217 4250 /* Prepare mime: */ 4218 4251 QMimeData *pMimeData = new QMimeData; 4219 4252 if (pMimeData) 4220 4253 { 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(); 4223 4256 pMimeData->setData(s_strControllerMimeType, parentId.toLatin1()); 4224 4257 pMimeData->setData(s_strAttachmentMimeType, id.toLatin1()); … … 4234 4267 void UIStorageSettingsEditor::sltHandleMouseClick(QMouseEvent *pEvent) 4235 4268 { 4269 /* Acquire model: */ 4270 AssertPtrReturnVoid(m_pTreeViewStorage); 4271 const QAbstractItemModel *pModel = m_pTreeViewStorage->model(); 4272 AssertPtrReturnVoid(pModel); 4273 4236 4274 /* Make sure event is valid: */ 4237 4275 AssertPtrReturnVoid(pEvent); … … 4240 4278 4241 4279 /* Acquire indexes: */ 4242 AssertPtrReturnVoid(m_pTreeViewStorage);4243 4280 const QModelIndex currentIndex = m_pTreeViewStorage->currentIndex(); 4244 4281 const QModelIndex index = m_pTreeViewStorage->indexAt(lPos); … … 4250 4287 4251 4288 /* 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(); 4256 4292 expanderRect.translate(indexRect.x(), indexRect.y()); 4257 4293 if (expanderRect.contains(lPos)) … … 4264 4300 4265 4301 /* Adder icons: */ 4266 if ( m_pModelStorage->data(index, StorageModel::R_IsController).toBool() &&4302 if (pModel->data(index, StorageModel::R_IsController).toBool() && 4267 4303 m_pTreeViewStorage->currentIndex() == index) 4268 4304 { 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>()); 4270 4306 for (int i = 0; i < devicesList.size(); ++ i) 4271 4307 { … … 4277 4313 case KDeviceType_HardDisk: 4278 4314 { 4279 deviceRect = m_pModelStorage->data(index, StorageModel::R_HDPixmapRect).toRect();4315 deviceRect = pModel->data(index, StorageModel::R_HDPixmapRect).toRect(); 4280 4316 break; 4281 4317 } 4282 4318 case KDeviceType_DVD: 4283 4319 { 4284 deviceRect = m_pModelStorage->data(index, StorageModel::R_CDPixmapRect).toRect();4320 deviceRect = pModel->data(index, StorageModel::R_CDPixmapRect).toRect(); 4285 4321 break; 4286 4322 } 4287 4323 case KDeviceType_Floppy: 4288 4324 { 4289 deviceRect = m_pModelStorage->data(index, StorageModel::R_FDPixmapRect).toRect();4325 deviceRect = pModel->data(index, StorageModel::R_FDPixmapRect).toRect(); 4290 4326 break; 4291 4327 } … … 4323 4359 void UIStorageSettingsEditor::sltHandleDragMove(QDragMoveEvent *pEvent) 4324 4360 { 4361 /* Acquire model: */ 4362 AssertPtrReturnVoid(m_pTreeViewStorage); 4363 const QAbstractItemModel *pModel = m_pTreeViewStorage->model(); 4364 AssertPtrReturnVoid(pModel); 4365 4325 4366 /* Make sure event is valid: */ 4326 4367 AssertPtrReturnVoid(pEvent); … … 4339 4380 4340 4381 /* Check what item we are hovering currently: */ 4341 AssertPtrReturnVoid(m_pTreeViewStorage);4342 4382 QModelIndex index = m_pTreeViewStorage->indexAt(pEvent->position().toPoint()); 4343 4383 /* 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) 4347 4386 return; 4348 4387 /* 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); 4350 4390 if (!devicesList.contains(m_pModelStorage->attachmentDeviceType(QUuid(strControllerId), QUuid(strAttachmentId)))) 4351 4391 return; 4352 4392 /* 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(); 4354 4394 if (!fIsMoreAttachmentsPossible) 4355 4395 return; … … 4361 4401 void UIStorageSettingsEditor::sltHandleDragDrop(QDropEvent *pEvent) 4362 4402 { 4403 /* Acquire model: */ 4404 AssertPtrReturnVoid(m_pTreeViewStorage); 4405 const QAbstractItemModel *pModel = m_pTreeViewStorage->model(); 4406 AssertPtrReturnVoid(pModel); 4407 4363 4408 /* Make sure event is valid: */ 4364 4409 AssertPtrReturnVoid(pEvent); … … 4368 4413 4369 4414 /* Check what item we are hovering currently: */ 4370 AssertPtrReturnVoid(m_pTreeViewStorage);4371 4415 QModelIndex index = m_pTreeViewStorage->indexAt(pEvent->position().toPoint()); 4372 4416 /* 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()) 4375 4418 { 4376 4419 /* Get controller/attachment ids: */ 4377 4420 const QString strControllerId = pMimeData->data(UIStorageSettingsEditor::s_strControllerMimeType); 4378 4421 const QString strAttachmentId = pMimeData->data(UIStorageSettingsEditor::s_strAttachmentMimeType); 4422 AssertPtrReturnVoid(m_pModelStorage); 4379 4423 m_pModelStorage->moveAttachment(QUuid(strAttachmentId), QUuid(strControllerId), 4380 m_pModelStorage->data(index, StorageModel::R_ItemId).toUuid());4424 pModel->data(index, StorageModel::R_ItemId).toUuid()); 4381 4425 } 4382 4426 } … … 5079 5123 { 5080 5124 #ifdef RT_STRICT 5125 /* Acquire model: */ 5081 5126 AssertPtrReturnVoid(m_pTreeViewStorage); 5082 AssertPtrReturnVoid(m_pModelStorage); 5127 const QAbstractItemModel *pModel = m_pTreeViewStorage->model(); 5128 AssertPtrReturnVoid(pModel); 5129 5083 5130 const QModelIndex index = m_pTreeViewStorage->currentIndex(); 5084 5131 switch (enmBus) 5085 5132 { 5086 5133 case KStorageBus_IDE: 5087 Assert( m_pModelStorage->data(index, StorageModel::R_IsMoreIDEControllersPossible).toBool());5134 Assert(pModel->data(index, StorageModel::R_IsMoreIDEControllersPossible).toBool()); 5088 5135 break; 5089 5136 case KStorageBus_SATA: 5090 Assert( m_pModelStorage->data(index, StorageModel::R_IsMoreSATAControllersPossible).toBool());5137 Assert(pModel->data(index, StorageModel::R_IsMoreSATAControllersPossible).toBool()); 5091 5138 break; 5092 5139 case KStorageBus_SCSI: 5093 Assert( m_pModelStorage->data(index, StorageModel::R_IsMoreSCSIControllersPossible).toBool());5140 Assert(pModel->data(index, StorageModel::R_IsMoreSCSIControllersPossible).toBool()); 5094 5141 break; 5095 5142 case KStorageBus_SAS: 5096 Assert( m_pModelStorage->data(index, StorageModel::R_IsMoreSASControllersPossible).toBool());5143 Assert(pModel->data(index, StorageModel::R_IsMoreSASControllersPossible).toBool()); 5097 5144 break; 5098 5145 case KStorageBus_Floppy: 5099 Assert( m_pModelStorage->data(index, StorageModel::R_IsMoreFloppyControllersPossible).toBool());5146 Assert(pModel->data(index, StorageModel::R_IsMoreFloppyControllersPossible).toBool()); 5100 5147 break; 5101 5148 case KStorageBus_USB: 5102 Assert( m_pModelStorage->data(index, StorageModel::R_IsMoreUSBControllersPossible).toBool());5149 Assert(pModel->data(index, StorageModel::R_IsMoreUSBControllersPossible).toBool()); 5103 5150 break; 5104 5151 case KStorageBus_PCIe: 5105 Assert( m_pModelStorage->data(index, StorageModel::R_IsMoreNVMeControllersPossible).toBool());5152 Assert(pModel->data(index, StorageModel::R_IsMoreNVMeControllersPossible).toBool()); 5106 5153 break; 5107 5154 case KStorageBus_VirtioSCSI: 5108 Assert( m_pModelStorage->data(index, StorageModel::R_IsMoreVirtioSCSIControllersPossible).toBool());5155 Assert(pModel->data(index, StorageModel::R_IsMoreVirtioSCSIControllersPossible).toBool()); 5109 5156 break; 5110 5157 default: … … 5123 5170 void UIStorageSettingsEditor::addAttachmentWrapper(KDeviceType enmDeviceType) 5124 5171 { 5125 /* Acquire current index: */5172 /* Acquire model and current index: */ 5126 5173 AssertPtrReturnVoid(m_pTreeViewStorage); 5174 const QAbstractItemModel *pModel = m_pTreeViewStorage->model(); 5175 AssertPtrReturnVoid(pModel); 5127 5176 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()); 5131 5179 const QString strMachineFolder(QFileInfo(m_strMachineSettingsFilePath).absolutePath()); 5132 5180 … … 5151 5199 /* Add attachment: */ 5152 5200 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); 5154 5202 m_pModelStorage->sort(); 5155 5203
Note:
See TracChangeset
for help on using the changeset viewer.