Changeset 23580 in vbox
- Timestamp:
- Oct 6, 2009 11:10:01 AM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 8 added
- 5 edited
-
VirtualBox1.qrc (modified) (1 diff)
-
images/floppy_add_16px.png (added)
-
images/floppy_add_disabled_16px.png (added)
-
images/ide_add_16px.png (added)
-
images/ide_add_disabled_16px.png (added)
-
images/sata_add_16px.png (added)
-
images/sata_add_disabled_16px.png (added)
-
images/scsi_add_16px.png (added)
-
images/scsi_add_disabled_16px.png (added)
-
include/VBoxMediaComboBox.h (modified) (1 diff)
-
include/VBoxVMSettingsHD.h (modified) (6 diffs)
-
src/VBoxVMSettingsHD.cpp (modified) (23 diffs)
-
ui/VBoxVMSettingsHD.ui (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/VirtualBox1.qrc
r23429 r23580 208 208 <file alias="ide_expand_16px.png">images/ide_expand_16px.png</file> 209 209 <file alias="ide_collapse_16px.png">images/ide_collapse_16px.png</file> 210 <file alias="ide_add_16px.png">images/ide_add_16px.png</file> 211 <file alias="ide_add_disabled_16px.png">images/ide_add_disabled_16px.png</file> 210 212 <file alias="sata_16px.png">images/sata_16px.png</file> 211 213 <file alias="sata_expand_16px.png">images/sata_expand_16px.png</file> 212 214 <file alias="sata_collapse_16px.png">images/sata_collapse_16px.png</file> 215 <file alias="sata_add_16px.png">images/sata_add_16px.png</file> 216 <file alias="sata_add_disabled_16px.png">images/sata_add_disabled_16px.png</file> 213 217 <file alias="scsi_16px.png">images/scsi_16px.png</file> 214 218 <file alias="scsi_expand_16px.png">images/scsi_expand_16px.png</file> 215 219 <file alias="scsi_collapse_16px.png">images/scsi_collapse_16px.png</file> 220 <file alias="scsi_add_16px.png">images/scsi_add_16px.png</file> 221 <file alias="scsi_add_disabled_16px.png">images/scsi_add_disabled_16px.png</file> 216 222 <file alias="floppy_16px.png">images/floppy_16px.png</file> 217 223 <file alias="floppy_expand_16px.png">images/floppy_expand_16px.png</file> 218 224 <file alias="floppy_collapse_16px.png">images/floppy_collapse_16px.png</file> 225 <file alias="floppy_add_16px.png">images/floppy_add_16px.png</file> 226 <file alias="floppy_add_disabled_16px.png">images/floppy_add_disabled_16px.png</file> 219 227 <file alias="import_16px.png">images/import_16px.png</file> 220 228 <file alias="export_16px.png">images/export_16px.png</file> -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxMediaComboBox.h
r23238 r23580 44 44 QString id (int = -1) const; 45 45 QString location (int = -1) const; 46 VBoxDefs::MediumType type() const { return mType; } 46 47 47 48 void setCurrentItem (const QString &aItemId); -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsHD.h
r23429 r23580 62 62 enum PixmapType 63 63 { 64 InvalidPixmap = -1, 65 66 AddControllerEn = 0, 67 AddControllerDis = 1, 68 DelControllerEn = 2, 69 DelControllerDis = 3, 70 71 AddAttachmentEn = 4, 72 AddAttachmentDis = 5, 73 DelAttachmentEn = 6, 74 DelAttachmentDis = 7, 75 76 IDEController = 8, 77 IDEExpand = 9, 78 IDECollapse = 10, 79 SATAController = 11, 80 SATAExpand = 12, 81 SATACollapse = 13, 82 SCSIController = 14, 83 SCSIExpand = 15, 84 SCSICollapse = 16, 85 FloppyController = 17, 86 FloppyExpand = 18, 87 FloppyCollapse = 19, 88 89 HDAttachmentEn = 20, 90 CDAttachmentEn = 21, 91 FDAttachmentEn = 22, 92 93 HDAttachmentAddEn = 23, 94 HDAttachmentAddDis = 24, 95 CDAttachmentAddEn = 25, 96 CDAttachmentAddDis = 26, 97 FDAttachmentAddEn = 27, 98 FDAttachmentAddDis = 28, 99 100 VMMEn = 29, 101 VMMDis = 30, 64 InvalidPixmap = -1, 65 66 ControllerAddEn = 0, 67 ControllerAddDis = 1, 68 ControllerDelEn = 2, 69 ControllerDelDis = 3, 70 71 AttachmentAddEn = 4, 72 AttachmentAddDis = 5, 73 AttachmentDelEn = 6, 74 AttachmentDelDis = 7, 75 76 IDEControllerNormal = 8, 77 IDEControllerExpand = 9, 78 IDEControllerCollapse = 10, 79 SATAControllerNormal = 11, 80 SATAControllerExpand = 12, 81 SATAControllerCollapse = 13, 82 SCSIControllerNormal = 14, 83 SCSIControllerExpand = 15, 84 SCSIControllerCollapse = 16, 85 FloppyControllerNormal = 17, 86 FloppyControllerExpand = 18, 87 FloppyControllerCollapse = 19, 88 89 IDEControllerAddEn = 20, 90 IDEControllerAddDis = 21, 91 SATAControllerAddEn = 22, 92 SATAControllerAddDis = 23, 93 SCSIControllerAddEn = 24, 94 SCSIControllerAddDis = 25, 95 FloppyControllerAddEn = 26, 96 FloppyControllerAddDis = 27, 97 98 HDAttachmentNormal = 28, 99 CDAttachmentNormal = 29, 100 FDAttachmentNormal = 30, 101 102 HDAttachmentAddEn = 31, 103 HDAttachmentAddDis = 32, 104 CDAttachmentAddEn = 33, 105 CDAttachmentAddDis = 34, 106 FDAttachmentAddEn = 35, 107 FDAttachmentAddDis = 36, 108 109 VMMEn = 37, 110 VMMDis = 38, 102 111 103 112 MaxIndex … … 255 264 RootItem(); 256 265 ~RootItem(); 266 267 ULONG childCount (KStorageBus aBus) const; 257 268 258 269 private: … … 395 406 396 407 R_ToolTipType, 397 R_IsMoreControllersPossible, 408 R_IsMoreIDEControllersPossible, 409 R_IsMoreSATAControllersPossible, 410 R_IsMoreSCSIControllersPossible, 411 R_IsMoreFloppyControllersPossible, 398 412 R_IsMoreAttachmentsPossible, 399 413 … … 538 552 void delController(); 539 553 540 void addAttachment (KDeviceType aDeviceType = KDeviceType_Null); 554 void addAttachment(); 555 void addHDAttachment(); 556 void addCDAttachment(); 557 void addFDAttachment(); 541 558 void delAttachment(); 542 559 … … 561 578 562 579 private: 580 581 void addControllerWrapper (const QString &aName, KStorageBus aBus, KStorageControllerType aType); 582 void addAttachmentWrapper (KDeviceType aDevice); 563 583 564 584 QString getWithNewHDWizard(); … … 581 601 QAction *mDelCtrAction; 582 602 QAction *mAddAttAction; 603 QAction *mAddHDAttAction; 604 QAction *mAddCDAttAction; 605 QAction *mAddFDAttAction; 583 606 QAction *mDelAttAction; 584 607 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsHD.cpp
r23444 r23580 114 114 mPool.resize (MaxIndex); 115 115 116 mPool [AddControllerEn] = QPixmap (":/controller_add_16px.png"); 117 mPool [AddControllerDis] = QPixmap (":/controller_add_disabled_16px.png"); 118 mPool [DelControllerEn] = QPixmap (":/controller_remove_16px.png"); 119 mPool [DelControllerDis] = QPixmap (":/controller_remove_disabled_16px.png"); 120 121 mPool [AddAttachmentEn] = QPixmap (":/attachment_add_16px.png"); 122 mPool [AddAttachmentDis] = QPixmap (":/attachment_add_disabled_16px.png"); 123 mPool [DelAttachmentEn] = QPixmap (":/attachment_remove_16px.png"); 124 mPool [DelAttachmentDis] = QPixmap (":/attachment_remove_disabled_16px.png"); 125 126 mPool [IDEController] = QPixmap (":/ide_16px.png"); 127 mPool [IDEExpand] = QPixmap (":/ide_expand_16px.png"); 128 mPool [IDECollapse] = QPixmap (":/ide_collapse_16px.png"); 129 mPool [SATAController] = QPixmap (":/sata_16px.png"); 130 mPool [SATAExpand] = QPixmap (":/sata_expand_16px.png"); 131 mPool [SATACollapse] = QPixmap (":/sata_collapse_16px.png"); 132 mPool [SCSIController] = QPixmap (":/scsi_16px.png"); 133 mPool [SCSIExpand] = QPixmap (":/scsi_expand_16px.png"); 134 mPool [SCSICollapse] = QPixmap (":/scsi_collapse_16px.png"); 135 mPool [FloppyController] = QPixmap (":/floppy_16px.png"); 136 mPool [FloppyExpand] = QPixmap (":/floppy_expand_16px.png"); 137 mPool [FloppyCollapse] = QPixmap (":/floppy_collapse_16px.png"); 138 139 mPool [HDAttachmentEn] = QPixmap (":/hd_16px.png"); 140 mPool [CDAttachmentEn] = QPixmap (":/cd_16px.png"); 141 mPool [FDAttachmentEn] = QPixmap (":/fd_16px.png"); 142 143 mPool [HDAttachmentAddEn] = QPixmap (":/hd_add_16px.png"); 144 mPool [HDAttachmentAddDis] = QPixmap (":/hd_add_disabled_16px.png"); 145 mPool [CDAttachmentAddEn] = QPixmap (":/cd_add_16px.png"); 146 mPool [CDAttachmentAddDis] = QPixmap (":/cd_add_disabled_16px.png"); 147 mPool [FDAttachmentAddEn] = QPixmap (":/fd_add_16px.png"); 148 mPool [FDAttachmentAddDis] = QPixmap (":/fd_add_disabled_16px.png"); 149 150 mPool [VMMEn] = QPixmap (":/select_file_16px.png"); 151 mPool [VMMDis] = QPixmap (":/select_file_dis_16px.png"); 116 mPool [ControllerAddEn] = QPixmap (":/controller_add_16px.png"); 117 mPool [ControllerAddDis] = QPixmap (":/controller_add_disabled_16px.png"); 118 mPool [ControllerDelEn] = QPixmap (":/controller_remove_16px.png"); 119 mPool [ControllerDelDis] = QPixmap (":/controller_remove_disabled_16px.png"); 120 121 mPool [AttachmentAddEn] = QPixmap (":/attachment_add_16px.png"); 122 mPool [AttachmentAddDis] = QPixmap (":/attachment_add_disabled_16px.png"); 123 mPool [AttachmentDelEn] = QPixmap (":/attachment_remove_16px.png"); 124 mPool [AttachmentDelDis] = QPixmap (":/attachment_remove_disabled_16px.png"); 125 126 mPool [IDEControllerNormal] = QPixmap (":/ide_16px.png"); 127 mPool [IDEControllerExpand] = QPixmap (":/ide_expand_16px.png"); 128 mPool [IDEControllerCollapse] = QPixmap (":/ide_collapse_16px.png"); 129 mPool [SATAControllerNormal] = QPixmap (":/sata_16px.png"); 130 mPool [SATAControllerExpand] = QPixmap (":/sata_expand_16px.png"); 131 mPool [SATAControllerCollapse] = QPixmap (":/sata_collapse_16px.png"); 132 mPool [SCSIControllerNormal] = QPixmap (":/scsi_16px.png"); 133 mPool [SCSIControllerExpand] = QPixmap (":/scsi_expand_16px.png"); 134 mPool [SCSIControllerCollapse] = QPixmap (":/scsi_collapse_16px.png"); 135 mPool [FloppyControllerNormal] = QPixmap (":/floppy_16px.png"); 136 mPool [FloppyControllerExpand] = QPixmap (":/floppy_expand_16px.png"); 137 mPool [FloppyControllerCollapse] = QPixmap (":/floppy_collapse_16px.png"); 138 139 mPool [IDEControllerAddEn] = QPixmap (":/ide_add_16px.png"); 140 mPool [IDEControllerAddDis] = QPixmap (":/ide_add_disabled_16px.png"); 141 mPool [SATAControllerAddEn] = QPixmap (":/sata_add_16px.png"); 142 mPool [SATAControllerAddDis] = QPixmap (":/sata_add_disabled_16px.png"); 143 mPool [SCSIControllerAddEn] = QPixmap (":/scsi_add_16px.png"); 144 mPool [SCSIControllerAddDis] = QPixmap (":/scsi_add_disabled_16px.png"); 145 mPool [FloppyControllerAddEn] = QPixmap (":/floppy_add_16px.png"); 146 mPool [FloppyControllerAddDis] = QPixmap (":/floppy_add_disabled_16px.png"); 147 148 mPool [HDAttachmentNormal] = QPixmap (":/hd_16px.png"); 149 mPool [CDAttachmentNormal] = QPixmap (":/cd_16px.png"); 150 mPool [FDAttachmentNormal] = QPixmap (":/fd_16px.png"); 151 152 mPool [HDAttachmentAddEn] = QPixmap (":/hd_add_16px.png"); 153 mPool [HDAttachmentAddDis] = QPixmap (":/hd_add_disabled_16px.png"); 154 mPool [CDAttachmentAddEn] = QPixmap (":/cd_add_16px.png"); 155 mPool [CDAttachmentAddDis] = QPixmap (":/cd_add_disabled_16px.png"); 156 mPool [FDAttachmentAddEn] = QPixmap (":/fd_add_16px.png"); 157 mPool [FDAttachmentAddDis] = QPixmap (":/fd_add_disabled_16px.png"); 158 159 mPool [VMMEn] = QPixmap (":/select_file_16px.png"); 160 mPool [VMMDis] = QPixmap (":/select_file_dis_16px.png"); 152 161 } 153 162 … … 171 180 { 172 181 case KStorageBus_IDE: 173 mPixmaps [i] = (PixmapPool::PixmapType) (PixmapPool::IDEController + i);182 mPixmaps [i] = (PixmapPool::PixmapType) (PixmapPool::IDEControllerNormal + i); 174 183 break; 175 184 case KStorageBus_SATA: 176 mPixmaps [i] = (PixmapPool::PixmapType) (PixmapPool::SATAController + i);185 mPixmaps [i] = (PixmapPool::PixmapType) (PixmapPool::SATAControllerNormal + i); 177 186 break; 178 187 case KStorageBus_SCSI: 179 mPixmaps [i] = (PixmapPool::PixmapType) (PixmapPool::SCSIController + i);188 mPixmaps [i] = (PixmapPool::PixmapType) (PixmapPool::SCSIControllerNormal + i); 180 189 break; 181 190 case KStorageBus_Floppy: 182 mPixmaps [i] = (PixmapPool::PixmapType) (PixmapPool::FloppyController + i);191 mPixmaps [i] = (PixmapPool::PixmapType) (PixmapPool::FloppyControllerNormal + i); 183 192 break; 184 193 default: … … 344 353 while (!mControllers.isEmpty()) 345 354 delete mControllers.first(); 355 } 356 357 ULONG RootItem::childCount (KStorageBus aBus) const 358 { 359 ULONG result = 0; 360 foreach (AbstractItem *item, mControllers) 361 { 362 ControllerItem *ctrItem = static_cast <ControllerItem*> (item); 363 if (ctrItem->ctrBusType() == aBus) 364 ++ result; 365 } 366 return result; 346 367 } 347 368 … … 817 838 { 818 839 case KDeviceType_HardDisk: 819 mAttPixmap = PixmapPool::pool()->pixmap (PixmapPool::HDAttachment En);840 mAttPixmap = PixmapPool::pool()->pixmap (PixmapPool::HDAttachmentNormal); 820 841 break; 821 842 case KDeviceType_DVD: 822 mAttPixmap = PixmapPool::pool()->pixmap (PixmapPool::CDAttachment En);843 mAttPixmap = PixmapPool::pool()->pixmap (PixmapPool::CDAttachmentNormal); 823 844 break; 824 845 case KDeviceType_Floppy: 825 mAttPixmap = PixmapPool::pool()->pixmap (PixmapPool::FDAttachment En);846 mAttPixmap = PixmapPool::pool()->pixmap (PixmapPool::FDAttachmentNormal); 826 847 break; 827 848 default: … … 1012 1033 return QVariant::fromValue (mToolTipType); 1013 1034 } 1014 case R_IsMoreControllersPossible: 1015 { 1016 return rowCount (root()) < 16; 1035 case R_IsMoreIDEControllersPossible: 1036 { 1037 return static_cast <RootItem*> (mRootItem)->childCount (KStorageBus_IDE) < 1038 vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus (KStorageBus_IDE); 1039 } 1040 case R_IsMoreSATAControllersPossible: 1041 { 1042 return static_cast <RootItem*> (mRootItem)->childCount (KStorageBus_SATA) < 1043 vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus (KStorageBus_SATA); 1044 } 1045 case R_IsMoreSCSIControllersPossible: 1046 { 1047 return static_cast <RootItem*> (mRootItem)->childCount (KStorageBus_SCSI) < 1048 vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus (KStorageBus_SCSI); 1049 } 1050 case R_IsMoreFloppyControllersPossible: 1051 { 1052 return static_cast <RootItem*> (mRootItem)->childCount (KStorageBus_Floppy) < 1053 vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus (KStorageBus_Floppy); 1017 1054 } 1018 1055 case R_IsMoreAttachmentsPossible: … … 1181 1218 case R_HDPixmapEn: 1182 1219 { 1183 return PixmapPool::pool()->pixmap (PixmapPool::HDAttachment En);1220 return PixmapPool::pool()->pixmap (PixmapPool::HDAttachmentNormal); 1184 1221 } 1185 1222 case R_CDPixmapEn: 1186 1223 { 1187 return PixmapPool::pool()->pixmap (PixmapPool::CDAttachment En);1224 return PixmapPool::pool()->pixmap (PixmapPool::CDAttachmentNormal); 1188 1225 } 1189 1226 case R_FDPixmapEn: 1190 1227 { 1191 return PixmapPool::pool()->pixmap (PixmapPool::FDAttachment En);1228 return PixmapPool::pool()->pixmap (PixmapPool::FDAttachmentNormal); 1192 1229 } 1193 1230 … … 1524 1561 /* Controller Actions */ 1525 1562 mAddCtrAction = new QAction (this); 1526 mAddCtrAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool:: AddControllerEn),1527 PixmapPool::pool()->pixmap (PixmapPool:: AddControllerDis)));1563 mAddCtrAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::ControllerAddEn), 1564 PixmapPool::pool()->pixmap (PixmapPool::ControllerAddDis))); 1528 1565 1529 1566 mAddIDECtrAction = new QAction (this); 1530 mAddIDECtrAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::IDEController))); 1567 mAddIDECtrAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::IDEControllerAddEn), 1568 PixmapPool::pool()->pixmap (PixmapPool::IDEControllerAddDis))); 1531 1569 1532 1570 mAddSATACtrAction = new QAction (this); 1533 mAddSATACtrAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::SATAController))); 1571 mAddSATACtrAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::SATAControllerAddEn), 1572 PixmapPool::pool()->pixmap (PixmapPool::SATAControllerAddDis))); 1534 1573 1535 1574 mAddSCSICtrAction = new QAction (this); 1536 mAddSCSICtrAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::SCSIController))); 1575 mAddSCSICtrAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::SCSIControllerAddEn), 1576 PixmapPool::pool()->pixmap (PixmapPool::SCSIControllerAddDis))); 1537 1577 1538 1578 mAddFloppyCtrAction = new QAction (this); 1539 mAddFloppyCtrAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::FloppyController))); 1579 mAddFloppyCtrAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::FloppyControllerAddEn), 1580 PixmapPool::pool()->pixmap (PixmapPool::FloppyControllerAddDis))); 1540 1581 1541 1582 mDelCtrAction = new QAction (this); 1542 mDelCtrAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool:: DelControllerEn),1543 PixmapPool::pool()->pixmap (PixmapPool:: DelControllerDis)));1583 mDelCtrAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::ControllerDelEn), 1584 PixmapPool::pool()->pixmap (PixmapPool::ControllerDelDis))); 1544 1585 1545 1586 /* Attachment Actions */ 1546 1587 mAddAttAction = new QAction (this); 1547 mAddAttAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::AddAttachmentEn), 1548 PixmapPool::pool()->pixmap (PixmapPool::AddAttachmentDis))); 1588 mAddAttAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::AttachmentAddEn), 1589 PixmapPool::pool()->pixmap (PixmapPool::AttachmentAddDis))); 1590 1591 mAddHDAttAction = new QAction (this); 1592 mAddHDAttAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::HDAttachmentAddEn), 1593 PixmapPool::pool()->pixmap (PixmapPool::HDAttachmentAddDis))); 1594 1595 mAddCDAttAction = new QAction (this); 1596 mAddCDAttAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::CDAttachmentAddEn), 1597 PixmapPool::pool()->pixmap (PixmapPool::CDAttachmentAddDis))); 1598 1599 mAddFDAttAction = new QAction (this); 1600 mAddFDAttAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::FDAttachmentAddEn), 1601 PixmapPool::pool()->pixmap (PixmapPool::FDAttachmentAddDis))); 1549 1602 1550 1603 mDelAttAction = new QAction (this); 1551 mDelAttAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool:: DelAttachmentEn),1552 PixmapPool::pool()->pixmap (PixmapPool:: DelAttachmentDis)));1604 mDelAttAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::AttachmentDelEn), 1605 PixmapPool::pool()->pixmap (PixmapPool::AttachmentDelDis))); 1553 1606 1554 1607 /* Storage Model/View */ … … 1605 1658 connect (mDelCtrAction, SIGNAL (triggered (bool)), this, SLOT (delController())); 1606 1659 connect (mAddAttAction, SIGNAL (triggered (bool)), this, SLOT (addAttachment())); 1660 connect (mAddHDAttAction, SIGNAL (triggered (bool)), this, SLOT (addHDAttachment())); 1661 connect (mAddCDAttAction, SIGNAL (triggered (bool)), this, SLOT (addCDAttachment())); 1662 connect (mAddFDAttAction, SIGNAL (triggered (bool)), this, SLOT (addFDAttachment())); 1607 1663 connect (mDelAttAction, SIGNAL (triggered (bool)), this, SLOT (delAttachment())); 1608 1664 connect (mStorageModel, SIGNAL (rowsInserted (const QModelIndex&, int, int)), … … 1625 1681 connect (mCbType, SIGNAL (activated (int)), this, SLOT (setInformation())); 1626 1682 connect (mCbSlot, SIGNAL (activated (int)), this, SLOT (setInformation())); 1627 connect (mCbDevice, SIGNAL (activated (int)), this, SLOT (setInformation()));1628 1683 connect (mCbVdi, SIGNAL (activated (int)), this, SLOT (setInformation())); 1629 1684 connect (mTbVmm, SIGNAL (clicked (bool)), this, SLOT (onVmmInvoked())); … … 1639 1694 /* Initial setup */ 1640 1695 setMinimumWidth (500); 1641 mSplitter->setSizes (QList<int>() << 0.45 * minimumWidth() << 0.55 * minimumWidth());1696 mSplitter->setSizes (QList<int>() << (int) (0.45 * minimumWidth()) << (int) (0.55 * minimumWidth())); 1642 1697 } 1643 1698 … … 1765 1820 mDelCtrAction->setText (tr ("Remove Controller")); 1766 1821 mAddAttAction->setText (tr ("Add Attachment")); 1822 mAddHDAttAction->setText (tr ("Add Hard Disk")); 1823 mAddCDAttAction->setText (tr ("Add CD/DVD Device")); 1824 mAddFDAttAction->setText (tr ("Add Floppy Device")); 1767 1825 mDelAttAction->setText (tr ("Remove Attachment")); 1768 1826 … … 1797 1855 mLtController->setColumnMinimumWidth (0, 10); 1798 1856 mLtAttachment->setColumnMinimumWidth (0, 10); 1799 1857 #if 0 1800 1858 /* Second column indent minimum width */ 1801 1859 QList <QLabel*> labelsList; 1802 labelsList << mLbSlot << mLb Device << mLbVdi1860 labelsList << mLbSlot << mLbVdi 1803 1861 << mLbHDVirtualSize << mLbHDActualSize << mLbSize 1804 1862 << mLbLocation << mLbHDFormat << mLbUsage; … … 1811 1869 } 1812 1870 mLtAttachment->setColumnMinimumWidth (1, maxWidth); 1871 #endif 1813 1872 } 1814 1873 VBoxSettingsPage::showEvent (aEvent); … … 1865 1924 void VBoxVMSettingsHD::addIDEController() 1866 1925 { 1867 mStorageModel->addController (generateUniqueName (tr ("IDE Controller")), 1868 KStorageBus_IDE, KStorageControllerType_PIIX4); 1869 emit storageChanged(); 1926 addControllerWrapper (generateUniqueName (tr ("IDE Controller")), KStorageBus_IDE, KStorageControllerType_PIIX4); 1870 1927 } 1871 1928 1872 1929 void VBoxVMSettingsHD::addSATAController() 1873 1930 { 1874 mStorageModel->addController (generateUniqueName (tr ("SATA Controller")), 1875 KStorageBus_SATA, KStorageControllerType_IntelAhci); 1876 emit storageChanged(); 1931 addControllerWrapper (generateUniqueName (tr ("SATA Controller")), KStorageBus_SATA, KStorageControllerType_IntelAhci); 1877 1932 } 1878 1933 1879 1934 void VBoxVMSettingsHD::addSCSIController() 1880 1935 { 1881 mStorageModel->addController (generateUniqueName (tr ("SCSI Controller")), 1882 KStorageBus_SCSI, KStorageControllerType_LsiLogic); 1883 emit storageChanged(); 1936 addControllerWrapper (generateUniqueName (tr ("SCSI Controller")), KStorageBus_SCSI, KStorageControllerType_LsiLogic); 1884 1937 } 1885 1938 1886 1939 void VBoxVMSettingsHD::addFloppyController() 1887 1940 { 1888 mStorageModel->addController (generateUniqueName (tr ("Floppy Controller")), 1889 KStorageBus_Floppy, KStorageControllerType_I82078); 1890 emit storageChanged(); 1941 addControllerWrapper (generateUniqueName (tr ("Floppy Controller")), KStorageBus_Floppy, KStorageControllerType_I82078); 1891 1942 } 1892 1943 … … 1901 1952 } 1902 1953 1903 void VBoxVMSettingsHD::addAttachment (KDeviceType aDeviceType)1954 void VBoxVMSettingsHD::addAttachment() 1904 1955 { 1905 1956 QModelIndex index = mTwStorageTree->currentIndex(); 1906 if (!mStorageModel->data (index, StorageModel::R_IsController).toBool()) return; 1907 1908 if (aDeviceType == KDeviceType_Null) 1909 aDeviceType = mStorageModel->data (index, StorageModel::R_CtrDevices).value <DeviceTypeList>() [0]; 1910 1911 mStorageModel->addAttachment (QUuid (mStorageModel->data (index, StorageModel::R_ItemId).toString()), aDeviceType); 1912 emit storageChanged(); 1913 mValidator->revalidate(); 1957 Assert (mStorageModel->data (index, StorageModel::R_IsController).toBool()); 1958 1959 if (mStorageModel->data (index, StorageModel::R_CtrBusType).value <KStorageBus>() == KStorageBus_Floppy) 1960 { 1961 Assert (mAddFDAttAction->isEnabled()); 1962 mAddFDAttAction->trigger(); 1963 } 1964 else 1965 { 1966 QMenu menu; 1967 menu.addAction (mAddHDAttAction); 1968 menu.addAction (mAddCDAttAction); 1969 menu.exec (QCursor::pos()); 1970 } 1971 } 1972 1973 void VBoxVMSettingsHD::addHDAttachment() 1974 { 1975 addAttachmentWrapper (KDeviceType_HardDisk); 1976 } 1977 1978 void VBoxVMSettingsHD::addCDAttachment() 1979 { 1980 addAttachmentWrapper (KDeviceType_DVD); 1981 } 1982 1983 void VBoxVMSettingsHD::addFDAttachment() 1984 { 1985 addAttachmentWrapper (KDeviceType_Floppy); 1914 1986 } 1915 1987 … … 1972 2044 mCbSlot->setCurrentIndex (attSlotPos == -1 ? 0 : attSlotPos); 1973 2045 1974 /* Getting Attachment Device */1975 mCbDevice->clear();1976 DeviceTypeList deviceTypeList (mStorageModel->data (index, StorageModel::R_AttDevices).value <DeviceTypeList>());1977 for (int i = 0; i < deviceTypeList.size(); ++ i)1978 mCbDevice->insertItem (mCbDevice->count(), vboxGlobal().toString (deviceTypeList [i]));1979 KDeviceType device = mStorageModel->data (index, StorageModel::R_AttDevice).value <KDeviceType>();1980 int attDevicePos = mCbDevice->findText (vboxGlobal().toString (device));1981 mCbDevice->setCurrentIndex (attDevicePos == -1 ? 0 : attDevicePos);1982 1983 2046 /* Getting Show Diffs state */ 1984 2047 bool isShowDiffs = mStorageModel->data (index, StorageModel::R_AttIsShowDiffs).toBool(); … … 1986 2049 1987 2050 /* Getting Attachment Medium */ 2051 KDeviceType device = mStorageModel->data (index, StorageModel::R_AttDevice).value <KDeviceType>(); 2052 switch (device) 2053 { 2054 case KDeviceType_HardDisk: 2055 mLbVdi->setText (tr ("Hard &Disk:")); 2056 break; 2057 case KDeviceType_DVD: 2058 mLbVdi->setText (tr ("&CD/DVD Device:")); 2059 break; 2060 case KDeviceType_Floppy: 2061 mLbVdi->setText (tr ("&Floppy Device:")); 2062 break; 2063 default: 2064 break; 2065 } 1988 2066 mCbVdi->setType (typeToLocal (device)); 1989 2067 mCbVdi->setShowDiffs (isShowDiffs); … … 2046 2124 mStorageModel->setData (index, QVariant::fromValue (vboxGlobal().toStorageSlot (mCbSlot->currentText())), 2047 2125 StorageModel::R_AttSlot); 2048 /* Setting Attachment Device-Type */2049 else if (sdr == mCbDevice)2050 {2051 KDeviceType device = vboxGlobal().toDeviceType (mCbDevice->currentText());2052 mStorageModel->setData (index, QVariant::fromValue (device), StorageModel::R_AttDevice);2053 mCbVdi->setType (typeToLocal (device));2054 mCbVdi->setShowDiffs (mCbShowDiffs->isChecked());2055 mCbVdi->refresh();2056 }2057 2126 /* Setting Attachment Medium */ 2058 2127 else if (sdr == mCbVdi) … … 2077 2146 void VBoxVMSettingsHD::onVmmInvoked() 2078 2147 { 2079 QString id = getWithMediaManager ( typeToLocal (vboxGlobal().toDeviceType (mCbDevice->currentText())));2148 QString id = getWithMediaManager (mCbVdi->type()); 2080 2149 if (!id.isNull()) 2081 2150 mCbVdi->setCurrentItem (id); … … 2086 2155 QModelIndex index = mTwStorageTree->currentIndex(); 2087 2156 2088 mAddCtrAction->setEnabled (mStorageModel->data (index, StorageModel::R_IsMoreControllersPossible).toBool()); 2089 mAddIDECtrAction->setEnabled (mStorageModel->data (index, StorageModel::R_IsMoreControllersPossible).toBool()); 2090 mAddSATACtrAction->setEnabled (mStorageModel->data (index, StorageModel::R_IsMoreControllersPossible).toBool()); 2091 mAddSCSICtrAction->setEnabled (mStorageModel->data (index, StorageModel::R_IsMoreControllersPossible).toBool()); 2092 mAddFloppyCtrAction->setEnabled (mStorageModel->data (index, StorageModel::R_IsMoreControllersPossible).toBool()); 2093 mAddAttAction->setEnabled (mStorageModel->data (index, StorageModel::R_IsController).toBool() && 2094 mStorageModel->data (index, StorageModel::R_IsMoreAttachmentsPossible).toBool()); 2095 2096 mDelCtrAction->setEnabled (mStorageModel->data (index, StorageModel::R_IsController).toBool()); 2097 mDelAttAction->setEnabled (mStorageModel->data (index, StorageModel::R_IsAttachment).toBool()); 2157 bool isIDEPossible = mStorageModel->data (index, StorageModel::R_IsMoreIDEControllersPossible).toBool(); 2158 bool isSATAPossible = mStorageModel->data (index, StorageModel::R_IsMoreSATAControllersPossible).toBool(); 2159 bool isSCSIPossible = mStorageModel->data (index, StorageModel::R_IsMoreSCSIControllersPossible).toBool(); 2160 bool isFloppyPossible = mStorageModel->data (index, StorageModel::R_IsMoreFloppyControllersPossible).toBool(); 2161 2162 bool isController = mStorageModel->data (index, StorageModel::R_IsController).toBool(); 2163 bool isAttachment = mStorageModel->data (index, StorageModel::R_IsAttachment).toBool(); 2164 bool isAttachmentsPossible = mStorageModel->data (index, StorageModel::R_IsMoreAttachmentsPossible).toBool(); 2165 2166 mAddCtrAction->setEnabled (isIDEPossible || isSATAPossible || isSCSIPossible || isFloppyPossible); 2167 mAddIDECtrAction->setEnabled (isIDEPossible); 2168 mAddSATACtrAction->setEnabled (isSATAPossible); 2169 mAddSCSICtrAction->setEnabled (isSCSIPossible); 2170 mAddFloppyCtrAction->setEnabled (isFloppyPossible); 2171 2172 mAddAttAction->setEnabled (isController && isAttachmentsPossible); 2173 mAddHDAttAction->setEnabled (isController && isAttachmentsPossible); 2174 mAddCDAttAction->setEnabled (isController && isAttachmentsPossible); 2175 mAddFDAttAction->setEnabled (isController && isAttachmentsPossible); 2176 2177 mDelCtrAction->setEnabled (isController); 2178 mDelAttAction->setEnabled (isAttachment); 2098 2179 } 2099 2180 … … 2140 2221 void VBoxVMSettingsHD::onRowRemoved() 2141 2222 { 2223 if (mStorageModel->rowCount (mStorageModel->root()) == 0) 2224 mTwStorageTree->setCurrentIndex (mStorageModel->root()); 2225 2142 2226 updateActionsState(); 2143 2227 getInformation(); … … 2160 2244 case AbstractItem::Type_ControllerItem: 2161 2245 { 2162 menu.addAction (mAddAttAction); 2246 DeviceTypeList deviceTypeList (mStorageModel->data (index, StorageModel::R_CtrDevices).value <DeviceTypeList>()); 2247 foreach (KDeviceType deviceType, deviceTypeList) 2248 { 2249 switch (deviceType) 2250 { 2251 case KDeviceType_HardDisk: 2252 menu.addAction (mAddHDAttAction); 2253 break; 2254 case KDeviceType_DVD: 2255 menu.addAction (mAddCDAttAction); 2256 break; 2257 case KDeviceType_Floppy: 2258 menu.addAction (mAddFDAttAction); 2259 break; 2260 default: 2261 break; 2262 } 2263 } 2163 2264 menu.addAction (mDelCtrAction); 2164 2265 break; … … 2341 2442 aEvent->setAccepted (true); 2342 2443 if (mAddAttAction->isEnabled()) 2343 addAttachment (deviceType);2444 addAttachmentWrapper (deviceType); 2344 2445 return; 2345 2446 } 2346 2447 } 2347 2448 } 2449 } 2450 2451 void VBoxVMSettingsHD::addControllerWrapper (const QString &aName, KStorageBus aBus, KStorageControllerType aType) 2452 { 2453 QModelIndex index = mTwStorageTree->currentIndex(); 2454 switch (aBus) 2455 { 2456 case KStorageBus_IDE: 2457 Assert (mStorageModel->data (index, StorageModel::R_IsMoreIDEControllersPossible).toBool()); 2458 break; 2459 case KStorageBus_SATA: 2460 Assert (mStorageModel->data (index, StorageModel::R_IsMoreSATAControllersPossible).toBool()); 2461 break; 2462 case KStorageBus_SCSI: 2463 Assert (mStorageModel->data (index, StorageModel::R_IsMoreSCSIControllersPossible).toBool()); 2464 break; 2465 case KStorageBus_Floppy: 2466 Assert (mStorageModel->data (index, StorageModel::R_IsMoreFloppyControllersPossible).toBool()); 2467 break; 2468 default: 2469 break; 2470 } 2471 2472 mStorageModel->addController (aName, aBus, aType); 2473 emit storageChanged(); 2474 } 2475 2476 void VBoxVMSettingsHD::addAttachmentWrapper (KDeviceType aDevice) 2477 { 2478 QModelIndex index = mTwStorageTree->currentIndex(); 2479 Assert (mStorageModel->data (index, StorageModel::R_IsController).toBool()); 2480 Assert (mStorageModel->data (index, StorageModel::R_IsMoreAttachmentsPossible).toBool()); 2481 2482 mStorageModel->addAttachment (QUuid (mStorageModel->data (index, StorageModel::R_ItemId).toString()), aDevice); 2483 emit storageChanged(); 2484 mValidator->revalidate(); 2348 2485 } 2349 2486 -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsHD.ui
r23260 r23580 72 72 <widget class="QITreeView" native="1" name="mTwStorageTree" > 73 73 <property name="whatsThis" > 74 <string>Contains all the created storage controllers and all the attached mediums representing virtual images and realhost-drives.</string>74 <string>Contains all the created storage controllers and all the attached virtual images and host-drives.</string> 75 75 </property> 76 76 </widget> … … 277 277 </item> 278 278 <item row="2" column="1" > 279 <widget class="QLabel" name="mLbDevice" >280 <property name="text" >281 <string>&Device:</string>282 </property>283 <property name="buddy" >284 <cstring>mCbDevice</cstring>285 </property>286 <property name="alignment" >287 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>288 </property>289 </widget>290 </item>291 <item row="2" column="2" colspan="2" >292 <widget class="QComboBox" name="mCbDevice" >293 <property name="whatsThis" >294 <string>Allows to select the type of the device represented by the currently selected attachment. The list of possible device types depends on parent controller type.</string>295 </property>296 <property name="sizePolicy" >297 <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >298 <horstretch>0</horstretch>299 <verstretch>0</verstretch>300 </sizepolicy>301 </property>302 </widget>303 </item>304 <item row="3" column="1" >305 279 <widget class="QLabel" name="mLbVdi" > 306 <property name="text" >307 <string>&Medium:</string>308 </property>309 280 <property name="buddy" > 310 281 <cstring>mCbVdi</cstring> … … 315 286 </widget> 316 287 </item> 317 <item row=" 3" column="2" >288 <item row="2" column="2" > 318 289 <widget class="VBoxMediaComboBox" native="1" name="mCbVdi" > 319 290 <property name="whatsThis" > 320 <string>Allows to select the medium assigned for the currently selected attachment according to device type of this attachment. Available mediums list could contain virtual images and real host drives corresponding to device type currently chosen forthis attachment.</string>291 <string>Allows to select virtual image or host-drive assigned for the currently selected attachment according to device type of this attachment.</string> 321 292 </property> 322 293 <property name="sizePolicy" > … … 328 299 </widget> 329 300 </item> 330 <item row=" 3" column="3" >301 <item row="2" column="3" > 331 302 <widget class="QIToolButton" name="mTbVmm" > 332 303 <property name="whatsThis" > 333 <string> Invokes the Virtual Media Manager to select a medium to mount.</string>304 <string>Opens the Virtual Media Manager to select a virtual image for this attachment.</string> 334 305 </property> 335 306 <property name="toolTip" > … … 344 315 </widget> 345 316 </item> 346 <item row=" 4" column="2" colspan="2" >317 <item row="3" column="2" colspan="2" > 347 318 <widget class="QCheckBox" name="mCbShowDiffs"> 348 319 <property name="sizePolicy" > … … 360 331 </widget> 361 332 </item> 362 <item row=" 5" column="2" colspan="2" >333 <item row="4" column="2" colspan="2" > 363 334 <widget class="QCheckBox" name="mCbPassthrough" > 364 335 <property name="sizePolicy" > … … 369 340 </property> 370 341 <property name="whatsThis" > 371 <string>When checked, allows the guest to send ATAPI commands directly to the host drive which makes it possible to use CD/DVD writers connected to the host inside the VM. Note that writing audio CD inside the VM is not yet supported.</string>342 <string>When checked, allows the guest to send ATAPI commands directly to the host-drive which makes it possible to use CD/DVD writers connected to the host inside the VM. Note that writing audio CD inside the VM is not yet supported.</string> 372 343 </property> 373 344 <property name="text" > … … 376 347 </widget> 377 348 </item> 378 <item row=" 6" column="0" colspan="4" >349 <item row="5" column="0" colspan="4" > 379 350 <widget class="QILabelSeparator" native="1" name="mLsInformation" > 380 351 <property name="text" > … … 383 354 </widget> 384 355 </item> 356 <item row="6" column="1" > 357 <widget class="QLabel" name="mLbHDVirtualSize" > 358 <property name="text" > 359 <string>Virtual Size:</string> 360 </property> 361 <property name="alignment" > 362 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> 363 </property> 364 </widget> 365 </item> 366 <item row="6" column="2" colspan="2" > 367 <widget class="QILabel" name="mLbHDVirtualSizeValue" > 368 <property name="sizePolicy" > 369 <sizepolicy vsizetype="Preferred" hsizetype="Ignored" > 370 <horstretch>0</horstretch> 371 <verstretch>0</verstretch> 372 </sizepolicy> 373 </property> 374 </widget> 375 </item> 385 376 <item row="7" column="1" > 386 <widget class="QLabel" name="mLbHD VirtualSize" >387 <property name="text" > 388 <string> Virtual Size:</string>377 <widget class="QLabel" name="mLbHDActualSize" > 378 <property name="text" > 379 <string>Actual Size:</string> 389 380 </property> 390 381 <property name="alignment" > … … 394 385 </item> 395 386 <item row="7" column="2" colspan="2" > 396 <widget class="QILabel" name="mLbHD VirtualSizeValue" >387 <widget class="QILabel" name="mLbHDActualSizeValue" > 397 388 <property name="sizePolicy" > 398 389 <sizepolicy vsizetype="Preferred" hsizetype="Ignored" > … … 404 395 </item> 405 396 <item row="8" column="1" > 406 <widget class="QLabel" name="mLb HDActualSize" >407 <property name="text" > 408 <string> ActualSize:</string>397 <widget class="QLabel" name="mLbSize" > 398 <property name="text" > 399 <string>Size:</string> 409 400 </property> 410 401 <property name="alignment" > … … 414 405 </item> 415 406 <item row="8" column="2" colspan="2" > 416 <widget class="QILabel" name="mLb HDActualSizeValue" >407 <widget class="QILabel" name="mLbSizeValue" > 417 408 <property name="sizePolicy" > 418 409 <sizepolicy vsizetype="Preferred" hsizetype="Ignored" > … … 424 415 </item> 425 416 <item row="9" column="1" > 426 <widget class="QLabel" name="mLb Size" >427 <property name="text" > 428 <string> Size:</string>417 <widget class="QLabel" name="mLbLocation" > 418 <property name="text" > 419 <string>Location:</string> 429 420 </property> 430 421 <property name="alignment" > … … 434 425 </item> 435 426 <item row="9" column="2" colspan="2" > 436 <widget class="QILabel" name="mLb SizeValue" >427 <widget class="QILabel" name="mLbLocationValue" > 437 428 <property name="sizePolicy" > 438 429 <sizepolicy vsizetype="Preferred" hsizetype="Ignored" > … … 444 435 </item> 445 436 <item row="10" column="1" > 446 <widget class="QLabel" name="mLb Location" >447 <property name="text" > 448 <string> Location:</string>437 <widget class="QLabel" name="mLbHDFormat" > 438 <property name="text" > 439 <string>Type (Format):</string> 449 440 </property> 450 441 <property name="alignment" > … … 454 445 </item> 455 446 <item row="10" column="2" colspan="2" > 456 <widget class="QILabel" name="mLb LocationValue" >447 <widget class="QILabel" name="mLbHDFormatValue" > 457 448 <property name="sizePolicy" > 458 449 <sizepolicy vsizetype="Preferred" hsizetype="Ignored" > … … 464 455 </item> 465 456 <item row="11" column="1" > 466 <widget class="QLabel" name="mLb HDFormat" >467 <property name="text" > 468 <string> Type (Format):</string>457 <widget class="QLabel" name="mLbUsage" > 458 <property name="text" > 459 <string>Attached To:</string> 469 460 </property> 470 461 <property name="alignment" > … … 474 465 </item> 475 466 <item row="11" column="2" colspan="2" > 476 <widget class="QILabel" name="mLb HDFormatValue" >467 <widget class="QILabel" name="mLbUsageValue" > 477 468 <property name="sizePolicy" > 478 469 <sizepolicy vsizetype="Preferred" hsizetype="Ignored" > … … 483 474 </widget> 484 475 </item> 485 <item row="12" column="1" > 486 <widget class="QLabel" name="mLbUsage" > 487 <property name="text" > 488 <string>Attached To:</string> 489 </property> 490 <property name="alignment" > 491 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> 492 </property> 493 </widget> 494 </item> 495 <item row="12" column="2" colspan="2" > 496 <widget class="QILabel" name="mLbUsageValue" > 497 <property name="sizePolicy" > 498 <sizepolicy vsizetype="Preferred" hsizetype="Ignored" > 499 <horstretch>0</horstretch> 500 <verstretch>0</verstretch> 501 </sizepolicy> 502 </property> 503 </widget> 504 </item> 505 <item row="13" column="0" colspan="4" > 476 <item row="12" column="0" colspan="4" > 506 477 <spacer name="mSp6" > 507 478 <property name="orientation" >
Note:
See TracChangeset
for help on using the changeset viewer.

