Changeset 78846 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- May 29, 2019 1:25:25 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.cpp
r78823 r78846 333 333 334 334 /* If client created: */ 335 if (!m_comCloudClient.isNull()) 336 { 337 /* Create appliance: */ 338 CVirtualBox comVBox = vboxGlobal().virtualBox(); 339 CAppliance comAppliance = comVBox.CreateAppliance(); 340 341 /* Show error message if necessary: */ 342 if (!comVBox.isOk()) 343 msgCenter().cannotCreateAppliance(comVBox); 344 else 345 { 335 if (m_comCloudClient.isNotNull()) 336 { 337 /* The underlying sequence is quite a large one, and each subsequent step depends on previous one. I do not want to 338 * make embedded ifs or multiple exit points, that's more or less Ok with few of them but certainly not with many. */ 339 do 340 { 341 /* Create appliance: */ 342 CVirtualBox comVBox = vboxGlobal().virtualBox(); 343 CAppliance comAppliance = comVBox.CreateAppliance(); 344 if (!comVBox.isOk()) 345 { 346 msgCenter().cannotCreateAppliance(comVBox); 347 break; 348 } 349 346 350 /* Create virtual system description: */ 347 351 comAppliance.CreateVirtualSystemDescriptions(1); 348 349 /* Show error message if necessary: */350 352 if (!comAppliance.isOk()) 353 { 351 354 msgCenter().cannotCreateVirtualSystemDescription(comAppliance); 352 else 353 { 354 /* Acquire virtual system description: */ 355 QVector<CVirtualSystemDescription> descriptions = comAppliance.GetVirtualSystemDescriptions(); 356 357 /* Show error message if necessary: */ 358 if (!comAppliance.isOk()) 359 msgCenter().cannotAcquireVirtualSystemDescription(comAppliance); 360 else 361 { 362 /* Make sure there is at least one virtual system description created: */ 363 AssertReturnVoid(!descriptions.isEmpty()); 364 CVirtualSystemDescription comDescription = descriptions.at(0); 365 366 /* Load default virtual system description values: */ 367 /// @todo make sure this is a progress returning call 368 m_comCloudClient.GetInstanceInfo(machineId(), comDescription); 369 370 /* Show error message if necessary: */ 371 if (!m_comCloudClient.isOk()) 372 msgCenter().cannotAcquireCloudInstanceInfo(m_comCloudClient); 373 else 374 { 375 /* Read Cloud Client description form: */ 376 CVirtualSystemDescriptionForm comForm; 377 CProgress comProgress = m_comCloudClient.GetImportDescriptionForm(comDescription, comForm); 378 379 /* Show error message if necessary: */ 380 if (!m_comCloudClient.isOk()) 381 msgCenter().cannotAcquireCloudClientParameter(m_comCloudClient); 382 else 383 { 384 /* Show "Acquire export form" progress: */ 385 msgCenter().showModalProgressDialog(comProgress, 386 UIWizardImportApp::tr("Acquire export form..."), 387 ":/progress_reading_appliance_90px.png", 388 0, 0); 389 390 /* Show error message if necessary: */ 391 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 392 msgCenter().cannotAcquireCloudClientParameter(comProgress); 393 else 394 m_comVSDForm = comForm; 395 } 396 } 397 } 398 } 399 } 355 break; 356 } 357 358 /* Acquire virtual system description: */ 359 QVector<CVirtualSystemDescription> descriptions = comAppliance.GetVirtualSystemDescriptions(); 360 if (!comAppliance.isOk()) 361 { 362 msgCenter().cannotAcquireVirtualSystemDescription(comAppliance); 363 break; 364 } 365 366 /* Make sure there is at least one virtual system description created: */ 367 AssertReturnVoid(!descriptions.isEmpty()); 368 CVirtualSystemDescription comDescription = descriptions.at(0); 369 370 /* Populate virtual system description with default values: */ 371 /// @todo make sure this is a progress returning call 372 m_comCloudClient.GetInstanceInfo(machineId(), comDescription); 373 if (!m_comCloudClient.isOk()) 374 { 375 msgCenter().cannotAcquireCloudInstanceInfo(m_comCloudClient); 376 break; 377 } 378 379 /* Read Cloud Client description form: */ 380 CVirtualSystemDescriptionForm comForm; 381 CProgress comImportDescriptionFormProgress = m_comCloudClient.GetImportDescriptionForm(comDescription, comForm); 382 if (!m_comCloudClient.isOk()) 383 { 384 msgCenter().cannotAcquireCloudClientParameter(m_comCloudClient); 385 break; 386 } 387 388 /* Show "Acquire import form" progress: */ 389 msgCenter().showModalProgressDialog(comImportDescriptionFormProgress, UIWizardImportApp::tr("Acquire import form..."), 390 ":/progress_reading_appliance_90px.png", 0, 0); 391 if (!comImportDescriptionFormProgress.isOk() || comImportDescriptionFormProgress.GetResultCode() != 0) 392 { 393 msgCenter().cannotAcquireCloudClientParameter(comImportDescriptionFormProgress); 394 break; 395 } 396 397 /* Remember form: */ 398 m_comVSDForm = comForm; 399 } 400 while (0); 400 401 } 401 402 }
Note:
See TracChangeset
for help on using the changeset viewer.