Changeset 90234 in vbox for trunk/src/VBox/Frontends/VBoxManage
- Timestamp:
- Jul 16, 2021 10:28:08 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r86434 r90234 202 202 * react a little slower than in the ideal case). 203 203 */ 204 HRESULT showProgress(ComPtr<IProgress> progress )204 HRESULT showProgress(ComPtr<IProgress> progress, unsigned int fFlags) 205 205 { 206 206 using namespace com; 207 HRESULT hrc; 207 208 208 209 AssertReturn(progress.isNotNull(), E_FAIL); 210 211 /* grandfather the old callers */ 212 if (g_fDetailedProgress) 213 fFlags = SHOW_PROGRESS_DETAILS; 214 215 const bool fDetailed = RT_BOOL(fFlags & SHOW_PROGRESS_DETAILS); 216 const bool fQuiet = !RT_BOOL(fFlags & (SHOW_PROGRESS | SHOW_PROGRESS_DETAILS)); 217 209 218 210 219 BOOL fCompleted = FALSE; … … 220 229 221 230 ULONG cOperations = 1; 222 HRESULThrc = progress->COMGETTER(OperationCount)(&cOperations);231 hrc = progress->COMGETTER(OperationCount)(&cOperations); 223 232 if (FAILED(hrc)) 224 233 { … … 226 235 RTStrmFlush(g_pStdErr); 227 236 return hrc; 237 } 238 239 if (fFlags & SHOW_PROGRESS_DESC) 240 { 241 com::Bstr bstrDescription; 242 hrc = progress->COMGETTER(Description(bstrDescription.asOutParam())); 243 if (FAILED(hrc)) 244 { 245 RTStrmPrintf(g_pStdErr, "Failed to get progress description: %Rhrc\n", hrc); 246 return hrc; 247 } 248 249 const char *pcszDescSep; 250 if (fFlags & SHOW_PROGRESS_DETAILS) 251 pcszDescSep = "\n"; 252 else 253 pcszDescSep = ": "; 254 255 RTStrmPrintf(g_pStdErr, "%ls%s", bstrDescription.raw(), pcszDescSep); 256 RTStrmFlush(g_pStdErr); 228 257 } 229 258 … … 234 263 */ 235 264 236 if (! g_fDetailedProgress)265 if (!fQuiet && !fDetailed) 237 266 { 238 267 RTStrmPrintf(g_pStdErr, "0%%..."); … … 260 289 progress->COMGETTER(Percent(&ulCurrentPercent)); 261 290 262 if ( g_fDetailedProgress)291 if (fDetailed) 263 292 { 264 293 ULONG ulOperation = 1; … … 293 322 } 294 323 } 295 else 324 else if (!fQuiet) 296 325 { 297 326 /* did we cross a 10% mark? */ … … 345 374 if (SUCCEEDED(hrc)) 346 375 { 376 /* async operation completed successfully */ 347 377 if (SUCCEEDED(iRc)) 348 RTStrmPrintf(g_pStdErr, "100%%\n"); 378 { 379 if (!fDetailed) 380 { 381 if (fFlags == SHOW_PROGRESS_DESC) 382 RTStrmPrintf(g_pStdErr, "ok\n"); 383 else if (!fQuiet) 384 RTStrmPrintf(g_pStdErr, "100%%\n"); 385 } 386 } 349 387 else if (g_fCanceled) 350 388 RTStrmPrintf(g_pStdErr, "CANCELED\n"); 351 389 else 352 390 { 353 if (! g_fDetailedProgress)391 if (!fDetailed) 354 392 RTStrmPrintf(g_pStdErr, "\n"); 355 393 RTStrmPrintf(g_pStdErr, "Progress state: %Rhrc\n", iRc); … … 359 397 else 360 398 { 361 if (! g_fDetailedProgress)399 if (!fDetailed) 362 400 RTStrmPrintf(g_pStdErr, "\n"); 363 401 RTStrmPrintf(g_pStdErr, "Progress object failure: %Rhrc\n", hrc); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h
r88086 r90234 209 209 RTEXITCODE errorSyntax(const char *pszFormat, ...); 210 210 211 HRESULT showProgress(ComPtr<IProgress> progress); 211 212 #define SHOW_PROGRESS_NONE 0 213 #define SHOW_PROGRESS_DESC (1u << 0) 214 #define SHOW_PROGRESS (1u << 1) 215 #define SHOW_PROGRESS_DETAILS (1u << 2) 216 HRESULT showProgress(ComPtr<IProgress> progress, unsigned int fFlags = SHOW_PROGRESS); 212 217 #endif 213 218
Note:
See TracChangeset
for help on using the changeset viewer.