VirtualBox

Changeset 18394 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Mar 27, 2009 2:04:43 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
45190
Message:

Main: do not allow IProgress to report 100% until we're really done

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ProgressImpl.cpp

    r18306 r18394  
    271271    else
    272272    {
    273         /* global percent =
    274          *      (100 / m_cOperations) * mOperation +
    275          *      ((100 / m_cOperations) / 100) * m_ulOperationPercent */
    276 //         *aPercent = (100 * mOperation + m_ulOperationPercent) / m_cOperations;
    277 
    278         *aPercent = (ULONG)(    (    (double)m_ulOperationsCompletedWeight                                              // weight of operations that have been completed
    279                                    + ((double)m_ulOperationPercent * (double)m_ulCurrentOperationWeight / (double)100)  // plus partial weight of the current operation
    280                                 ) * (double)100 / (double)m_ulTotalOperationsWeight);
     273        ULONG ulPercent = (ULONG)(    (    (double)m_ulOperationsCompletedWeight                                              // weight of operations that have been completed
     274                                         + ((double)m_ulOperationPercent * (double)m_ulCurrentOperationWeight / (double)100)  // plus partial weight of the current operation
     275                                      ) * (double)100 / (double)m_ulTotalOperationsWeight
     276                                 );
     277        // do not report 100% until we're really really done with everything as the Qt GUI dismisses progress dialogs in that case
     278        if (    ulPercent == 100
     279             && (    m_ulOperationPercent < 100
     280                  || (m_ulCurrentOperation < m_cOperations -1)
     281                )
     282           )
     283            *aPercent = 99;
     284        else
     285            *aPercent = ulPercent;
    281286    }
    282287
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette