Changeset 91736 in vbox
- Timestamp:
- Oct 14, 2021 5:35:29 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIBootFailureDialog.cpp
r91719 r91736 81 81 { 82 82 if (m_pCloseButton) 83 { 83 84 m_pCloseButton->setText(tr("&Close")); 85 m_pCloseButton->setToolTip(tr("Closes this dialog without resetting the guest or mounting a medium")); 86 } 84 87 if (m_pResetButton) 85 m_pResetButton->setText(tr("&Reset")); 88 { 89 m_pResetButton->setText(tr("&Reset VM")); 90 m_pResetButton->setToolTip(tr("Mounts the selected ISO if any and restarts the vm")); 91 } 86 92 87 93 if (m_pLabel) 88 94 m_pLabel->setText(tr("The virtual machine failed to boot. That might be caused by a missing operating system " 89 95 "or misconfigured boot order. Mounting an operation install DVD might solve this problem. " 90 "Selecting an ISO file will attemt to mount it immediately to the guest machine.")); 96 "Selecting an ISO file will attempt to mount it after the dialog is closed.")); 97 91 98 if (m_pBootImageLabel) 92 99 m_pBootImageLabel->setText(tr("Boot DVD:")); … … 204 211 } 205 212 206 bool UIBootFailureDialog::insertBootMedium(const QUuid &uMediumId)207 {208 AssertReturn(!uMediumId.isNull(), false);209 210 CVirtualBox comVBox = uiCommon().virtualBox();211 const CGuestOSType &comOsType = comVBox.GetGuestOSType(m_comMachine.GetOSTypeId());212 /* Get recommended controller bus & type: */213 const KStorageBus enmRecommendedDvdBus = comOsType.GetRecommendedDVDStorageBus();214 const KStorageControllerType enmRecommendedDvdType = comOsType.GetRecommendedDVDStorageController();215 216 CMediumAttachment comAttachment;217 /* Search for an attachment of required bus & type: */218 foreach (const CMediumAttachment &comCurrentAttachment, m_comMachine.GetMediumAttachments())219 {220 /* Determine current attachment's controller: */221 const CStorageController &comCurrentController = m_comMachine.GetStorageControllerByName(comCurrentAttachment.GetController());222 223 if ( comCurrentController.GetBus() == enmRecommendedDvdBus224 && comCurrentController.GetControllerType() == enmRecommendedDvdType225 && comCurrentAttachment.GetType() == KDeviceType_DVD)226 {227 comAttachment = comCurrentAttachment;228 break;229 }230 }231 AssertMsgReturn(!comAttachment.isNull(), ("Storage Controller is NOT properly configured!\n"), false);232 233 const UIMedium guiMedium = uiCommon().medium(uMediumId);234 const CMedium comMedium = guiMedium.medium();235 236 /* Mount medium to the predefined port/device: */237 m_comMachine.MountMedium(comAttachment.GetController(), comAttachment.GetPort(), comAttachment.GetDevice(), comMedium, false /* force */);238 bool fSuccess = m_comMachine.isOk();239 240 QWidget *pParent = windowManager().realParentWindow(this);241 242 /* Show error message if necessary: */243 if (!fSuccess)244 msgCenter().cannotRemountMedium(m_comMachine, guiMedium, true /* mount? */, false /* retry? */, pParent);245 else246 {247 /* Save machine settings: */248 m_comMachine.SaveSettings();249 fSuccess = m_comMachine.isOk();250 251 /* Show error message if necessary: */252 if (!fSuccess)253 msgCenter().cannotSaveMachineSettings(m_comMachine, pParent);254 }255 return fSuccess;256 }257 258 213 void UIBootFailureDialog::sltFileSelectorPathChanged(const QString &strPath) 259 214 { 260 insertBootMedium(uiCommon().openMedium(UIMediumDeviceType_DVD, strPath)); 215 Q_UNUSED(strPath); 216 bool fISOValid = checkISOImage(); 217 if (m_pBootImageSelector) 218 { 219 m_pBootImageSelector->mark(!fISOValid, tr("The selected path is invalid.")); 220 } 221 if (m_pResetButton) 222 m_pResetButton->setEnabled(fISOValid); 261 223 } 262 224 … … 269 231 return icon.pixmap(iSize, iSize); 270 232 } 233 234 bool UIBootFailureDialog::checkISOImage() const 235 { 236 AssertReturn(m_pBootImageSelector, true); 237 if (m_pBootImageSelector->path().isEmpty()) 238 return true; 239 QFileInfo fileInfo(m_pBootImageSelector->path()); 240 if (!fileInfo.exists() || !fileInfo.isReadable()) 241 return false; 242 return true; 243 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIBootFailureDialog.h
r91717 r91736 74 74 private: 75 75 76 bool insertBootMedium(const QUuid &uMediumId);77 76 QPixmap iconPixmap(); 77 /* Checks if selected iso exists and readable. Returns false if not. Returns true if nothing is selected. */ 78 bool checkISOImage() const; 78 79 79 80 /** @name Event-handling stuff. -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r91719 r91736 3269 3269 3270 3270 int iResult = pBootFailureDialog->exec(false); 3271 QString strISOPath = pBootFailureDialog->bootMediumPath(); 3271 3272 3272 3273 delete pBootFailureDialog; 3274 3275 QFileInfo bootMediumFileInfo(strISOPath); 3276 if (bootMediumFileInfo.exists() && bootMediumFileInfo.isReadable()) 3277 mountBootMedium(uiCommon().openMedium(UIMediumDeviceType_DVD, strISOPath)); 3273 3278 3274 3279 if (iResult == static_cast<int>(UIBootFailureDialog::ReturnCode_Reset)) 3275 3280 sltReset(false); 3281 } 3282 3283 bool UIMachineLogic::mountBootMedium(const QUuid &uMediumId) 3284 { 3285 AssertReturn(!uMediumId.isNull(), false); 3286 3287 CVirtualBox comVBox = uiCommon().virtualBox(); 3288 CMachine &comMachine = machine(); 3289 const CGuestOSType &comOsType = comVBox.GetGuestOSType(comMachine.GetOSTypeId()); 3290 /* Get recommended controller bus & type: */ 3291 const KStorageBus enmRecommendedDvdBus = comOsType.GetRecommendedDVDStorageBus(); 3292 const KStorageControllerType enmRecommendedDvdType = comOsType.GetRecommendedDVDStorageController(); 3293 3294 CMediumAttachment comAttachment; 3295 /* Search for an attachment of required bus & type: */ 3296 foreach (const CMediumAttachment &comCurrentAttachment, comMachine.GetMediumAttachments()) 3297 { 3298 /* Determine current attachment's controller: */ 3299 const CStorageController &comCurrentController = comMachine.GetStorageControllerByName(comCurrentAttachment.GetController()); 3300 3301 if ( comCurrentController.GetBus() == enmRecommendedDvdBus 3302 && comCurrentController.GetControllerType() == enmRecommendedDvdType 3303 && comCurrentAttachment.GetType() == KDeviceType_DVD) 3304 { 3305 comAttachment = comCurrentAttachment; 3306 break; 3307 } 3308 } 3309 AssertMsgReturn(!comAttachment.isNull(), ("Storage Controller is NOT properly configured!\n"), false); 3310 3311 const UIMedium guiMedium = uiCommon().medium(uMediumId); 3312 const CMedium comMedium = guiMedium.medium(); 3313 3314 /* Mount medium to the predefined port/device: */ 3315 comMachine.MountMedium(comAttachment.GetController(), comAttachment.GetPort(), comAttachment.GetDevice(), comMedium, false /* force */); 3316 bool fSuccess = comMachine.isOk(); 3317 3318 QWidget *pParent = windowManager().realParentWindow(activeMachineWindow()); 3319 3320 /* Show error message if necessary: */ 3321 if (!fSuccess) 3322 msgCenter().cannotRemountMedium(comMachine, guiMedium, true /* mount? */, false /* retry? */, pParent); 3323 else 3324 { 3325 /* Save machine settings: */ 3326 comMachine.SaveSettings(); 3327 fSuccess = comMachine.isOk(); 3328 3329 /* Show error message if necessary: */ 3330 if (!fSuccess) 3331 msgCenter().cannotSaveMachineSettings(comMachine, pParent); 3332 } 3333 return fSuccess; 3276 3334 } 3277 3335 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
r91656 r91736 388 388 /* Shows the boot failure dialog through which user can mount a boot DVD and reset the vm. */ 389 389 void showBootFailureDialog(); 390 bool mountBootMedium(const QUuid &uMediumId); 390 391 391 392 /* Private variables: */
Note:
See TracChangeset
for help on using the changeset viewer.