VirtualBox

Ignore:
Timestamp:
Aug 23, 2017 8:28:18 AM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: Runtime UI: Update indicators order list with missing indicators (usually it's newly added indicators) in the order of original appearance.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r68351 r68512  
    37773777            result << value;
    37783778    }
     3779
     3780    /* We should update the list with missing indicators: */
     3781    for (int i = (int)IndicatorType_Invalid; i < (int)IndicatorType_Max; ++i)
     3782    {
     3783        /* Skip the IndicatorType_Invalid (we used it as start of this loop): */
     3784        if (i == (int)IndicatorType_Invalid)
     3785            continue;
     3786        /* Skip the IndicatorType_KeyboardExtension (special handling): */
     3787        if (i == (int)IndicatorType_KeyboardExtension)
     3788            continue;
     3789
     3790        /* Get the current one: */
     3791        const IndicatorType enmCurrent = (IndicatorType)i;
     3792
     3793        /* Skip the current one if it's present: */
     3794        if (result.contains(enmCurrent))
     3795            continue;
     3796
     3797        /* Let's find the first of those which stays before it and is not missing: */
     3798        IndicatorType enmPrevious = (IndicatorType)(enmCurrent - 1);
     3799        while (enmPrevious != IndicatorType_Invalid && !result.contains(enmPrevious))
     3800            enmPrevious = (IndicatorType)(enmPrevious - 1);
     3801
     3802        /* Calculate position to insert missing one: */
     3803        const int iInsertPosition = enmPrevious != IndicatorType_Invalid
     3804                                  ? result.indexOf(enmPrevious) + 1
     3805                                  : 0;
     3806
     3807        /* Finally insert missing indicator at required position: */
     3808        result.insert(iInsertPosition, enmCurrent);
     3809    }
     3810
    37793811    /* Return result: */
    37803812    return result;
Note: See TracChangeset for help on using the changeset viewer.

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