Changeset 84035 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Apr 28, 2020 10:36:53 AM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/globals
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICloudNetworkingStuff.cpp
r84028 r84035 121 121 } 122 122 123 QVector<CCloudMachine> UICloudNetworkingStuff::listCloudMachines(CCloudClient comCloudClient, 124 QWidget *pParent /* = 0 */) 125 { 126 /* Execute ReadCloudMachineList async method: */ 127 CProgress comProgress = comCloudClient.ReadCloudMachineList(); 128 if (!comCloudClient.isOk()) 129 msgCenter().cannotAcquireCloudClientParameter(comCloudClient, pParent); 130 else 131 { 132 /* Show "Read cloud machines" progress: */ 133 msgCenter().showModalProgressDialog(comProgress, 134 QString(), 135 ":/progress_reading_appliance_90px.png", pParent, 0); 136 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 137 msgCenter().cannotAcquireCloudClientParameter(comProgress, pParent); 138 else 139 return comCloudClient.GetCloudMachineList(); 140 } 141 /* Return empty list by default: */ 142 return QVector<CCloudMachine>(); 143 } 144 145 QVector<CCloudMachine> UICloudNetworkingStuff::listCloudMachines(CCloudClient comCloudClient, 146 QString &strErrorMessage) 147 { 148 /* Execute ReadCloudMachineList async method: */ 149 CProgress comProgress = comCloudClient.ReadCloudMachineList(); 150 if (!comCloudClient.isOk()) 151 strErrorMessage = UIErrorString::formatErrorInfo(comCloudClient); 152 else 153 { 154 /* Show "Read cloud machines" progress: */ 155 comProgress.WaitForCompletion(-1); 156 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 157 strErrorMessage = UIErrorString::formatErrorInfo(comProgress); 158 else 159 return comCloudClient.GetCloudMachineList(); 160 } 161 /* Return empty list by default: */ 162 return QVector<CCloudMachine>(); 163 } 164 123 165 bool UICloudNetworkingStuff::cloudMachineId(const CCloudMachine &comCloudMachine, 124 166 QUuid &uResult, … … 127 169 const QUuid uId = comCloudMachine.GetId(); 128 170 if (!comCloudMachine.isOk()) 129 { 130 msgCenter().cannotAcquireCloudMachineParameter(comCloudMachine, pParent); 131 return false; 132 } 133 uResult = uId; 134 return true; 171 msgCenter().cannotAcquireCloudMachineParameter(comCloudMachine, pParent); 172 else 173 { 174 uResult = uId; 175 return true; 176 } 177 return false; 135 178 } 136 179 … … 141 184 const bool fAccessible = comCloudMachine.GetAccessible(); 142 185 if (!comCloudMachine.isOk()) 143 { 144 msgCenter().cannotAcquireCloudMachineParameter(comCloudMachine, pParent); 145 return false; 146 } 147 fResult = fAccessible; 148 return true; 186 msgCenter().cannotAcquireCloudMachineParameter(comCloudMachine, pParent); 187 else 188 { 189 fResult = fAccessible; 190 return true; 191 } 192 return false; 149 193 } 150 194 … … 155 199 const CVirtualBoxErrorInfo comAccessError = comCloudMachine.GetAccessError(); 156 200 if (!comCloudMachine.isOk()) 157 { 158 msgCenter().cannotAcquireCloudMachineParameter(comCloudMachine, pParent); 159 return false; 160 } 161 comResult = comAccessError; 162 return true; 201 msgCenter().cannotAcquireCloudMachineParameter(comCloudMachine, pParent); 202 else 203 { 204 comResult = comAccessError; 205 return true; 206 } 207 return false; 163 208 } 164 209 … … 169 214 const QString strName = comCloudMachine.GetName(); 170 215 if (!comCloudMachine.isOk()) 171 { 172 msgCenter().cannotAcquireCloudMachineParameter(comCloudMachine, pParent); 173 return false; 174 } 175 strResult = strName; 176 return true; 216 msgCenter().cannotAcquireCloudMachineParameter(comCloudMachine, pParent); 217 else 218 { 219 strResult = strName; 220 return true; 221 } 222 return false; 177 223 } 178 224 … … 183 229 const QString strOSTypeId = comCloudMachine.GetOSTypeId(); 184 230 if (!comCloudMachine.isOk()) 185 { 186 msgCenter().cannotAcquireCloudMachineParameter(comCloudMachine, pParent); 187 return false; 188 } 189 strResult = strOSTypeId; 190 return true; 231 msgCenter().cannotAcquireCloudMachineParameter(comCloudMachine, pParent); 232 else 233 { 234 strResult = strOSTypeId; 235 return true; 236 } 237 return false; 191 238 } 192 239 … … 197 244 const KMachineState enmState = comCloudMachine.GetState(); 198 245 if (!comCloudMachine.isOk()) 199 { 200 msgCenter().cannotAcquireCloudMachineParameter(comCloudMachine, pParent); 201 return false; 202 } 203 enmResult = enmState; 246 msgCenter().cannotAcquireCloudMachineParameter(comCloudMachine, pParent); 247 else 248 { 249 enmResult = enmState; 250 return true; 251 } 252 return false; 253 } 254 255 bool UICloudNetworkingStuff::refreshCloudMachineInfo(CCloudMachine comCloudMachine, 256 QWidget *pParent /* = 0 */) 257 { 258 /* Acquire machine name first: */ 259 QString strMachineName; 260 if (!cloudMachineName(comCloudMachine, strMachineName)) 261 return false; 262 263 /* Now execute Refresh async method: */ 264 CProgress comProgress = comCloudMachine.Refresh(); 265 if (!comCloudMachine.isOk()) 266 { 267 msgCenter().cannotAcquireCloudMachineParameter(comCloudMachine, pParent); 268 return false; 269 } 270 271 /* Show "Refresh cloud machine information" progress: */ 272 msgCenter().showModalProgressDialog(comProgress, 273 strMachineName, 274 ":/progress_reading_appliance_90px.png", pParent, 0); 275 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 276 { 277 msgCenter().cannotAcquireCloudMachineParameter(comProgress, pParent); 278 return false; 279 } 280 281 /* Return result: */ 282 return true; 283 } 284 285 bool UICloudNetworkingStuff::refreshCloudMachineInfo(CCloudMachine comCloudMachine, 286 QString &strErrorMessage) 287 { 288 /* Execute Refresh async method: */ 289 CProgress comProgress = comCloudMachine.Refresh(); 290 if (!comCloudMachine.isOk()) 291 { 292 strErrorMessage = UIErrorString::formatErrorInfo(comCloudMachine); 293 return false; 294 } 295 296 /* Show "Refresh cloud machine information" progress: */ 297 comProgress.WaitForCompletion(-1); 298 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 299 { 300 strErrorMessage = UIErrorString::formatErrorInfo(comProgress); 301 return false; 302 } 303 304 /* Return result: */ 204 305 return true; 205 306 } … … 325 426 if (pParent) 326 427 msgCenter().showModalProgressDialog(comProgress, 327 UICommon::tr("Acquire cloud instances ..."),428 QString(), 328 429 ":/progress_reading_appliance_90px.png", pParent, 0); 329 430 else … … 350 451 /* Return empty map by default: */ 351 452 return QMap<QString, QString>(); 352 }353 354 QVector<CCloudMachine> UICloudNetworkingStuff::listCloudMachines(CCloudClient comCloudClient,355 QString &strErrorMessage,356 QWidget *pParent /* = 0 */)357 {358 /* Execute ReadCloudMachineList async method: */359 CProgress comProgress = comCloudClient.ReadCloudMachineList();360 if (!comCloudClient.isOk())361 {362 if (pParent)363 msgCenter().cannotAcquireCloudClientParameter(comCloudClient, pParent);364 else365 strErrorMessage = UIErrorString::formatErrorInfo(comCloudClient);366 }367 else368 {369 /* Show "Read cloud machines" progress: */370 if (pParent)371 msgCenter().showModalProgressDialog(comProgress,372 UICommon::tr("Read cloud machines ..."),373 ":/progress_reading_appliance_90px.png", pParent, 0);374 else375 comProgress.WaitForCompletion(-1);376 if (!comProgress.isOk() || comProgress.GetResultCode() != 0)377 {378 if (pParent)379 msgCenter().cannotAcquireCloudClientParameter(comProgress, pParent);380 else381 strErrorMessage = UIErrorString::formatErrorInfo(comProgress);382 }383 else384 {385 /* Return acquired cloud machines: */386 return comCloudClient.GetCloudMachineList();387 }388 }389 390 /* Return empty list by default: */391 return QVector<CCloudMachine>();392 453 } 393 454 … … 444 505 if (pParent) 445 506 msgCenter().showModalProgressDialog(comProgress, 446 UICommon::tr("Acquire cloud instance info ..."),507 QString(), 447 508 ":/progress_reading_appliance_90px.png", pParent, 0); 448 509 else … … 485 546 } 486 547 487 void UICloudNetworkingStuff::refreshCloudMachineInfo(CCloudMachine comCloudMachine,488 QString &strErrorMessage,489 QWidget *pParent /* = 0 */)490 {491 /* Execute Refresh async method: */492 CProgress comProgress = comCloudMachine.Refresh();493 if (!comCloudMachine.isOk())494 {495 if (pParent)496 msgCenter().cannotAcquireCloudMachineParameter(comCloudMachine, pParent);497 else498 strErrorMessage = UIErrorString::formatErrorInfo(comCloudMachine);499 }500 else501 {502 /* Show "Refresh cloud machine information" progress: */503 if (pParent)504 msgCenter().showModalProgressDialog(comProgress,505 UICommon::tr("Refresh cloud machine information ..."),506 ":/progress_reading_appliance_90px.png", pParent, 0);507 else508 comProgress.WaitForCompletion(-1);509 if (!comProgress.isOk() || comProgress.GetResultCode() != 0)510 {511 if (pParent)512 msgCenter().cannotAcquireCloudMachineParameter(comProgress, pParent);513 else514 strErrorMessage = UIErrorString::formatErrorInfo(comProgress);515 }516 }517 }518 519 548 QMap<QString, QString> UICloudNetworkingStuff::getImageInfo(const CCloudClient &comCloudClient, 520 549 const QString &strId, … … 540 569 if (pParent) 541 570 msgCenter().showModalProgressDialog(comProgress, 542 UICommon::tr("Acquire cloud image info ..."),571 QString(), 543 572 ":/progress_reading_appliance_90px.png", pParent, 0); 544 573 else -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICloudNetworkingStuff.h
r84028 r84035 52 52 const QUuid &uMachineId); 53 53 54 /** Acquires cloud machines of certain @a comCloudClient, using @a pParent to show messages according to. */ 55 SHARED_LIBRARY_STUFF QVector<CCloudMachine> listCloudMachines(CCloudClient comCloudClient, 56 QWidget *pParent = 0); 57 /** Acquires cloud machines of certain @a comCloudClient, using @a strErrorMessage to store messages to. */ 58 SHARED_LIBRARY_STUFF QVector<CCloudMachine> listCloudMachines(CCloudClient comCloudClient, 59 QString &strErrorMessage); 60 54 61 /** Acquires @a comCloudMachine ID as a @a uResult, using @a pParent to show messages according to. */ 55 62 SHARED_LIBRARY_STUFF bool cloudMachineId(const CCloudMachine &comCloudMachine, … … 77 84 QWidget *pParent = 0); 78 85 86 /** Refreshes @a comCloudMachine information, using @a pParent to show messages according to. 87 * @note Be aware, this is a blocking function, corresponding progress dialog will be executed. */ 88 SHARED_LIBRARY_STUFF bool refreshCloudMachineInfo(CCloudMachine comCloudMachine, 89 QWidget *pParent = 0); 90 /** Refreshes @a comCloudMachine information, using @a pParent to show messages according to. 91 * @note Be aware, this is a blocking function, it will hang for a time of progress being executed. */ 92 SHARED_LIBRARY_STUFF bool refreshCloudMachineInfo(CCloudMachine comCloudMachine, 93 QString &strErrorMessage); 79 94 /** Acquires @a comCloudMachine settings form as a @a comResult, using @a pParent to show messages according to. 80 95 * @note Be aware, this is a blocking function, corresponding progress dialog will be executed. */ … … 102 117 QString &strErrorMessage, 103 118 QWidget *pParent = 0); 104 /** Acquires cloud machine vector.105 * @param comCloudClient Brings cloud client object.106 * @param strErrorMessage Brings error message container.107 * @param pWidget Brings parent widget to show messages according to,108 * if no parent set, progress will be executed in blocking way. */109 SHARED_LIBRARY_STUFF QVector<CCloudMachine> listCloudMachines(CCloudClient comCloudClient,110 QString &strErrorMessage,111 QWidget *pParent = 0);112 113 119 /** Acquires instance info as a map. 114 120 * @param comCloudClient Brings cloud client object. … … 132 138 QString &strErrorMessage, 133 139 QWidget *pParent = 0); 134 /** Refreshes cloud machine information.135 * @param comCloudMachine Brings cloud machine object.136 * @param strErrorMessage Brings error message container.137 * @param pWidget Brings parent widget to show messages according to,138 * if no parent set, progress will be executed in blocking way. */139 SHARED_LIBRARY_STUFF void refreshCloudMachineInfo(CCloudMachine comCloudMachine,140 QString &strErrorMessage,141 QWidget *pParent = 0);142 143 140 /** Acquires image info as a map. 144 141 * @param comCloudClient Brings cloud client object.
Note:
See TracChangeset
for help on using the changeset viewer.