Changeset 78880 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- May 30, 2019 1:42:02 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 130994
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.cpp
r78855 r78880 283 283 else 284 284 { 285 /* Read Cloud Client VM instances: */ 286 CStringArray comNames; 287 CStringArray comIDs; 288 CProgress comProgress = m_comCloudClient.ListInstances(KCloudMachineState_Running, comNames, comIDs); 289 290 /* Show error message if necessary: */ 291 if (!m_comCloudClient.isOk()) 292 msgCenter().cannotAcquireCloudClientParameter(m_comCloudClient); 293 else 294 { 285 /* Read Cloud Client VM instances. 286 * Please take into account that for now CCloudClient::ListInstances 287 * doesn't support OR-ed enum combinations, so we have to aquire 288 * Stopped and Running cloud VM instances separately. That also means 289 * that there will be two subsequent progress dialogs shown. */ 290 /// @todo rework when it's possible to do the right way 291 do 292 { 293 /* Stopped VM names and ids: */ 294 CStringArray comNamesStopped; 295 CStringArray comIDsStopped; 296 297 /* Ask for Stopped cloud VMs: */ 298 CProgress comProgressStopped = m_comCloudClient.ListInstances(KCloudMachineState_Stopped, comNamesStopped, comIDsStopped); 299 if (!m_comCloudClient.isOk()) 300 { 301 msgCenter().cannotAcquireCloudClientParameter(m_comCloudClient); 302 break; 303 } 304 295 305 /* Show "Acquire cloud instances" progress: */ 296 msgCenter().showModalProgressDialog(comProgress, 297 UIWizardImportApp::tr("Acquire cloud instances..."), 298 ":/progress_reading_appliance_90px.png", 299 0, 0); 300 301 /* Show error message if necessary: */ 302 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 303 msgCenter().cannotAcquireCloudClientParameter(comProgress); 304 else 306 msgCenter().showModalProgressDialog(comProgressStopped, UIWizardImportApp::tr("Acquire stopped cloud instances..."), 307 ":/progress_reading_appliance_90px.png", 0, 0); 308 if (!comProgressStopped.isOk() || comProgressStopped.GetResultCode() != 0) 305 309 { 306 /* Push acquired names to list rows: */ 307 const QVector<QString> &names = comNames.GetValues(); 308 const QVector<QString> &ids = comIDs.GetValues(); 309 for (int i = 0; i < names.size(); ++i) 310 msgCenter().cannotAcquireCloudClientParameter(comProgressStopped); 311 break; 312 } 313 314 /* Running VM names and ids: */ 315 CStringArray comNamesRunning; 316 CStringArray comIDsRunning; 317 318 /* Ask for Running cloud VMs: */ 319 CProgress comProgressRunning = m_comCloudClient.ListInstances(KCloudMachineState_Running, comNamesRunning, comIDsRunning); 320 if (!m_comCloudClient.isOk()) 321 { 322 msgCenter().cannotAcquireCloudClientParameter(m_comCloudClient); 323 break; 324 } 325 326 /* Show "Acquire cloud instances" progress: */ 327 msgCenter().showModalProgressDialog(comProgressRunning, UIWizardImportApp::tr("Acquire running cloud instances..."), 328 ":/progress_reading_appliance_90px.png", 0, 0); 329 if (!comProgressRunning.isOk() || comProgressRunning.GetResultCode() != 0) 330 { 331 msgCenter().cannotAcquireCloudClientParameter(comProgressRunning); 332 break; 333 } 334 335 /* Push acquired names to list rows: */ 336 const QVector<QString> names = comNamesStopped.GetValues() + comNamesRunning.GetValues(); 337 const QVector<QString> ids = comIDsStopped.GetValues() + comIDsRunning.GetValues(); 338 for (int i = 0; i < names.size(); ++i) 339 { 340 /* Create list item: */ 341 QListWidgetItem *pItem = new QListWidgetItem(names.at(i), m_pAccountInstanceList); 342 if (pItem) 310 343 { 311 /* Create list item: */ 312 QListWidgetItem *pItem = new QListWidgetItem(names.at(i), m_pAccountInstanceList); 313 if (pItem) 314 { 315 pItem->setFlags(pItem->flags() & ~Qt::ItemIsEditable); 316 pItem->setData(Qt::UserRole, ids.at(i)); 317 } 344 pItem->setFlags(pItem->flags() & ~Qt::ItemIsEditable); 345 pItem->setData(Qt::UserRole, ids.at(i)); 318 346 } 319 /* Choose the 1st one by default if possible: */320 if (m_pAccountInstanceList->count())321 m_pAccountInstanceList->setCurrentRow(0);322 347 } 323 } 348 /* Choose the 1st one by default if possible: */ 349 if (m_pAccountInstanceList->count()) 350 m_pAccountInstanceList->setCurrentRow(0); 351 } 352 while (0); 324 353 } 325 354 }
Note:
See TracChangeset
for help on using the changeset viewer.