VirtualBox

Changeset 67507 in vbox for trunk/src


Ignore:
Timestamp:
Jun 20, 2017 1:39:18 PM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: Selector UI: New VD wizard: Make sure native slider values are 512-byte aligned as well, single-step property is not enough since Qt5.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.cpp

    r64729 r67507  
    224224int UIWizardNewVDPage3::sizeMBToSlider(qulonglong uValue, int iSliderScale)
    225225{
     226    /* Make sure *any* slider value is multiple of 512: */
     227    uValue /= 512;
     228
     229    /* Calculate result: */
    226230    int iPower = log2i(uValue);
    227231    qulonglong uTickMB = qulonglong (1) << iPower;
    228232    qulonglong uTickMBNext = qulonglong (1) << (iPower + 1);
    229233    int iStep = (uValue - uTickMB) * iSliderScale / (uTickMBNext - uTickMB);
    230     return iPower * iSliderScale + iStep;
     234    int iResult = iPower * iSliderScale + iStep;
     235
     236    /* Return result: */
     237    return iResult;
    231238}
    232239
     
    234241qulonglong UIWizardNewVDPage3::sliderToSizeMB(int uValue, int iSliderScale)
    235242{
     243    /* Calculate result: */
    236244    int iPower = uValue / iSliderScale;
    237245    int iStep = uValue % iSliderScale;
    238246    qulonglong uTickMB = qulonglong (1) << iPower;
    239247    qulonglong uTickMBNext = qulonglong (1) << (iPower + 1);
    240     return uTickMB + (uTickMBNext - uTickMB) * iStep / iSliderScale;
     248    qulonglong uResult = uTickMB + (uTickMBNext - uTickMB) * iStep / iSliderScale;
     249
     250    /* Make sure *any* slider value is multiple of 512: */
     251    uResult *= 512;
     252
     253    /* Return result: */
     254    return uResult;
    241255}
    242256
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