VirtualBox

Changeset 28731 in vbox


Ignore:
Timestamp:
Apr 26, 2010 8:11:58 AM (15 years ago)
Author:
vboxsync
Message:

Frontends/VirtualBox: use IEC KiB/MiB/... unit prefixes consistently instead of misusing SI KB/MB/... unit prefixes consistently

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
11 edited

Legend:

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

    r27961 r28731  
    46854685    /* HDTV == 1920x1080 ~ 2M
    46864686     * for the 4:2:2 formats each pixel is 2Bytes
    4687      * so each frame may be 4MB
    4688      * so for triple-buffering we would need 12 MB */
     4687     * so each frame may be 4MiB
     4688     * so for triple-buffering we would need 12 MiB */
    46894689    return _1M * 12;
    46904690}
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r28593 r28731  
    19781978
    19791979        QString item = QString (sSectionItemTpl2).arg (tr ("Base Memory", "details report"),
    1980                                                        tr ("<nobr>%1 MB</nobr>", "details report"))
     1980                                                       tr ("<nobr>%1 MiB</nobr>", "details report"))
    19811981                       .arg (aMachine.GetMemorySize())
    19821982                     + QString (sSectionItemTpl2).arg (tr ("Processor(s)", "details report"),
     
    20112011        QString item = QString(sSectionItemTpl2)
    20122012                       .arg(tr ("Video Memory", "details report"),
    2013                              tr ("<nobr>%1 MB</nobr>", "details report"))
     2013                             tr ("<nobr>%1 MiB</nobr>", "details report"))
    20142014                       .arg(aMachine.GetVRAMSize());
    20152015        ++rows;
     
    38323832/**
    38333833 *  Returns the regexp string that defines the format of the human-readable
    3834  *  size representation, <tt>####[.##] B|KB|MB|GB|TB|PB</tt>.
     3834 *  size representation, <tt>####[.##] B|kB|KB|KiB|MB|MiB|GB|GiB|TB|TiB|PB|PiB</tt>.
    38353835 *
    38363836 *  This regexp will capture 5 groups of text:
     
    38473847{
    38483848    QString regexp =
    3849         QString ("^(?:(?:(\\d+)(?:\\s?([KMGTP]?B))?)|(?:(\\d*)%1(\\d{1,2})(?:\\s?([KMGTP]B))))$")
    3850                  .arg (decimalSep());
     3849        tr ("^(?:(?:(\\d+)(?:\\s?(B|kB|KB|KiB|MB|MiB|GB|GiB|TB|TiB|PB|PiB))?)|(?:(\\d*)%1(\\d{1,2})(?:\\s?(kB|KB|KiB|MB|MiB|GB|GiB|TB|TiB|PB|PiB))))$", "regexp for matching ####[.##] B|kB|KB|KiB|MB|MiB|GB|GiB|TB|TiB|PB|PiB, %1=decimal point")
     3850            .arg (decimalSep());
    38513851    return regexp;
    38523852}
     
    38543854/**
    38553855 *  Parses the given size string that should be in form of
    3856  *  <tt>####[.##] B|KB|MB|GB|TB|PB</tt> and returns the size value
    3857  *  in bytes. Zero is returned on error.
     3856 *  <tt>####[.##] B|kB|KB|KiB|MB|MiB|GB|GiB|TB|TiB|PB|PiB</tt> and returns
     3857 *  the size value in bytes. Zero is returned on error.
    38583858 */
    38593859/* static */
     
    38753875
    38763876        quint64 denom = 0;
    3877         if (suff.isEmpty() || suff == "B")
     3877        if (suff.isEmpty() || suff == tr ("B", "size suffix Bytes"))
    38783878            denom = 1;
    3879         else if (suff == "KB")
     3879        else if (suff == tr ("kB", "size suffix kBytes=1000 Bytes"))
     3880            denom = 1000;
     3881        else if (   suff == tr ("KiB", "size suffix KiBytes")
     3882                 || suff == tr ("KB", "size suffix legacy KB=KiBytes"))
    38803883            denom = _1K;
    3881         else if (suff == "MB")
     3884        else if (suff == tr ("MB", "size suffix MBytes=1000 kBytes"))
     3885            denom = 1000000;
     3886        else if (suff == tr ("MiB", "size suffix MiBytes"))
    38823887            denom = _1M;
    3883         else if (suff == "GB")
     3888        else if (suff == tr ("GB", "size suffix GBytes=1000 MBytes"))
     3889            denom = 1000000000;
     3890        else if (suff == tr ("GiB", "size suffix GiBytes"))
    38843891            denom = _1G;
    3885         else if (suff == "TB")
     3892        else if (suff == tr ("TB", "size suffix TBytes=1000 GBytes"))
     3893            denom = 1000000000000ULL;
     3894        else if (suff == tr ("TiB", "size suffix TiBytes"))
    38863895            denom = _1T;
    3887         else if (suff == "PB")
     3896        else if (suff == tr ("PB", "size suffix PBytes=1000 TBytes"))
     3897            denom = 1000000000000000ULL;
     3898        else if (suff == tr ("PiB", "size suffix PiBytes"))
    38883899            denom = _1P;
    38893900
     
    39033914/**
    39043915 * Formats the given @a aSize value in bytes to a human readable string
    3905  * in form of <tt>####[.##] B|KB|MB|GB|TB|PB</tt>.
     3916 * in form of <tt>####[.##] B|KiB|MiB|GiB|TiB|PiB</tt>.
    39063917 *
    39073918 * The @a aMode and @a aDecimal parameters are used for rounding the resulting
    3908  * number when converting the size value to KB, MB, etc gives a fractional part:
     3919 * number when converting the size value to KiB, MiB, etc gives a fractional part:
    39093920 * <ul>
    39103921 * <li>When \a aMode is FormatSize_Round, the result is rounded to the
     
    39343945                                VBoxDefs::FormatSize aMode /* = FormatSize_Round */)
    39353946{
    3936     static const char *Suffixes [] = { "B", "KB", "MB", "GB", "TB", "PB", NULL };
     3947    static QString Suffixes [7];
     3948    Suffixes[0] = tr ("B", "size suffix Bytes");
     3949    Suffixes[1] = tr ("KiB", "size suffix KiBytes");
     3950    Suffixes[2] = tr ("MiB", "size suffix MiBytes");
     3951    Suffixes[3] = tr ("GiB", "size suffix GiBytes");
     3952    Suffixes[4] = tr ("TiB", "size suffix TiBytes");
     3953    Suffixes[5] = tr ("PiB", "size suffix PiBytes");
     3954    Suffixes[6] = (const char *)NULL;
     3955    AssertCompile(6 < RT_ELEMENTS (Suffixes));
    39373956
    39383957    quint64 denom = 0;
     
    39954014            decm = 0;
    39964015            ++ intg;
    3997             /* check if we've got 1024 XB after rounding and scale down if so */
     4016            /* check if we've got 1024 XiB after rounding and scale down if so */
    39984017            if (intg == 1024 && Suffixes [suffix + 1] != NULL)
    39994018            {
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp

    r28268 r28731  
    156156    {
    157157        quint64 availBits = machine.GetVRAMSize() /* VRAM */
    158             * _1M /* MB to bytes */
     158            * _1M /* MiB to bytes */
    159159            * 8; /* to bits */
    160160        quint64 usedBits = memoryRequirements(pTmpMap);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp

    r28493 r28731  
    8484    {
    8585        quint64 availBits = machine.GetVRAMSize() /* VRAM */
    86                             * _1M /* MB to bytes */
     86                            * _1M /* MiB to bytes */
    8787                            * 8; /* to bits */
    8888        quint64 usedBits = m_pScreenLayout->memoryRequirements();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp

    r28493 r28731  
    8282    {
    8383        quint64 availBits = machine.GetVRAMSize() /* VRAM */
    84                             * _1M /* MB to bytes */
     84                            * _1M /* MiB to bytes */
    8585                            * 8; /* to bits */
    8686        quint64 usedBits = m_pScreenLayout->memoryRequirements();
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsDisplay.cpp

    r28279 r28731  
    267267
    268268    CSystemProperties sys = vboxGlobal().virtualBox().GetSystemProperties();
    269     mLbMemoryMin->setText (tr ("<qt>%1&nbsp;MB</qt>").arg (m_minVRAM));
    270     mLbMemoryMax->setText (tr ("<qt>%1&nbsp;MB</qt>").arg (m_maxVRAMVisible));
     269    mLbMemoryMin->setText (tr ("<qt>%1&nbsp;MiB</qt>").arg (m_minVRAM));
     270    mLbMemoryMax->setText (tr ("<qt>%1&nbsp;MiB</qt>").arg (m_maxVRAMVisible));
    271271    mLbMonitorsMin->setText (tr ("<qt>%1</qt>").arg (1));
    272272    mLbMonitorsMax->setText (tr ("<qt>%1</qt>").arg (sys.GetMaxGuestMonitors()));
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsDisplay.h

    r28178 r28731  
    6767    QIWidgetValidator *mValidator;
    6868
    69     /* System minimum lower limit of VRAM (MB). */
     69    /* System minimum lower limit of VRAM (MiB). */
    7070    int m_minVRAM;
    71     /* System maximum limit of VRAM (MB). */
     71    /* System maximum limit of VRAM (MiB). */
    7272    int m_maxVRAM;
    73     /* Upper limit of VRAM in MB for this dialog. This value is lower than
     73    /* Upper limit of VRAM in MiB for this dialog. This value is lower than
    7474     * m_maxVRAM to save careless users from setting useless big values. */
    7575    int m_maxVRAMVisible;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsDisplay.ui

    r27407 r28731  
    145145              </property>
    146146              <property name="text">
    147                <string>MB</string>
     147               <string>MiB</string>
    148148              </property>
    149149             </widget>
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsSystem.cpp

    r27591 r28731  
    77
    88/*
    9  * Copyright (C) 2008-2009 Sun Microsystems, Inc.
     9 * Copyright (C) 2008-2010 Sun Microsystems, Inc.
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    381381
    382382    /* Retranslate the memory slider legend */
    383     mLbMemoryMin->setText (tr ("<qt>%1&nbsp;MB</qt>").arg (mSlMemory->minRAM()));
    384     mLbMemoryMax->setText (tr ("<qt>%1&nbsp;MB</qt>").arg (mSlMemory->maxRAM()));
     383    mLbMemoryMin->setText (tr ("<qt>%1&nbsp;MiB</qt>").arg (mSlMemory->minRAM()));
     384    mLbMemoryMax->setText (tr ("<qt>%1&nbsp;MiB</qt>").arg (mSlMemory->maxRAM()));
    385385
    386386    /* Retranslate the cpu slider legend */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsSystem.ui

    r27591 r28731  
    145145           </property>
    146146           <property name="text">
    147             <string>MB</string>
     147            <string>MiB</string>
    148148           </property>
    149149          </widget>
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/VBoxApplianceEditorWgt.cpp

    r26715 r28731  
    77
    88/*
    9  * Copyright (C) 2009 Sun Microsystems, Inc.
     9 * Copyright (C) 2009-2010 Sun Microsystems, Inc.
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    220220                            }
    221221                        case KVirtualSystemDescriptionType_OS: v = vboxGlobal().vmGuestOSTypeDescription (mConfigValue); break;
    222                         case KVirtualSystemDescriptionType_Memory: v = mConfigValue + " " + VBoxApplianceEditorWgt::tr ("MB"); break;
     222                        case KVirtualSystemDescriptionType_Memory: v = mConfigValue + " " + VBoxApplianceEditorWgt::tr ("MiB", "size suffix MiBytes"); break;
    223223                        case KVirtualSystemDescriptionType_SoundCard: v = vboxGlobal().toString (static_cast<KAudioControllerType> (mConfigValue.toInt())); break;
    224224                        case KVirtualSystemDescriptionType_NetworkAdapter: v = vboxGlobal().toString (static_cast<KNetworkAdapterType> (mConfigValue.toInt())); break;
     
    399399                    QSpinBox *e = new QSpinBox (aParent);
    400400                    e->setRange (VBoxApplianceEditorWgt::minGuestRAM(), VBoxApplianceEditorWgt::maxGuestRAM());
    401                     e->setSuffix (" " + VBoxApplianceEditorWgt::tr ("MB"));
     401                    e->setSuffix (" " + VBoxApplianceEditorWgt::tr ("MiB", "size suffix MiBytes"));
    402402                    editor = e;
    403403                    break;
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