Changeset 74887 in vbox for trunk/src/VBox
- Timestamp:
- Oct 17, 2018 3:23:38 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 125872
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/cloud/UICloudProfileManager.cpp
r74884 r74887 34 34 # include "UICloudProfileDetailsWidget.h" 35 35 # include "UICloudProfileManager.h" 36 # include "UIMessageCenter.h" 36 37 # include "UIToolBar.h" 37 38 # ifdef VBOX_WS_MAC … … 42 43 #include "CCloudProfile.h" 43 44 #include "CCloudProvider.h" 45 #include "CCloudProviderManager.h" 44 46 45 47 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ … … 428 430 m_pTreeWidget->clear(); 429 431 430 /// @todo load cloud profiles! 432 /* Get VirtualBox for further activities: */ 433 const CVirtualBox comVBox = vboxGlobal().virtualBox(); 434 435 /* Get CloudProviderManager for further activities: */ 436 const CCloudProviderManager comCloudProviderManager = comVBox.GetCloudProviderManager(); 437 /* Show error message if necessary: */ 438 if (!comVBox.isOk()) 439 msgCenter().cannotAcquireCloudProviderManager(comVBox, this); 440 else 441 { 442 /* Iterate through existing providers: */ 443 foreach (const CCloudProvider &comCloudProvider, comCloudProviderManager.GetProviders()) 444 { 445 /* Skip if we have nothing to populate (file missing?): */ 446 if (comCloudProvider.isNull()) 447 continue; 448 449 /* Load provider data: */ 450 UIDataCloudProvider providerData; 451 loadCloudProvider(comCloudProvider, providerData); 452 createItemForCloudProvider(providerData, false); 453 454 /* Make sure provider item is properly inserted: */ 455 UIItemCloudProvider *pItem = searchItem(providerData.m_uuid); 456 457 /* Iterate through existing profiles: */ 458 foreach (const CCloudProfile &comCloudProfile, comCloudProvider.GetProfiles()) 459 { 460 /* Load profile data: */ 461 UIDataCloudProfile profileData; 462 loadCloudProfile(comCloudProfile, profileData); 463 createItemForCloudProfile(pItem, profileData, false); 464 } 465 466 /* Expand provider item finally: */ 467 pItem->setExpanded(true); 468 } 469 470 /* Choose the 1st item as current initially: */ 471 m_pTreeWidget->setCurrentItem(m_pTreeWidget->topLevelItem(0)); 472 sltHandleCurrentItemChange(); 473 } 431 474 } 432 475 … … 436 479 Q_UNUSED(data); 437 480 438 /// @todo load cloud profile! 481 /* Gather provider settings: */ 482 if (comProvider.isOk()) 483 data.m_uuid = comProvider.GetId(); 484 if (comProvider.isOk()) 485 data.m_strName = comProvider.GetName(); 486 487 /* Show error message if necessary: */ 488 if (!comProvider.isOk()) 489 msgCenter().cannotAcquireCloudProviderParameter(comProvider, this); 439 490 } 440 491 … … 444 495 Q_UNUSED(data); 445 496 446 /// @todo load cloud profile! 497 /* Gather profile settings: */ 498 if (comProfile.isOk()) 499 data.m_strName = comProfile.GetName(); 500 501 /* Show error message if necessary: */ 502 if (!comProfile.isOk()) 503 msgCenter().cannotAcquireCloudProfileParameter(comProfile, this); 504 } 505 506 UIItemCloudProvider *UICloudProfileManagerWidget::searchItem(const QUuid &uuid) const 507 { 508 /* Iterated through top-level items: */ 509 for (int i = 0; i < m_pTreeWidget->topLevelItemCount(); ++i) 510 if (m_pTreeWidget->topLevelItem(i)->data(0, Data_ProviderID).toUuid() == uuid) 511 return static_cast<UIItemCloudProvider*>(m_pTreeWidget->topLevelItem(i)); 512 /* Null by default: */ 513 return 0; 447 514 } 448 515 -
trunk/src/VBox/Frontends/VirtualBox/src/cloud/UICloudProfileManager.h
r74881 r74887 141 141 /** @name Tree-widget stuff. 142 142 * @{ */ 143 /** Seearches a provider item with specified @a uuid. */ 144 UIItemCloudProvider *searchItem(const QUuid &uuid) const; 145 143 146 /** Creates a new tree-widget item on the basis of passed @a data, @a fChooseItem if requested. */ 144 147 void createItemForCloudProvider(const UIDataCloudProvider &data, bool fChooseItem); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r74878 r74887 57 57 58 58 /* COM includes: */ 59 # include "CCloudProfile.h" 60 # include "CCloudProvider.h" 59 61 # include "CNATNetwork.h" 60 62 # include "CDHCPServer.h" … … 1610 1612 } 1611 1613 1614 void UIMessageCenter::cannotAcquireCloudProviderManager(const CVirtualBox &comVBox, QWidget *pParent /* = 0 */) const 1615 { 1616 error(pParent, MessageType_Error, 1617 tr("Failed to acquire cloud provider manager."), 1618 UIErrorString::formatErrorInfo(comVBox)); 1619 } 1620 1621 void UIMessageCenter::cannotAcquireCloudProviderParameter(const CCloudProvider &comProvider, QWidget *pParent /* = 0 */) const 1622 { 1623 error(pParent, MessageType_Error, 1624 tr("Failed to acquire cloud provider parameter."), 1625 UIErrorString::formatErrorInfo(comProvider)); 1626 } 1627 1628 void UIMessageCenter::cannotAcquireCloudProfileParameter(const CCloudProfile &comProfile, QWidget *pParent /* = 0 */) const 1629 { 1630 error(pParent, MessageType_Error, 1631 tr("Failed to acquire cloud profile parameter."), 1632 UIErrorString::formatErrorInfo(comProfile)); 1633 } 1634 1612 1635 bool UIMessageCenter::confirmHardDisklessMachine(QWidget *pParent /* = 0*/) const 1613 1636 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r74878 r74887 359 359 void cannotAcquireDHCPServerParameter(const CDHCPServer &comServer, QWidget *pParent = 0) const; 360 360 void cannotSaveDHCPServerParameter(const CDHCPServer &comServer, QWidget *pParent = 0) const; 361 362 /* API: Cloud Profile Manager warnings: */ 363 void cannotAcquireCloudProviderManager(const CVirtualBox &comVBox, QWidget *pParent = 0) const; 364 void cannotAcquireCloudProviderParameter(const CCloudProvider &comProvider, QWidget *pParent = 0) const; 365 void cannotAcquireCloudProfileParameter(const CCloudProfile &comProfile, QWidget *pParent = 0) const; 361 366 362 367 /* API: Wizards warnings: */
Note:
See TracChangeset
for help on using the changeset viewer.