- Timestamp:
- Jun 30, 2011 1:56:23 PM (13 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r37374 r37710 551 551 , mAttIsHostDrive (false) 552 552 , mAttIsPassthrough (false) 553 , mAttIsTempEject (false) 553 554 { 554 555 /* Check for proper parent type */ … … 604 605 } 605 606 607 bool AttachmentItem::attIsTempEject() const 608 { 609 return mAttIsTempEject; 610 } 611 606 612 void AttachmentItem::setAttSlot (const StorageSlot &aAttSlot) 607 613 { … … 624 630 { 625 631 mAttIsPassthrough = aIsAttPassthrough; 632 } 633 634 void AttachmentItem::setAttIsTempEject (bool aIsAttTempEject) 635 { 636 mAttIsTempEject = aIsAttTempEject; 626 637 } 627 638 … … 1078 1089 return false; 1079 1090 } 1091 case R_AttIsTempEject: 1092 { 1093 if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer())) 1094 if (item->rtti() == AbstractItem::Type_AttachmentItem) 1095 return static_cast <AttachmentItem*> (item)->attIsTempEject(); 1096 return false; 1097 } 1080 1098 case R_AttSize: 1081 1099 { … … 1282 1300 { 1283 1301 static_cast <AttachmentItem*> (item)->setAttIsPassthrough (aValue.toBool()); 1302 emit dataChanged (aIndex, aIndex); 1303 return true; 1304 } 1305 return false; 1306 } 1307 case R_AttIsTempEject: 1308 { 1309 if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer())) 1310 if (item->rtti() == AbstractItem::Type_AttachmentItem) 1311 { 1312 static_cast <AttachmentItem*> (item)->setAttIsTempEject (aValue.toBool()); 1284 1313 emit dataChanged (aIndex, aIndex); 1285 1314 return true; … … 1771 1800 connect (pOpenMediumMenu, SIGNAL (aboutToShow()), this, SLOT (sltPrepareOpenMediumMenu())); 1772 1801 connect (mCbPassthrough, SIGNAL (stateChanged (int)), this, SLOT (setInformation())); 1802 connect (mCbTempEject, SIGNAL (stateChanged (int)), this, SLOT (setInformation())); 1773 1803 1774 1804 /* Applying language settings */ … … 1834 1864 storageAttachmentData.m_iAttachmentDevice = attachment.GetDevice(); 1835 1865 storageAttachmentData.m_fAttachmentPassthrough = attachment.GetPassthrough(); 1866 storageAttachmentData.m_fAttachmentTempEject = attachment.GetTemporaryEject(); 1836 1867 CMedium comMedium(attachment.GetMedium()); 1837 1868 VBoxMedium vboxMedium; … … 1893 1924 mStorageModel->setData(attachmentIndex, QVariant::fromValue(attachmentStorageSlot), StorageModel::R_AttSlot); 1894 1925 mStorageModel->setData(attachmentIndex, attachmentData.m_fAttachmentPassthrough, StorageModel::R_AttIsPassthrough); 1926 mStorageModel->setData(attachmentIndex, attachmentData.m_fAttachmentTempEject, StorageModel::R_AttIsTempEject); 1895 1927 } 1896 1928 } … … 1944 1976 attachmentData.m_iAttachmentDevice = attachmentSlot.device; 1945 1977 attachmentData.m_fAttachmentPassthrough = mStorageModel->data(attachmentIndex, StorageModel::R_AttIsPassthrough).toBool(); 1978 attachmentData.m_fAttachmentTempEject = mStorageModel->data(attachmentIndex, StorageModel::R_AttIsTempEject).toBool(); 1946 1979 attachmentData.m_strAttachmentMediumId = mStorageModel->data(attachmentIndex, StorageModel::R_AttMediumId).toString(); 1947 1980 … … 2380 2413 mCbPassthrough->setChecked (isHostDrive && mStorageModel->data (index, StorageModel::R_AttIsPassthrough).toBool()); 2381 2414 2415 /* Getting TempEject state */ 2416 mCbTempEject->setVisible (device == KDeviceType_DVD && !isHostDrive); 2417 mCbTempEject->setChecked (!isHostDrive && mStorageModel->data (index, StorageModel::R_AttIsTempEject).toBool()); 2418 2382 2419 /* Update optional widgets visibility */ 2383 2420 updateAdditionalObjects (device); … … 2447 2484 if (mStorageModel->data (index, StorageModel::R_AttIsHostDrive).toBool()) 2448 2485 mStorageModel->setData (index, mCbPassthrough->isChecked(), StorageModel::R_AttIsPassthrough); 2486 } 2487 else if (sdr == mCbTempEject) 2488 { 2489 if (!mStorageModel->data (index, StorageModel::R_AttIsHostDrive).toBool()) 2490 mStorageModel->setData (index, mCbTempEject->isChecked(), StorageModel::R_AttIsTempEject); 2449 2491 } 2450 2492 break; … … 3354 3396 QString strAttachmentMediumId = attachmentData.m_strAttachmentMediumId; 3355 3397 bool fAttachmentPassthrough = attachmentData.m_fAttachmentPassthrough; 3398 bool fAttachmentTempEject = attachmentData.m_fAttachmentTempEject; 3356 3399 /* Get GUI medium object: */ 3357 3400 VBoxMedium vboxMedium = vboxGlobal().findMedium(strAttachmentMediumId); … … 3376 3419 /* Check that machine is OK: */ 3377 3420 fSuccess = m_machine.isOk(); 3421 if (fSuccess) 3422 { 3423 m_machine.TemporaryEjectDevice(strControllerName, iAttachmentPort, iAttachmentDevice, fAttachmentTempEject); 3424 /* Check that machine is OK: */ 3425 fSuccess = m_machine.isOk(); 3426 } 3378 3427 } 3379 3428 } … … 3411 3460 QString strAttachmentMediumId = attachmentData.m_strAttachmentMediumId; 3412 3461 bool fAttachmentPassthrough = attachmentData.m_fAttachmentPassthrough; 3462 bool fAttachmentTempEject = attachmentData.m_fAttachmentTempEject; 3413 3463 KDeviceType attachmentDeviceType = attachmentData.m_attachmentType; 3414 3464 … … 3438 3488 } 3439 3489 } 3490 if (fSuccess) 3491 { 3492 if (attachmentDeviceType == KDeviceType_DVD) 3493 { 3494 m_machine.TemporaryEjectDevice(strControllerName, iAttachmentPort, iAttachmentDevice, fAttachmentTempEject); 3495 /* Check that machine is OK: */ 3496 fSuccess = m_machine.isOk(); 3497 } 3498 } 3440 3499 } 3441 3500 else … … 3511 3570 mTbOpen->setEnabled(isMachineOffline() || (isMachineOnline() && device != KDeviceType_HardDisk)); 3512 3571 mCbPassthrough->setEnabled(isMachineOffline()); 3572 mCbTempEject->setEnabled(isMachineInValidMode()); 3513 3573 mLsInformation->setEnabled(isMachineInValidMode()); 3514 3574 mLbHDFormat->setEnabled(isMachineInValidMode()); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h
r37374 r37710 356 356 bool attIsHostDrive() const; 357 357 bool attIsPassthrough() const; 358 bool attIsTempEject() const; 358 359 359 360 void setAttSlot (const StorageSlot &aAttSlot); … … 361 362 void setAttMediumId (const QString &aAttMediumId); 362 363 void setAttIsPassthrough (bool aPassthrough); 364 void setAttIsTempEject (bool aTempEject); 363 365 364 366 QString attSize() const; … … 391 393 bool mAttIsHostDrive; 392 394 bool mAttIsPassthrough; 395 bool mAttIsTempEject; 393 396 394 397 QString mAttName; … … 444 447 R_AttIsHostDrive, 445 448 R_AttIsPassthrough, 449 R_AttIsTempEject, 446 450 R_AttSize, 447 451 R_AttLogicalSize, … … 557 561 , m_iAttachmentDevice(-1) 558 562 , m_strAttachmentMediumId(QString()) 559 , m_fAttachmentPassthrough(false) {} 563 , m_fAttachmentPassthrough(false) 564 , m_fAttachmentTempEject(false) {} 560 565 /* Functions: */ 561 566 bool equal(const UIDataSettingsMachineStorageAttachment &other) const … … 565 570 (m_iAttachmentDevice == other.m_iAttachmentDevice) && 566 571 (m_strAttachmentMediumId == other.m_strAttachmentMediumId) && 567 (m_fAttachmentPassthrough == other.m_fAttachmentPassthrough); 572 (m_fAttachmentPassthrough == other.m_fAttachmentPassthrough) && 573 (m_fAttachmentTempEject == other.m_fAttachmentTempEject); 568 574 } 569 575 /* Operators: */ … … 576 582 QString m_strAttachmentMediumId; 577 583 bool m_fAttachmentPassthrough; 584 bool m_fAttachmentTempEject; 578 585 }; 579 586 typedef UISettingsCache<UIDataSettingsMachineStorageAttachment> UICacheSettingsMachineStorageAttachment; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.ui
r37374 r37710 323 323 </widget> 324 324 </item> 325 <item row="2" column="2" > 326 <widget class="QCheckBox" name="mCbTempEject" > 327 <property name="sizePolicy" > 328 <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" > 329 <horstretch>0</horstretch> 330 <verstretch>0</verstretch> 331 </sizepolicy> 332 </property> 333 <property name="whatsThis" > 334 <string>When checked, it suppresses unmounting the medium when the guest OS ejects it.</string> 335 </property> 336 <property name="text" > 337 <string>&Live CD/DVD</string> 338 </property> 339 </widget> 340 </item> 325 341 <item row="3" column="0" colspan="3" > 326 342 <widget class="QILabelSeparator" native="1" name="mLsInformation" >
Note:
See TracChangeset
for help on using the changeset viewer.