Changeset 18276 in vbox for trunk/src/VBox/Main
- Timestamp:
- Mar 25, 2009 7:39:08 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 45026
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ProgressImpl.cpp
r18269 r18276 473 473 474 474 /** 475 * Initializes the normal progress object. 475 * Initializes the normal progress object. With this variant, one can have 476 * an arbitrary number of sub-operation which IProgress can analyze to 477 * have a weighted progress computed. 478 * 479 * For example, say that one IProgress is supposed to track the cloning 480 * of two hard disk images, which are 100 MB and 1000 MB in size, respectively, 481 * and each of these hard disks should be one sub-operation of the IProgress. 482 * 483 * Obviously the progress would be misleading if the progress displayed 50% 484 * after the smaller image was cloned and would then take much longer for 485 * the second half. 486 * 487 * With weighted progress, one can invoke the following calls: 488 * 489 * 1) create progress object with cOperations = 2 and ulTotalOperationsWeight = 490 * 1100 (100 MB plus 1100, but really the weights can be any ULONG); pass 491 * in ulFirstOperationWeight = 100 for the first sub-operation 492 * 493 * 2) Then keep calling setCurrentOperationProgress() with a percentage 494 * for the first image; the total progress will increase up to a value 495 * of 9% (100MB / 1100MB * 100%). 496 * 497 * 3) Then call setNextOperation with the second weight (1000 for the megabytes 498 * of the second disk). 499 * 500 * 4) Then keep calling setCurrentOperationProgress() with a percentage for 501 * the second image, where 100% of the operation will then yield a 100% 502 * progress of the entire task. 503 * 504 * Weighting is optional; you can simply assign a weight of 1 to each operation 505 * and pass ulTotalOperationsWeight == cOperations to this constructor (but 506 * for that variant and for backwards-compatibility a simpler constructor exists 507 * in ProgressImpl.h as well). 508 * 509 * Even simpler, if you need no sub-operations at all, pass in cOperations = 510 * ulTotalOperationsWeight = ulFirstOperationWeight = 1. 476 511 * 477 512 * @param aParent See ProgressBase::init(). … … 479 514 * @param aDescription See ProgressBase::init(). 480 515 * @param aCancelable Flag whether the task maybe canceled. 481 * @param aOperationCount Number of operations within this task (at least 1). 482 * @param aOperationDescription Description of the first operation. 516 * @param cOperations Number of operations within this task (at least 1). 517 * @param ulTotalOperationsWeight Total weight of operations; must be the sum of ulFirstOperationWeight and 518 * what is later passed with each subsequent setNextOperation() call. 519 * @param bstrFirstOperationDescription Description of the first operation. 520 * @param ulFirstOperationWeight Weight of first sub-operation. 483 521 * @param aId See ProgressBase::init(). 522 */ 523 /** 524 * 525 * @param aParent 526 * @param aInitiator 527 * @param aDescription 528 * @param aCancelable 529 * @param aId 530 * @return 484 531 */ 485 532 HRESULT Progress::init (
Note:
See TracChangeset
for help on using the changeset viewer.