VirtualBox

Changeset 28755 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Apr 26, 2010 3:23:04 PM (15 years ago)
Author:
vboxsync
Message:

Frontends/VirtualBox: back out the change to IEC unit prefixes. Seems a useful and more then 10 year old standard is too irritating.

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

Legend:

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

    r26719 r28755  
    77
    88/*
    9  * Copyright (C) 2006-2009 Sun Microsystems, Inc.
     9 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    167167        adjustText();
    168168        recacheToolTip();
     169    }
     170
     171    KMachineState getCurrentState()
     172    {
     173        if (mMachine.isNull())
     174            return KMachineState_Null;
     175
     176        return mMachineState;
    169177    }
    170178
     
    439447    bool busy = mSessionState != KSessionState_Closed;
    440448
    441     /* Enable/disable snapshot actions */
    442     mSnapshotActionGroup->setEnabled (!busy && mCurSnapshotItem && item && !item->isCurrentStateItem());
     449    /* Machine state of the current state item */
     450    KMachineState s = KMachineState_Null;
     451    if (curStateItem())
     452        s = curStateItem()->getCurrentState();
     453
     454    /* Enable/disable restoring snapshot */
     455    mRestoreSnapshotAction->setEnabled (!busy && mCurSnapshotItem && item && !item->isCurrentStateItem());
     456
     457    /* Enable/disable deleting snapshot */
     458    mDeleteSnapshotAction->setEnabled (   (   !busy
     459                                           || s == KMachineState_PoweredOff
     460                                           || s == KMachineState_Saved
     461                                           || s == KMachineState_Aborted
     462                                           || s == KMachineState_Running
     463                                           || s == KMachineState_Paused)
     464                                       && mCurSnapshotItem && item && !item->isCurrentStateItem());
    443465
    444466    /* Enable/disable the details action regardles of the session state */
     
    534556    if (!vboxProblem().askAboutSnapshotDeleting (snapshot.GetName()))
    535557        return;
     558
     559    /** @todo check available space on the target filesystem etc etc. */
     560#if 0
     561    if (!vboxProblem().askAboutSnapshotDeletingFreeSpace (snapshot.GetName(),
     562                                                          "/home/juser/.VirtualBox/Machines/SampleVM/Snapshots/{01020304-0102-0102-0102-010203040506}.vdi",
     563                                                          "59 GiB",
     564                                                          "15 GiB"))
     565        return;
     566#endif
     567                                                         
    536568
    537569    /* Open a direct session (this call will handle all errors) */
     
    799831                           mCurSnapshotItem->child (mCurSnapshotItem->childCount() - 1) :
    800832                           mTreeWidget->invisibleRootItem()->child (0);
    801     Assert (csi);
    802833    return static_cast <SnapshotWgtItem*> (csi);
    803834}
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r28731 r28755  
    19781978
    19791979        QString item = QString (sSectionItemTpl2).arg (tr ("Base Memory", "details report"),
    1980                                                        tr ("<nobr>%1 MiB</nobr>", "details report"))
     1980                                                       tr ("<nobr>%1 MB</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 MiB</nobr>", "details report"))
     2013                             tr ("<nobr>%1 MB</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|KB|KiB|MB|MiB|GB|GiB|TB|TiB|PB|PiB</tt>.
     3834 *  size representation, <tt>####[.##] B|KB|MB|GB|TB|PB</tt>.
    38353835 *
    38363836 *  This regexp will capture 5 groups of text:
     
    38473847{
    38483848    QString regexp =
    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")
     3849        tr ("^(?:(?:(\\d+)(?:\\s?(B|KB|MB|GB|TB|PB))?)|(?:(\\d*)%1(\\d{1,2})(?:\\s?(KB|MB|GB|TB|PB))))$", "regexp for matching ####[.##] B|KB|MB|GB|TB|PB, %1=decimal point")
    38503850            .arg (decimalSep());
    38513851    return regexp;
     
    38543854/**
    38553855 *  Parses the given size string that should be in form of
    3856  *  <tt>####[.##] B|kB|KB|KiB|MB|MiB|GB|GiB|TB|TiB|PB|PiB</tt> and returns
     3856 *  <tt>####[.##] B|KB|MB|GB|TB|PB</tt> and returns
    38573857 *  the size value in bytes. Zero is returned on error.
    38583858 */
     
    38773877        if (suff.isEmpty() || suff == tr ("B", "size suffix Bytes"))
    38783878            denom = 1;
    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"))
     3879        else if (suff == tr ("KB", "size suffix KBytes=1024 Bytes"))
    38833880            denom = _1K;
    3884         else if (suff == tr ("MB", "size suffix MBytes=1000 kBytes"))
    3885             denom = 1000000;
    3886         else if (suff == tr ("MiB", "size suffix MiBytes"))
     3881        else if (suff == tr ("MB", "size suffix MBytes=1024 KBytes"))
    38873882            denom = _1M;
    3888         else if (suff == tr ("GB", "size suffix GBytes=1000 MBytes"))
    3889             denom = 1000000000;
    3890         else if (suff == tr ("GiB", "size suffix GiBytes"))
     3883        else if (suff == tr ("GB", "size suffix GBytes=1024 MBytes"))
    38913884            denom = _1G;
    3892         else if (suff == tr ("TB", "size suffix TBytes=1000 GBytes"))
    3893             denom = 1000000000000ULL;
    3894         else if (suff == tr ("TiB", "size suffix TiBytes"))
     3885        else if (suff == tr ("TB", "size suffix TBytes=1024 GBytes"))
    38953886            denom = _1T;
    3896         else if (suff == tr ("PB", "size suffix PBytes=1000 TBytes"))
    3897             denom = 1000000000000000ULL;
    3898         else if (suff == tr ("PiB", "size suffix PiBytes"))
     3887        else if (suff == tr ("PB", "size suffix PBytes=1024 TBytes"))
    38993888            denom = _1P;
    39003889
     
    39143903/**
    39153904 * Formats the given @a aSize value in bytes to a human readable string
    3916  * in form of <tt>####[.##] B|KiB|MiB|GiB|TiB|PiB</tt>.
     3905 * in form of <tt>####[.##] B|KB|MB|GB|TB|PB</tt>.
    39173906 *
    39183907 * The @a aMode and @a aDecimal parameters are used for rounding the resulting
    3919  * number when converting the size value to KiB, MiB, etc gives a fractional part:
     3908 * number when converting the size value to KB, MB, etc gives a fractional part:
    39203909 * <ul>
    39213910 * <li>When \a aMode is FormatSize_Round, the result is rounded to the
     
    39473936    static QString Suffixes [7];
    39483937    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");
     3938    Suffixes[1] = tr ("KB", "size suffix KBytes=1024 Bytes");
     3939    Suffixes[2] = tr ("MB", "size suffix MBytes=1024 KBytes");
     3940    Suffixes[3] = tr ("GB", "size suffix GBytes=1024 MBytes");
     3941    Suffixes[4] = tr ("TB", "size suffix TBytes=1024 GBytes");
     3942    Suffixes[5] = tr ("PB", "size suffix PBytes=1024 TBytes");
    39543943    Suffixes[6] = (const char *)NULL;
    39553944    AssertCompile(6 < RT_ELEMENTS (Suffixes));
     
    40144003            decm = 0;
    40154004            ++ intg;
    4016             /* check if we've got 1024 XiB after rounding and scale down if so */
     4005            /* check if we've got 1024 XB after rounding and scale down if so */
    40174006            if (intg == 1024 && Suffixes [suffix + 1] != NULL)
    40184007            {
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.cpp

    r28593 r28755  
    77
    88/*
    9  * Copyright (C) 2006-2008 Sun Microsystems, Inc.
     9 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    894894}
    895895
     896bool VBoxProblemReporter::askAboutSnapshotDeletingFreeSpace (const QString &aSnapshotName,
     897                                                             const QString &aTargetImageName,
     898                                                             const QString &aTargetImageMaxSize,
     899                                                             const QString &aTargetFilesystemFree)
     900{
     901    return messageOkCancel (mainWindowShown(), Question,
     902        tr ("<p>Deleting the snapshot %1 will temporarily need more disk space. In the worst case the size of image %2 will grow by %3, "
     903            "however on this filesystem there is only %4 free.</p><p>Running out of disk space during the merge operation can result in "
     904            "corruption of the image and the VM configuration, i.e. loss of the VM and its data.</p><p>You may continue with deleting "
     905            "the snapshot at your own risk.</p>")
     906            .arg (aSnapshotName)
     907            .arg (aTargetImageName)
     908            .arg (aTargetImageMaxSize)
     909            .arg (aTargetFilesystemFree),
     910        /* Do NOT allow this message to be disabled! */
     911        NULL /* aAutoConfirmId */,
     912        tr ("Delete"), tr ("Cancel"));
     913}
     914
    896915void VBoxProblemReporter::cannotRestoreSnapshot (const CConsole &aConsole,
    897916                                                 const QString &aSnapshotName)
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.h

    r27695 r28755  
    66
    77/*
    8  * Copyright (C) 2006-2008 Sun Microsystems, Inc.
     8 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    215215    bool askAboutSnapshotRestoring (const QString &aSnapshotName);
    216216    bool askAboutSnapshotDeleting (const QString &aSnapshotName);
     217    bool askAboutSnapshotDeletingFreeSpace (const QString &aSnapshotName,
     218                                            const QString &aTargetImageName,
     219                                            const QString &aTargetImageMaxSize,
     220                                            const QString &aTargetFilesystemFree);
    217221    void cannotRestoreSnapshot (const CConsole &aConsole, const QString &aSnapshotName);
    218222    void cannotRestoreSnapshot (const CProgress &aProgress, const QString &aSnapshotName);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsDisplay.cpp

    r28731 r28755  
    267267
    268268    CSystemProperties sys = vboxGlobal().virtualBox().GetSystemProperties();
    269     mLbMemoryMin->setText (tr ("<qt>%1&nbsp;MiB</qt>").arg (m_minVRAM));
    270     mLbMemoryMax->setText (tr ("<qt>%1&nbsp;MiB</qt>").arg (m_maxVRAMVisible));
     269    mLbMemoryMin->setText (tr ("<qt>%1&nbsp;MB</qt>").arg (m_minVRAM));
     270    mLbMemoryMax->setText (tr ("<qt>%1&nbsp;MB</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.ui

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

    r28731 r28755  
    381381
    382382    /* Retranslate the memory slider legend */
    383     mLbMemoryMin->setText (tr ("<qt>%1&nbsp;MiB</qt>").arg (mSlMemory->minRAM()));
    384     mLbMemoryMax->setText (tr ("<qt>%1&nbsp;MiB</qt>").arg (mSlMemory->maxRAM()));
     383    mLbMemoryMin->setText (tr ("<qt>%1&nbsp;MB</qt>").arg (mSlMemory->minRAM()));
     384    mLbMemoryMax->setText (tr ("<qt>%1&nbsp;MB</qt>").arg (mSlMemory->maxRAM()));
    385385
    386386    /* Retranslate the cpu slider legend */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsSystem.ui

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

    r28731 r28755  
    220220                            }
    221221                        case KVirtualSystemDescriptionType_OS: v = vboxGlobal().vmGuestOSTypeDescription (mConfigValue); break;
    222                         case KVirtualSystemDescriptionType_Memory: v = mConfigValue + " " + VBoxApplianceEditorWgt::tr ("MiB", "size suffix MiBytes"); break;
     222                        case KVirtualSystemDescriptionType_Memory: v = mConfigValue + " " + VBoxApplianceEditorWgt::tr ("MB", "size suffix MBytes=1024 KBytes"); 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 ("MiB", "size suffix MiBytes"));
     401                    e->setSuffix (" " + VBoxApplianceEditorWgt::tr ("MB", "size suffix MBytes=1024KBytes"));
    402402                    editor = e;
    403403                    break;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newhd/UINewHDWzd.cpp

    r28732 r28755  
    220220
    221221    /* Setup size-editor field */
    222     m_pSizeEditor->setFixedWidthByText("88888.88 MiB");
     222    m_pSizeEditor->setFixedWidthByText("88888.88 MB");
    223223    m_pSizeEditor->setAlignment(Qt::AlignRight);
    224224    m_pSizeEditor->setValidator(new QRegExpValidator(QRegExp(vboxGlobal().sizeRegexp()), this));
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UINewVMWzd.cpp

    r28732 r28755  
    281281    QString strRecommendedRAM = field("type").value<CGuestOSType>().isNull() ? QString() :
    282282                                QString::number(field("type").value<CGuestOSType>().GetRecommendedRAM());
    283     m_pPage3Text2->setText(tr("The recommended base memory size is <b>%1</b> MiB.").arg(strRecommendedRAM));
     283    m_pPage3Text2->setText(tr("The recommended base memory size is <b>%1</b> MB.").arg(strRecommendedRAM));
    284284
    285285    /* Translate minimum & maximum 'ram' field values */
    286     m_pRamMin->setText(QString("%1 %2").arg(m_pRamSlider->minRAM()).arg(tr("MiB", "size suffix MiBytes")));
    287     m_pRamMax->setText(QString("%1 %2").arg(m_pRamSlider->maxRAM()).arg(tr("MiB", "size suffix MiBytes")));
     286    m_pRamMin->setText(QString("%1 %2").arg(m_pRamSlider->minRAM()).arg(tr("MB", "size suffix MBytes=1024 KBytes")));
     287    m_pRamMax->setText(QString("%1 %2").arg(m_pRamSlider->maxRAM()).arg(tr("MB", "size suffix MBytes=1024 KBytes")));
    288288}
    289289
     
    374374    QString strRecommendedHDD = field("type").value<CGuestOSType>().isNull() ? QString() :
    375375                                QString::number(field("type").value<CGuestOSType>().GetRecommendedHDD());
    376     m_pPage4Text2->setText (tr ("The recommended size of the boot hard disk is <b>%1</b> MiB.").arg (strRecommendedHDD));
     376    m_pPage4Text2->setText (tr ("The recommended size of the boot hard disk is <b>%1</b> MB.").arg (strRecommendedHDD));
    377377}
    378378
     
    585585    .arg(tr("Name", "summary"), name)
    586586    .arg(tr("OS Type", "summary"), type)
    587     .arg(tr("Base Memory", "summary"), ram, tr("MiB", "size suffix MiBytes"))
     587    .arg(tr("Base Memory", "summary"), ram, tr("MB", "size suffix MBytes=1024KBytes"))
    588588    ;
    589589    /* Feat summary to 3 lines */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UINewVMWzdPage3.ui

    r28732 r28755  
    9696       <widget class="QLabel" name="m_pRamUnits">
    9797        <property name="text">
    98          <string>MiB</string>
     98         <string>MB</string>
    9999        </property>
    100100       </widget>
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