Changeset 98810 in vbox
- Timestamp:
- Mar 1, 2023 5:20:14 PM (21 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
r98809 r98810 750 750 { 751 751 return uisession()->setDnDMode(enmMode); 752 } 753 754 bool UIMachine::acquireAmountOfStorageDevices(ulong &cHardDisks, ulong &cOpticalDrives, ulong &cFloppyDrives) 755 { 756 return uisession()->acquireAmountOfStorageDevices(cHardDisks, cOpticalDrives, cFloppyDrives); 752 757 } 753 758 … … 1834 1839 { 1835 1840 /* Initialize CD/FD menus: */ 1836 int iDevicesCountCD = 0; 1837 int iDevicesCountFD = 0; 1838 foreach (const CMediumAttachment &comAttachment, uisession()->machine().GetMediumAttachments()) 1839 { 1840 if (comAttachment.GetType() == KDeviceType_DVD) 1841 ++iDevicesCountCD; 1842 if (comAttachment.GetType() == KDeviceType_Floppy) 1843 ++iDevicesCountFD; 1844 } 1841 ulong cHardDisks = 0; 1842 ulong iOpticalDevices = 0; 1843 ulong cFloppyDevices = 0; 1844 acquireAmountOfStorageDevices(cHardDisks, iOpticalDevices, cFloppyDevices); 1845 1845 QAction *pOpticalDevicesMenu = actionPool()->action(UIActionIndexRT_M_Devices_M_OpticalDevices); 1846 1846 QAction *pFloppyDevicesMenu = actionPool()->action(UIActionIndexRT_M_Devices_M_FloppyDevices); 1847 pOpticalDevicesMenu->setData( iDevicesCountCD);1848 pFloppyDevicesMenu->setData( iDevicesCountFD);1849 if (!i DevicesCountCD)1847 pOpticalDevicesMenu->setData((int)iOpticalDevices); 1848 pFloppyDevicesMenu->setData((int)cFloppyDevices); 1849 if (!iOpticalDevices) 1850 1850 restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType) 1851 1851 (restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_OpticalDevices); 1852 if (! iDevicesCountFD)1852 if (!cFloppyDevices) 1853 1853 restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType) 1854 1854 (restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_FloppyDevices); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h
r98809 r98810 516 516 /** @name Storage stuff. 517 517 ** @{ */ 518 /** Enumerates amount of storage devices. */ 519 bool acquireAmountOfStorageDevices(ulong &cHardDisks, ulong &cOpticalDrives, ulong &cFloppyDrives); 520 518 521 /** Returns a list of storage devices. */ 519 522 bool storageDevices(KDeviceType enmDeviceType, QList<StorageDeviceInfo> &guiStorageDevices); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r98809 r98810 555 555 if (!fSuccess) 556 556 UINotificationMessage::cannotAcquireMachineParameter(comMachine); 557 return fSuccess; 558 } 559 560 bool UISession::acquireAmountOfStorageDevices(ulong &cHardDisks, ulong &cOpticalDrives, ulong &cFloppyDrives) 561 { 562 const CMachine comMachine = machine(); 563 ulong cActualHardDisks = 0, cActualOpticalDrives = 0, cActualFloppyDrives = 0; 564 const CMediumAttachmentVector comAttachments = comMachine.GetMediumAttachments(); 565 bool fSuccess = comMachine.isOk(); 566 if (!fSuccess) 567 UINotificationMessage::cannotAcquireMachineParameter(comMachine); 568 else 569 { 570 foreach (const CMediumAttachment &comAttachment, comAttachments) 571 { 572 /* Get device type: */ 573 const KDeviceType enmDeviceType = comAttachment.GetType(); 574 fSuccess = comAttachment.isOk(); 575 if (!fSuccess) 576 { 577 UINotificationMessage::cannotAcquireMediumAttachmentParameter(comAttachment); 578 break; 579 } 580 581 /* And advance corresponding amount: */ 582 switch (enmDeviceType) 583 { 584 case KDeviceType_HardDisk: ++cActualHardDisks; break; 585 case KDeviceType_DVD: ++cActualOpticalDrives; break; 586 case KDeviceType_Floppy: ++cActualFloppyDrives; break; 587 default: break; 588 } 589 } 590 } 591 if (fSuccess) 592 { 593 cHardDisks = cActualHardDisks; 594 cOpticalDrives = cActualOpticalDrives; 595 cFloppyDrives = cActualFloppyDrives; 596 } 557 597 return fSuccess; 558 598 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r98809 r98810 326 326 /** @name Storage stuff. 327 327 ** @{ */ 328 /** Enumerates amount of storage devices. */ 329 bool acquireAmountOfStorageDevices(ulong &cHardDisks, ulong &cOpticalDrives, ulong &cFloppyDrives); 330 328 331 /** Returns a list of storage devices. */ 329 332 bool storageDevices(KDeviceType enmDeviceType, QList<StorageDeviceInfo> &guiStorageDevices);
Note:
See TracChangeset
for help on using the changeset viewer.