- Timestamp:
- Apr 14, 2020 2:08:19 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 137188
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r83643 r83690 595 595 tr("Encryption password for <nobr>ID = '%1'</nobr> is invalid.") 596 596 .arg(strPasswordId)); 597 } 598 599 void UIMessageCenter::cannotAcquireVirtualBoxParameter(const CVirtualBox &comVBox, QWidget *pParent /* = 0 */) const 600 { 601 /* Show the error: */ 602 error(pParent, MessageType_Error, 603 tr("Failed to acquire VirtualBox parameter."), UIErrorString::formatErrorInfo(comVBox)); 597 604 } 598 605 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r83643 r83690 263 263 void cannotSetExtraData(const CMachine &machine, const QString &strKey, const QString &strValue); 264 264 void warnAboutInvalidEncryptionPassword(const QString &strPasswordId, QWidget *pParent = 0); 265 void cannotAcquireVirtualBoxParameter(const CVirtualBox &comVBox, QWidget *pParent = 0) const; 265 266 void cannotAcquireMachineParameter(const CMachine &comMachine, QWidget *pParent = 0) const; 266 267 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.cpp
r83689 r83690 75 75 76 76 /* Create global node: */ 77 new UIChooserNodeGlobal(invisibleRoot() ,77 new UIChooserNodeGlobal(invisibleRoot() /* parent */, 78 78 isGlobalNodeFavorite(invisibleRoot()), 79 79 0 /* position */, 80 80 QString() /* tip */); 81 81 82 /* Add all the approved machine nodes into the tree: */ 83 LogRelFlow(("UIChooserModel: Loading VMs...\n")); 84 foreach (const CMachine &comMachine, uiCommon().virtualBox().GetMachines()) 82 /* Acquire VBox: */ 83 const CVirtualBox comVBox = uiCommon().virtualBox(); 84 85 /* Add local machines: */ 86 LogRelFlow(("UIChooserAbstractModel: Loading local VMs...\n")); 87 /* Acquire existing machines: */ 88 const QVector<CMachine> machines = comVBox.GetMachines(); 89 /* Show error message if necessary: */ 90 if (!comVBox.isOk()) 91 msgCenter().cannotAcquireVirtualBoxParameter(comVBox); 92 else 85 93 { 86 const QUuid uMachineID = comMachine.GetId(); 87 if (!uMachineID.isNull() && gEDataManager->showMachineInVirtualBoxManagerChooser(uMachineID)) 94 /* Iterate through existing machines: */ 95 foreach (const CMachine &comMachine, machines) 96 { 97 /* Skip if we have nothing to populate (wtf happened?): */ 98 if (comMachine.isNull()) 99 continue; 100 101 /* Get machine ID: */ 102 const QUuid uMachineID = comMachine.GetId(); 103 /* Show error message if necessary: */ 104 if (!comMachine.isOk()) 105 { 106 msgCenter().cannotAcquireMachineParameter(comMachine); 107 continue; 108 } 109 110 /* Skip if we have nothing to show (wtf happened?): */ 111 if (uMachineID.isNull()) 112 continue; 113 114 /* Skip if machine is restricted from being shown: */ 115 if (!gEDataManager->showMachineInVirtualBoxManagerChooser(uMachineID)) 116 continue; 117 118 /* Add machine into tree: */ 88 119 addMachineIntoTheTree(comMachine); 120 } 89 121 } 90 LogRelFlow(("UIChooser Model:VMs loaded.\n"));122 LogRelFlow(("UIChooserAbstractModel: Local VMs loaded.\n")); 91 123 92 124 #ifdef VBOX_GUI_WITH_CLOUD_VMS 93 /* Add cloud provider groups: */ 94 LogRelFlow(("UIChooserModel: Loading cloud providers...\n")); 95 /* Acquire VBox: */ 96 CVirtualBox comVBox = uiCommon().virtualBox(); 97 /* Acquire Cloud Provider Manager: */ 98 CCloudProviderManager comCloudProviderManager = comVBox.GetCloudProviderManager(); 125 /* Add cloud providers/profiles: */ 126 LogRelFlow(("UIChooserAbstractModel: Loading cloud providers/profiles...\n")); 127 /* Acquire cloud provider manager: */ 128 const CCloudProviderManager comCloudProviderManager = comVBox.GetCloudProviderManager(); 99 129 /* Show error message if necessary: */ 100 130 if (!comVBox.isOk()) … … 115 145 if (comCloudProvider.isNull()) 116 146 continue; 147 148 /* Get profile names: */ 149 const QVector<QString> profileNames = comCloudProvider.GetProfileNames(); 150 /* Show error message if necessary: */ 151 if (!comCloudProvider.isOk()) 152 { 153 msgCenter().cannotAcquireCloudProviderParameter(comCloudProvider); 154 continue; 155 } 156 117 157 /* Skip if we have nothing to populate (profiles missing?): */ 118 const QVector<QString> profileNames = comCloudProvider.GetProfileNames();119 158 if (profileNames.isEmpty()) 120 159 continue; … … 124 163 /* Show error message if necessary: */ 125 164 if (!comCloudProvider.isOk()) 165 { 126 166 msgCenter().cannotAcquireCloudProviderParameter(comCloudProvider); 127 else 167 continue; 168 } 169 170 /* Add provider group node: */ 171 UIChooserNodeGroup *pProviderNode = 172 new UIChooserNodeGroup(invisibleRoot() /* parent */, 173 false /* favorite */, 174 getDesiredNodePosition(invisibleRoot(), 175 UIChooserNodeType_Group, 176 strProviderName), 177 strProviderName, 178 UIChooserNodeGroupType_Provider, 179 false /* opened */); 180 181 /* Iterate through provider's profile names: */ 182 foreach (const QString &strProfileName, profileNames) 128 183 { 129 /* Add provider group node: */ 130 UIChooserNodeGroup *pProviderNode = 131 new UIChooserNodeGroup(invisibleRoot(), 184 /* Skip if we have nothing to show (wtf happened?): */ 185 if (strProfileName.isEmpty()) 186 continue; 187 188 /* Acquire cloud profile: */ 189 CCloudProfile comCloudProfile = comCloudProvider.GetProfileByName(strProfileName); 190 /* Show error message if necessary: */ 191 if (!comCloudProvider.isOk()) 192 { 193 msgCenter().cannotFindCloudProfile(comCloudProvider, strProfileName); 194 continue; 195 } 196 197 /* Create cloud client: */ 198 CCloudClient comCloudClient = comCloudProfile.CreateCloudClient(); 199 /* Show error message if necessary: */ 200 if (!comCloudProfile.isOk()) 201 { 202 msgCenter().cannotCreateCloudClient(comCloudProfile); 203 continue; 204 } 205 206 /* Add profile sub-group node: */ 207 UIChooserNodeGroup *pProfileNode = 208 new UIChooserNodeGroup(pProviderNode /* parent */, 132 209 false /* favorite */, 133 getDesiredNodePosition( invisibleRoot(),210 getDesiredNodePosition(pProviderNode, 134 211 UIChooserNodeType_Group, 135 strProviderName), 136 strProviderName, 137 UIChooserNodeGroupType_Provider, 138 false /* opened */); 139 140 /* Iterate through existing profile names: */ 141 foreach (const QString &strProfileName, profileNames) 212 strProfileName), 213 strProfileName, 214 UIChooserNodeGroupType_Profile, 215 true /* opened */); 216 /* Add fake cloud VM item: */ 217 new UIChooserNodeMachine(pProfileNode /* parent */, 218 false /* favorite */, 219 0 /* position */); 220 221 /* Create cloud list machines task: */ 222 UITaskCloudListMachines *pTask = new UITaskCloudListMachines(comCloudClient, 223 pProfileNode); 224 if (pTask) 142 225 { 143 /* Skip if we have nothing to show (wtf happened?): */ 144 if (strProfileName.isEmpty()) 145 continue; 146 147 /* Acquire Cloud Profile: */ 148 CCloudProfile comCloudProfile = comCloudProvider.GetProfileByName(strProfileName); 149 /* Show error message if necessary: */ 150 if (!comCloudProvider.isOk()) 151 msgCenter().cannotFindCloudProfile(comCloudProvider, strProfileName); 152 else 153 { 154 /* Create Cloud Client: */ 155 CCloudClient comCloudClient = comCloudProfile.CreateCloudClient(); 156 /* Show error message if necessary: */ 157 if (!comCloudProfile.isOk()) 158 msgCenter().cannotCreateCloudClient(comCloudProfile); 159 else 160 { 161 /* Add profile sub-group node: */ 162 UIChooserNodeGroup *pProfileNode = 163 new UIChooserNodeGroup(pProviderNode, 164 false /* favorite */, 165 getDesiredNodePosition(pProviderNode, 166 UIChooserNodeType_Group, 167 strProfileName), 168 strProfileName, 169 UIChooserNodeGroupType_Profile, 170 true /* opened */); 171 /* Add fake cloud VM item: */ 172 new UIChooserNodeMachine(pProfileNode, 173 false /* favorite */, 174 0 /* position */); 175 176 /* Create cloud acquire isntances task: */ 177 UITaskCloudListMachines *pTask = new UITaskCloudListMachines(comCloudClient, 178 pProfileNode); 179 if (pTask) 180 { 181 connect(uiCommon().threadPoolCloud(), &UIThreadPool::sigTaskComplete, 182 this, &UIChooserAbstractModel::sltHandleCloudListMachinesTaskComplete); 183 uiCommon().threadPoolCloud()->enqueueTask(pTask); 184 } 185 } 186 } 226 connect(uiCommon().threadPoolCloud(), &UIThreadPool::sigTaskComplete, 227 this, &UIChooserAbstractModel::sltHandleCloudListMachinesTaskComplete); 228 uiCommon().threadPoolCloud()->enqueueTask(pTask); 187 229 } 188 230 } … … 190 232 } 191 233 } 192 LogRelFlow(("UIChooser Model: Cloud providers loaded.\n"));234 LogRelFlow(("UIChooserAbstractModel: Cloud providers/profiles loaded.\n")); 193 235 #endif /* VBOX_GUI_WITH_CLOUD_VMS */ 194 236 }
Note:
See TracChangeset
for help on using the changeset viewer.